deribit

package module
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: MIT Imports: 12 Imported by: 0

README

go-deribit

V2 API - Major Breaking Changes

Both the remote API and this implementation have changed a lot since v1. The deprecated, but still functioning v1 API has been tagged v1.0.0.

V2 API Documentation

Overview

Go library for using the Deribit's v2 Websocket API.

Deribit is a modern, fast BitCoin derivatives exchange. If you are using BitMex then you are doing it wrong! Deribit does not freeze up during higher than average load. Also, it is peer-to-peer, not run by market makers on lucrative contracts who want to liquidate you.

This library is a port of the official wrapper libraries to Go.

If you wish to try it out, be kind and use my affiliate link https://www.deribit.com/reg-3027.8327

Example Usage

Look at cmd/example/main.go

make build
example --access-key XXX --secret-key YYYYYY

Development

The models directory is where all the requests and responses are stored. The contents is automatically generated from the example json snippets from examples which were kindly provided to me by Deribit from their Slate documentation sources.

If you need to rebuild these use make generate-models.

The RPC methods and subscriptions are also auto-generated. Use make generate-methods to rebuild these. They are in rpc_methods.go and rpc_subscriptions.go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("timed out waiting for a response")

ErrTimeout - request timed out

Functions

This section is empty.

Types

type Exchange

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

Exchange is an API wrapper with the exchange

func NewExchange

func NewExchange(test bool, errs chan error, stop chan bool) (*Exchange, error)

NewExchange creates a new API wrapper key and secret can be ignored if you are only calling public endpoints

func (*Exchange) Authenticate

func (e *Exchange) Authenticate(key, secret string) error

func (*Exchange) Close

func (e *Exchange) Close() error

Close the websocket connection

func (*Exchange) Connect

func (e *Exchange) Connect() error

Connect to the websocket API

func (*Exchange) PrivateBuy

func (e *Exchange) PrivateBuy(params *private.BuyRequest) (*private.BuyResponse, error)

PrivateBuy makes a request to private/buy

func (*Exchange) PrivateCancel

func (e *Exchange) PrivateCancel(params *private.CancelRequest) (*private.CancelResponse, error)

PrivateCancel makes a request to private/cancel

func (*Exchange) PrivateCancelAll

func (e *Exchange) PrivateCancelAll(params *private.CancelAllRequest) (*private.CancelAllResponse, error)

PrivateCancelAll makes a request to private/cancel_all

func (*Exchange) PrivateCancelAllByCurrency

func (e *Exchange) PrivateCancelAllByCurrency(params *private.CancelAllByCurrencyRequest) (*private.CancelAllByCurrencyResponse, error)

PrivateCancelAllByCurrency makes a request to private/cancel_all_by_currency

func (*Exchange) PrivateCancelAllByInstrument

func (e *Exchange) PrivateCancelAllByInstrument(params *private.CancelAllByInstrumentRequest) (*private.CancelAllByInstrumentResponse, error)

PrivateCancelAllByInstrument makes a request to private/cancel_all_by_instrument

func (*Exchange) PrivateCancelTransferById

func (e *Exchange) PrivateCancelTransferById(params *private.CancelTransferByIdRequest) (*private.CancelTransferByIdResponse, error)

PrivateCancelTransferById makes a request to private/cancel_transfer_by_id

func (*Exchange) PrivateCancelWithdrawal

func (e *Exchange) PrivateCancelWithdrawal(params *private.CancelWithdrawalRequest) (*private.CancelWithdrawalResponse, error)

PrivateCancelWithdrawal makes a request to private/cancel_withdrawal

func (*Exchange) PrivateChangeSubaccountName

func (e *Exchange) PrivateChangeSubaccountName(params *private.ChangeSubaccountNameRequest) (*private.ChangeSubaccountNameResponse, error)

PrivateChangeSubaccountName makes a request to private/change_subaccount_name

func (*Exchange) PrivateClosePosition

func (e *Exchange) PrivateClosePosition(params *private.ClosePositionRequest) (*private.ClosePositionResponse, error)

PrivateClosePosition makes a request to private/close_position

