Documentation
¶
Index ¶
- Constants
- Variables
- func Init(ctx context.Context, testNet bool) error
- func NewError(code int, msg string) error
- func NewIndexChannel(index string) exchange.Channel
- func NewOrderBookChannel(sym exchange.Symbol) exchange.Channel
- func ParseFutureSymbol(sym string) (exchange.FuturesSymbol, error)
- func ParseOptionSymbol(sym string) (exchange.OptionSymbol, error)
- func ParseSymbol(sym string) (exchange.Symbol, error)
- type AccountSummaryReq
- type AccountSummaryResp
- type AuthParam
- type AuthResult
- type AuthToken
- type BookData
- type BookGreeks
- type BookStats
- type ChIndex
- type ChOrderBook
- type ChTicker
- type Client
- func (c *Client) Auth(ctx context.Context) error
- func (c *Client) Call(ctx context.Context, method string, params interface{}, dest interface{}, ...) error
- func (c *Client) CancelOrder(ctx context.Context, order *exchange.Order) (*exchange.Order, error)
- func (c *Client) CreateOrder(ctx context.Context, req *exchange.OrderRequest, ...) (*exchange.Order, error)
- func (c *Client) Exchange() string
- func (c *Client) FetchOrder(ctx context.Context, order *exchange.Order) (*exchange.Order, error)
- func (client *Client) FetchOrderBook(ctx context.Context, symbol exchange.Symbol, maxDepth int) (*exchange.OrderBook, error)
- func (c *Client) FutureFetchInstruments(ctx context.Context, currency string, expired bool) ([]InstrumentResult, error)
- func (c *Client) FuturesSymbols(ctx context.Context, currency string) ([]exchange.FuturesSymbol, error)
- func (c *Client) Handle(ctx context.Context, notify *rpc.Notify)
- func (c *Client) OptionExpireSymbols(ctx context.Context, currency string) ([]exchange.OptionSymbol, error)
- func (c *Client) OptionFetchInstruments(ctx context.Context, currency string, expired bool) ([]InstrumentResult, error)
- func (c *Client) OptionSymbols(ctx context.Context, currency string) ([]exchange.OptionSymbol, error)
- func (c *Client) Subscribe(ctx context.Context, chs ...exchange.Channel) error
- func (c *Client) SwapSymbol(ctx context.Context, currency string) (exchange.SwapSymbol, error)
- func (c *Client) UnSubscribe(ctx context.Context, chs ...exchange.Channel) error
- type Codec
- type Error
- type FuturesSymbol
- type IndexResult
- type InstrumentResult
- type JRPCError
- type Notify
- type OptionSymbol
- type Order
- type OrderID
- type PositionRequest
- type PositionResult
- type PositionsRequest
- type PublicSettlementByInstrumentReq
- type Request
- type Response
- type RestBookData
- type RestBookReq
- type Settlement
- type SettlementReq
- type SettlementResp
- type SettlementType
- type SpotSymbol
- type SwapSymbol
- type TickerGreeks
- type TickerResult
- type TickerStats
- type Token
Constants ¶
View Source
const ( WSAddr = "wss://www.deribit.com/ws/api/v2/" WSTestAddr = "wss://test.deribit.com/ws/api/v2/" )
View Source
const ( PrivateGetPosition = "private/get_position" PrivateGetPositions = "private/get_positions" )
View Source
const ( OptionTypeCall = "call" OptionTypePut = "put" KindOption = "option" KindFuture = "future" SettlePeriodPerpetual = "perpetual" SettlePeriodWeek = "week" SettlePeriodMonth = "month" )
View Source
const (
AccountSummaryMethod = "private/get_account_summary"
)
View Source
const (
JsonRPCVersion = "2.0"
)
View Source
const (
PublicTickerMethod = "public/ticker"
)
View Source
const (
RestOrderBookMethod = "public/get_order_book"
)
Variables ¶
View Source
var (
Currencies = []string{"BTC", "ETH"}
)
Functions ¶
func NewIndexChannel ¶ added in v0.3.0
func NewOrderBookChannel ¶ added in v0.3.0
func ParseFutureSymbol ¶ added in v0.3.0
func ParseFutureSymbol(sym string) (exchange.FuturesSymbol, error)
func ParseOptionSymbol ¶ added in v0.3.0
func ParseOptionSymbol(sym string) (exchange.OptionSymbol, error)
Types ¶
type AccountSummaryReq ¶ added in v0.3.0
type AccountSummaryResp ¶ added in v0.3.0
type AccountSummaryResp struct { Balance decimal.Decimal `json:"balance"` OptionsSessionUPL decimal.Decimal `json:"options_session_upl"` DepositAddress string `json:"deposit_address"` OptionGamma decimal.Decimal `json:"option_gamma"` OptionTheta decimal.Decimal `json:"option_theta"` UserName string `json:"user"` Equity decimal.Decimal `json:"equity"` Type string `json:"type"` Currency string `json:"currency"` DeltaTotal decimal.Decimal `json:"delta_total"` FuturesSessionRPL decimal.Decimal `json:"futures_session_rpl"` PortfolioMarginingEnabled bool `json:"portfolio_margining_enabled"` TotalPL decimal.Decimal `json:"total_pl"` MarginBalance decimal.Decimal `json:"margin_balance"` TfaEnabled bool `json:"tfa_enabled"` OptionsSessionRPL decimal.Decimal `json:"options_session_rpl"` OptionsDelta decimal.Decimal `json:"options_delta"` FuturesPL decimal.Decimal `json:"futures_pl"` ID int `json:"id"` SessionUPL decimal.Decimal `json:"session_upl"` AvailableWithdrawalFunds decimal.Decimal `json:"available_withdrawal_funds"` CreationTimestmap int64 `json:"creation_timestamp"` OptionsPL decimal.Decimal `json:"options_pl"` SystemName string `json:"system_name"` InitialMargin decimal.Decimal `json:"initial_margin"` ProjectedInitialMargin decimal.Decimal `json:"projected_initial_margin"` MaintenanceMargin decimal.Decimal `json:"maintenance_margin"` ProjectedMaintenanceMargin decimal.Decimal `json:"projected_maintenance_margin"` SessinRPL decimal.Decimal `json:"session_rpl"` InteruserTransfersEnabled bool `json:"interuser_transfers_enabled"` OptionsVega decimal.Decimal `json:"options_vega"` ProjectedDeltaTotal decimal.Decimal `json:"projectd_delta_total"` Email string `json:"email"` FuturesSessionUPL decimal.Decimal `json:"futures_session_upl"` AvailableFunds decimal.Decimal `json:"available_funds"` OptionsValue decimal.Decimal `json:"options_value"` }
type AuthResult ¶
type BookGreeks ¶ added in v0.3.0
type ChOrderBook ¶ added in v0.3.0
type ChOrderBook struct {
// contains filtered or unexported fields
}
func (*ChOrderBook) String ¶ added in v0.3.0
func (co *ChOrderBook) String() string
type ChTicker ¶ added in v0.3.0
type ChTicker struct {
// contains filtered or unexported fields
}
func NewTickerChannel ¶ added in v0.3.0
type Client ¶
func NewTestWSClient ¶ added in v0.3.0
func NewWSClient ¶ added in v0.3.0
func (*Client) Call ¶ added in v0.3.0
func (c *Client) Call(ctx context.Context, method string, params interface{}, dest interface{}, private bool) error
Call genetic method
func (*Client) CancelOrder ¶ added in v0.3.0
func (*Client) CreateOrder ¶ added in v0.3.0
func (c *Client) CreateOrder(ctx context.Context, req *exchange.OrderRequest, opts ...exchange.OrderReqOption) (*exchange.Order, error)
func (*Client) FetchOrder ¶ added in v0.3.0
func (*Client) FetchOrderBook ¶ added in v0.3.0
func (*Client) FutureFetchInstruments ¶ added in v0.3.0
func (*Client) FuturesSymbols ¶ added in v0.3.0
func (*Client) OptionExpireSymbols ¶ added in v0.3.0
func (*Client) OptionFetchInstruments ¶
func (*Client) OptionSymbols ¶ added in v0.3.0
func (*Client) SwapSymbol ¶ added in v0.3.0
type FuturesSymbol ¶ added in v0.3.0
type FuturesSymbol struct {
*exchange.BaseFutureSymbol
}
func (*FuturesSymbol) String ¶ added in v0.3.0
func (fs *FuturesSymbol) String() string
type IndexResult ¶
type InstrumentResult ¶
type InstrumentResult struct { TickSize decimal.Decimal `json:"tick_size"` TakerCommision decimal.Decimal `json:"taker_commision"` MakerCommision decimal.Decimal `json:"maker_commision"` Strike decimal.Decimal `json:"strike"` SettlementPeriod string `json:"settlement_period"` QuoteCurrency string `json:"quote_currency"` BaseCurreny string `json:"base_currency"` MinTradeAmount decimal.Decimal `json:"min_trade_amount"` Kind string `json:"kind"` IsActive bool `json:"is_active"` InstrumentName string `json:"instrument_name"` ExpirationTimestamp int64 `json:"expiration_timestamp"` CreationTimestamp int64 `json:"creation_timestamp"` ContractSize decimal.Decimal `json:"contract_size"` OptionType string `json:"option_type"` }
type Notify ¶
type Notify struct { Data json.RawMessage `json:"data"` Channel string `json:"channel"` }
type OptionSymbol ¶
type OptionSymbol struct {
*exchange.BaseOptionSymbol
}
func (*OptionSymbol) String ¶
func (sym *OptionSymbol) String() string
type Order ¶
type Order struct { Price decimal.Decimal `json:"price"` Amount decimal.Decimal `json:"amount"` AveragePrice decimal.Decimal `json:"average_price"` OrderState string `json:"order_state"` OrderID string `json:"order_id"` LastUpdatedTimestamp int64 `json:"last_update_timestamp"` CreationTimestamp int64 `json:"creation_timestamp"` Commision decimal.Decimal `json:"commision"` Direction string `json:"direction"` FilledAmont decimal.Decimal `json:"filled_amount"` InstrumentName string `json:"instrument_name"` }
type PositionRequest ¶ added in v0.3.0
type PositionResult ¶ added in v0.3.0
type PositionResult struct { AveragePrice decimal.Decimal `json:"average_price"` AveragePriceUSD decimal.Decimal `json:"average_price_usd"` Delta decimal.Decimal `json:"delta"` Direction string `json:"direction"` EstimatedLiquidationPrice decimal.Decimal `json:"estimated_liquidation_price"` FloatingProfitLoss decimal.Decimal `json:"floating_profit_loss"` FloatingProfitLossUSD decimal.Decimal `json:"floating_profit_loss_usd"` Gamma decimal.Decimal `json:"gamma"` IndexPrice decimal.Decimal `json:"index_price"` InitialMargin decimal.Decimal `json:"initial_margin"` InstrumentName string `json:"instrument_name"` Kind string `json:"kind"` Leverage int `json:"leverage"` MaintenanceMargin decimal.Decimal `json:"maintenance_margin"` MarkPrice decimal.Decimal `json:"mark_price"` OpenOrdersMargin decimal.Decimal `json:"open_orders_margin"` RealizedFunding decimal.Decimal `json:"realized_funding"` RealizedProfitLoss decimal.Decimal `json:"realized_profit_loss"` SettlementPrice decimal.Decimal `json:"settlement_price"` Size decimal.Decimal `json:"size"` SizeCurrency decimal.Decimal `json:"size_currency"` Theta decimal.Decimal `json:"theta"` TotalProfitLoss decimal.Decimal `json:"total_profit_loss"` Vega decimal.Decimal `json:"vega"` }
type PositionsRequest ¶ added in v0.3.0
type PublicSettlementByInstrumentReq ¶ added in v0.3.0
type PublicSettlementByInstrumentReq struct { InstrumentName string `json:"instrument_name"` Type SettlementType `json:"type"` }
type RestBookData ¶ added in v0.3.0
type RestBookData struct { Timestamp int64 `json:"timestamp"` Stats BookStats `json:"stats"` State string `json:"state"` SettlementPrice decimal.Decimal `json:"settlement_price"` OpenInterest decimal.Decimal `json:"open_interest"` MinPrice decimal.Decimal `json:"min_price"` MaxPrice decimal.Decimal `json:"max_price"` MarkPrice decimal.Decimal `json:"mark_price"` MarkIV decimal.Decimal `json:"mark_iv"` LastPrice decimal.Decimal `json:"last_price"` InstrumentName string `json:"instrument_name"` IndexPrice decimal.Decimal `json:"index_price"` ChangeID int `json:"change_id'` Bids [][2]interface{} `json:"bids"` Asks [][2]interface{} `json:"asks"` BestBidPrice decimal.Decimal `json:"best_bid_price"` BestBidAmount decimal.Decimal `json:"best_bid_amount"` BestAskPrice decimal.Decimal `json:"best_ask_price"` BestAskAmount decimal.Decimal `json:"best_ask_amount"` Funding8H decimal.Decimal `json:"funding_8h"` CurrentFunding decimal.Decimal `json:"current_funding"` Greeks BookGreeks `json:"greeks"` }
type RestBookReq ¶ added in v0.3.0
type Settlement ¶ added in v0.3.0
type Settlement struct { Type string `json:"type"` Timestamp int64 `json:"timestamp"` SessionProfitLoss decimal.Decimal `json:"session_profit_loss"` ProfitLoss decimal.Decimal `json:"profit_loss"` Position decimal.Decimal `json:"position"` MarkPrice decimal.Decimal `json:"mark_price"` InstrumentName string `json:"instrument_name"` IndexPrice decimal.Decimal `json:"index_price"` }
type SettlementReq ¶ added in v0.3.0
type SettlementReq struct { AuthToken InstrumentName string `json:"instrument_name"` Type SettlementType `json:"type"` }
type SettlementResp ¶ added in v0.3.0
type SettlementResp struct { Settlements []Settlement `json:"settlements"` Continuation string `json:"continuation"` }
type SettlementType ¶ added in v0.3.0
type SettlementType string
const ( SettlementMethodByInstrument = "private/get_settlement_history_by_instrument" PublicSettlementMethodByInstrument = "public/get_last_settlements_by_instrument" SettlementTypeSettlement SettlementType = "settlement" SettlementTypeDelivery SettlementType = "delivery" SettlementTypeBankrupcty SettlementType = "bankruptcy" )
type SpotSymbol ¶
type SpotSymbol struct {
*exchange.BaseSpotSymbol
}
func ParseIndexSymbol ¶ added in v0.3.0
func ParseIndexSymbol(symbol string) (*SpotSymbol, error)
func (*SpotSymbol) String ¶
func (ss *SpotSymbol) String() string
type SwapSymbol ¶ added in v0.3.0
type SwapSymbol struct {
*exchange.BaseSwapSymbol
}
func (*SwapSymbol) String ¶ added in v0.3.0
func (ss *SwapSymbol) String() string
type TickerGreeks ¶ added in v0.3.0
type TickerResult ¶ added in v0.3.0
type TickerResult struct { UnderlyingPrice decimal.Decimal `json:"underlying_price"` UnderlyingIndex string `json:"underlying_index"` Timestamp int64 `json:"timestamp"` State string `json:"state"` Stats TickerStats `json:"stats"` SettlementPrice decimal.Decimal `json:"settlement_price"` OpenInterest decimal.Decimal `json:"open_interest"` MinPrice decimal.Decimal `json:"min_price"` MaxPrice decimal.Decimal `json:"max_price"` MarkPrice decimal.Decimal `json:"mark_price"` MarkIV decimal.Decimal `json:"mark_iv"` LastPrice decimal.Decimal `json:"last_price"` InterestRate decimal.Decimal `json:"interest_rate"` InstrumentName string `json:"instrument_name"` IndexPrice decimal.Decimal `json:"index_price"` Greeks TickerGreeks `json:"greeks"` EstimatedDeliveryPrice decimal.Decimal `json:"estimated_delivery_price"` BidIV decimal.Decimal `json:"bid_iv"` BestBidPrice decimal.Decimal `json:"best_bid_price"` BestBidAmount decimal.Decimal `json:"best_bid_amount"` BestAskPrice decimal.Decimal `json:"best_ask_price"` BestAskAmount decimal.Decimal `json:"best_ask_amount"` AskIV decimal.Decimal `json:"ask_iv"` }
type TickerStats ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.