Documentation ¶
Index ¶
- Variables
- func IsError(body []byte) (bool, string)
- type Account
- type AccountState
- type AccountType
- type BookEntry
- type Client
- func (client *Client) Account(accountType AccountType, accountState AccountState) (*Account, error)
- func (client *Client) Accounts() ([]Account, error)
- func (client *Client) CancelOrder(orderId int64) error
- func (client *Client) OpenOrders(symbol string) ([]Order, error)
- func (client *Client) OrderBook(symbol string) (*OrderBook, error)
- func (client *Client) PastOrders(symbol string, days int, state OrderState) ([]Order, error)
- func (client *Client) PlaceOrder(symbol string, orderType OrderType, amount, price float64, metadata string) ([]byte, error)
- func (client *Client) Summary(symbol string) (*Summary, error)
- func (client *Client) Symbols() ([]Symbol, error)
- func (client *Client) Ticker(symbol string) (*Ticker, error)
- type Order
- type OrderBook
- type OrderState
- type OrderType
- type Response
- type Summary
- type Symbol
- type Ticker
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Account ¶
type Account struct { Id int64 `json:"id"` // unique account id AccountType AccountType `json:"type"` // the type of this account (see above) State AccountState `json:"state"` // account state (see above) }
type AccountState ¶
type AccountState string
const ( AccountStateWorking AccountState = "working" AccountStateLock AccountState = "lock" )
type AccountType ¶
type AccountType string
const ( AccountTypeSpot AccountType = "spot" AccountTypeMargin AccountType = "margin" AccountTypeOTC AccountType = "otc" AccountTypePoint AccountType = "point" AccountTypeSuperMargin AccountType = "super-margin" AccountTypeInvestment AccountType = "investment" AccountTypeBorrow AccountType = "borrow" )
type Client ¶
type Client struct { URL string // contains filtered or unexported fields }
func (*Client) Account ¶
func (client *Client) Account(accountType AccountType, accountState AccountState) (*Account, error)
func (*Client) CancelOrder ¶
func (*Client) PastOrders ¶
func (*Client) PlaceOrder ¶
type Order ¶
type Order struct { Symbol string `json:"symbol"` // the trading symbol to trade, e.g. btcusdt, bccbtc Amount float64 `json:"amount,string"` Price float64 `json:"price,string"` // the limit price of limit order CreatedAt int64 `json:"created-at"` // the timestamp in milliseconds when the order was created AccountId int64 `json:"account-id"` ClientOrderId string `json:"client-order-id"` // the identity defined by the client FilledAmount float64 `json:"field-amount,string"` // the amount which has been filled FilledCashAmount float64 `json:"field-cash-amount,string"` // the filled total in quote currency FilledFees float64 `json:"field-fees,string"` // transaction fee Id int64 `json:"id"` // the unique identity for the order State OrderState `json:"state"` // order status (see above) OrderType OrderType `json:"type"` // order type (see above) }
func (*Order) GetCreatedAt ¶
type OrderState ¶
type OrderState string
const ( OrderStateCreated OrderState = "created" // The order is created, and not in the matching queue yet. OrderStateSubmitted OrderState = "submitted" // The order is submitted, and already in the matching queue, waiting for deal. OrderStatePartialFilled OrderState = "partial-filled" // The order is already in the matching queue and partially traded, and is waiting for further matching and trade. OrderStateFilled OrderState = "filled" // The order is already traded and not in the matching queue any more. OrderStatePartialCanceled OrderState = "partial-canceled" // The order is not in the matching queue any more. The status is transferred from 'partial-filled', the order is partially trade, but remaining is canceled. OrderStateCanceling OrderState = "canceling" // The order is under canceling, but haven't been removed from matching queue yet. OrderStateCanceled OrderState = "canceled" // The order is not in the matching queue any more, and completely canceled. There is no trade associated with this order. )
type OrderType ¶
type OrderType string
const ( OrderTypeBuyMarket OrderType = "buy-market" OrderTypeSellMarket OrderType = "sell-market" OrderTypeBuyLimit OrderType = "buy-limit" OrderTypeSellLimit OrderType = "sell-limit" OrderTypeBuyIOC OrderType = "buy-ioc" // IOC stands for "immediately or cancel", it means the order will be canceled if it couldn't be matched. If the order is partially traded, the remaining part will be canceled. OrderTypeSellIOC OrderType = "sell-ioc" // IOC stands for "immediately or cancel", it means the order will be canceled if it couldn't be matched. If the order is partially traded, the remaining part will be canceled. OrderTypeBuyLimitMaker OrderType = "buy-limit-maker" OrderTypeSellLimitMaker OrderType = "sell-limit-maker" OrderTypeBuyStopLimit OrderType = "buy-stop-limit" OrderTypeSellStopLimit OrderType = "sell-stop-limit" OrderTypeBuyLimitFOK OrderType = "buy-limit-fok" // FOK stands for "fill or kill", it means the order will be cancelled if it couldn't be fully matched. Even if the order can be partially filled, the entire order will be cancelled. OrderTypeSellLimitFOK OrderType = "sell-limit-fok" // FOK stands for "fill or kill", it means the order will be cancelled if it couldn't be fully matched. Even if the order can be partially filled, the entire order will be cancelled. OrderTypeBuyStopLimitFOK OrderType = "buy-stop-limit-fok" OrderTypeSellStopLimitFOK OrderType = "sell-stop-limit-fok" )
type Summary ¶
type Summary struct { Low float64 `json:"low"` // the lowest price of last 24 hours High float64 `json:"high"` // the highest price of last 24 hours Open float64 `json:"open"` // the opening price of last 24 hours Close float64 `json:"close"` // the closing price of last 24 hours Volume float64 `json:"vol"` // the trading volume in base currency of last 24 hours Amount float64 `json:"amount"` // the aggregated trading volume in USDT of last 24 hours }
type Symbol ¶
type Symbol struct { BaseCurrency string `json:"base-currency"` QuoteCurrency string `json:"quote-currency"` PricePrecision int `json:"price-precision"` // quote currency precision AmountPrecision int `json:"amount-precision"` // base currency precision Partition string `json:"symbol-partition"` Symbol string `json:"symbol"` State string `json:"state"` // "online" or "offline" or "suspended" ValuePrecision int `json:"value-precision"` // precision of value in quote currency (value = price * amount) LimitOrderMinOrderAmt float64 `json:"limit-order-min-order-amt"` // minimum order amount of limit order in base currency LimitOrderMaxOrderAmt float64 `json:"limit-order-max-order-amt"` // max order amount of limit order in base currency SellMarketMinOrderAmt float64 `json:"sell-market-min-order-amt"` // minimum order amount of sell-market order in base currency SellMarketMaxOrderAmt float64 `json:"sell-market-max-order-amt"` // max order amount of sell-market order in base currency BuyMarketMaxOrderValue float64 `json:"buy-market-max-order-value"` // max order value of buy-market order in quote currency MinOrderValue float64 `json:"min-order-value"` // minimum order value of limit order and buy-market order in quote currency ApiTrading string `json:"api-trading"` // "enabled" or "disabled" }
Click to show internal directories.
Click to hide internal directories.