func (*Exchange) PrivateCreateDepositAddress

func (e *Exchange) PrivateCreateDepositAddress(params *private.CreateDepositAddressRequest) (*private.CreateDepositAddressResponse, error)

PrivateCreateDepositAddress makes a request to private/create_deposit_address

func (*Exchange) PrivateCreateSubaccount

func (e *Exchange) PrivateCreateSubaccount(params *private.CreateSubaccountRequest) (*private.CreateSubaccountResponse, error)

PrivateCreateSubaccount makes a request to private/create_subaccount

func (*Exchange) PrivateDisableCancelOnDisconnect

func (e *Exchange) PrivateDisableCancelOnDisconnect(params *private.DisableCancelOnDisconnectRequest) (*private.DisableCancelOnDisconnectResponse, error)

PrivateDisableCancelOnDisconnect makes a request to private/disable_cancel_on_disconnect

func (*Exchange) PrivateDisableTfaForSubaccount

func (e *Exchange) PrivateDisableTfaForSubaccount(params *private.DisableTfaForSubaccountRequest) (*private.DisableTfaForSubaccountResponse, error)

PrivateDisableTfaForSubaccount makes a request to private/disable_tfa_for_subaccount

func (*Exchange) PrivateEdit

func (e *Exchange) PrivateEdit(params *private.EditRequest) (*private.EditResponse, error)

PrivateEdit makes a request to private/edit

func (*Exchange) PrivateEnableCancelOnDisconnect

func (e *Exchange) PrivateEnableCancelOnDisconnect(params *private.EnableCancelOnDisconnectRequest) (*private.EnableCancelOnDisconnectResponse, error)

PrivateEnableCancelOnDisconnect makes a request to private/enable_cancel_on_disconnect

func (*Exchange) PrivateGetAccountSummary

func (e *Exchange) PrivateGetAccountSummary(params *private.GetAccountSummaryRequest) (*private.GetAccountSummaryResponse, error)

PrivateGetAccountSummary makes a request to private/get_account_summary

func (*Exchange) PrivateGetCurrentDepositAddress

func (e *Exchange) PrivateGetCurrentDepositAddress(params *private.GetCurrentDepositAddressRequest) (*private.GetCurrentDepositAddressResponse, error)

PrivateGetCurrentDepositAddress makes a request to private/get_current_deposit_address

func (*Exchange) PrivateGetDeposits

func (e *Exchange) PrivateGetDeposits(params *private.GetDepositsRequest) (*private.GetDepositsResponse, error)

PrivateGetDeposits makes a request to private/get_deposits

func (*Exchange) PrivateGetEmailLanguage

func (e *Exchange) PrivateGetEmailLanguage(params *private.GetEmailLanguageRequest) (*private.GetEmailLanguageResponse, error)

PrivateGetEmailLanguage makes a request to private/get_email_language

func (*Exchange) PrivateGetMargins

func (e *Exchange) PrivateGetMargins(params *private.GetMarginsRequest) (*private.GetMarginsResponse, error)

PrivateGetMargins makes a request to private/get_margins

func (*Exchange) PrivateGetNewAnnouncements

func (e *Exchange) PrivateGetNewAnnouncements(params *private.GetNewAnnouncementsRequest) (*private.GetNewAnnouncementsResponse, error)

PrivateGetNewAnnouncements makes a request to private/get_new_announcements

func (*Exchange) PrivateGetOpenOrdersByCurrency

func (e *Exchange) PrivateGetOpenOrdersByCurrency(params *private.GetOpenOrdersByCurrencyRequest) (*private.GetOpenOrdersByCurrencyResponse, error)

PrivateGetOpenOrdersByCurrency makes a request to private/get_open_orders_by_currency

func (*Exchange) PrivateGetOpenOrdersByInstrument

func (e *Exchange) PrivateGetOpenOrdersByInstrument(params *private.GetOpenOrdersByInstrumentRequest) (*private.GetOpenOrdersByInstrumentResponse, error)

PrivateGetOpenOrdersByInstrument makes a request to private/get_open_orders_by_instrument

func (*Exchange) PrivateGetOrderHistoryByCurrency

func (e *Exchange) PrivateGetOrderHistoryByCurrency(params *private.GetOrderHistoryByCurrencyRequest) (*private.GetOrderHistoryByCurrencyResponse, error)

PrivateGetOrderHistoryByCurrency makes a request to private/get_order_history_by_currency

func (*Exchange) PrivateGetOrderHistoryByInstrument

func (e *Exchange) PrivateGetOrderHistoryByInstrument(params *private.GetOrderHistoryByInstrumentRequest) (*private.GetOrderHistoryByInstrumentResponse, error)

PrivateGetOrderHistoryByInstrument makes a request to private/get_order_history_by_instrument

func (*Exchange) PrivateGetOrderMarginByIds

func (e *Exchange) PrivateGetOrderMarginByIds(params *private.GetOrderMarginByIdsRequest) (*private.GetOrderMarginByIdsResponse, error)

PrivateGetOrderMarginByIds makes a request to private/get_order_margin_by_ids

func (*Exchange) PrivateGetOrderState

func (e *Exchange) PrivateGetOrderState(params *private.GetOrderStateRequest) (*private.GetOrderStateResponse, error)

PrivateGetOrderState makes a request to private/get_order_state

func (*Exchange) PrivateGetPosition

func (e *Exchange) PrivateGetPosition(params *private.GetPositionRequest) (*private.GetPositionResponse, error)

PrivateGetPosition makes a request to private/get_position

func (*Exchange) PrivateGetPositions

func (e *Exchange) PrivateGetPositions(params *private.GetPositionsRequest) (*private.GetPositionsResponse, error)

PrivateGetPositions makes a request to private/get_positions

func (*Exchange) PrivateGetSettlementHistoryByCurrency

func (e *Exchange) PrivateGetSettlementHistoryByCurrency(params *private.GetSettlementHistoryByCurrencyRequest) (*private.GetSettlementHistoryByCurrencyResponse, error)

PrivateGetSettlementHistoryByCurrency makes a request to private/get_settlement_history_by_currency

func (*Exchange) PrivateGetSettlementHistoryByInstrument

PrivateGetSettlementHistoryByInstrument makes a request to private/get_settlement_history_by_instrument

func (*Exchange) PrivateGetSubaccounts

func (e *Exchange) PrivateGetSubaccounts(params *private.GetSubaccountsRequest) (*private.GetSubaccountsResponse, error)

PrivateGetSubaccounts makes a request to private/get_subaccounts

func (*Exchange) PrivateGetTransfers

func (e *Exchange) PrivateGetTransfers(params *private.GetTransfersRequest) (*private.GetTransfersResponse, error)

PrivateGetTransfers makes a request to private/get_transfers

func (*Exchange) PrivateGetUserTradesByCurrency

func (e *Exchange) PrivateGetUserTradesByCurrency(params *private.GetUserTradesByCurrencyRequest) (*private.GetUserTradesByCurrencyResponse, error)

PrivateGetUserTradesByCurrency makes a request to private/get_user_trades_by_currency

func (*Exchange) PrivateGetUserTradesByCurrencyAndTime

func (e *Exchange) PrivateGetUserTradesByCurrencyAndTime(params *private.GetUserTradesByCurrencyAndTimeRequest) (*private.GetUserTradesByCurrencyAndTimeResponse, error)

PrivateGetUserTradesByCurrencyAndTime makes a request to private/get_user_trades_by_currency_and_time

func (*Exchange) PrivateGetUserTradesByInstrument

func (e *Exchange) PrivateGetUserTradesByInstrument(params *private.GetUserTradesByInstrumentRequest) (*private.GetUserTradesByInstrumentResponse, error)

PrivateGetUserTradesByInstrument makes a request to private/get_user_trades_by_instrument

func (*Exchange) PrivateGetUserTradesByInstrumentAndTime

PrivateGetUserTradesByInstrumentAndTime makes a request to private/get_user_trades_by_instrument_and_time

func (*Exchange) PrivateGetUserTradesByOrder

func (e *Exchange) PrivateGetUserTradesByOrder(params *private.GetUserTradesByOrderRequest) (*private.GetUserTradesByOrderResponse, error)

PrivateGetUserTradesByOrder makes a request to private/get_user_trades_by_order

func (*Exchange) PrivateGetWithdrawals

func (e *Exchange) PrivateGetWithdrawals(params *private.GetWithdrawalsRequest) (*private.GetWithdrawalsResponse, error)

PrivateGetWithdrawals makes a request to private/get_withdrawals

func (*Exchange) PrivateSell

func (e *Exchange) PrivateSell(params *private.SellRequest) (*private.SellResponse, error)

PrivateSell makes a request to private/sell

func (*Exchange) PrivateSetAnnouncementAsRead

func (e *Exchange) PrivateSetAnnouncementAsRead(params *private.SetAnnouncementAsReadRequest) (*private.SetAnnouncementAsReadResponse, error)

PrivateSetAnnouncementAsRead makes a request to private/set_announcement_as_read

func (*Exchange) PrivateSetEmailForSubaccount

func (e *Exchange) PrivateSetEmailForSubaccount(params *private.SetEmailForSubaccountRequest) (*private.SetEmailForSubaccountResponse, error)

PrivateSetEmailForSubaccount makes a request to private/set_email_for_subaccount

func (*Exchange) PrivateSetEmailLanguage

func (e *Exchange) PrivateSetEmailLanguage(params *private.SetEmailLanguageRequest) (*private.SetEmailLanguageResponse, error)

PrivateSetEmailLanguage makes a request to private/set_email_language

func (*Exchange) PrivateSetPasswordForSubaccount

func (e *Exchange) PrivateSetPasswordForSubaccount(params *private.SetPasswordForSubaccountRequest) (*private.SetPasswordForSubaccountResponse, error)

PrivateSetPasswordForSubaccount makes a request to private/set_password_for_subaccount

func (*Exchange) PrivateSubmitTransferToSubaccount

func (e *Exchange) PrivateSubmitTransferToSubaccount(params *private.SubmitTransferToSubaccountRequest) (*private.SubmitTransferToSubaccountResponse, error)

PrivateSubmitTransferToSubaccount makes a request to private/submit_transfer_to_subaccount

func (*Exchange) PrivateSubmitTransferToUser

func (e *Exchange) PrivateSubmitTransferToUser(params *private.SubmitTransferToUserRequest) (*private.SubmitTransferToUserResponse, error)

PrivateSubmitTransferToUser makes a request to private/submit_transfer_to_user

func (*Exchange) PrivateSubscribe

func (e *Exchange) PrivateSubscribe(params *private.SubscribeRequest) (*private.SubscribeResponse, error)

PrivateSubscribe makes a request to private/subscribe

func (*Exchange) PrivateToggleNotificationsFromSubaccount

PrivateToggleNotificationsFromSubaccount makes a request to private/toggle_notifications_from_subaccount

func (*Exchange) PrivateToggleSubaccountLogin

func (e *Exchange) PrivateToggleSubaccountLogin(params *private.ToggleSubaccountLoginRequest) (*private.ToggleSubaccountLoginResponse, error)

PrivateToggleSubaccountLogin makes a request to private/toggle_subaccount_login

func (*Exchange) PrivateUnsubscribe

func (e *Exchange) PrivateUnsubscribe(params *private.UnsubscribeRequest) (*private.UnsubscribeResponse, error)

PrivateUnsubscribe makes a request to private/unsubscribe

func (*Exchange) PrivateWithdraw

func (e *Exchange) PrivateWithdraw(params *private.WithdrawRequest) (*private.WithdrawResponse, error)

PrivateWithdraw makes a request to private/withdraw

func (*Exchange) PublicAuth

func (e *Exchange) PublicAuth(params *public.AuthRequest) (*public.AuthResponse, error)

PublicAuth makes a request to public/auth

func (*Exchange) PublicDisableHeartbeat

func (e *Exchange) PublicDisableHeartbeat(params *public.DisableHeartbeatRequest) (*public.DisableHeartbeatResponse, error)

PublicDisableHeartbeat makes a request to public/disable_heartbeat

func (*Exchange) PublicGetAnnouncements

func (e *Exchange) PublicGetAnnouncements(params *public.GetAnnouncementsRequest) (*public.GetAnnouncementsResponse, error)

PublicGetAnnouncements makes a request to public/get_announcements

func (*Exchange) PublicGetBookSummaryByCurrency

func (e *Exchange) PublicGetBookSummaryByCurrency(params *public.GetBookSummaryByCurrencyRequest) (*public.GetBookSummaryByCurrencyResponse, error)

PublicGetBookSummaryByCurrency makes a request to public/get_book_summary_by_currency

func (*Exchange) PublicGetBookSummaryByInstrument

func (e *Exchange) PublicGetBookSummaryByInstrument(params *public.GetBookSummaryByInstrumentRequest) (*public.GetBookSummaryByInstrumentResponse, error)

PublicGetBookSummaryByInstrument makes a request to public/get_book_summary_by_instrument

func (*Exchange) PublicGetCurrencies

func (e *Exchange) PublicGetCurrencies(params *public.GetCurrenciesRequest) (*public.GetCurrenciesResponse, error)

PublicGetCurrencies makes a request to public/get_currencies

func (*Exchange) PublicGetHistoricalVolatility

func (e *Exchange) PublicGetHistoricalVolatility(params *public.GetHistoricalVolatilityRequest) (*public.GetHistoricalVolatilityResponse, error)

PublicGetHistoricalVolatility makes a request to public/get_historical_volatility

func (*Exchange) PublicGetInstruments

func (e *Exchange) PublicGetInstruments(params *public.GetInstrumentsRequest) (*public.GetInstrumentsResponse, error)

PublicGetInstruments makes a request to public/get_instruments

func (*Exchange) PublicGetLastSettlementsByCurrency

func (e *Exchange) PublicGetLastSettlementsByCurrency(params *public.GetLastSettlementsByCurrencyRequest) (*public.GetLastSettlementsByCurrencyResponse, error)

PublicGetLastSettlementsByCurrency makes a request to public/get_last_settlements_by_currency

func (*Exchange) PublicGetLastSettlementsByInstrument

func (e *Exchange) PublicGetLastSettlementsByInstrument(params *public.GetLastSettlementsByInstrumentRequest) (*public.GetLastSettlementsByInstrumentResponse, error)

PublicGetLastSettlementsByInstrument makes a request to public/get_last_settlements_by_instrument

func (*Exchange) PublicGetLastTradesByCurrency

func (e *Exchange) PublicGetLastTradesByCurrency(params *public.GetLastTradesByCurrencyRequest) (*public.GetLastTradesByCurrencyResponse, error)

PublicGetLastTradesByCurrency makes a request to public/get_last_trades_by_currency

func (*Exchange) PublicGetLastTradesByCurrencyAndTime

func (e *Exchange) PublicGetLastTradesByCurrencyAndTime(params *public.GetLastTradesByCurrencyAndTimeRequest) (*public.GetLastTradesByCurrencyAndTimeResponse, error)

PublicGetLastTradesByCurrencyAndTime makes a request to public/get_last_trades_by_currency_and_time

func (*Exchange) PublicGetLastTradesByInstrument

func (e *Exchange) PublicGetLastTradesByInstrument(params *public.GetLastTradesByInstrumentRequest) (*public.GetLastTradesByInstrumentResponse, error)

PublicGetLastTradesByInstrument makes a request to public/get_last_trades_by_instrument

func (*Exchange) PublicGetLastTradesByInstrumentAndTime

PublicGetLastTradesByInstrumentAndTime makes a request to public/get_last_trades_by_instrument_and_time

func (*Exchange) PublicGetOptionMarkPrices

func (e *Exchange) PublicGetOptionMarkPrices(params *public.GetOptionMarkPricesRequest) (*public.GetOptionMarkPricesResponse, error)

PublicGetOptionMarkPrices makes a request to public/get_option_mark_prices

func (*Exchange) PublicGetOrderBook

func (e *Exchange) PublicGetOrderBook(params *public.GetOrderBookRequest) (*public.GetOrderBookResponse, error)

