deribit

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WSAddr     = "wss://www.deribit.com/ws/api/v2/"
	WSTestAddr = "wss://test.deribit.com/ws/api/v2/"
)
View Source
const (
	InstrumentsKindOption = "option"
	InstrumentsKindFuture = "future"

	InstrumentsEndPoint = "/public/get_instruments"
)
View Source
const (
	PrivateGetPosition  = "private/get_position"
	PrivateGetPositions = "private/get_positions"
)
View Source
const (
	OptionTypeCall = "call"
	OptionTypePut  = "put"

	KindOption            = "option"
	KindFuture            = "future"
	KindOptionCombo       = "option_combo"
	KindFutureCombo       = "future_combo"
	SettlePeriodPerpetual = "perpetual"
	SettlePeriodDay       = "day"
	SettlePeriodWeek      = "week"
	SettlePeriodMonth     = "month"
)
View Source
const (
	GetUserTradesByCurrency = "private/get_user_trades_by_currency"
)
View Source
const (
	JsonRPCVersion = "2.0"
)
View Source
const (
	PrivateGetAccountSummary = "private/get_account_summary"
)
View Source
const (
	PrivateGetOpenOrdersByCurrency = "/private/get_open_orders_by_currency"
)
View Source
const (
	PublicTickerMethod = "public/ticker"
)
View Source
const (
	RestOrderBookMethod = "public/get_order_book"
)

Variables

View Source
var (
	Currencies = []string{"BTC", "ETH"}
)

Functions

func Init added in v0.3.0

func Init(ctx context.Context, testNet bool) error

func NewError

func NewError(code int, msg string) error

func NewIndexChannel added in v0.3.0

func NewIndexChannel(index string) exchange.Channel

func NewOptionSymbol added in v0.5.4

func NewOptionSymbol(currency string, st time.Time, strike float64, typ exchange.OptionType) (exchange.OptionSymbol, error)

NewOptionSymbol create a option symbol string with curreny, st, strike, typ. and parse it with ParseOptionSymbol

func NewOrderBookChannel added in v0.3.0

func NewOrderBookChannel(sym exchange.Symbol) exchange.Channel

NewOrderBookChannel return channel for change of order book

func NewOrderBookSnapChannel added in v0.5.4

func NewOrderBookSnapChannel(sym exchange.Symbol, group string, depth int) exchange.Channel

NewOrderBookSnap return channel for snapshot of orderbook

func OptionSymbolsWithIndex added in v0.5.4

func OptionSymbolsWithIndex(index string) []exchange.OptionSymbol

OptionSymbolWithIndex get all option symbol with specific index from symbol map

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)

func ParseSymbol added in v0.3.0

func ParseSymbol(sym string) (exchange.Symbol, error)

func SymbolLoop added in v0.5.4

func SymbolLoop(ctx context.Context)

SymbolLoop start loop update symbol map periodly

func Symbols added in v0.5.4

func Symbols() []exchange.Symbol

Symbols get all symbols from symbol map

func UpdateSymbolMap added in v0.5.4

func UpdateSymbolMap(ctx context.Context) error

UpdateSymbolMap rebuild symbol map. the symbol map update is leave to user

Types

type AccountSummaryRequest added in v0.5.3

type AccountSummaryRequest struct {
	AuthToken
	Currency string `json:"currency"`
	Extended bool   `json:"extended"`
}

func NewAccountSummaryRequest added in v0.5.3

func NewAccountSummaryRequest(currency string) *AccountSummaryRequest

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 AuthParam

type AuthParam struct {
	GrantType    string `json:"grant_type"`
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

type AuthResult

type AuthResult struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	TokenType    string `json:"token_type"`
}

type AuthToken

type AuthToken struct {
	AccessToken string `json:"access_token"`
}

func (*AuthToken) SetToken

func (ap *AuthToken) SetToken(token string)

type BookData

type BookData struct {
	Timestamp      int              `json:"timestamp"`
	InstrumentName string           `json:"instrument_name"`
	ChangeID       int              `json:"charge_id"`
	PrevChangeID   int              `json:"prev_change_id"`
	Bids           [][3]interface{} `json:"bids"`
	Asks           [][3]interface{} `json:"asks"`
}

type BookGreeks added in v0.3.0

type BookGreeks struct {
	Delta decimal.Decimal
	Gamma decimal.Decimal
	Rho   decimal.Decimal
	Theta decimal.Decimal
	Vega  decimal.Decimal
}

type BookSnapData added in v0.5.4

type BookSnapData struct {
	Timestamp      int64        `json:"timestamp"`
	InstrumentName string       `json:"instrument_name"`
	ChangeID       int          `json:"charge_id"`
	Bids           [][2]float64 `json:"bids"`
	Asks           [][2]float64 `json:"asks"`
}

type BookStats added in v0.3.0

type BookStats struct {
	Volume      decimal.Decimal
	PriceChange decimal.Decimal
	Low         decimal.Decimal
	High        decimal.Decimal
}

type ChIndex added in v0.3.0

type ChIndex struct {
	// contains filtered or unexported fields
}

func (*ChIndex) String added in v0.3.0

func (ci *ChIndex) String() string

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 ChOrderBookSnap added in v0.5.4

type ChOrderBookSnap struct {
	// contains filtered or unexported fields
}

func (*ChOrderBookSnap) String added in v0.5.4

func (cos *ChOrderBookSnap) String() string

type ChTicker added in v0.3.0

type ChTicker struct {
	// contains filtered or unexported fields
}

func NewTickerChannel added in v0.3.0

func NewTickerChannel(symbol exchange.Symbol) *ChTicker

func (*ChTicker) String added in v0.3.0

func (ct *ChTicker) String() string

type Client

type Client struct {
	*exchange.WSClient
	// contains filtered or unexported fields
}

func NewTestWSClient added in v0.3.0

func NewTestWSClient(key, secret string, data chan interface{}) *Client

func NewWSClient added in v0.3.0

func NewWSClient(key, secret string, data chan interface{}) *Client

func (*Client) Auth added in v0.3.0

func (c *Client) Auth(ctx context.Context) error

Auth is done by client.call

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 (c *Client) CancelOrder(ctx context.Context, order *exchange.Order) (*exchange.Order, error)

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) Exchange

func (c *Client) Exchange() string

func (*Client) FetchOrder added in v0.3.0

func (c *Client) FetchOrder(ctx context.Context, order *exchange.Order) (*exchange.Order, error)

func (*Client) FetchOrderBook added in v0.3.0

func (client *Client) FetchOrderBook(ctx context.Context, symbol exchange.Symbol, maxDepth int) (*exchange.OrderBook, error)

func (*Client) Handle added in v0.3.0

func (c *Client) Handle(ctx context.Context, notify *rpc.Notify)

func (*Client) OpenOrdersByCurrency added in v0.5.3

func (c *Client) OpenOrdersByCurrency(ctx context.Context, req *OpenOrdersByCurrencyRequest) ([]Order, error)

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, chs ...exchange.Channel) error

func (*Client) UnSubscribe

func (c *Client) UnSubscribe(ctx context.Context, chs ...exchange.Channel) error

type Codec

type Codec struct {
}

func (*Codec) Decode

func (cc *Codec) Decode(raw []byte) (rpc.Response, error)

func (*Codec) Encode

func (cc *Codec) Encode(req rpc.Request) ([]byte, error)

type Error

type Error struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

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 GetUserTradesByCurrencyReq added in v0.5.3

type GetUserTradesByCurrencyReq struct {
	AuthToken
	// contains filtered or unexported fields
}

func NewGetUserTradesByCurrencyReq added in v0.5.3

func NewGetUserTradesByCurrencyReq(currency string) *GetUserTradesByCurrencyReq

