zb

package
v0.0.0-...-4c12c4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 20 Imported by: 0

README

GoCryptoTrader package Zb

Build Status Software License GoDoc Coverage Status Go Report Card

This zb package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

ZB Exchange

Current Features
  • REST functions
How to enable
  // Exchanges will be abstracted out in further updates and examples will be
  // supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var z exchange.IBotExchange

for i := range bot.exchanges {
  if bot.exchanges[i].GetName() == "ZB" {
    z = bot.exchanges[i]
  }
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := z.GetTickerPrice()
if err != nil {
  // Handle error
}

// Fetches current orderbook information
ob, err := z.GetOrderbookEx()
if err != nil {
  // Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := z.GetAccountInfo()
if err != nil {
  // Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := z.GetTicker()
if err != nil {
  // Handle error
}

// Fetches current orderbook information
ob, err := z.GetOrderBook()
if err != nil {
  // Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := z.GetUserInfo(...)
if err != nil {
  // Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := z.Trade(...)
if err != nil {
  // Handle error
}
How to do LongPolling public/private calls
  // Exchanges will be abstracted out in further updates and examples will be
  // supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SpotNewOrderRequestParamsTypeBuy 买
	SpotNewOrderRequestParamsTypeBuy = SpotNewOrderRequestParamsType("1")
	// SpotNewOrderRequestParamsTypeSell 卖
	SpotNewOrderRequestParamsTypeSell = SpotNewOrderRequestParamsType("0")
)
View Source
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

View Source
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 {
	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 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 {
	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 Markets

type Markets map[string]struct {
	AmountScale int64 `json:"amountScale"`
	PriceScale  int64 `json:"priceScale"`
}

Markets defines market data

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 int     `json:"trade_amount"`
	TradeDate   int     `json:"trade_date"`
	TradeMoney  float64 `json:"trade_money"`
	Type        int64   `json:"type"`
}

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 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 {
	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 TimeInterval

type TimeInterval string

TimeInterval represents interval enum.

type UserAddress

type UserAddress struct {
	Code    int64 `json:"code"`
	Message struct {
		Description  string `json:"des"`
		IsSuccessful bool   `json:"isSuc"`
		Data         struct {
			Key string `json:"key"`
		} `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,omtempty"`
	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 []struct {
			Freez       float64 `json:"freez,string"`
			EnName      string  `json:"enName"`
			UnitDecimal int64   `json:"unitDecimal"`
			CnName      string  `json:"cnName"`
			UnitTag     string  `json:"unitTag"`
			Available   float64 `json:"available,string"`
			Key         string  `json:"key"`
		} `json:"coins"`
		Base struct {
			Username             string `json:"username"`
			TradePasswordEnabled bool   `json:"trade_password_enabled"`
			AuthGoogleEnabled    bool   `json:"auth_google_enabled"`
			AuthMobileEnabled    bool   `json:"auth_mobile_enabled"`
		} `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    WsGetOrderResponseData `json:"data"`
}

WsGetOrderResponse contains order data

type WsGetOrderResponseData

type WsGetOrderResponseData struct {
	Currency    string  `json:"currency"`
	Fees        float64 `json:"fees"`
	ID          string  `json:"id"`
	Price       float64 `json:"price"`
	Status      int64   `json:"status"`
	TotalAmount float64 `json:"total_amount"`
	TradeAmount float64 `json:"trade_amount"`
	TradePrice  float64 `json:"trade_price"`
	TradeDate   int64   `json:"trade_date"`
	TradeMoney  float64 `json:"trade_money"`
	Type        int64   `json:"type"`
	No          int64   `json:"no,string"`
}

WsGetOrderResponseData Detailed 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    []WsGetOrderResponseData `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    []WsGetOrderResponseData `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

type ZB struct {
	WebsocketConn *wshandler.WebsocketConnection
	exchange.Base
}

ZB is the overarching type across this package 47.91.169.147 api.zb.com 47.52.55.212 trade.zb.com

func (*ZB) AuthenticateWebsocket

func (z *ZB) AuthenticateWebsocket() error

AuthenticateWebsocket sends an authentication message to the websocket

func (*ZB) CancelAllOrders

CancelAllOrders cancels all orders associated with a currency pair

func (*ZB) CancelExistingOrder

func (z *ZB) CancelExistingOrder(orderID int64, symbol string) error

CancelExistingOrder cancels an order

func (*ZB) CancelOrder

func (z *ZB) CancelOrder(order *exchange.OrderCancellation) error

CancelOrder cancels an order by its corresponding ID number

func (*ZB) GenerateDefaultSubscriptions

func (z *ZB) GenerateDefaultSubscriptions()

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*ZB) GetAccountInfo

func (z *ZB) GetAccountInfo() (exchange.AccountInfo, error)

GetAccountInfo retrieves balances for all enabled currencies for the ZB exchange

func (*ZB) GetAccountInformation

func (z *ZB) GetAccountInformation() (AccountsResponse, error)

GetAccountInformation returns account information including coin information and pricing

func (*ZB) GetActiveOrders

func (z *ZB) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)

GetActiveOrders retrieves any orders that are active/open This function is not concurrency safe due to orderSide/orderType maps

func (*ZB) GetCryptoAddress

func (z *ZB) GetCryptoAddress(currency currency.Code) (UserAddress, error)

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) GetDepositAddress

func (z *ZB) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, error)

GetDepositAddress returns a deposit address for a specified currency

func (*ZB) GetExchangeHistory

func (z *ZB) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

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

func (z *ZB) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*ZB) GetFundingHistory

func (z *ZB) GetFundingHistory() ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*ZB) GetLatestSpotPrice

func (z *ZB) GetLatestSpotPrice(symbol string) (float64, error)

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) GetOrderHistory

func (z *ZB) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, 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(orderID string) (exchange.OrderDetail, error)

GetOrderInfo returns information on a current open order

func (*ZB) GetOrderbook

func (z *ZB) GetOrderbook(symbol string) (OrderbookResponse, error)

GetOrderbook returns the orderbook for a given symbol

func (*ZB) GetOrderbookEx

func (z *ZB) GetOrderbookEx(currency currency.Pair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns orderbook base on the currency pair

func (*ZB) GetOrders

func (z *ZB) GetOrders(currency string, pageindex, side int64) ([]Order, error)

GetOrders returns finished orders

func (*ZB) GetSpotKline

func (z *ZB) GetSpotKline(arg KlinesRequestParams) (KLineResponse, error)

GetSpotKline returns Kline data

func (*ZB) GetSubscriptions

func (z *ZB) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)

GetSubscriptions returns a copied list of subscriptions

func (*ZB) GetTicker

func (z *ZB) GetTicker(symbol string) (TickerResponse, error)

GetTicker returns a ticker for a given symbol

func (*ZB) GetTickerPrice

func (z *ZB) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)

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) GetUnfinishedOrdersIgnoreTradeType

func (z *ZB) GetUnfinishedOrdersIgnoreTradeType(currency string, pageindex, pagesize int64) ([]Order, error)

GetUnfinishedOrdersIgnoreTradeType returns unfinished orders

func (*ZB) GetWebsocket

func (z *ZB) GetWebsocket() (*wshandler.Websocket, error)

GetWebsocket returns a pointer to the exchange websocket

func (*ZB) ModifyOrder

func (z *ZB) ModifyOrder(action *exchange.ModifyOrder) (string, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*ZB) Run

func (z *ZB) Run()

Run implements the OKEX wrapper

func (*ZB) SendAuthenticatedHTTPRequest

func (z *ZB) SendAuthenticatedHTTPRequest(httpMethod string, params url.Values, result interface{}) error

SendAuthenticatedHTTPRequest sends authenticated requests to the zb API

func (*ZB) SendHTTPRequest

func (z *ZB) SendHTTPRequest(path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*ZB) SetDefaults

func (z *ZB) SetDefaults()

SetDefaults sets default values for the exchange

func (*ZB) Setup

func (z *ZB) Setup(exch *config.ExchangeConfig)

Setup sets user configuration

func (*ZB) SpotNewOrder

func (z *ZB) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)

SpotNewOrder submits an order to ZB

func (*ZB) Start

func (z *ZB) Start(wg *sync.WaitGroup)

Start starts the OKEX go routine

func (*ZB) SubmitOrder

func (z *ZB) SubmitOrder(p currency.Pair, side exchange.OrderSide, _ exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error)

SubmitOrder submits a new order

func (*ZB) Subscribe

func (z *ZB) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error

Subscribe sends a websocket message to receive data from the channel

func (*ZB) SubscribeToWebsocketChannels

func (z *ZB) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error

SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing

func (*ZB) UnsubscribeToWebsocketChannels

func (z *ZB) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error

UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing

func (*ZB) UpdateOrderbook

func (z *ZB) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*ZB) UpdateTicker

func (z *ZB) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*ZB) Withdraw

func (z *ZB) Withdraw(currency, address, safepassword string, amount, fees float64, itransfer bool) (string, error)

Withdraw transfers funds

func (*ZB) WithdrawCryptocurrencyFunds

func (z *ZB) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*ZB) WithdrawFiatFunds

func (z *ZB) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*ZB) WithdrawFiatFundsToInternationalBank

func (z *ZB) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*ZB) WsConnect

func (z *ZB) WsConnect() error

WsConnect initiates a websocket connection

func (*ZB) WsHandleData

func (z *ZB) WsHandleData()

WsHandleData handles all the websocket data coming from the websocket connection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL