Versions in this module Expand all Collapse all v0 v0.1.1 Feb 19, 2024 Changes in this version + const ATOP + const BIGONE + const BINANCE + const BINANCE_FUTURES + const BINANCE_SWAP + const BITFINEX + const BITGET_SWAP + const BITHUMB + const BITMEX + const BITMEX_TEST + const BITSTAMP + const BITTREX + const C2C + const CLOSE_BUY + const CLOSE_SELL + const COINBENE + const COINEX + const CRYPTOPIA + const FCOIN + const FCOIN_MARGIN + const FMEX + const FUTURE + const GATEIO + const GDAX + const HBDM + const HBDM_SWAP + 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_3H + 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 KUCOIN + const OKCOIN_COM + const OKEX + const OKEX_FUTURE + const OKEX_SWAP + const OKEX_V3 + const OPEN_BUY + const OPEN_SELL + const ORDER_FEATURE_FAK + const ORDER_FEATURE_FOK + const ORDER_FEATURE_IOC + const ORDER_FEATURE_LIMIT + const ORDER_FEATURE_ORDINARY + const ORDER_FEATURE_POST_ONLY + const ORDER_TYPE_LIMIT + const ORDER_TYPE_MARKET + const POLONIEX + const SPOT + const SPOT_MARGIN + const SUB_ACCOUNT + const SWAP + const SWAP_USDT + const TIPS + const WALLET + const ZB + var ALGO = Currency + var ALGO_USD = CurrencyPair + var ALGO_USDT = CurrencyPair + var ANS = Currency + var API_ERR = ApiError + var BCC = Currency + var BCC_BTC = 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 BI_QUARTER_CONTRACT = "bi_quarter" + 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_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 CNY = Currency + var CRV = Currency + var CRV_USD = CurrencyPair + var CRV_USDT = CurrencyPair + var DASH = Currency + var DASH_USD = CurrencyPair + var DASH_USDT = CurrencyPair + var DCR = Currency + var DCR_BTC = CurrencyPair + var DOT = Currency + var DOT_BTC = CurrencyPair + var DOT_USD = CurrencyPair + var DOT_USDT = CurrencyPair + var EOS = Currency + var EOS_BTC = CurrencyPair + var EOS_ETH = CurrencyPair + var EOS_USD = CurrencyPair + var EOS_USDT = CurrencyPair + var ETC = Currency + var ETC_BTC = 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_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 GBP = Currency + 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_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 QUARTER_CONTRACT = "quarter" + var SC = Currency + var SWAP_CONTRACT = "swap" + var SWAP_USDT_CONTRACT = "swap-usdt" + 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 XLM = 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_ETH = CurrencyPair + func AdaptKlinePeriodForOKEx(period int) string + func CancelAllUnfinishedFutureOrders(api FutureRestAPI, contractType string, currencyPair CurrencyPair) int + func CancelAllUnfinishedOrders(api API, currencyPair CurrencyPair) int + func FlateDecompress(data []byte) ([]byte, error) + func FloatToFixed(v float64, precision int) float64 + func FloatToString(v float64, precision int) string + func GenerateOrderClientId(size 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 GzipDecompress(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 HttpPut(client *http.Client, reqUrl string, postData url.Values, ...) ([]byte, error) + func MergeOptionalParameter(values *url.Values, opts ...OptionalParameter) url.Values + func NewHttpRequest(client *http.Client, reqType string, reqUrl string, postData string, ...) ([]byte, error) + func NewHttpRequestWithFasthttp(client *http.Client, reqMethod, reqUrl, 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 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 KlinePeriod, size int, ...) ([]Kline, error) + GetOneOrder func(orderId string, currency CurrencyPair) (*Order, error) + GetOrderHistorys func(currency CurrencyPair, opt ...OptionalParameter) ([]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 float64 + 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 + AmountTickSize int + CurrencyA Currency + CurrencyB Currency + PriceTickSize int + func NewCurrencyPair(currencyA Currency, currencyB Currency) CurrencyPair + func NewCurrencyPair2(currencyPairSymbol string) CurrencyPair + func NewCurrencyPair3(currencyPairSymbol string, sep string) CurrencyPair + func (pair *CurrencyPair) SetAmountTickSize(tickSize int) CurrencyPair + func (pair *CurrencyPair) SetPriceTickSize(tickSize int) CurrencyPair + func (pair CurrencyPair) AdaptUsdToUsdt() CurrencyPair + func (pair CurrencyPair) AdaptUsdtToUsd() CurrencyPair + func (pair CurrencyPair) Eq(c2 CurrencyPair) bool + func (pair CurrencyPair) Reverse() CurrencyPair + func (pair CurrencyPair) String() string + func (pair CurrencyPair) ToLower() CurrencyPair + func (pair CurrencyPair) ToSymbol(joinChar string) string + func (pair CurrencyPair) ToSymbol2(joinChar string) string + type DepositWithdrawHistory struct + Amount float64 + Currency string + Fee string + From string + Memo string + Status int + Timestamp time.Time + To string + Txid string + WithdrawalId string + type Depth struct + AskList DepthRecords + BidList DepthRecords + ContractId string + 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 + AlgoType int + Amount float64 + AvgPrice float64 + ClientOid string + ContractName string + Currency CurrencyPair + DealAmount float64 + Fee float64 + FinishedTime int64 + LeverRate float64 + OType int + OrderID int64 + OrderID2 string + OrderTime int64 + OrderType int + Price float64 + Status TradeStatus + TriggerPrice float64 + type FuturePosition struct + BuyAmount float64 + BuyAvailable float64 + BuyPriceAvg float64 + BuyPriceCost float64 + BuyProfit float64 + BuyProfitReal float64 + ContractId int64 + ContractType string + CreateDate int64 + ForceLiquPrice float64 + LeverRate float64 + LongPnlRatio float64 + SellAmount float64 + SellAvailable float64 + SellPriceAvg float64 + SellPriceCost float64 + SellProfit float64 + SellProfitReal float64 + ShortPnlRatio 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) + GetFutureOrderHistory func(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]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(currencyPair ...CurrencyPair) (*FutureAccount, error) + GetKlineRecords func(contractType string, currency CurrencyPair, period KlinePeriod, size int, ...) ([]FutureKline, error) + GetTrades func(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error) + GetUnfinishFutureOrders func(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error) + LimitFuturesOrder func(currencyPair CurrencyPair, contractType, price, amount string, openType int, ...) (*FutureOrder, error) + MarketFuturesOrder func(currencyPair CurrencyPair, contractType, amount string, openType int) (*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 string + ContractType string + HoldAmount float64 + LimitHigh float64 + LimitLow float64 + UnitAmount float64 + type FuturesContractInfo struct + ContractType string + ContractVal float64 + Delivery string + type FuturesWsApi interface + DepthCallback func(func(depth *Depth)) + SubscribeDepth func(pair CurrencyPair, contractType string) error + SubscribeTicker func(pair CurrencyPair, contractType string) error + SubscribeTrade func(pair CurrencyPair, contractType string) error + TickerCallback func(func(ticker *FutureTicker)) + TradeCallback func(func(trade *Trade, contract string)) + 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 LimitOrderOptionalParameter int + const Fok + const Ioc + const PostOnly + func (opt LimitOrderOptionalParameter) String() string + 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 OptionalParameter map[string]interface + func (optional OptionalParameter) GetFloat64(name string) float64 + func (optional OptionalParameter) GetInt(name string) int + func (optional OptionalParameter) GetInt64(name string) int64 + func (optional OptionalParameter) GetString(name string) string + func (optional OptionalParameter) GetTime(name string) *time.Time + func (optional OptionalParameter) Optional(name string, value interface{}) OptionalParameter + type Order struct + Amount float64 + AvgPrice float64 + Cid string + Currency CurrencyPair + DealAmount float64 + Fee float64 + FinishedTime int64 + OrderID int + OrderID2 string + OrderTime int + OrderType int + Price float64 + Side TradeSide + Status TradeStatus + Type string + type OrderFeature int + func (of OrderFeature) String() string + type OrderType int + func (ot OrderType) String() string + type RepaymentParameter struct + BorrowId string + type SpotWsApi interface + DepthCallback func(func(depth *Depth)) + SubscribeDepth func(pair CurrencyPair) error + SubscribeTicker func(pair CurrencyPair) error + SubscribeTrade func(pair CurrencyPair) error + TickerCallback func(func(ticker *Ticker)) + TradeCallback func(func(trade *Trade)) + type SubAccount struct + Amount float64 + Currency Currency + ForzenAmount float64 + LoanAmount float64 + type TickSize struct + AmountTickSize float64 + InstrumentID string + PriceTickSize float64 + QuoteCurrency string + UnderlyingIndex string + type Ticker struct + Buy float64 + Date uint64 + High float64 + Last float64 + Low float64 + Open 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 TransferParameter struct + Amount float64 + Currency string + From int + InstrumentId string + SubAccount string + To int + ToInstrumentId string + type WalletApi interface + GetAccount func() (*Account, error) + GetDepositHistory func(currency *Currency) ([]DepositWithdrawHistory, error) + GetWithDrawHistory func(currency *Currency) ([]DepositWithdrawHistory, error) + Transfer func(param TransferParameter) error + Withdrawal func(param WithdrawParameter) (withdrawId string, err error) + type WithdrawParameter struct + Amount float64 + Currency string + Destination int + Fee string + ToAddress string + TradePwd string + type WsBuilder struct + func NewWsBuilder() *WsBuilder + func (b *WsBuilder) AutoReconnect() *WsBuilder + func (b *WsBuilder) Build() *WsConn + func (b *WsBuilder) ConnectSuccessAfterSendMessage(msg func() []byte) *WsBuilder + func (b *WsBuilder) DecompressFunc(f func([]byte) ([]byte, error)) *WsBuilder + func (b *WsBuilder) DisableEnableCompression() *WsBuilder + func (b *WsBuilder) Dump() *WsBuilder + func (b *WsBuilder) ErrorHandleFunc(f func(err error)) *WsBuilder + func (b *WsBuilder) Heartbeat(heartbeat func() []byte, t time.Duration) *WsBuilder + func (b *WsBuilder) ProtoHandleFunc(f func([]byte) error) *WsBuilder + func (b *WsBuilder) ProxyUrl(proxyUrl string) *WsBuilder + func (b *WsBuilder) ReconnectInterval(t time.Duration) *WsBuilder + func (b *WsBuilder) ReqHeader(key, value string) *WsBuilder + func (b *WsBuilder) WsUrl(wsUrl string) *WsBuilder + type WsConfig struct + ConnectSuccessAfterSendMessage func() []byte + DecompressFunc func([]byte) ([]byte, error) + DisableEnableCompression bool + ErrorHandleFunc func(err error) + HeartbeatData func() []byte + HeartbeatIntervalTime time.Duration + IsAutoReconnect bool + IsDump bool + ProtoHandleFunc func([]byte) error + ProxyUrl string + ReqHeaders map[string][]string + WsUrl string + type WsConn struct + func (ws *WsConn) CloseWs() + func (ws *WsConn) NewWs() *WsConn + func (ws *WsConn) SendCloseMessage(msg []byte) + func (ws *WsConn) SendJsonMessage(m interface{}) error + func (ws *WsConn) SendMessage(msg []byte) + func (ws *WsConn) SendPingMessage(msg []byte) + func (ws *WsConn) SendPongMessage(msg []byte) + func (ws *WsConn) Subscribe(subEvent interface{}) error