func (*GetUserTradesByCurrencyReq) Count added in v0.5.3

func (*GetUserTradesByCurrencyReq) EndID added in v0.5.3

func (*GetUserTradesByCurrencyReq) IncludeOld added in v0.5.3

func (*GetUserTradesByCurrencyReq) Kind added in v0.5.3

func (*GetUserTradesByCurrencyReq) MarshalJSON added in v0.5.3

func (gr *GetUserTradesByCurrencyReq) MarshalJSON() ([]byte, error)

func (*GetUserTradesByCurrencyReq) Sorting added in v0.5.3

func (*GetUserTradesByCurrencyReq) StartID added in v0.5.3

type IndexResult

type IndexResult struct {
	IndexName string          `json:"index_name"`
	Price     decimal.Decimal `json:"price"`
	Timestamp int64           `json:"timestamp"`
}

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"`
}

func (*InstrumentResult) Symbol added in v0.3.0

func (i *InstrumentResult) Symbol() (exchange.Symbol, error)

type InstrumentsRequest added in v0.5.1

type InstrumentsRequest struct {
	// contains filtered or unexported fields
}

func NewInstrumentsRequest added in v0.5.1

func NewInstrumentsRequest(currency string) *InstrumentsRequest

func (*InstrumentsRequest) Expired added in v0.5.1

func (ir *InstrumentsRequest) Expired() *InstrumentsRequest

func (*InstrumentsRequest) Kind added in v0.5.1

type JRPCError

type JRPCError struct {
	Code int
	Msg  string
}

JRPCError json rpc error data

func (*JRPCError) Error

func (je *JRPCError) Error() string

func (*JRPCError) Is

func (js *JRPCError) Is(target error) bool

type Notify

type Notify struct {
	Data    json.RawMessage `json:"data"`
	Channel string          `json:"channel"`
}

type OpenOrdersByCurrencyRequest added in v0.5.3

type OpenOrdersByCurrencyRequest struct {
	AuthToken
	// contains filtered or unexported fields
}

func NewOpenOrdersByCurrencyRequest added in v0.5.3

func NewOpenOrdersByCurrencyRequest(currency string) *OpenOrdersByCurrencyRequest

func (*OpenOrdersByCurrencyRequest) Kind added in v0.5.3

func (*OpenOrdersByCurrencyRequest) MarshalJSON added in v0.5.3

func (obr *OpenOrdersByCurrencyRequest) MarshalJSON() ([]byte, error)

func (*OpenOrdersByCurrencyRequest) Type added in v0.5.3

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 OrderID

type OrderID string

func NewOrderID

func NewOrderID(id string) OrderID

func (OrderID) String

func (id OrderID) String() string

type PositionRequest added in v0.3.0

type PositionRequest struct {
	AuthToken
	InstrumentName string `json:"instrument_name"`
}

func NewPositionRequest added in v0.5.3

func NewPositionRequest(instrument string) *PositionRequest

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"`
}

func (*PositionResult) Transfer added in v0.5.4

func (pr *PositionResult) Transfer() (*exchange.Position, error)

type PositionsRequest added in v0.3.0

type PositionsRequest struct {
	AuthToken
	Currency string `json:"currency"`
	Kind     string `json:"kind"`
}

func NewPositionsRequest added in v0.5.3

func NewPositionsRequest(currency string, kind string) *PositionsRequest

type PublicSettlementByInstrumentReq added in v0.3.0

type PublicSettlementByInstrumentReq struct {
	InstrumentName string         `json:"instrument_name"`
	Type           SettlementType `json:"type"`
}

type Request

type Request struct {
	ID      int64       `json:"id"`
	Method  string      `json:"method"`
	JsonRPC string      `json:"jsonrpc"`
	Params  interface{} `json:"params"`
}

type Response

