Documentation ¶
Index ¶
- Variables
- type Exchange
- func (e *Exchange) Authenticate(key, secret string) error
- func (e *Exchange) Client() *operations.Client
- func (e *Exchange) Close() error
- func (e *Exchange) Connect() error
- func (e *Exchange) Submit(operation *runtime.ClientOperation) (interface{}, error)
- func (e *Exchange) SubscribeAnnouncements(instrument_name, interval string) (chan *models.AnnouncementNotification, error)
- func (e *Exchange) SubscribeBookGroup(instrument_name, group, depth, interval string) (chan *models.BookNotification, error)
- func (e *Exchange) SubscribeBookInterval(instrument_name, interval string) (chan *models.BookNotificationRaw, error)
- func (e *Exchange) SubscribeDeribitPriceIndex(index_name string) (chan *models.DeribitPriceIndexNotification, error)
- func (e *Exchange) SubscribeDeribitPriceRanking(index_name string) (chan *models.DeribitPriceRankingNotification, error)
- func (e *Exchange) SubscribeEstimatedExpirationPrice(index_name string) (chan *models.EstimatedExpirationPriceNotification, error)
- func (e *Exchange) SubscribeMarkPriceOptions(index_name string) (chan *models.MarkpriceOptionsNotification, error)
- func (e *Exchange) SubscribePerpetual(instrument_name, interval string) (chan *models.PerpetualNotification, error)
- func (e *Exchange) SubscribeQuote(instrument_name string) (chan *models.QuoteNotification, error)
- func (e *Exchange) SubscribeTicker(instrument_name, interval string) (chan *models.TickerNotification, error)
- func (e *Exchange) SubscribeTrades(instrument_name, interval string) (chan *models.PublicTrade, error)
- func (e *Exchange) SubscribeUserOrdersInstrumentName(instrument_name, interval string) (chan *models.Order, error)
- func (e *Exchange) SubscribeUserOrdersKind(kind, currency, interval string) (chan *models.Order, error)
- func (e *Exchange) SubscribeUserPortfolio(currency string) (chan *models.UserPortfolioNotification, error)
- func (e *Exchange) SubscribeUserTradesInstrument(instrument_name, interval string) (chan *models.UserTrade, error)
- func (e *Exchange) SubscribeUserTradesKind(kind, currency, interval string) (chan *models.UserTrade, error)
- type RPCCall
- type RPCError
- type RPCNotification
- type RPCRequest
- func (RPCRequest) GetBody() []byte
- func (RPCRequest) GetBodyParam() interface{}
- func (RPCRequest) GetFileParam() map[string][]runtime.NamedReadCloser
- func (RPCRequest) GetHeaderParams() http.Header
- func (RPCRequest) GetMethod() string
- func (r *RPCRequest) GetPath() string
- func (RPCRequest) GetQueryParams() url.Values
- func (RPCRequest) SetBodyParam(interface{}) error
- func (RPCRequest) SetFileParam(string, ...runtime.NamedReadCloser) error
- func (RPCRequest) SetFormParam(string, ...string) error
- func (RPCRequest) SetHeaderParam(string, ...string) error
- func (RPCRequest) SetPathParam(string, string) error
- func (r *RPCRequest) SetQueryParam(key string, vals ...string) error
- func (RPCRequest) SetTimeout(time.Duration) error
- type RPCResponse
- type RPCSubscription
Constants ¶
This section is empty.
Variables ¶
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 { OnDisconnect func(*Exchange) // triggers on a failed read from connection // contains filtered or unexported fields }
Exchange is an API wrapper with the exchange
func NewExchange ¶
NewExchange creates a new API wrapper key and secret can be ignored if you are only calling public endpoints
func (*Exchange) Authenticate ¶
func (*Exchange) Client ¶
func (e *Exchange) Client() *operations.Client
Client returns an initialised API client
func (*Exchange) Submit ¶
func (e *Exchange) Submit(operation *runtime.ClientOperation) (interface{}, error)
Submit satisfies the runtime.ClientTransport interface
func (*Exchange) SubscribeAnnouncements ¶
func (e *Exchange) SubscribeAnnouncements(instrument_name, interval string) (chan *models.AnnouncementNotification, error)
SubscribeAnnouncements subscribes to the announcements channel
func (*Exchange) SubscribeBookGroup ¶
func (e *Exchange) SubscribeBookGroup(instrument_name, group, depth, interval string) (chan *models.BookNotification, error)
SubscribeBookGroup subscribes to the book.{instrument_name}.{group}.{depth}.{interval} channel
func (*Exchange) SubscribeBookInterval ¶
func (e *Exchange) SubscribeBookInterval(instrument_name, interval string) (chan *models.BookNotificationRaw, error)
SubscribeBookInterval subscribes to the book.{instrument_name}.{interval} channel
func (*Exchange) SubscribeDeribitPriceIndex ¶
func (e *Exchange) SubscribeDeribitPriceIndex(index_name string) (chan *models.DeribitPriceIndexNotification, error)
SubscribeDeribitPriceIndex subscribes to the deribit_price_index.{index_name} channel
func (*Exchange) SubscribeDeribitPriceRanking ¶
func (e *Exchange) SubscribeDeribitPriceRanking(index_name string) (chan *models.DeribitPriceRankingNotification, error)
SubscribeDeribitPriceRanking subscribes to the deribit_price_ranking.{index_name} channel
func (*Exchange) SubscribeEstimatedExpirationPrice ¶
func (e *Exchange) SubscribeEstimatedExpirationPrice(index_name string) (chan *models.EstimatedExpirationPriceNotification, error)
SubscribeEstimatedExpirationPrice subscribes to the estimated_expiration_price.{index_name} channel
func (*Exchange) SubscribeMarkPriceOptions ¶
func (e *Exchange) SubscribeMarkPriceOptions(index_name string) (chan *models.MarkpriceOptionsNotification, error)
SubscribeMarkPriceOptions subscribes to the markprice.options.{index_name} channel
func (*Exchange) SubscribePerpetual ¶
func (e *Exchange) SubscribePerpetual(instrument_name, interval string) (chan *models.PerpetualNotification, error)
SubscribePerpetual subscribes to the perpetual.{instrument_name}.{interval} channel
func (*Exchange) SubscribeQuote ¶
func (e *Exchange) SubscribeQuote(instrument_name string) (chan *models.QuoteNotification, error)
SubscribeQuote subscribes to the quote.{instrument_name} channel
func (*Exchange) SubscribeTicker ¶
func (e *Exchange) SubscribeTicker(instrument_name, interval string) (chan *models.TickerNotification, error)
SubscribeTicker subscribes to the ticker.{instrument_name}.{interval} channel
func (*Exchange) SubscribeTrades ¶
func (e *Exchange) SubscribeTrades(instrument_name, interval string) (chan *models.PublicTrade, error)
SubscribeTrades subscribes to the trades.{instrument_name}.{interval} channel
func (*Exchange) SubscribeUserOrdersInstrumentName ¶
func (e *Exchange) SubscribeUserOrdersInstrumentName(instrument_name, interval string) (chan *models.Order, error)
SubscribeUserOrdersInstrumentName subscribes to the user.orders.{instrument_name}.{interval} channel
func (*Exchange) SubscribeUserOrdersKind ¶
func (e *Exchange) SubscribeUserOrdersKind(kind, currency, interval string) (chan *models.Order, error)
SubscribeUserOrdersKind subscribes to the user.orders.{kind}.{currency}.{interval} channel
func (*Exchange) SubscribeUserPortfolio ¶
func (e *Exchange) SubscribeUserPortfolio(currency string) (chan *models.UserPortfolioNotification, error)
SubscribeUserPortfolio subscribes to the user.portfolio.{currency} 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 RPCNotification ¶
type RPCNotification struct { JsonRpc string Method string `json:"method"` Params struct { Data json.RawMessage `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 Implements runtime.ClientRequest
func NewRPCRequest ¶
func NewRPCRequest(method string) *RPCRequest
func (RPCRequest) GetBody ¶
func (RPCRequest) GetBody() []byte
func (RPCRequest) GetBodyParam ¶
func (RPCRequest) GetBodyParam() interface{}
func (RPCRequest) GetFileParam ¶
func (RPCRequest) GetFileParam() map[string][]runtime.NamedReadCloser
func (RPCRequest) GetHeaderParams ¶
func (RPCRequest) GetHeaderParams() http.Header
func (RPCRequest) GetMethod ¶
func (RPCRequest) GetMethod() string
func (*RPCRequest) GetPath ¶
func (r *RPCRequest) GetPath() string
func (RPCRequest) GetQueryParams ¶
func (RPCRequest) GetQueryParams() url.Values
func (RPCRequest) SetBodyParam ¶
func (RPCRequest) SetBodyParam(interface{}) error
func (RPCRequest) SetFileParam ¶
func (RPCRequest) SetFileParam(string, ...runtime.NamedReadCloser) error
func (RPCRequest) SetFormParam ¶
func (RPCRequest) SetFormParam(string, ...string) error
func (RPCRequest) SetHeaderParam ¶
func (RPCRequest) SetHeaderParam(string, ...string) error
func (RPCRequest) SetPathParam ¶
func (RPCRequest) SetPathParam(string, string) error
func (*RPCRequest) SetQueryParam ¶
func (r *RPCRequest) SetQueryParam(key string, vals ...string) error
func (RPCRequest) SetTimeout ¶
func (RPCRequest) SetTimeout(time.Duration) error
type RPCResponse ¶
type RPCResponse struct { JsonRpc string `json:"jsonrpc"` ID uint64 `json:"id,omitempty"` Result json.RawMessage `json:"result"` Error *RPCError `json:"error,omitempty"` }
RPCResponse is what we receive from the remote Implements runtime.ClientResponse
func (*RPCResponse) Body ¶
func (r *RPCResponse) Body() io.ReadCloser
func (*RPCResponse) Code ¶
func (r *RPCResponse) Code() int
func (RPCResponse) GetHeader ¶
func (RPCResponse) GetHeader(string) string
func (*RPCResponse) Message ¶
func (r *RPCResponse) Message() string
type RPCSubscription ¶
type RPCSubscription struct { Data chan *RPCNotification Channel string }
RPCSubscription is a subscription to an event type to receive notifications about