PublicGetOrderBook makes a request to public/get_order_book

func (*Exchange) PublicGetTime

func (e *Exchange) PublicGetTime(params *public.GetTimeRequest) (*public.GetTimeResponse, error)

PublicGetTime makes a request to public/get_time

func (*Exchange) PublicGetTradeVolumes

func (e *Exchange) PublicGetTradeVolumes(params *public.GetTradeVolumesRequest) (*public.GetTradeVolumesResponse, error)

PublicGetTradeVolumes makes a request to public/get_trade_volumes

func (*Exchange) PublicHello

func (e *Exchange) PublicHello(params *public.HelloRequest) (*public.HelloResponse, error)

PublicHello makes a request to public/hello

func (*Exchange) PublicSetHeartbeat

func (e *Exchange) PublicSetHeartbeat(params *public.SetHeartbeatRequest) (*public.SetHeartbeatResponse, error)

PublicSetHeartbeat makes a request to public/set_heartbeat

func (*Exchange) PublicSubscribe

func (e *Exchange) PublicSubscribe(params *public.SubscribeRequest) (*public.SubscribeResponse, error)

PublicSubscribe makes a request to public/subscribe

func (*Exchange) PublicTest

func (e *Exchange) PublicTest(params *public.TestRequest) (*public.TestResponse, error)

PublicTest makes a request to public/test

func (*Exchange) PublicTicker

func (e *Exchange) PublicTicker(params *public.TickerRequest) (*public.TickerResponse, error)

PublicTicker makes a request to public/ticker

func (*Exchange) PublicUnsubscribe

func (e *Exchange) PublicUnsubscribe(params *public.UnsubscribeRequest) (*public.UnsubscribeResponse, error)

PublicUnsubscribe makes a request to public/unsubscribe

func (*Exchange) SubscribeAnnouncements

func (e *Exchange) SubscribeAnnouncements(instrument_name, interval string) (chan *notifications.Announcements, error)

SubscribeAnnouncements subscribes to the announcements channel

func (*Exchange) SubscribeBookGroup

func (e *Exchange) SubscribeBookGroup(instrument_name, interval string) (chan *notifications.BookInstrumentNameGroupDepthIntervalRepeated, error)

SubscribeBookGroup subscribes to the book.{instrument_name}.{interval} channel

func (*Exchange) SubscribeBookInterval

func (e *Exchange) SubscribeBookInterval(instrument_name, group, depth, interval string) (chan *notifications.BookInstrumentNameGroupDepthIntervalRepeated, error)

SubscribeBookInterval subscribes to the book.{instrument_name}.{group}.{depth}.{interval} channel

func (*Exchange) SubscribeDeribitPriceIndex

func (e *Exchange) SubscribeDeribitPriceIndex(index_name string) (chan *notifications.DeribitPriceIndexIndexNameRepeated, error)

SubscribeDeribitPriceIndex subscribes to the deribit_price_index.{index_name} channel

func (*Exchange) SubscribeDeribitPriceRanking

func (e *Exchange) SubscribeDeribitPriceRanking(index_name string) (chan *notifications.DeribitPriceRankingIndexNameRepeated, error)

SubscribeDeribitPriceRanking subscribes to the deribit_price_ranking.{index_name} channel

func (*Exchange) SubscribeEstimatedExpirationPrice

func (e *Exchange) SubscribeEstimatedExpirationPrice(index_name string) (chan *notifications.EstimatedExpirationPriceIndexNameRepeated, error)

SubscribeEstimatedExpirationPrice subscribes to the estimated_expiration_price.{index_name} channel

func (*Exchange) SubscribeMarkPriceOptions

func (e *Exchange) SubscribeMarkPriceOptions(index_name string) (chan *notifications.MarkpriceOptionsIndexNameRepeated, error)

SubscribeMarkPriceOptions subscribes to the markprice.options.{index_name} channel

func (*Exchange) SubscribePerpetual

func (e *Exchange) SubscribePerpetual(instrument_name, interval string) (chan *notifications.PerpetualInstrumentNameIntervalRepeated, error)

SubscribePerpetual subscribes to the perpetual.{instrument_name}.{interval} channel

func (*Exchange) SubscribeQuote

func (e *Exchange) SubscribeQuote(instrument_name string) (chan *notifications.QuoteInstrumentNameRepeated, error)

SubscribeQuote subscribes to the quote.{instrument_name} channel

func (*Exchange) SubscribeTicker

func (e *Exchange) SubscribeTicker(instrument_name, interval string) (chan *notifications.TickerInstrumentNameIntervalRepeated, error)

SubscribeTicker subscribes to the ticker.{instrument_name}.{interval} channel

func (*Exchange) SubscribeTrades

func (e *Exchange) SubscribeTrades(instrument_name, interval string) (chan *notifications.TradesInstrumentNameIntervalRepeated, error)

SubscribeTrades subscribes to the trades.{instrument_name}.{interval} channel

func (*Exchange) SubscribeUserOrdersInstrumentName

func (e *Exchange) SubscribeUserOrdersInstrumentName(instrument_name, interval string) (chan *notifications.UserOrdersInstrumentNameIntervalRepeated, error)

SubscribeUserOrdersInstrumentName subscribes to the user.orders.{instrument_name}.{interval} channel

func (*Exchange) SubscribeUserOrdersKind

func (e *Exchange) SubscribeUserOrdersKind(kind, currency, interval string) (chan *notifications.UserOrdersKindCurrencyIntervalRepeated, error)

SubscribeUserOrdersKind subscribes to the user.orders.{kind}.{currency}.{interval} channel

func (*Exchange) SubscribeUserPortfolio

func (e *Exchange) SubscribeUserPortfolio(currency string) (chan *notifications.UserPortfolioCurrencyRepeated, error)

SubscribeUserPortfolio subscribes to the user.portfolio.{currency} channel

func (*Exchange) SubscribeUserTradesInstrument

func (e *Exchange) SubscribeUserTradesInstrument(instrument_name, interval string) (chan *notifications.UserTradesInstrumentNameIntervalRepeated, error)

SubscribeUserTradesInstrument subscribes to the user.trades.{instrument_name}.{interval} channel

func (*Exchange) SubscribeUserTradesKind

func (e *Exchange) SubscribeUserTradesKind(kind, currency, interval string) (chan *notifications.UserTradesKindCurrencyIntervalRepeated, error)

SubscribeUserTradesKind subscribes to the user.trades.{kind}.{currency}.{interval} channel

type RPCCall

type RPCCall struct {
	Req   *RPCRequest
	Res   *RPCResponse
	Error error
	Done  chan bool
}

RPCCall represents the entire call from request to response

func NewRPCCall

func NewRPCCall(req *RPCRequest) *RPCCall

NewRPCCall returns a new RPCCall initialised with a done channel and request

type RPCError

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

RPCError error object

type RPCNotification

type RPCNotification struct {
	JsonRpc string `json:"jsonrpc"`
	Method  string `json:"action"`
	Params  struct {
		Data    map[string]interface{} `json:"data"`
		Channel string                 `json:"channel"`
	} `json:"params,omitempty"`
}

RPCNotification is a notification which we have subscribed to

type RPCRequest

type RPCRequest struct {
	JsonRpc string                 `json:"jsonrpc"`
	Method  string                 `json:"method"`
	ID      uint64                 `json:"id"`
	Params  map[string]interface{} `json:"params,omitempty"`
}

RPCRequest is what we send to the remote

func NewRPCRequest

func NewRPCRequest(method string) *RPCRequest

type RPCResponse

type RPCResponse struct {
	JsonRpc string                 `json:"jsonrpc"`
	ID      uint64                 `json:"id,omitempty"`
	Result  map[string]interface{} `json:"result"`
	Error   *RPCError              `json:"error,omitempty"`
}

RPCResponse is what we receive from the remote

type RPCSubscription

type RPCSubscription struct {
	Data    chan *RPCNotification
	Channel string
}

RPCSubscription is a subscription to an event type to receive notifications about

Directories

Path Synopsis
cmd
example command
gen command
models

Jump to

Keyboard shortcuts

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