type Response struct {
	JsonRPC string          `json:"jsonrpc"`
	ID      int64           `json:"id"`
	Error   Error           `json:"error"`
	Result  json.RawMessage `json:"result"`
	Method  string          `json:"method"`
	Params  Notify          `json:"params"`
}

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"`
}

func (*RestBookData) Transform added in v0.3.0

func (ob *RestBookData) Transform(sym exchange.Symbol) (*exchange.OrderBook, error)

type RestBookReq added in v0.3.0

type RestBookReq struct {
	InstrumentName string `json:"instrument_name"`
	Depth          string `json:"depth,omitempty"`
}

type RestClient added in v0.5.1

type RestClient struct {
	// contains filtered or unexported fields
}

func NewRestClient added in v0.5.1

func NewRestClient(key, secret string) *RestClient

func NewTestRestClient added in v0.5.1

func NewTestRestClient(key, secret string) *RestClient

func (*RestClient) Instruments added in v0.5.1

func (c *RestClient) Instruments(ctx context.Context, ir *InstrumentsRequest) ([]InstrumentResult, error)

func (*RestClient) OptionSymbols added in v0.5.1

func (c *RestClient) OptionSymbols(ctx context.Context, currency string) ([]exchange.OptionSymbol, error)

func (*RestClient) Request added in v0.5.1

func (rc *RestClient) Request(ctx context.Context, method string, endPoint string, params url.Values, body io.Reader, signed bool, dst interface{}) error

func (*RestClient) Symbols added in v0.5.1

func (c *RestClient) Symbols(ctx context.Context, currency string) ([]exchange.Symbol, error)

Symbols fetch deribit option and futures(future + swap) symbols

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 TickerGreeks struct {
	Vega  decimal.Decimal `json:"vega"`
	Theta decimal.Decimal `json:"theta"`
	Rho   decimal.Decimal `json:"rho"`
	Gamma decimal.Decimal `json:"gamma"`
	Delta decimal.Decimal `json:"delta"`
}

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"`
}

func (*TickerResult) Parse added in v0.3.0

func (tr *TickerResult) Parse() (*exchange.Ticker, error)

type TickerStats added in v0.3.0

type TickerStats struct {
	Volume      decimal.Decimal
	PriceChange decimal.Decimal `json:"price_change"`
	Low         decimal.Decimal
	High        decimal.Decimal
}

type Token

type Token interface {
	SetToken(string)
}

type TradeResp added in v0.5.3

type TradeResp struct {
	HasMore bool          `json:"has_more"`
	Trades  []TradeResult `json:"trades"`
}

type TradeResult added in v0.5.3

type TradeResult struct {
	Amount          decimal.Decimal `json:"amount"`
	BlockTradeID    string          `json:"block_trade_id"`
	Direction       string          `json:"direction"`
	Fee             decimal.Decimal `json:"fee"`
	FeeCurrency     string          `json:"fee_currency"`
	IndexPrice      decimal.Decimal `json:"index_price"`
	InstrumentName  string          `json:"instrument_name"`
	IV              decimal.Decimal `json:"iv"`
	Label           string          `json:"label"`
	Liquidation     string          `json:"liquidation"`
	Liquidity       string          `json:"liquidity"`
	MarkPrice       decimal.Decimal `json:"mark_price"`
	MatchingID      string          `json:"matching_id"`
	OrderID         string          `json:"order_id"`
	OrderType       string          `json:"order_type"`
	PostOnly        bool            `json:"post_only"`
	Price           decimal.Decimal `json:"price"`
	ProfitLoss      decimal.Decimal `json:"profit_loss"`
	ReduceOnly      bool            `json:"reduce_only"`
	SelfTrade       bool            `json:"self_trade"`
	State           string          `json:"state"`
	TickDirection   int             `json:"tick_direction"`
	Timestamp       int64           `json:"timestamp"`
	TradeID         string          `json:"trade_id"`
	TradeSeq        int64           `json:"trade_seq"`
	UnderlyingPrice decimal.Decimal `json:"underlying_price"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL