Documentation ¶
Index ¶
- Variables
- type AccountsBaseResponse
- type AccountsResponse
- type AccountsResponseCoin
- type KLineResponse
- type KLineResponseData
- type KlinesRequestParams
- type MarketResponseItem
- type OrderbookResponse
- type SpotNewOrderRequestParams
- type SpotNewOrderRequestParamsType
- type SpotNewOrderResponse
- type TickerChildResponse
- type TickerResponse
- type TimeInterval
- type ZB
- func (z *ZB) CancelAllExchangeOrders() error
- func (z *ZB) CancelExchangeOrder(orderID int64) error
- func (z *ZB) CancelOrder(orderID int64, symbol string) error
- func (z *ZB) GetAccountInfo() (AccountsResponse, error)
- func (z *ZB) GetExchangeAccountInfo() (exchange.AccountInfo, error)
- func (z *ZB) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
- func (z *ZB) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error)
- func (z *ZB) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
- func (z *ZB) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error)
- func (z *ZB) GetLatestSpotPrice(symbol string) (float64, error)
- func (z *ZB) GetMarkets() (map[string]MarketResponseItem, error)
- func (z *ZB) GetOrderbook(symbol string) (OrderbookResponse, error)
- func (z *ZB) GetOrderbookEx(currency pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (z *ZB) GetSpotKline(arg KlinesRequestParams) (KLineResponse, error)
- func (z *ZB) GetTicker(symbol string) (TickerResponse, error)
- func (z *ZB) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (z *ZB) GetTickers() (map[string]TickerChildResponse, error)
- func (z *ZB) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error)
- func (z *ZB) Run()
- func (z *ZB) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, result interface{}) error
- func (z *ZB) SendHTTPRequest(path string, result interface{}) error
- func (z *ZB) SetDefaults()
- func (z *ZB) Setup(exch config.ExchangeConfig)
- func (z *ZB) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
- func (z *ZB) Start(wg *sync.WaitGroup)
- func (z *ZB) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, ...) (int64, error)
- func (z *ZB) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (z *ZB) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (z *ZB) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
- func (z *ZB) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
- func (z *ZB) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( // SpotNewOrderRequestParamsTypeBuy 买 SpotNewOrderRequestParamsTypeBuy = SpotNewOrderRequestParamsType("1") // SpotNewOrderRequestParamsTypeSell 卖 SpotNewOrderRequestParamsTypeSell = SpotNewOrderRequestParamsType("0") )
var ( TimeIntervalMinute = TimeInterval("1min") TimeIntervalThreeMinutes = TimeInterval("3min") TimeIntervalFiveMinutes = TimeInterval("5min") TimeIntervalFifteenMinutes = TimeInterval("15min") TimeIntervalThirtyMinutes = TimeInterval("30min") TimeIntervalHour = TimeInterval("1hour") TimeIntervalTwoHours = TimeInterval("2hour") TimeIntervalFourHours = TimeInterval("4hour") TimeIntervalSixHours = TimeInterval("6hour") TimeIntervalTwelveHours = TimeInterval("12hour") TimeIntervalDay = TimeInterval("1day") TimeIntervalThreeDays = TimeInterval("3day") TimeIntervalWeek = TimeInterval("1week") )
TimeInterval vars
Functions ¶
This section is empty.
Types ¶
type AccountsBaseResponse ¶
type AccountsBaseResponse struct { UserName string `json:"username"` //用户名 TradePasswordEnabled bool `json:"trade_password_enabled"` //是否开通交易密码 AuthGoogleEnabled bool `json:"auth_google_enabled"` //是否开通谷歌验证 AuthMobileEnabled bool `json:"auth_mobile_enabled"` //是否开通手机验证 }
AccountsBaseResponse holds basic account details
type AccountsResponse ¶
type AccountsResponse struct { Result struct { Coins []AccountsResponseCoin `json:"coins"` Base AccountsBaseResponse `json:"base"` } `json:"result"` //用户名 AssetPerm bool `json:"assetPerm"` //是否开通交易密码 LeverPerm bool `json:"leverPerm"` //是否开通谷歌验证 EntrustPerm bool `json:"entrustPerm"` //是否开通手机验证 MoneyPerm bool `json:"moneyPerm"` // 资产列表 }
AccountsResponse 用户基本信息
type AccountsResponseCoin ¶
type AccountsResponseCoin struct { Freez string `json:"freez"` //冻结资产 EnName string `json:"enName"` //币种英文名 UnitDecimal int `json:"unitDecimal"` //保留小数位 UnName string `json:"cnName"` //币种中文名 UnitTag string `json:"unitTag"` //币种符号 Available string `json:"available"` //可用资产 Key string `json:"key"` //币种 }
AccountsResponseCoin holds the accounts coin details
type KLineResponse ¶
type KLineResponse struct { // Data string `json:"data"` // 买入货币 MoneyType string `json:"moneyType"` // 卖出货币 Symbol string `json:"symbol"` // 内容说明 Data []*KLineResponseData `json:"data"` // KLine数据 }
KLineResponse K线返回类型
type KLineResponseData ¶
type KLineResponseData struct { ID float64 `json:"id"` // K线ID KlineTime time.Time `json:"klineTime"` Open float64 `json:"open"` // 开盘价 Close float64 `json:"close"` // 收盘价, 当K线为最晚的一根时, 时最新成交价 Low float64 `json:"low"` // 最低价 High float64 `json:"high"` // 最高价 Volume float64 `json:"vol"` // 成交量 }
KLineResponseData Kline Data
type KlinesRequestParams ¶
type KlinesRequestParams struct { Symbol string //交易对, zb_qc,zb_usdt,zb_btc... Type TimeInterval //K线类型, 1min, 3min, 15min, 30min, 1hour...... Since string //从这个时间戳之后的 Size int //返回数据的条数限制(默认为1000,如果返回数据多于1000条,那么只返回1000条) }
KlinesRequestParams represents Klines request data.
type MarketResponseItem ¶
type MarketResponseItem struct { AmountScale float64 `json:"amountScale"` PriceScale float64 `json:"priceScale"` }
MarketResponseItem stores market data
type OrderbookResponse ¶
type OrderbookResponse struct { Timestamp int64 `json:"timestamp"` Asks [][]float64 `json:"asks"` Bids [][]float64 `json:"bids"` }
OrderbookResponse holds the orderbook data for a symbol
type SpotNewOrderRequestParams ¶
type SpotNewOrderRequestParams struct { Amount float64 `json:"amount"` // 交易数量 Price float64 `json:"price"` // 下单价格, Symbol string `json:"currency"` // 交易对, btcusdt, bccbtc...... Type SpotNewOrderRequestParamsType `json:"tradeType"` // 订单类型, buy-market: 市价买, sell-market: 市价卖, buy-limit: 限价买, sell-limit: 限价卖 }
SpotNewOrderRequestParams is the params used for placing an order
type SpotNewOrderRequestParamsType ¶
type SpotNewOrderRequestParamsType string
SpotNewOrderRequestParamsType ZB 交易类型
type SpotNewOrderResponse ¶
type SpotNewOrderResponse struct { Code int `json:"code"` //返回代码 Message string `json:"message"` //提示信息 ID string `json:"id"` //委托挂单号 }
SpotNewOrderResponse stores the new order response data
type TickerChildResponse ¶
type TickerChildResponse struct { Vol float64 `json:"vol,string"` //成交量(最近的24小时) Last float64 `json:"last,string"` //最新成交价 Sell float64 `json:"sell,string"` //卖一价 Buy float64 `json:"buy,string"` //买一价 High float64 `json:"high,string"` //最高价 Low float64 `json:"low,string"` //最低价 }
TickerChildResponse holds the ticker child response data
type TickerResponse ¶
type TickerResponse struct { Date string `json:"date"` Ticker TickerChildResponse `json:"ticker"` }
TickerResponse holds the ticker response data
type ZB ¶
ZB is the overarching type across this package 47.91.169.147 api.zb.com 47.52.55.212 trade.zb.com
func (*ZB) CancelAllExchangeOrders ¶
CancelAllExchangeOrders cancels all orders associated with a currency pair
func (*ZB) CancelExchangeOrder ¶
CancelExchangeOrder cancels an order by its corresponding ID number
func (*ZB) CancelOrder ¶
CancelOrder cancels an order on Huobi
func (*ZB) GetAccountInfo ¶
func (z *ZB) GetAccountInfo() (AccountsResponse, error)
GetAccountInfo returns account information including coin information and pricing
func (*ZB) GetExchangeAccountInfo ¶
GetExchangeAccountInfo retrieves balances for all enabled currencies for the ZB exchange
func (*ZB) GetExchangeDepositAddress ¶
func (z *ZB) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
GetExchangeDepositAddress returns a deposit address for a specified currency
func (*ZB) GetExchangeFundTransferHistory ¶
GetExchangeFundTransferHistory returns funding history, deposits and withdrawals
func (*ZB) GetExchangeHistory ¶
func (z *ZB) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*ZB) GetExchangeOrderInfo ¶
GetExchangeOrderInfo returns information on a current open order
func (*ZB) GetLatestSpotPrice ¶
GetLatestSpotPrice returns latest spot price of symbol
symbol: string of currency pair 获取最新价格
func (*ZB) GetMarkets ¶
func (z *ZB) GetMarkets() (map[string]MarketResponseItem, error)
GetMarkets returns market information including pricing, symbols and each symbols decimal precision
func (*ZB) GetOrderbook ¶
func (z *ZB) GetOrderbook(symbol string) (OrderbookResponse, error)
GetOrderbook returns the orderbook for a given symbol
func (*ZB) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*ZB) GetSpotKline ¶
func (z *ZB) GetSpotKline(arg KlinesRequestParams) (KLineResponse, error)
GetSpotKline returns Kline data
func (*ZB) GetTicker ¶
func (z *ZB) GetTicker(symbol string) (TickerResponse, error)
GetTicker returns a ticker for a given symbol
func (*ZB) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*ZB) GetTickers ¶
func (z *ZB) GetTickers() (map[string]TickerChildResponse, error)
GetTickers returns ticker data for all supported symbols
func (*ZB) ModifyExchangeOrder ¶
ModifyExchangeOrder will allow of changing orderbook placement and limit to market conversion
func (*ZB) SendAuthenticatedHTTPRequest ¶
func (z *ZB) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, result interface{}) error
SendAuthenticatedHTTPRequest sends authenticated requests to the zb API
func (*ZB) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP request
func (*ZB) SetDefaults ¶
func (z *ZB) SetDefaults()
SetDefaults sets default values for the exchange
func (*ZB) SpotNewOrder ¶
func (z *ZB) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
SpotNewOrder submits an order to ZB
func (*ZB) SubmitExchangeOrder ¶
func (z *ZB) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error)
SubmitExchangeOrder submits a new order
func (*ZB) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*ZB) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*ZB) WithdrawCryptoExchangeFunds ¶
func (z *ZB) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*ZB) WithdrawFiatExchangeFunds ¶
WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*ZB) WithdrawFiatExchangeFundsToInternationalBank ¶
func (z *ZB) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted