Documentation ¶
Index ¶
- type Balance
- type Client
- func (c *Client) Balances() ([]*Balance, error)
- func (c *Client) Buy(amount float64, symbol string, price float64, typ Type) (*OrderResponse, error)
- func (c *Client) Cancel(id interface{}) (*OrderResponse, error)
- func (c *Client) Order(order *Order) (*OrderResponse, error)
- func (c *Client) RealtimeTicker(ts *TickerSubscription) (tkCh chan *Ticker, cancelFunc func() error, err error)
- func (c *Client) Sell(amount float64, symbol string, price float64, typ Type) (*OrderResponse, error)
- func (c *Client) SetCredentials(ak *Credentials)
- func (c *Client) SetHTTPRoundTripper(rt http.RoundTripper)
- func (c *Client) Status(id interface{}) (*OrderResponse, error)
- func (c *Client) Ticker(symbol string) (*Ticker, error)
- func (c *Client) VolumeInDays(symbol string) (*Volume, error)
- type Credentials
- type Order
- type OrderResponse
- type Side
- type Subscription
- type Ticker
- type TickerSubscription
- type Type
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientFromEnv ¶
func (*Client) Buy ¶
func (c *Client) Buy(amount float64, symbol string, price float64, typ Type) (*OrderResponse, error)
Buy is a convenience method to buy a currency instead of invoking Order.
func (*Client) Cancel ¶
func (c *Client) Cancel(id interface{}) (*OrderResponse, error)
func (*Client) RealtimeTicker ¶
func (c *Client) RealtimeTicker(ts *TickerSubscription) (tkCh chan *Ticker, cancelFunc func() error, err error)
func (*Client) Sell ¶
func (c *Client) Sell(amount float64, symbol string, price float64, typ Type) (*OrderResponse, error)
Sell is a convenience method to sell a currency instead of invoking Order.
func (*Client) SetCredentials ¶
func (c *Client) SetCredentials(ak *Credentials)
func (*Client) SetHTTPRoundTripper ¶
func (c *Client) SetHTTPRoundTripper(rt http.RoundTripper)
func (*Client) Status ¶
func (c *Client) Status(id interface{}) (*OrderResponse, error)
type Credentials ¶
type Order ¶
type Order struct { // Side is required, even in the zero value. Side Side `json:"side,omitempty"` Type Type `json:"type,omitempty"` // Symbol is required, even in the zero value. Symbol string `json:"symbol,omitempty"` // Price is required, even in the zero value. Price float64 `json:"price,string"` // Amount is required, even in the zero value. Amount float64 `json:"amount,string,omitempty"` // Hidden if set, means that the order should be hidden. Hidden bool `json:"is_hidden,omitempty"` // PostOnly is only relevant for limit orders. PostOnly bool `json:"is_postonly,omitempty"` // UseAllAvailable if set will post an order // that will use all of your available balance. UseAllAvailable otils.NumericBool `json:"use_all_available,omitempty"` // OCOOrder sets an additional STOP OCO order // that will be linked with the current order. // OCOOrder is optional but its serialized form // must be sent even with the zero value. OCOOrder bool `json:"ocoorder"` // BuyPriceOCO represents the price of the OCO // stop order to place iff OCOOrder is set. // BuyPriceOCO is optional but its serialized form // must be sent even with the zero value. BuyPriceOCO float64 `json:"buy_price_oco"` // SellPriceOCO represents the price of the OCO // stop order to place if OCOOrder is set. // SellPriceOCO is optional but its serialized form // must be sent even with the zero value. SellPriceOCO float64 `json:"sell_price_oco"` }
type OrderResponse ¶
type OrderResponse struct { ID uint64 `json:"id,omitempty"` Symbol string `json:"symbol,omitempty"` Exchange string `json:"exchange,omitempty"` Price float64 `json:"price,string,omitempty"` AverageExecutionPrice float64 `json:"avg_execution_price,string,omitempty"` Side Side `json:"side,omitempty"` Type string `json:"type,omitempty"` TimestampMs float64 `json:"timestamp,string,omitempty"` Live bool `json:"is_live,omitempty"` Cancelled bool `json:"is_cancelled,omitempty"` Hidden bool `json:"is_hidden,omitempty"` WasForced bool `json:"was_forced,omitempty"` OriginalAmount float64 `json:"original_amount,string,omitempty"` RemainingAmount float64 `json:"remaining_amount,string,omitempty"` ExecutedAmount float64 `json:"executed_amount,string,omitempty"` OrderID uint64 `json:"order_id,omitempty"` // OCOOrderID will be set if the order is // an OCO order, otherwise it will be null. OCOOrderID interface{} `json:"oco_order,omitempty"` }
type Subscription ¶
type TickerSubscription ¶
type TickerSubscription struct {
Symbols []string `json:"symbols"`
}
type Type ¶
type Type string
const ( ExchangeLimit Type = "exchange limit" ExchangeMarket Type = "exchange market" Market Type = "market" Limit Type = "limit" Stop Type = "stop" TrailingStop Type = "trailing-stop" FillOrKill Type = "fill-or-kill" ExchangeTrailingStop Type = "exchange trailing-stop" ExchangeFillOrKill Type = "exchange fill-or-kill" )
Click to show internal directories.
Click to hide internal directories.