Versions in this module Expand all Collapse all v1 v1.0.6 Sep 27, 2019 Changes in this version + const BIGONE + const BINANCE + const BITFINEX + const BITHUMB + const BITMEX + const BITSTAMP + const BITTREX + const CLOSE_BUY + const CLOSE_SELL + const COIN58 + const COINBENE + const COINEX + const CRYPTOPIA + const FCOIN + const FCOIN_MARGIN + const GATEIO + const GDAX + const HBDM + const HITBTC + const HUOBI + const HUOBI_PRO + const KLINE_PERIOD_12H + const KLINE_PERIOD_15MIN + const KLINE_PERIOD_1DAY + const KLINE_PERIOD_1H + const KLINE_PERIOD_1MIN + const KLINE_PERIOD_1MONTH + const KLINE_PERIOD_1WEEK + const KLINE_PERIOD_1YEAR + const KLINE_PERIOD_2H + const KLINE_PERIOD_30MIN + const KLINE_PERIOD_3DAY + const KLINE_PERIOD_3MIN + const KLINE_PERIOD_4H + const KLINE_PERIOD_5MIN + const KLINE_PERIOD_60MIN + const KLINE_PERIOD_6H + const KLINE_PERIOD_8H + const KRAKEN + const OKCOIN_CN + const OKCOIN_COM + const OKEX + const OKEX_FUTURE + const OKEX_SWAP + const OKEX_V3 + const OPEN_BUY + const OPEN_SELL + const ORDER_TYPE_FAK + const ORDER_TYPE_FOK + const ORDER_TYPE_IOC + const ORDER_TYPE_LIMIT + const ORDER_TYPE_MARKET + const ORDER_TYPE_ORDINARY + const ORDER_TYPE_POST_ONLY + const POLONIEX + const WEX_NZ + const ZB + var ANS = Currency + var ANS_CNY = CurrencyPair + var API_ERR = ApiError + var BCC = Currency + var BCC_BTC = CurrencyPair + var BCC_CNY = CurrencyPair + var BCC_USD = CurrencyPair + var BCC_USDT = CurrencyPair + var BCD = Currency + var BCD_BTC = CurrencyPair + var BCD_USD = CurrencyPair + var BCD_USDT = CurrencyPair + var BCH = Currency + var BCH_BTC = CurrencyPair + var BCH_JPY = CurrencyPair + var BCH_KRW = CurrencyPair + var BCH_USD = CurrencyPair + var BCH_USDT = CurrencyPair + var BCX = Currency + var BNB = Currency + var BNB_BTC = CurrencyPair + var BNB_USDT = CurrencyPair + var BSV = Currency + var BSV_BTC = CurrencyPair + var BSV_USD = CurrencyPair + var BSV_USDT = CurrencyPair + var BTC = Currency + var BTC_CNY = CurrencyPair + var BTC_JPY = CurrencyPair + var BTC_KRW = CurrencyPair + var BTC_USD = CurrencyPair + var BTC_USDT = CurrencyPair + var BTG = Currency + var BTG_BTC = CurrencyPair + var BTG_USD = CurrencyPair + var BTS = Currency + var BTS_CNY = CurrencyPair + var CNY = Currency + var DCR = Currency + var DCR_BTC = CurrencyPair + var EOS = Currency + var EOS_BTC = CurrencyPair + var EOS_CNY = CurrencyPair + var EOS_ETH = CurrencyPair + var EOS_USD = CurrencyPair + var EOS_USDT = CurrencyPair + var ETC = Currency + var ETC_BTC = CurrencyPair + var ETC_CNY = CurrencyPair + var ETC_ETH = CurrencyPair + var ETC_JPY = CurrencyPair + var ETC_KRW = CurrencyPair + var ETC_USD = CurrencyPair + var ETC_USDT = CurrencyPair + var ETH = Currency + var ETH_BTC = CurrencyPair + var ETH_CNY = CurrencyPair + var ETH_JPY = CurrencyPair + var ETH_KRW = CurrencyPair + var ETH_USD = CurrencyPair + var ETH_USDT = CurrencyPair + var EUR = Currency + var EX_ERR_API_LIMIT = ApiError + var EX_ERR_CANCEL_ORDER_FAIL = ApiError + var EX_ERR_INSUFFICIENT_BALANCE = ApiError + var EX_ERR_INVALID_CURRENCY_PAIR = ApiError + var EX_ERR_NOT_FIND_APIKEY = ApiError + var EX_ERR_NOT_FIND_ORDER = ApiError + var EX_ERR_NOT_FIND_SECRETKEY = ApiError + var EX_ERR_PLACE_ORDER_FAIL = ApiError + var EX_ERR_SIGN = ApiError + var EX_ERR_SYMBOL_ERR = ApiError + var HSR = Currency + var HSR_BTC = CurrencyPair + var HSR_ETH = CurrencyPair + var HSR_USDT = CurrencyPair + var HT = Currency + var HTTP_ERR_CODE = ApiError + var HT_BTC = CurrencyPair + var HT_USDT = CurrencyPair + var JPY = Currency + var KRW = Currency + var LTC = Currency + var LTC_BTC = CurrencyPair + var LTC_CNY = CurrencyPair + var LTC_ETH = CurrencyPair + var LTC_JPY = CurrencyPair + var LTC_KRW = CurrencyPair + var LTC_USD = CurrencyPair + var LTC_USDT = CurrencyPair + var NEO = Currency + var NEO_BTC = CurrencyPair + var NEO_ETH = CurrencyPair + var NEO_USDT = CurrencyPair + var NEXT_WEEK_CONTRACT = "next_week" + var OKB = Currency + var OKB_BTC = CurrencyPair + var OKB_USDT = CurrencyPair + var PAX = Currency + var PAX_USDT = CurrencyPair + var QTUM = Currency + var QTUM_CNY = CurrencyPair + var QUARTER_CONTRACT = "quarter" + var SC = Currency + var SC_CNY = CurrencyPair + var SWAP_CONTRACT = "swap" + var THIS_WEEK_CONTRACT = "this_week" + var TRX = Currency + var TRX_BTC = CurrencyPair + var TRX_USDT = CurrencyPair + var UNKNOWN = Currency + var UNKNOWN_PAIR = CurrencyPair + var USD = Currency + var USDC = Currency + var USDT = Currency + var XBT = Currency + var XRP = Currency + var XRP_BTC = CurrencyPair + var XRP_EUR = CurrencyPair + var XRP_USD = CurrencyPair + var XRP_USDT = CurrencyPair + var ZEC = Currency + var ZEC_CNY = CurrencyPair + var ZEC_ETH = CurrencyPair + func AdaptKlinePeriodForOKEx(period int) string + func CancelAllUnfinishedFutureOrders(api FutureRestAPI, contractType string, currencyPair CurrencyPair) int + func CancelAllUnfinishedOrders(api API, currencyPair CurrencyPair) int + func FlateUnCompress(data []byte) ([]byte, error) + func FloatToString(v float64, n int) string + func GetParamHmacMD5Sign(secret, params string) (string, error) + func GetParamHmacSHA1Sign(secret, params string) (string, error) + func GetParamHmacSHA256Base64Sign(secret, params string) (string, error) + func GetParamHmacSHA256Sign(secret, params string) (string, error) + func GetParamHmacSHA512Base64Sign(hmac_key string, hmac_data string) string + func GetParamHmacSHA512Sign(secret, params string) (string, error) + func GetParamHmacSha384Sign(secret, params string) (string, error) + func GetParamMD5Sign(secret, params string) (string, error) + func GetSHA(text string) (string, error) + func GzipUnCompress(data []byte) ([]byte, error) + func HttpDeleteForm(client *http.Client, reqUrl string, postData url.Values, ...) ([]byte, error) + func HttpGet(client *http.Client, reqUrl string) (map[string]interface{}, error) + func HttpGet2(client *http.Client, reqUrl string, headers map[string]string) (map[string]interface{}, error) + func HttpGet3(client *http.Client, reqUrl string, headers map[string]string) ([]interface{}, error) + func HttpGet4(client *http.Client, reqUrl string, headers map[string]string, ...) error + func HttpGet5(client *http.Client, reqUrl string, headers map[string]string) ([]byte, error) + func HttpPostForm(client *http.Client, reqUrl string, postData url.Values) ([]byte, error) + func HttpPostForm2(client *http.Client, reqUrl string, postData url.Values, ...) ([]byte, error) + func HttpPostForm3(client *http.Client, reqUrl string, postData string, headers map[string]string) ([]byte, error) + func HttpPostForm4(client *http.Client, reqUrl string, postData map[string]string, ...) ([]byte, error) + func NewHttpRequest(client *http.Client, reqType string, reqUrl string, postData string, ...) ([]byte, error) + func RE(retry int, delay time.Duration, method interface{}, params ...interface{}) interface + func ToFloat64(v interface{}) float64 + func ToInt(v interface{}) int + func ToInt64(v interface{}) int64 + func ToUint64(v interface{}) uint64 + func UUID() string + func ValuesToJson(v url.Values) ([]byte, error) + type API interface + CancelOrder func(orderId string, currency CurrencyPair) (bool, error) + GetAccount func() (*Account, error) + GetDepth func(size int, currency CurrencyPair) (*Depth, error) + GetExchangeName func() string + GetKlineRecords func(currency CurrencyPair, period, size, since int) ([]Kline, error) + GetOneOrder func(orderId string, currency CurrencyPair) (*Order, error) + GetOrderHistorys func(currency CurrencyPair, currentPage, pageSize int) ([]Order, error) + GetTicker func(currency CurrencyPair) (*Ticker, error) + GetTrades func(currencyPair CurrencyPair, since int64) ([]Trade, error) + GetUnfinishOrders func(currency CurrencyPair) ([]Order, error) + LimitBuy func(amount, price string, currency CurrencyPair) (*Order, error) + LimitSell func(amount, price string, currency CurrencyPair) (*Order, error) + MarketBuy func(amount, price string, currency CurrencyPair) (*Order, error) + MarketSell func(amount, price string, currency CurrencyPair) (*Order, error) + type APIConfig struct + ApiKey string + ApiPassphrase string + ApiSecretKey string + ClientId string + Endpoint string + HttpClient *http.Client + Lever int + type Account struct + Asset float64 + Exchange string + NetAsset float64 + SubAccounts map[Currency]SubAccount + type ApiError struct + ErrCode string + ErrMsg string + OriginErrMsg string + func (e ApiError) Error() string + func (e ApiError) OriginErr(err string) ApiError + type BorrowParameter struct + Amount float64 + Currency Currency + CurrencyPair CurrencyPair + type Currency struct + Desc string + Symbol string + func NewCurrency(symbol, desc string) Currency + func (c Currency) AdaptBccToBch() Currency + func (c Currency) AdaptBchToBcc() Currency + func (c Currency) Eq(c2 Currency) bool + func (c Currency) String() string + type CurrencyPair struct + CurrencyA Currency + CurrencyB Currency + func NewCurrencyPair(currencyA Currency, currencyB Currency) CurrencyPair + func NewCurrencyPair2(currencyPairSymbol string) CurrencyPair + func (c CurrencyPair) Eq(c2 CurrencyPair) bool + func (c CurrencyPair) String() string + func (pair CurrencyPair) AdaptBccToBch() CurrencyPair + func (pair CurrencyPair) AdaptBchToBcc() CurrencyPair + func (pair CurrencyPair) AdaptUsdToUsdt() CurrencyPair + func (pair CurrencyPair) AdaptUsdtToUsd() CurrencyPair + func (pair CurrencyPair) Reverse() CurrencyPair + func (pair CurrencyPair) ToLower() CurrencyPair + func (pair CurrencyPair) ToSymbol(joinChar string) string + func (pair CurrencyPair) ToSymbol2(joinChar string) string + type Depth struct + AskList DepthRecords + BidList DepthRecords + ContractType string + Pair CurrencyPair + UTime time.Time + type DepthRecord struct + Amount float64 + Price float64 + type DepthRecords []DepthRecord + func (dr DepthRecords) Len() int + func (dr DepthRecords) Less(i, j int) bool + func (dr DepthRecords) Swap(i, j int) + type FutureAccount struct + FutureSubAccounts map[Currency]FutureSubAccount + type FutureKline struct + Vol2 float64 + type FutureOrder struct + Amount float64 + AvgPrice float64 + ClientOid string + ContractName string + Currency CurrencyPair + DealAmount float64 + Fee float64 + LeverRate int + OType int + OrderID int64 + OrderID2 string + OrderTime int64 + OrderType int + Price float64 + Status TradeStatus + type FuturePosition struct + BuyAmount float64 + BuyAvailable float64 + BuyPriceAvg float64 + BuyPriceCost float64 + BuyProfitReal float64 + ContractId int64 + ContractType string + CreateDate int64 + ForceLiquPrice float64 + LeverRate int + SellAmount float64 + SellAvailable float64 + SellPriceAvg float64 + SellPriceCost float64 + SellProfitReal float64 + Symbol CurrencyPair + type FutureRestAPI interface + FutureCancelOrder func(currencyPair CurrencyPair, contractType, orderId string) (bool, error) + GetContractValue func(currencyPair CurrencyPair) (float64, error) + GetDeliveryTime func() (int, int, int, int) + GetExchangeName func() string + GetFee func() (float64, error) + GetFutureDepth func(currencyPair CurrencyPair, contractType string, size int) (*Depth, error) + GetFutureEstimatedPrice func(currencyPair CurrencyPair) (float64, error) + GetFutureIndex func(currencyPair CurrencyPair) (float64, error) + GetFutureOrder func(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error) + GetFutureOrders func(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error) + GetFuturePosition func(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error) + GetFutureTicker func(currencyPair CurrencyPair, contractType string) (*Ticker, error) + GetFutureUserinfo func() (*FutureAccount, error) + GetKlineRecords func(contract_type string, currency CurrencyPair, period, size, since int) ([]FutureKline, error) + GetTrades func(contract_type string, currencyPair CurrencyPair, since int64) ([]Trade, error) + GetUnfinishFutureOrders func(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error) + PlaceFutureOrder func(currencyPair CurrencyPair, contractType, price, amount string, ...) (string, error) + type FutureSubAccount struct + AccountRights float64 + Currency Currency + KeepDeposit float64 + ProfitReal float64 + ProfitUnreal float64 + RiskRate float64 + type FutureTicker struct + ContractId int + ContractType string + HoldAmount float64 + LimitHigh float64 + LimitLow float64 + UnitAmount float64 + type HistoricalFunding struct + FundingTime time.Time + InstrumentId string + RealizedRate float64 + type Kline struct + Close float64 + High float64 + Low float64 + Open float64 + Pair CurrencyPair + Timestamp int64 + Vol float64 + type KlinePeriod int + type MarginAccount struct + LiquidationPrice float64 + MarginRatio float64 + RiskRate float64 + Sub map[Currency]MarginSubAccount + type MarginSubAccount struct + Available float64 + Balance float64 + CanWithdraw float64 + Frozen float64 + LendingFee float64 + Loan float64 + type Order struct + Amount float64 + AvgPrice float64 + Cid string + Currency CurrencyPair + DealAmount float64 + Fee float64 + OrderID int + OrderID2 string + OrderTime int + OrderType int + Price float64 + Side TradeSide + Status TradeStatus + Type string + type OrderType int + func (ot OrderType) String() string + type RepaymentParameter struct + BorrowId string + type SubAccount struct + Amount float64 + Currency Currency + ForzenAmount float64 + LoanAmount float64 + type Ticker struct + Buy float64 + Date uint64 + High float64 + Last float64 + Low float64 + Pair CurrencyPair + Sell float64 + Vol float64 + type Trade struct + Amount float64 + Date int64 + Pair CurrencyPair + Price float64 + Tid int64 + Type TradeSide + type TradeSide int + const BUY + const BUY_MARKET + const SELL + const SELL_MARKET + func AdaptTradeSide(side string) TradeSide + func (ts TradeSide) String() string + type TradeStatus int + const ORDER_CANCEL + const ORDER_CANCEL_ING + const ORDER_FAIL + const ORDER_FINISH + const ORDER_PART_FINISH + const ORDER_REJECT + const ORDER_UNFINISH + func (ts TradeStatus) String() string + type WsBuilder struct + func NewWsBuilder() *WsBuilder + func (b *WsBuilder) Build() *WsConn + func (b *WsBuilder) Dump() *WsBuilder + func (b *WsBuilder) ErrorHandleFunc(f func(err error)) *WsBuilder + func (b *WsBuilder) Heartbeat(data []byte, t time.Duration) *WsBuilder + func (b *WsBuilder) Heartbeat2(heartbeat func() interface{}, t time.Duration) *WsBuilder + func (b *WsBuilder) ProtoHandleFunc(f func([]byte) error) *WsBuilder + func (b *WsBuilder) ProxyUrl(proxyUrl string) *WsBuilder + func (b *WsBuilder) ReconnectIntervalTime(t time.Duration) *WsBuilder + func (b *WsBuilder) ReqHeader(key, value string) *WsBuilder + func (b *WsBuilder) UnCompressFunc(f func([]byte) ([]byte, error)) *WsBuilder + func (b *WsBuilder) WsUrl(wsUrl string) *WsBuilder + type WsConfig struct + ErrorHandleFunc func(err error) + HeartbeatData []byte + HeartbeatFunc func() interface{} + HeartbeatIntervalTime time.Duration + IsDump bool + ProtoHandleFunc func([]byte) error + ProxyUrl string + ReconnectIntervalTime time.Duration + ReqHeaders map[string][]string + UnCompressFunc func([]byte) ([]byte, error) + WsUrl string + type WsConn struct + func (ws *WsConn) CloseWs() + func (ws *WsConn) HeartbeatTimer() + func (ws *WsConn) NewWs() *WsConn + func (ws *WsConn) ReConnect() + func (ws *WsConn) ReConnectTimer() + func (ws *WsConn) ReceiveMessage() + func (ws *WsConn) SendJsonMessage(v interface{}) error + func (ws *WsConn) SendTextMessage(data []byte) error + func (ws *WsConn) Subscribe(subEvent interface{}) error + func (ws *WsConn) UpdateActiveTime()