Documentation
¶
Index ¶
- Variables
- type AccountsBaseResponse
- type AccountsResponse
- type AccountsResponseCoin
- type Generic
- type KLineResponse
- type KLineResponseData
- type KlinesRequestParams
- type MarketResponseItem
- type Markets
- type MultiChainDepositAddress
- type MultiChainDepositAddressResponse
- type Order
- type OrderbookResponse
- type RateLimit
- type SpotNewOrderRequestParams
- type SpotNewOrderRequestParamsType
- type SpotNewOrderResponse
- type Subscription
- type TickerChildResponse
- type TickerResponse
- type TradeHistory
- type UserAddress
- type WsAddSubUserRequest
- type WsAuthenticatedRequest
- type WsCancelOrderRequest
- type WsCancelOrderResponse
- type WsCreateSubUserKeyRequest
- type WsDepth
- type WsDoTransferFundsRequest
- type WsGetAccountInfoResponse
- type WsGetOrderRequest
- type WsGetOrderResponse
- type WsGetOrdersIgnoreTradeTypeRequest
- type WsGetOrdersIgnoreTradeTypeResponse
- type WsGetOrdersRequest
- type WsGetOrdersResponse
- type WsGetSubUserListResponse
- type WsGetSubUserListResponseData
- type WsRequestResponse
- type WsSubmitOrderRequest
- type WsSubmitOrderResponse
- type WsTicker
- type WsTrades
- type ZB
- func (z *ZB) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
- func (z *ZB) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)
- func (z *ZB) CancelExistingOrder(ctx context.Context, orderID int64, symbol string) error
- func (z *ZB) CancelOrder(ctx context.Context, o *order.Cancel) error
- func (z *ZB) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (z *ZB) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (z *ZB) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (z *ZB) FetchTradablePairs(ctx context.Context, asset asset.Item) ([]string, error)
- func (z *ZB) FormatExchangeKlineInterval(in kline.Interval) string
- func (z *ZB) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
- func (z *ZB) GetAccountInformation(ctx context.Context) (AccountsResponse, error)
- func (z *ZB) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (z *ZB) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
- func (z *ZB) GetCryptoAddress(ctx context.Context, currency currency.Code) (*UserAddress, error)
- func (z *ZB) GetDefaultConfig() (*config.Exchange, error)
- func (z *ZB) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)
- func (z *ZB) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (z *ZB) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (z *ZB) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)
- func (z *ZB) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (z *ZB) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (z *ZB) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
- func (z *ZB) GetLatestSpotPrice(ctx context.Context, symbol string) (float64, error)
- func (z *ZB) GetMarkets(ctx context.Context) (map[string]MarketResponseItem, error)
- func (z *ZB) GetMultiChainDepositAddress(ctx context.Context, currency currency.Code) ([]MultiChainDepositAddress, error)
- func (z *ZB) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (z *ZB) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)
- func (z *ZB) GetOrderbook(ctx context.Context, symbol string) (OrderbookResponse, error)
- func (z *ZB) GetOrders(ctx context.Context, currency string, pageindex, side int64) ([]Order, error)
- func (z *ZB) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
- func (z *ZB) GetSpotKline(ctx context.Context, arg KlinesRequestParams) (KLineResponse, error)
- func (z *ZB) GetTicker(ctx context.Context, symbol string) (TickerResponse, error)
- func (z *ZB) GetTickers(ctx context.Context) (map[string]TickerChildResponse, error)
- func (z *ZB) GetTrades(ctx context.Context, symbol string) (TradeHistory, error)
- func (z *ZB) GetUnfinishedOrdersIgnoreTradeType(ctx context.Context, currency string, pageindex, pagesize int64) ([]Order, error)
- func (z *ZB) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
- func (z *ZB) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)
- func (z *ZB) Run()
- func (z *ZB) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, httpMethod string, params url.Values, ...) error
- func (z *ZB) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}, ...) error
- func (z *ZB) SetDefaults()
- func (z *ZB) Setup(exch *config.Exchange) error
- func (z *ZB) SpotNewOrder(ctx context.Context, arg SpotNewOrderRequestParams) (int64, error)
- func (z *ZB) Start(wg *sync.WaitGroup) error
- func (z *ZB) SubmitOrder(ctx context.Context, o *order.Submit) (order.SubmitResponse, error)
- func (z *ZB) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
- func (z *ZB) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (z *ZB) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (z *ZB) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
- func (z *ZB) UpdateTickers(ctx context.Context, a asset.Item) error
- func (z *ZB) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
- func (z *ZB) ValidateCredentials(ctx context.Context, assetType asset.Item) error
- func (z *ZB) Withdraw(ctx context.Context, currency, address, safepassword string, ...) (string, error)
- func (z *ZB) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (z *ZB) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (z *ZB) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (z *ZB) WsConnect() error
Constants ¶
This section is empty.
Variables ¶
var ( // SpotNewOrderRequestParamsTypeBuy 买 SpotNewOrderRequestParamsTypeBuy = SpotNewOrderRequestParamsType("1") // SpotNewOrderRequestParamsTypeSell 卖 SpotNewOrderRequestParamsTypeSell = SpotNewOrderRequestParamsType("0") )
var WithdrawalFees = map[currency.Code]float64{ currency.ZB: 5, currency.BTC: 0.001, currency.BCH: 0.0006, currency.LTC: 0.005, currency.ETH: 0.01, currency.ETC: 0.01, currency.BTS: 3, currency.EOS: 0.1, currency.QTUM: 0.01, currency.HC: 0.001, currency.XRP: 0.1, currency.QC: 5, currency.DASH: 0.002, currency.BCD: 0, currency.UBTC: 0.001, currency.SBTC: 0, currency.INK: 60, currency.BTH: 0.01, currency.LBTC: 0.01, currency.CHAT: 20, currency.BITCNY: 20, currency.HLC: 100, currency.BTP: 0.001, currency.TOPC: 200, currency.ENT: 50, currency.BAT: 40, currency.FIRST: 30, currency.SAFE: 0.001, currency.QUN: 200, currency.BTN: 0.005, currency.TRUE: 5, currency.CDC: 1, currency.DDM: 1, currency.HOTC: 150, currency.USDT: 5, currency.XUC: 1, currency.EPC: 40, currency.BDS: 3, currency.GRAM: 5, currency.DOGE: 20, currency.NEO: 0, currency.OMG: 0.5, currency.BTM: 4, currency.SNT: 60, currency.AE: 3, currency.ICX: 3, currency.ZRX: 10, currency.EDO: 4, currency.FUN: 250, currency.MANA: 70, currency.RCN: 70, currency.MCO: 0.6, currency.MITH: 10, currency.KNC: 5, currency.XLM: 0.1, currency.GNT: 20, currency.MTL: 3, currency.SUB: 20, currency.XEM: 4, currency.EOSDAC: 0, currency.KAN: 350, currency.AAA: 1, currency.XWC: 1, currency.PDX: 1, currency.SLT: 100, currency.ADA: 1, currency.HPY: 100, currency.PAX: 5, currency.XTZ: 0.1, }
WithdrawalFees the large list of predefined withdrawal fees Prone to change, using highest value
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 {
Freeze 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 Generic ¶
type Generic struct {
Code int64 `json:"code"`
Channel string `json:"channel"`
Message interface{} `json:"message"`
No int64 `json:"no,string,omitempty"`
Data json.RawMessage `json:"data"`
}
Generic defines a generic fields associated with many return types
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 {
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 string // K线类型, 1min, 3min, 15min, 30min, 1hour......
Since int64 // 从这个时间戳之后的
Size int64 // 返回数据的条数限制(默认为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 Markets ¶
type Markets map[string]struct { AmountScale int64 `json:"amountScale"` PriceScale int64 `json:"priceScale"` }
Markets defines market data
type MultiChainDepositAddress ¶
type MultiChainDepositAddress struct {
Blockchain string `json:"blockChain"`
IsUseMemo bool `json:"isUseMemo"`
Account string `json:"account"`
Address string `json:"address"`
Memo string `json:"memo"`
CanDeposit bool `json:"canDeposit"`
CanWithdraw bool `json:"canWithdraw"`
}
MultiChainDepositAddress stores an individual multichain deposit item
type MultiChainDepositAddressResponse ¶
type MultiChainDepositAddressResponse struct {
Code int64 `json:"code"`
Message struct {
Description string `json:"des"`
IsSuccessful bool `json:"isSuc"`
Data []MultiChainDepositAddress `json:"datas"`
} `json:"message"`
}
MultiChainDepositAddressResponse stores the multichain deposit address response
type Order ¶
type Order struct {
Currency string `json:"currency"`
ID int64 `json:"id,string"`
Price float64 `json:"price"`
Status int `json:"status"`
TotalAmount float64 `json:"total_amount"`
TradeAmount float64 `json:"trade_amount"`
TradeDate int `json:"trade_date"`
TradeMoney float64 `json:"trade_money"`
Type int64 `json:"type"`
Fees float64 `json:"fees,omitempty"`
TradePrice float64 `json:"trade_price,omitempty"`
No int64 `json:"no,string,omitempty"`
}
Order is the order details for retrieving all orders
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 RateLimit ¶
RateLimit implements the request.Limiter interface
func SetRateLimit ¶
func SetRateLimit() *RateLimit
SetRateLimit returns the rate limit for the exchange
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 Subscription ¶
type Subscription struct {
Event string `json:"event"`
Channel string `json:"channel"`
No int64 `json:"no,string,omitempty"`
}
Subscription defines an initial subscription type to be sent
type TickerChildResponse ¶
type TickerChildResponse struct {
Volume 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 TradeHistory ¶
type TradeHistory []struct {
Amount float64 `json:"amount,string"`
Date int64 `json:"date"`
Price float64 `json:"price,string"`
Tid int64 `json:"tid"`
TradeType string `json:"trade_type"`
Type string `json:"type"`
}
TradeHistory defines a slice of historic trades
type UserAddress ¶
type UserAddress struct {
Code int64 `json:"code"`
Message struct {
Description string `json:"des"`
IsSuccessful bool `json:"isSuc"`
Data struct {
Address string `json:"key"`
Tag string // custom field we populate
} `json:"datas"`
} `json:"message"`
}
UserAddress defines Users Address for depositing funds
type WsAddSubUserRequest ¶
type WsAddSubUserRequest struct {
Accesskey string `json:"accesskey"`
Channel string `json:"channel"`
Event string `json:"event"`
Memo string `json:"memo"`
Password string `json:"password"`
SubUserName string `json:"subUserName"`
No int64 `json:"no,string,omitempty"`
Sign string `json:"sign,omitempty"`
}
WsAddSubUserRequest data to add sub users
type WsAuthenticatedRequest ¶
type WsAuthenticatedRequest struct {
Accesskey string `json:"accesskey"`
Channel string `json:"channel"`
Event string `json:"event"`
No int64 `json:"no,string,omitempty"`
Sign string `json:"sign,omitempty"`
}
WsAuthenticatedRequest base request type
type WsCancelOrderRequest ¶
type WsCancelOrderRequest struct {
Accesskey string `json:"accesskey"`
Channel string `json:"channel"`
Event string `json:"event"`
ID int64 `json:"id"`
Sign string `json:"sign,omitempty"`
No int64 `json:"no,string"`
}
WsCancelOrderRequest order cancel request
type WsCancelOrderResponse ¶
type WsCancelOrderResponse struct {
Message string `json:"message"`
No int64 `json:"no,string"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Success bool `json:"success"`
}
WsCancelOrderResponse order cancel response
type WsCreateSubUserKeyRequest ¶
type WsCreateSubUserKeyRequest struct {
Accesskey string `json:"accesskey"`
AssetPerm bool `json:"assetPerm,string"`
Channel string `json:"channel"`
EntrustPerm bool `json:"entrustPerm,string"`
Event string `json:"event"`
KeyName string `json:"keyName"`
LeverPerm bool `json:"leverPerm,string"`
MoneyPerm bool `json:"moneyPerm,string"`
No int64 `json:"no,string,omitempty"`
Sign string `json:"sign,omitempty"`
ToUserID string `json:"toUserId"`
}
WsCreateSubUserKeyRequest data to add sub user keys
type WsDepth ¶
type WsDepth struct {
Timestamp int64 `json:"timestamp"`
Asks [][]interface{} `json:"asks"`
Bids [][]interface{} `json:"bids"`
}
WsDepth defines websocket orderbook data
type WsDoTransferFundsRequest ¶
type WsDoTransferFundsRequest struct {
Accesskey string `json:"accesskey"`
Amount float64 `json:"amount,string"`
Channel string `json:"channel"`
Currency currency.Code `json:"currency"`
Event string `json:"event"`
FromUserName string `json:"fromUserName"`
No int64 `json:"no,string"`
Sign string `json:"sign,omitempty"`
ToUserName string `json:"toUserName"`
}
WsDoTransferFundsRequest data to transfer funds
type WsGetAccountInfoResponse ¶
type WsGetAccountInfoResponse struct {
Message string `json:"message"`
No int64 `json:"no,string"`
Data struct {
Coins []AccountsResponseCoin `json:"coins"`
Base AccountsBaseResponse `json:"base"`
} `json:"data"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Success bool `json:"success"`
}
WsGetAccountInfoResponse contains account data
type WsGetOrderRequest ¶
type WsGetOrderRequest struct {
Accesskey string `json:"accesskey"`
Channel string `json:"channel"`
Event string `json:"event"`
ID int64 `json:"id"`
Sign string `json:"sign,omitempty"`
No int64 `json:"no,string"`
}
WsGetOrderRequest Get specific order details
type WsGetOrderResponse ¶
type WsGetOrderResponse struct {
Message string `json:"message"`
No int64 `json:"no,string"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Success bool `json:"success"`
Data []Order `json:"data"`
}
WsGetOrderResponse contains order data
type WsGetOrdersIgnoreTradeTypeRequest ¶
type WsGetOrdersIgnoreTradeTypeRequest struct {
Accesskey string `json:"accesskey"`
Channel string `json:"channel"`
Event string `json:"event"`
No int64 `json:"no,string"`
PageIndex int64 `json:"pageIndex"`
PageSize int64 `json:"pageSize"`
Sign string `json:"sign,omitempty"`
}
WsGetOrdersIgnoreTradeTypeRequest ws request
type WsGetOrdersIgnoreTradeTypeResponse ¶
type WsGetOrdersIgnoreTradeTypeResponse struct {
Message string `json:"message"`
No int64 `json:"no,string"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Success bool `json:"success"`
Data []Order `json:"data"`
}
WsGetOrdersIgnoreTradeTypeResponse contains orders data
type WsGetOrdersRequest ¶
type WsGetOrdersRequest struct {
Accesskey string `json:"accesskey"`
Channel string `json:"channel"`
Event string `json:"event"`
No int64 `json:"no,string"`
PageIndex int64 `json:"pageIndex"`
TradeType int64 `json:"tradeType"`
Sign string `json:"sign,omitempty"`
}
WsGetOrdersRequest get more orders, with no orderID filtering
type WsGetOrdersResponse ¶
type WsGetOrdersResponse struct {
Message string `json:"message"`
No int64 `json:"no,string"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Success bool `json:"success"`
Data []Order `json:"data"`
}
WsGetOrdersResponse contains orders data
type WsGetSubUserListResponse ¶
type WsGetSubUserListResponse struct {
Success bool `json:"success"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Message []WsGetSubUserListResponseData `json:"message"`
No int64 `json:"no,string"`
}
WsGetSubUserListResponse data response from GetSubUserList
type WsGetSubUserListResponseData ¶
type WsGetSubUserListResponseData struct {
IsOpenAPI bool `json:"isOpenApi,omitempty"`
Memo string `json:"memo,omitempty"`
UserName string `json:"userName,omitempty"`
UserID int64 `json:"userId,omitempty"`
IsFreez bool `json:"isFreez,omitempty"`
}
WsGetSubUserListResponseData user data
type WsRequestResponse ¶
type WsRequestResponse struct {
Success bool `json:"success"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Message interface{} `json:"message"`
No int64 `json:"no,string"`
}
WsRequestResponse generic response data
type WsSubmitOrderRequest ¶
type WsSubmitOrderRequest struct {
Accesskey string `json:"accesskey"`
Amount float64 `json:"amount,string"`
Channel string `json:"channel"`
Event string `json:"event"`
No int64 `json:"no,string,omitempty"`
Price float64 `json:"price,string"`
Sign string `json:"sign,omitempty"`
TradeType int64 `json:"tradeType,string"`
}
WsSubmitOrderRequest creates an order via ws
type WsSubmitOrderResponse ¶
type WsSubmitOrderResponse struct {
Message string `json:"message"`
No int64 `json:"no,string"`
Data struct {
EntrustID int64 `json:"intrustID"`
} `json:"data"`
Code int64 `json:"code"`
Channel string `json:"channel"`
Success bool `json:"success"`
}
WsSubmitOrderResponse data about submitted order
type WsTicker ¶
type WsTicker struct {
Date int64 `json:"date,string"`
Data struct {
Volume24Hr float64 `json:"vol,string"`
High float64 `json:"high,string"`
Low float64 `json:"low,string"`
Last float64 `json:"last,string"`
Buy float64 `json:"buy,string"`
Sell float64 `json:"sell,string"`
} `json:"ticker"`
}
WsTicker defines websocket ticker data
type WsTrades ¶
type WsTrades struct {
Data []struct {
Amount float64 `json:"amount,string"`
Price float64 `json:"price,string"`
TID int64 `json:"tid"`
Date int64 `json:"date"`
Type string `json:"type"`
TradeType string `json:"trade_type"`
} `json:"data"`
}
WsTrades defines websocket trade 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) CancelAllOrders ¶
CancelAllOrders cancels all orders associated with a currency pair
func (*ZB) CancelBatchOrders ¶
func (z *ZB) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)
CancelBatchOrders cancels an orders by their corresponding ID numbers
func (*ZB) CancelExistingOrder ¶
CancelExistingOrder cancels an order
func (*ZB) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
func (*ZB) FetchAccountInfo ¶
FetchAccountInfo retrieves balances for all enabled currencies
func (*ZB) FetchOrderbook ¶
func (z *ZB) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
FetchOrderbook returns orderbook base on the currency pair
func (*ZB) FetchTicker ¶
func (z *ZB) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
FetchTicker returns the ticker for a currency pair
func (*ZB) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*ZB) FormatExchangeKlineInterval ¶
FormatExchangeKlineInterval returns Interval to exchange formatted string
func (*ZB) GenerateDefaultSubscriptions ¶
func (z *ZB) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*ZB) GetAccountInformation ¶
func (z *ZB) GetAccountInformation(ctx context.Context) (AccountsResponse, error)
GetAccountInformation returns account information including coin information and pricing
func (*ZB) GetActiveOrders ¶
func (z *ZB) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
GetActiveOrders retrieves any orders that are active/open This function is not concurrency safe due to orderSide/orderType maps
func (*ZB) GetAvailableTransferChains ¶
func (z *ZB) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)
GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency
func (*ZB) GetCryptoAddress ¶
GetCryptoAddress fetches and returns the deposit address NOTE - PLEASE BE AWARE THAT YOU NEED TO GENERATE A DEPOSIT ADDRESS VIA LOGGING IN AND NOT BY USING THIS ENDPOINT OTHERWISE THIS WILL GIVE YOU A GENERAL ERROR RESPONSE.
func (*ZB) GetDefaultConfig ¶
GetDefaultConfig returns a default exchange config
func (*ZB) GetDepositAddress ¶
func (z *ZB) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, chain string) (*deposit.Address, error)
GetDepositAddress returns a deposit address for a specified currency
func (*ZB) GetFee ¶
func (z *ZB) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*ZB) GetFeeByType ¶
GetFeeByType returns an estimate of fee based on type of transaction
func (*ZB) GetFundingHistory ¶
GetFundingHistory returns funding history, deposits and withdrawals
func (*ZB) GetHistoricCandles ¶
func (z *ZB) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*ZB) GetHistoricCandlesExtended ¶
func (z *ZB) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (*ZB) GetHistoricTrades ¶
func (z *ZB) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
GetHistoricTrades returns historic trade data within the timeframe provided
func (*ZB) GetLatestSpotPrice ¶
GetLatestSpotPrice returns latest spot price of symbol
symbol: string of currency pair 获取最新价格
func (*ZB) GetMarkets ¶
GetMarkets returns market information including pricing, symbols and each symbols decimal precision
func (*ZB) GetMultiChainDepositAddress ¶
func (z *ZB) GetMultiChainDepositAddress(ctx context.Context, currency currency.Code) ([]MultiChainDepositAddress, error)
GetMultiChainDepositAddress returns deposit addresses for a given currency
func (*ZB) GetOrderHistory ¶
func (z *ZB) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status This function is not concurrency safe due to orderSide/orderType maps
func (*ZB) GetOrderInfo ¶
func (z *ZB) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)
GetOrderInfo returns order information based on order ID
func (*ZB) GetOrderbook ¶
GetOrderbook returns the orderbook for a given symbol
func (*ZB) GetOrders ¶
func (z *ZB) GetOrders(ctx context.Context, currency string, pageindex, side int64) ([]Order, error)
GetOrders returns finished orders
func (*ZB) GetRecentTrades ¶
func (z *ZB) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
GetRecentTrades returns the most recent trades for a currency and asset
func (*ZB) GetSpotKline ¶
func (z *ZB) GetSpotKline(ctx context.Context, arg KlinesRequestParams) (KLineResponse, error)
GetSpotKline returns Kline data
func (*ZB) GetTickers ¶
GetTickers returns ticker data for all supported symbols
func (*ZB) GetUnfinishedOrdersIgnoreTradeType ¶
func (z *ZB) GetUnfinishedOrdersIgnoreTradeType(ctx context.Context, currency string, pageindex, pagesize int64) ([]Order, error)
GetUnfinishedOrdersIgnoreTradeType returns unfinished orders
func (*ZB) GetWithdrawalsHistory ¶
func (z *ZB) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)
GetWithdrawalsHistory returns previous withdrawals data
func (*ZB) ModifyOrder ¶
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*ZB) SendAuthenticatedHTTPRequest ¶
func (z *ZB) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, httpMethod string, params url.Values, result interface{}, f request.EndpointLimit) error
SendAuthenticatedHTTPRequest sends authenticated requests to the zb API
func (*ZB) SendHTTPRequest ¶
func (z *ZB) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}, f request.EndpointLimit) error
SendHTTPRequest sends an unauthenticated HTTP request
func (*ZB) SetDefaults ¶
func (z *ZB) SetDefaults()
SetDefaults sets default values for the exchange
func (*ZB) SpotNewOrder ¶
SpotNewOrder submits an order to ZB
func (*ZB) SubmitOrder ¶
SubmitOrder submits a new order
func (*ZB) Subscribe ¶
func (z *ZB) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*ZB) UpdateAccountInfo ¶
UpdateAccountInfo retrieves balances for all enabled currencies for the ZB exchange
func (*ZB) UpdateOrderbook ¶
func (z *ZB) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*ZB) UpdateTicker ¶
func (z *ZB) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
UpdateTicker updates and returns the ticker for a currency pair
func (*ZB) UpdateTickers ¶
UpdateTickers updates the ticker for all currency pairs of a given asset type
func (*ZB) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*ZB) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*ZB) Withdraw ¶
func (z *ZB) Withdraw(ctx context.Context, currency, address, safepassword string, amount, fees float64, itransfer bool) (string, error)
Withdraw transfers funds
func (*ZB) WithdrawCryptocurrencyFunds ¶
func (z *ZB) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*ZB) WithdrawFiatFunds ¶
func (z *ZB) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*ZB) WithdrawFiatFundsToInternationalBank ¶
func (z *ZB) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted