Versions in this module Expand all Collapse all v0 v0.0.2 Jun 16, 2023 Changes in this version + const BINANCE + const BITSTAMP + const COINBASE + const CROSS + const GATE + const GO_BIRTHDAY + const ISOLATED + 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 NEXT_QUARTER_CONTRACT + const NEXT_WEEK_CONTRACT + const OKEX + const QUARTER_CONTRACT + const SETTLE_MODE_BASIS + const SETTLE_MODE_COUNTER + const SUBJECT_COLLATERAL_TRANSFER_IN + const SUBJECT_COLLATERAL_TRANSFER_OUT + const SUBJECT_COMMISSION + const SUBJECT_FREEZE + const SUBJECT_FUNDING_FEE + const SUBJECT_SETTLE + const SUBJECT_TRANSFER_IN + const SUBJECT_TRANSFER_OUT + const SUBJECT_UNFREEZE + const SWAP_CONTRACT + const THIS_WEEK_CONTRACT + const TRADE_TYPE_FUTURE + const TRADE_TYPE_MARGIN + const TRADE_TYPE_SPOT + const TRADE_TYPE_SWAP + var AAVE = Currency + var ADA = Currency + var ALGO = Currency + var ANS = Currency + var AR = Currency + var ATOM = Currency + var AVAX = Currency + var BCH = Currency + var BNB = Currency + var BSV = Currency + var BTC = Currency + var BTC_USD = Pair + var BTC_USDT = Pair + var BTS = Currency + var BUSD = Currency + var CNY = Currency + var COMP = Currency + var DAI = Currency + var DASH = Currency + var DCR = Currency + var DOT = Currency + var EOS = Currency + var EOS_USD = Pair + var ETC = Currency + var ETH = Currency + var ETH_USD = Pair + var ETH_USDT = Pair + var EUR = Currency + var FIL = Currency + var HKD = Currency + var HT = Currency + var JPY = Currency + var KRW = Currency + var LINK = Currency + var LTC = Currency + var LTC_USD = Pair + var MATIC = Currency + var NEO = Currency + var OKB = Currency + var PAX = Currency + var PeriodMillisecond = map[int]int64 + var QTUM = Currency + var SC = Currency + var SGD = Currency + var SHIT = Currency + var SOL = Currency + var SUSHI = Currency + var UNI = Currency + var UNKNOWN = Currency + var USD = Currency + var USDC = Currency + var USDT = Currency + var XBT = Currency + var XRP = Currency + var XTZ = Currency + var YFI = Currency + var YFII = Currency + var ZEC = Currency + func FlateUnCompress(data []byte) ([]byte, error) + func FloatToPrice(v float64, n int64, tickSize float64) string + func FloatToString(v float64, n int64) 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 GetPrecision(minSize float64) int + func GetPrecisionInt64(minSize float64) int64 + func GetSHA(text string) (string, error) + func GzipUnCompress(data []byte) ([]byte, error) + func NewHttpRequest(client *http.Client, reqType, reqUrl, postData string, ...) ([]byte, error) + 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 APIConfig struct + ApiKey string + ApiPassphrase string + ApiSecretKey string + ClientId string + Endpoint string + HttpClient *http.Client + LastTimestamp int64 + Location *time.Location + type Account struct + Asset float64 + Exchange string + NetAsset float64 + SubAccounts map[string]SubAccount + type Currency struct + Desc string + Symbol string + func NewCurrency(symbol, desc string) Currency + func (c Currency) Eq(c2 Currency) bool + func (c Currency) String() string + type Depth struct + AskList DepthRecords + BidList DepthRecords + Date string + Pair Pair + Sequence int64 + Timestamp int64 + func (depth *Depth) Verify() error + 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 Error interface + Code func() int + func NewError(code int, message string, args ...interface{}) Error + type FutureAPIConfig struct + Lever int + type FutureAccount struct + Exchange string + SubAccount map[Currency]FutureSubAccount + type FutureAccountItem struct + Amount float64 + ContractName string + DateTime string + Exchange string + Info string + Pair Pair + SettleCurrency Currency + SettleMode int64 + Subject string + Timestamp int64 + type FutureContract struct + AmountPrecision int64 + ContractName string + ContractType string + DueDate string + DueTimestamp int64 + Exchange string + MaxScalePriceLimit float64 + MinScalePriceLimit float64 + OpenDate string + OpenTimestamp int64 + Pair Pair + PricePrecision int64 + SettleMode int64 + Symbol string + TickSize float64 + UnitAmount float64 + type FutureContracts struct + ContractNameKV map[string]*FutureContract + ContractTypeKV map[string]*FutureContract + DueTimestampKV map[string]*FutureContract + type FutureDepth struct + AskList DepthRecords + BidList DepthRecords + ContractName string + ContractType string + Date string + DueTimestamp int64 + Pair Pair + Sequence int64 + Timestamp int64 + func (fd FutureDepth) Verify() error + type FutureKline struct + ContractType string + DueDate string + DueTimestamp int64 + Vol2 float64 + func GetAscFutureKline(klines []*FutureKline) []*FutureKline + type FutureOrder struct + Amount int64 + AvgPrice float64 + Cid string + ContractName string + ContractType string + DealAmount int64 + DealDatetime string + DealTimestamp int64 + Exchange string + Fee float64 + LeverRate int64 + OrderId string + Pair Pair + PlaceDatetime string + PlaceTimestamp int64 + PlaceType PlaceType + Price float64 + Status TradeStatus + Type FutureType + type FuturePosition struct + BuyAmount float64 + BuyAvailable float64 + BuyPriceAvg float64 + BuyPriceCost float64 + BuyProfitReal float64 + ContractId int64 + ContractType string + CreateDate int64 + ForceLiquidatePrice float64 + LeverRate int + SellAmount float64 + SellAvailable float64 + SellPriceAvg float64 + SellPriceCost float64 + SellProfitReal float64 + Symbol Pair + type FutureRestAPI interface + CancelOrder func(order *FutureOrder) ([]byte, error) + GetAccount func() (*FutureAccount, []byte, error) + GetContract func(pair Pair, contractType string) (*FutureContract, error) + GetDepth func(pair Pair, contractType string, size int) (*FutureDepth, []byte, error) + GetExchangeName func() string + GetIndex func(pair Pair) (float64, []byte, error) + GetKlineRecords func(contractType string, pair Pair, period, size, since int) ([]*FutureKline, []byte, error) + GetLimit func(pair Pair, contractType string) (float64, float64, error) + GetMark func(pair Pair, contractType string) (float64, []byte, error) + GetOrder func(order *FutureOrder) ([]byte, error) + GetOrders func(pair Pair, contractType string) ([]*FutureOrder, []byte, error) + GetPairFlow func(pair Pair) ([]*FutureAccountItem, []byte, error) + GetTicker func(pair Pair, contractType string) (*FutureTicker, []byte, error) + GetTrades func(pair Pair, contractType string) ([]*Trade, []byte, error) + KeepAlive func() + PlaceOrder func(order *FutureOrder) ([]byte, error) + type FutureRule struct + ContractVal float64 + type FutureSubAccount struct + BalanceAvail float64 + BalanceNet float64 + BalanceTotal float64 + Currency Currency + Margin float64 + MarginDealed float64 + MarginRate float64 + MarginUnDealed float64 + ProfitReal float64 + ProfitUnreal float64 + type FutureTicker struct + ContractName string + ContractType string + type FutureType int64 + const LIQUIDATE_LONG + const LIQUIDATE_SHORT + const OPEN_LONG + const OPEN_SHORT + func (ft FutureType) String() string + type FutureWebsocketAPI interface + Close func() + Init func() + Start func() + Subscribe func(channel string) error + type Kline struct + Close float64 + Date string + Exchange string + High float64 + Low float64 + Open float64 + Pair Pair + Timestamp int64 + Vol float64 + func GetAscKline(klines []*Kline) []*Kline + type Loan struct + Amount float64 + AmountInterest float64 + AmountLoaned float64 + Currency Currency + LoanDate string + LoanId string + LoanTimestamp int64 + Pair Pair + RepayDate string + RepayDeadlineDate string + RepayId string + RepayTimestamp int64 + Status LoanStatus + type LoanStatus int + const LOAN_FAIL + const LOAN_FINISH + const LOAN_PART_FINISH + const LOAN_REPAY + const LOAN_UNFINISH + type MarginAccount struct + LiquidationPrice float64 + MarginRatio float64 + Pair Pair + RiskRate float64 + SubAccount map[string]MarginSubAccount + type MarginRestAPI interface + CancelOrder func(order *Order) ([]byte, error) + GetAccount func(pair Pair) (*MarginAccount, []byte, error) + GetDepth func(pair Pair, size int) (*Depth, []byte, error) + GetExchangeName func() string + GetKlineRecords func(pair Pair, period, size, since int) ([]*Kline, []byte, error) + GetLoan func(loan *Loan) ([]byte, error) + GetOrder func(order *Order) ([]byte, error) + GetOrders func(pair Pair) ([]*Order, []byte, error) + GetTicker func(pair Pair) (*Ticker, []byte, error) + GetUnFinishOrders func(pair Pair) ([]*Order, []byte, error) + KeepAlive func() + PlaceLoan func(loan *Loan) ([]byte, error) + PlaceOrder func(order *Order) ([]byte, error) + ReturnLoan func(loan *Loan) ([]byte, error) + type MarginSubAccount struct + Amount float64 + AmountAvail float64 + AmountFrozen float64 + AmountLoaned float64 + AmountNet float64 + Currency Currency + LoaningFee float64 + type OHLC struct + Close float64 + Date string + Exchange string + High float64 + Low float64 + Open float64 + Symbol string + Timestamp int64 + Vol float64 + type Order struct + Amount float64 + AvgPrice float64 + Cid string + DealAmount float64 + Fee float64 + OrderDate string + OrderId string + OrderTimestamp int64 + OrderType PlaceType + Pair Pair + Price float64 + Side TradeSide + Status TradeStatus + type Pair struct + Basis Currency + Counter Currency + func NewPair(symbol string, sepChar string) Pair + func (pair Pair) Eq(otherPair Pair) bool + func (pair Pair) String() string + func (pair Pair) ToSwapContractName() string + func (pair Pair) ToSymbol(joinChar string, isUpper bool) string + type PlaceType int + const FOK + const IOC + const NORMAL + const ONLY_MAKER + func (ot PlaceType) String() string + type Rule struct + Base Currency + BaseMinSize float64 + BasePrecision int + Counter Currency + CounterPrecision int + Pair Pair + type SpotRestAPI interface + CancelOrder func(order *Order) ([]byte, error) + GetAccount func() (*Account, []byte, error) + GetDepth func(pair Pair, size int) (*Depth, []byte, error) + GetExchangeName func() string + GetKlineRecords func(pair Pair, period, size, since int) ([]*Kline, []byte, error) + GetOHLCs func(symbol string, period, size, since int) ([]*OHLC, []byte, error) + GetOrder func(order *Order) ([]byte, error) + GetOrders func(pair Pair) ([]*Order, error) + GetTicker func(pair Pair) (*Ticker, []byte, error) + GetTrades func(pair Pair, since int64) ([]*Trade, error) + GetUnFinishOrders func(pair Pair) ([]*Order, []byte, error) + KeepAlive func() + PlaceOrder func(order *Order) ([]byte, error) + type SubAccount struct + Amount float64 + AmountFrozen float64 + Currency Currency + type SwapAccount struct + BalanceAvail float64 + BalanceNet float64 + BalanceTotal float64 + Currency Currency + Exchange string + Margin float64 + MarginOpen float64 + MarginPosition float64 + MarginRate float64 + Positions []*SwapPosition + ProfitReal float64 + ProfitUnreal float64 + type SwapAccountItem struct + Amount float64 + DateTime string + Exchange string + Info string + Pair Pair + SettleCurrency Currency + SettleMode int64 + Subject string + Timestamp int64 + type SwapContract struct + AmountPrecision int64 + ContractName string + Exchange string + Pair Pair + PricePrecision int64 + SettleMode int64 + Symbol string + TickSize float64 + UnitAmount float64 + type SwapContracts struct + ContractNameKV map[string]*SwapContract + type SwapDepth struct + AskList DepthRecords + BidList DepthRecords + Date string + Pair Pair + Sequence int64 + Timestamp int64 + func (depth *SwapDepth) Verify() error + type SwapKline struct + Close float64 + Date string + Exchange string + High float64 + Low float64 + Open float64 + Pair Pair + Timestamp int64 + Vol float64 + func GetAscSwapKline(klines []*SwapKline) []*SwapKline + type SwapOrder struct + Amount float64 + AvgPrice float64 + Cid string + DealAmount float64 + DealDatetime string + DealTimestamp int64 + Exchange string + Fee float64 + LeverRate int64 + MarginType string + OrderId string + Pair Pair + PlaceDatetime string + PlaceTimestamp int64 + PlaceType PlaceType + Price float64 + Status TradeStatus + Type FutureType + type SwapPosition struct + Amount float64 + Leverage int64 + LiquidatePrice float64 + MarginAmount float64 + MarginType string + MarkPrice float64 + Pair Pair + Price float64 + Type FutureType + type SwapRestAPI interface + AddMargin func(pair Pair, openType FutureType, marginAmount float64) ([]byte, error) + CancelOrder func(order *SwapOrder) ([]byte, error) + GetAccount func() (*SwapAccount, []byte, error) + GetAccountFlow func() ([]*SwapAccountItem, []byte, error) + GetContract func(pair Pair) *SwapContract + GetDepth func(pair Pair, size int) (*SwapDepth, []byte, error) + GetExchangeName func() string + GetFundingFee func(pair Pair) (float64, error) + GetFundingFees func(pair Pair) ([][]interface{}, []byte, error) + GetKline func(pair Pair, period, size, since int) ([]*SwapKline, []byte, error) + GetLimit func(pair Pair) (float64, float64, error) + GetOpenAmount func(pair Pair) (float64, int64, []byte, error) + GetOrder func(order *SwapOrder) ([]byte, error) + GetOrders func(pair Pair) ([]*SwapOrder, []byte, error) + GetPairFlow func(pair Pair) ([]*SwapAccountItem, []byte, error) + GetPosition func(pair Pair, openType FutureType) (*SwapPosition, []byte, error) + GetTicker func(pair Pair) (*SwapTicker, []byte, error) + GetUnFinishOrders func(pair Pair) ([]*SwapOrder, []byte, error) + KeepAlive func() + PlaceOrder func(order *SwapOrder) ([]byte, error) + ReduceMargin func(pair Pair, openType FutureType, marginAmount float64) ([]byte, error) + type SwapTicker struct + Buy float64 + Date string + High float64 + Last float64 + Low float64 + Pair Pair + Sell float64 + Timestamp int64 + Vol float64 + type Ticker struct + Buy float64 + Date string + High float64 + Last float64 + Low float64 + Pair Pair + Sell float64 + Timestamp int64 + Vol float64 + type Trade struct + Amount float64 + Pair Pair + Price float64 + Tid int64 + Timestamp int64 + Type TradeSide + type TradeSide int64 + const BUY + const BUY_MARKET + const SELL + const SELL_MARKET + func (ts TradeSide) String() string + type TradeStatus int64 + 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, dataType int, 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 + HeartbeatDataType int + 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()