Documentation
¶
Index ¶
- Constants
- Variables
- func Float32Pointer(value float32) *float32
- func Float64Pointer(value float64) *float64
- func Int32Pointer(value int32) *int32
- func Int64Pointer(value int64) *int64
- func IntPointer(value int) *int
- func StringPointer(value string) *string
- type Client
- func (c *Client) Auth(apiKey string, secretKey string) (err error)
- func (c *Client) Buy(params *models.BuyParams) (result models.BuyResponse, err error)
- func (c *Client) Call(method string, params interface{}, result interface{}) (err error)
- func (c *Client) Cancel(params *models.CancelParams) (result models.Order, err error)
- func (c *Client) CancelAll() (result string, err error)
- func (c *Client) CancelAllByCurrency(params *models.CancelAllByCurrencyParams) (result string, err error)
- func (c *Client) CancelAllByInstrument(params *models.CancelAllByInstrumentParams) (result string, err error)
- func (c *Client) CancelTransferByID(params *models.CancelTransferByIDParams) (result models.Transfer, err error)
- func (c *Client) CancelWithdrawal(params *models.CancelWithdrawalParams) (result models.Withdrawal, err error)
- func (c *Client) ChangeSubaccountName(params *models.ChangeSubaccountNameParams) (result string, err error)
- func (c *Client) Close() error
- func (c *Client) ClosePosition(params *models.ClosePositionParams) (result models.ClosePositionResponse, err error)
- func (c *Client) CreateDepositAddress(params *models.CreateDepositAddressParams) (result models.DepositAddress, err error)
- func (c *Client) CreateSubaccount() (result models.Subaccount, err error)
- func (c *Client) DisableCancelOnDisconnect() (result string, err error)
- func (c *Client) DisableHeartbeat() (result string, err error)
- func (c *Client) DisableTfaForSubaccount(params *models.DisableTfaForSubaccountParams) (result string, err error)
- func (c *Client) Edit(params *models.EditParams) (result models.EditResponse, err error)
- func (c *Client) Emit(event interface{}, arguments ...interface{}) *emission.Emitter
- func (c *Client) EnableCancelOnDisconnect() (result string, err error)
- func (c *Client) GetAccountSummary(params *models.GetAccountSummaryParams) (result models.AccountSummary, err error)
- func (c *Client) GetAnnouncements() (result []models.Announcement, err error)
- func (c *Client) GetBookSummaryByCurrency(params *models.GetBookSummaryByCurrencyParams) (result []models.BookSummary, err error)
- func (c *Client) GetBookSummaryByInstrument(params *models.GetBookSummaryByInstrumentParams) (result []models.BookSummary, err error)
- func (c *Client) GetContractSize(params *models.GetContractSizeParams) (result models.GetContractSizeResponse, err error)
- func (c *Client) GetCurrencies() (result []models.Currency, err error)
- func (c *Client) GetCurrentDepositAddress(params *models.GetCurrentDepositAddressParams) (result models.DepositAddress, err error)
- func (c *Client) GetDeposits(params *models.GetDepositsParams) (result models.GetDepositsResponse, err error)
- func (c *Client) GetEmailLanguage() (result string, err error)
- func (c *Client) GetFundingChartData(params *models.GetFundingChartDataParams) (result models.GetFundingChartDataResponse, err error)
- func (c *Client) GetHistoricalVolatility(params *models.GetHistoricalVolatilityParams) (result models.GetHistoricalVolatilityResponse, err error)
- func (c *Client) GetIndex(params *models.GetIndexParams) (result models.GetIndexResponse, err error)
- func (c *Client) GetInstruments(params *models.GetInstrumentsParams) (result []models.Instrument, err error)
- func (c *Client) GetLastSettlementsByCurrency(params *models.GetLastSettlementsByCurrencyParams) (result models.GetLastSettlementsResponse, err error)
- func (c *Client) GetLastSettlementsByInstrument(params *models.GetLastSettlementsByInstrumentParams) (result models.GetLastSettlementsResponse, err error)
- func (c *Client) GetLastTradesByCurrency(params *models.GetLastTradesByCurrencyParams) (result models.GetLastTradesResponse, err error)
- func (c *Client) GetLastTradesByCurrencyAndTime(params *models.GetLastTradesByCurrencyAndTimeParams) (result models.GetLastTradesResponse, err error)
- func (c *Client) GetLastTradesByInstrument(params *models.GetLastTradesByInstrumentParams) (result models.GetLastTradesResponse, err error)
- func (c *Client) GetLastTradesByInstrumentAndTime(params *models.GetLastTradesByInstrumentAndTimeParams) (result models.GetLastTradesResponse, err error)
- func (c *Client) GetMargins(params *models.GetMarginsParams) (result models.GetMarginsResponse, err error)
- func (c *Client) GetNewAnnouncements() (result []models.Announcement, err error)
- func (c *Client) GetOpenOrdersByCurrency(params *models.GetOpenOrdersByCurrencyParams) (result []models.Order, err error)
- func (c *Client) GetOpenOrdersByInstrument(params *models.GetOpenOrdersByInstrumentParams) (result []models.Order, err error)
- func (c *Client) GetOrderBook(params *models.GetOrderBookParams) (result models.GetOrderBookResponse, err error)
- func (c *Client) GetOrderHistoryByCurrency(params *models.GetOrderHistoryByCurrencyParams) (result []models.Order, err error)
- func (c *Client) GetOrderHistoryByInstrument(params *models.GetOrderHistoryByInstrumentParams) (result []models.Order, err error)
- func (c *Client) GetOrderMarginByIDs(params *models.GetOrderMarginByIDsParams) (result models.GetOrderMarginByIDsResponse, err error)
- func (c *Client) GetOrderState(params *models.GetOrderStateParams) (result models.Order, err error)
- func (c *Client) GetPosition(params *models.GetPositionParams) (result models.Position, err error)
- func (c *Client) GetPositions(params *models.GetPositionsParams) (result []models.Position, err error)
- func (c *Client) GetSettlementHistoryByCurrency(params *models.GetSettlementHistoryByCurrencyParams) (result models.GetSettlementHistoryResponse, err error)
- func (c *Client) GetSettlementHistoryByInstrument(params *models.GetSettlementHistoryByInstrumentParams) (result models.GetSettlementHistoryResponse, err error)
- func (c *Client) GetStopOrderHistory(params *models.GetStopOrderHistoryParams) (result models.GetStopOrderHistoryResponse, err error)
- func (c *Client) GetSubaccounts(params *models.GetSubaccountsParams) (result []models.Subaccount, err error)
- func (c *Client) GetSubaccountsDetails(params *models.GetSubaccountsDetailsParams) (result []models.SubaccountsDetails, err error)
- func (c *Client) GetTime() (result int64, err error)
- func (c *Client) GetTradeVolumes() (result models.GetTradeVolumesResponse, err error)
- func (c *Client) GetTradingviewChartData(params *models.GetTradingviewChartDataParams) (result models.GetTradingviewChartDataResponse, err error)
- func (c *Client) GetTransfers(params *models.GetTransfersParams) (result models.GetTransfersResponse, err error)
- func (c *Client) GetUserTradesByCurrency(params *models.GetUserTradesByCurrencyParams) (result models.GetUserTradesResponse, err error)
- func (c *Client) GetUserTradesByCurrencyAndTime(params *models.GetUserTradesByCurrencyAndTimeParams) (result models.GetUserTradesResponse, err error)
- func (c *Client) GetUserTradesByInstrument(params *models.GetUserTradesByInstrumentParams) (result models.GetUserTradesResponse, err error)
- func (c *Client) GetUserTradesByInstrumentAndTime(params *models.GetUserTradesByInstrumentAndTimeParams) (result models.GetUserTradesResponse, err error)
- func (c *Client) GetUserTradesByOrder(params *models.GetUserTradesByOrderParams) (result models.GetUserTradesResponse, err error)
- func (c *Client) GetWithdrawals(params *models.GetWithdrawalsParams) (result []models.Withdrawal, err error)
- func (c *Client) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request)
- func (c *Client) Hello(params *models.HelloParams) (result models.HelloResponse, err error)
- func (c *Client) IsClosed() bool
- func (c *Client) IsConnected() bool
- func (c *Client) Logout() (err error)
- func (c *Client) Off(event interface{}, listener interface{}) *emission.Emitter
- func (c *Client) On(event interface{}, listener interface{}) *emission.Emitter
- func (c *Client) PrivateSubscribe(params *models.SubscribeParams) (result models.SubscribeResponse, err error)
- func (c *Client) PrivateUnsubscribe(params *models.UnsubscribeParams) (result models.UnsubscribeResponse, err error)
- func (c *Client) PublicSubscribe(params *models.SubscribeParams) (result models.SubscribeResponse, err error)
- func (c *Client) PublicUnsubscribe(params *models.UnsubscribeParams) (result models.UnsubscribeResponse, err error)
- func (c *Client) Sell(params *models.SellParams) (result models.SellResponse, err error)
- func (c *Client) SetAnnouncementAsRead(params *models.SetAnnouncementAsReadParams) (result string, err error)
- func (c *Client) SetEmailForSubaccount(params *models.SetEmailForSubaccountParams) (result string, err error)
- func (c *Client) SetEmailLanguage(params *models.SetEmailLanguageParams) (result string, err error)
- func (c *Client) SetHeartbeat(params *models.SetHeartbeatParams) (result string, err error)
- func (c *Client) SetPasswordForSubaccount(params *models.SetPasswordForSubaccountParams) (result string, err error)
- func (c *Client) Subscribe(channels []string)
- func (c *Client) Test() (result models.TestResponse, err error)
- func (c *Client) Ticker(params *models.TickerParams) (result models.TickerResponse, err error)
- func (c *Client) ToggleNotificationsFromSubaccount(params *models.ToggleNotificationsFromSubaccountParams) (result string, err error)
- func (c *Client) ToggleSubaccountLogin(params *models.ToggleSubaccountLoginParams) (result string, err error)
- func (c *Client) Withdraw(params *models.WithdrawParams) (result models.Withdrawal, err error)
- type Configuration
- type Event
- type ObjectStream
- type Token
Constants ¶
const ( RealBaseURL = "wss://www.deribit.com/ws/api/v2/" TestBaseURL = "wss://test.deribit.com/ws/api/v2/" )
const (
MaxTryTimes = 10000
)
Variables ¶
var ErrAuthenticationIsRequired = errors.New("authentication is required")
Functions ¶
func Float32Pointer ¶
func Float64Pointer ¶
func Int32Pointer ¶
func Int64Pointer ¶
func IntPointer ¶
func StringPointer ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg *Configuration) *Client
func (*Client) CancelAllByCurrency ¶
func (c *Client) CancelAllByCurrency(params *models.CancelAllByCurrencyParams) (result string, err error)
func (*Client) CancelAllByInstrument ¶
func (c *Client) CancelAllByInstrument(params *models.CancelAllByInstrumentParams) (result string, err error)
func (*Client) CancelTransferByID ¶
func (*Client) CancelWithdrawal ¶
func (c *Client) CancelWithdrawal(params *models.CancelWithdrawalParams) (result models.Withdrawal, err error)
func (*Client) ChangeSubaccountName ¶
func (c *Client) ChangeSubaccountName(params *models.ChangeSubaccountNameParams) (result string, err error)
func (*Client) Close ¶ added in v1.0.9
Close releases the connection and stops the heartbeat goroutine that start launched. It is safe to call more than once, and safe with AutoReconnect either enabled or disabled — a client closed here is not reconnected.
Without this a caller that replaces a Client cannot reclaim it: heartbeat exits only on heartCancel, which is otherwise closed solely on the autoReconnect path, so an abandoned client keeps calling Test every 3s and keeps decoding everything it is still subscribed to.
func (*Client) ClosePosition ¶
func (c *Client) ClosePosition(params *models.ClosePositionParams) (result models.ClosePositionResponse, err error)
func (*Client) CreateDepositAddress ¶
func (c *Client) CreateDepositAddress(params *models.CreateDepositAddressParams) (result models.DepositAddress, err error)
func (*Client) CreateSubaccount ¶
func (c *Client) CreateSubaccount() (result models.Subaccount, err error)
func (*Client) DisableCancelOnDisconnect ¶
func (*Client) DisableHeartbeat ¶
func (*Client) DisableTfaForSubaccount ¶
func (c *Client) DisableTfaForSubaccount(params *models.DisableTfaForSubaccountParams) (result string, err error)
func (*Client) Edit ¶
func (c *Client) Edit(params *models.EditParams) (result models.EditResponse, err error)
func (*Client) EnableCancelOnDisconnect ¶
func (*Client) GetAccountSummary ¶
func (c *Client) GetAccountSummary(params *models.GetAccountSummaryParams) (result models.AccountSummary, err error)
func (*Client) GetAnnouncements ¶
func (c *Client) GetAnnouncements() (result []models.Announcement, err error)
func (*Client) GetBookSummaryByCurrency ¶
func (c *Client) GetBookSummaryByCurrency(params *models.GetBookSummaryByCurrencyParams) (result []models.BookSummary, err error)
func (*Client) GetBookSummaryByInstrument ¶
func (c *Client) GetBookSummaryByInstrument(params *models.GetBookSummaryByInstrumentParams) (result []models.BookSummary, err error)
func (*Client) GetContractSize ¶
func (c *Client) GetContractSize(params *models.GetContractSizeParams) (result models.GetContractSizeResponse, err error)
func (*Client) GetCurrencies ¶
func (*Client) GetCurrentDepositAddress ¶
func (c *Client) GetCurrentDepositAddress(params *models.GetCurrentDepositAddressParams) (result models.DepositAddress, err error)
func (*Client) GetDeposits ¶
func (c *Client) GetDeposits(params *models.GetDepositsParams) (result models.GetDepositsResponse, err error)
func (*Client) GetEmailLanguage ¶
func (*Client) GetFundingChartData ¶
func (c *Client) GetFundingChartData(params *models.GetFundingChartDataParams) (result models.GetFundingChartDataResponse, err error)
func (*Client) GetHistoricalVolatility ¶
func (c *Client) GetHistoricalVolatility(params *models.GetHistoricalVolatilityParams) (result models.GetHistoricalVolatilityResponse, err error)
func (*Client) GetIndex ¶
func (c *Client) GetIndex(params *models.GetIndexParams) (result models.GetIndexResponse, err error)
func (*Client) GetInstruments ¶
func (c *Client) GetInstruments(params *models.GetInstrumentsParams) (result []models.Instrument, err error)
func (*Client) GetLastSettlementsByCurrency ¶
func (c *Client) GetLastSettlementsByCurrency(params *models.GetLastSettlementsByCurrencyParams) (result models.GetLastSettlementsResponse, err error)
func (*Client) GetLastSettlementsByInstrument ¶
func (c *Client) GetLastSettlementsByInstrument(params *models.GetLastSettlementsByInstrumentParams) (result models.GetLastSettlementsResponse, err error)
func (*Client) GetLastTradesByCurrency ¶
func (c *Client) GetLastTradesByCurrency(params *models.GetLastTradesByCurrencyParams) (result models.GetLastTradesResponse, err error)
func (*Client) GetLastTradesByCurrencyAndTime ¶
func (c *Client) GetLastTradesByCurrencyAndTime(params *models.GetLastTradesByCurrencyAndTimeParams) (result models.GetLastTradesResponse, err error)
func (*Client) GetLastTradesByInstrument ¶
func (c *Client) GetLastTradesByInstrument(params *models.GetLastTradesByInstrumentParams) (result models.GetLastTradesResponse, err error)
func (*Client) GetLastTradesByInstrumentAndTime ¶
func (c *Client) GetLastTradesByInstrumentAndTime(params *models.GetLastTradesByInstrumentAndTimeParams) (result models.GetLastTradesResponse, err error)
func (*Client) GetMargins ¶
func (c *Client) GetMargins(params *models.GetMarginsParams) (result models.GetMarginsResponse, err error)
func (*Client) GetNewAnnouncements ¶
func (c *Client) GetNewAnnouncements() (result []models.Announcement, err error)
func (*Client) GetOpenOrdersByCurrency ¶
func (*Client) GetOpenOrdersByInstrument ¶
func (*Client) GetOrderBook ¶
func (c *Client) GetOrderBook(params *models.GetOrderBookParams) (result models.GetOrderBookResponse, err error)
func (*Client) GetOrderHistoryByCurrency ¶
func (*Client) GetOrderHistoryByInstrument ¶
func (*Client) GetOrderMarginByIDs ¶
func (c *Client) GetOrderMarginByIDs(params *models.GetOrderMarginByIDsParams) (result models.GetOrderMarginByIDsResponse, err error)
func (*Client) GetOrderState ¶
func (*Client) GetPosition ¶
func (*Client) GetPositions ¶
func (*Client) GetSettlementHistoryByCurrency ¶
func (c *Client) GetSettlementHistoryByCurrency(params *models.GetSettlementHistoryByCurrencyParams) (result models.GetSettlementHistoryResponse, err error)
func (*Client) GetSettlementHistoryByInstrument ¶
func (c *Client) GetSettlementHistoryByInstrument(params *models.GetSettlementHistoryByInstrumentParams) (result models.GetSettlementHistoryResponse, err error)
func (*Client) GetStopOrderHistory ¶
func (c *Client) GetStopOrderHistory(params *models.GetStopOrderHistoryParams) (result models.GetStopOrderHistoryResponse, err error)
func (*Client) GetSubaccounts ¶
func (c *Client) GetSubaccounts(params *models.GetSubaccountsParams) (result []models.Subaccount, err error)
func (*Client) GetSubaccountsDetails ¶
func (c *Client) GetSubaccountsDetails(params *models.GetSubaccountsDetailsParams) (result []models.SubaccountsDetails, err error)
func (*Client) GetTradeVolumes ¶
func (c *Client) GetTradeVolumes() (result models.GetTradeVolumesResponse, err error)
func (*Client) GetTradingviewChartData ¶
func (c *Client) GetTradingviewChartData(params *models.GetTradingviewChartDataParams) (result models.GetTradingviewChartDataResponse, err error)
func (*Client) GetTransfers ¶
func (c *Client) GetTransfers(params *models.GetTransfersParams) (result models.GetTransfersResponse, err error)
func (*Client) GetUserTradesByCurrency ¶
func (c *Client) GetUserTradesByCurrency(params *models.GetUserTradesByCurrencyParams) (result models.GetUserTradesResponse, err error)
func (*Client) GetUserTradesByCurrencyAndTime ¶
func (c *Client) GetUserTradesByCurrencyAndTime(params *models.GetUserTradesByCurrencyAndTimeParams) (result models.GetUserTradesResponse, err error)
func (*Client) GetUserTradesByInstrument ¶
func (c *Client) GetUserTradesByInstrument(params *models.GetUserTradesByInstrumentParams) (result models.GetUserTradesResponse, err error)
func (*Client) GetUserTradesByInstrumentAndTime ¶
func (c *Client) GetUserTradesByInstrumentAndTime(params *models.GetUserTradesByInstrumentAndTimeParams) (result models.GetUserTradesResponse, err error)
func (*Client) GetUserTradesByOrder ¶
func (c *Client) GetUserTradesByOrder(params *models.GetUserTradesByOrderParams) (result models.GetUserTradesResponse, err error)
func (*Client) GetWithdrawals ¶
func (c *Client) GetWithdrawals(params *models.GetWithdrawalsParams) (result []models.Withdrawal, err error)
func (*Client) Hello ¶
func (c *Client) Hello(params *models.HelloParams) (result models.HelloResponse, err error)
func (*Client) IsConnected ¶
IsConnected returns the WebSocket connection state
func (*Client) PrivateSubscribe ¶
func (c *Client) PrivateSubscribe(params *models.SubscribeParams) (result models.SubscribeResponse, err error)
func (*Client) PrivateUnsubscribe ¶
func (c *Client) PrivateUnsubscribe(params *models.UnsubscribeParams) (result models.UnsubscribeResponse, err error)
func (*Client) PublicSubscribe ¶
func (c *Client) PublicSubscribe(params *models.SubscribeParams) (result models.SubscribeResponse, err error)
func (*Client) PublicUnsubscribe ¶
func (c *Client) PublicUnsubscribe(params *models.UnsubscribeParams) (result models.UnsubscribeResponse, err error)
func (*Client) Sell ¶
func (c *Client) Sell(params *models.SellParams) (result models.SellResponse, err error)
func (*Client) SetAnnouncementAsRead ¶
func (c *Client) SetAnnouncementAsRead(params *models.SetAnnouncementAsReadParams) (result string, err error)
func (*Client) SetEmailForSubaccount ¶
func (c *Client) SetEmailForSubaccount(params *models.SetEmailForSubaccountParams) (result string, err error)
func (*Client) SetEmailLanguage ¶
func (c *Client) SetEmailLanguage(params *models.SetEmailLanguageParams) (result string, err error)
func (*Client) SetHeartbeat ¶
func (c *Client) SetHeartbeat(params *models.SetHeartbeatParams) (result string, err error)
func (*Client) SetPasswordForSubaccount ¶
func (c *Client) SetPasswordForSubaccount(params *models.SetPasswordForSubaccountParams) (result string, err error)
func (*Client) Ticker ¶
func (c *Client) Ticker(params *models.TickerParams) (result models.TickerResponse, err error)
func (*Client) ToggleNotificationsFromSubaccount ¶
func (c *Client) ToggleNotificationsFromSubaccount(params *models.ToggleNotificationsFromSubaccountParams) (result string, err error)
func (*Client) ToggleSubaccountLogin ¶
func (c *Client) ToggleSubaccountLogin(params *models.ToggleSubaccountLoginParams) (result string, err error)
func (*Client) Withdraw ¶
func (c *Client) Withdraw(params *models.WithdrawParams) (result models.Withdrawal, err error)
type Configuration ¶
type Event ¶
type Event struct {
Channel string `json:"channel"`
Data json.RawMessage `json:"data"`
}
Event is wrapper of received event
type ObjectStream ¶
type ObjectStream struct {
// contains filtered or unexported fields
}
A ObjectStream is a jsonrpc2.ObjectStream that uses a WebSocket to send and receive JSON-RPC 2.0 objects.
func NewObjectStream ¶
func NewObjectStream(conn *websocket.Conn) ObjectStream
NewObjectStream creates a new jsonrpc2.ObjectStream for sending and receiving JSON-RPC 2.0 objects over a WebSocket.
func (ObjectStream) Close ¶
func (t ObjectStream) Close() error
Close implements jsonrpc2.ObjectStream.
func (ObjectStream) ReadObject ¶
func (t ObjectStream) ReadObject(v interface{}) error
ReadObject implements jsonrpc2.ObjectStream.
func (ObjectStream) WriteObject ¶
func (t ObjectStream) WriteObject(obj interface{}) error
WriteObject implements jsonrpc2.ObjectStream.