Versions in this module Expand all Collapse all v1 v1.0.10 Aug 10, 2020 Changes in this version + const UPEX v1.0.9 Jul 7, 2020 v1.0.8 Jul 7, 2020 Changes in this version + var ErrorAssetNotFound = errors.New("Asset not found") + var ErrorUnsupported = errors.New("Unsupported") v1.0.7 Jul 5, 2020 v1.0.6 Jul 4, 2020 v1.0.5 Jun 30, 2020 Changes in this version + const JBEX + func HttpDeleteForm2(client *http.Client, reqUrl string, postData string, headers map[string]string) ([]byte, error) v1.0.3 Jun 28, 2020 v1.0.2 Jun 28, 2020 v1.0.1 Jun 28, 2020 Changes in this version + const AOFEX + const BITZ v0 v0.1.0 Jun 14, 2020 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 COINEX + const CRYPTOPIA + const Depth10 + const Depth100 + const Depth20 + const Depth5 + const Depth50 + const Depth_Aggregate1 + const Depth_Aggregate2 + const Depth_Aggregate3 + const Depth_Aggregate4 + const Depth_Aggregate5 + const Depth_Aggregate_Default + const Depth_Default + const ET + const FCOIN + const GATE + const GDAX + const HBDM + const HITBTC + const HUOBI + 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 OPEN_BUY + const OPEN_SELL + const POLONIEX + const STREAM_DEPTH + const STREAM_TICKER + const STREAM_TRADE + const WEX_NZ + const ZB + var BCC = Currency + var BCH = Currency + var CNY = Currency + var NEXT_WEEK_CONTRACT = "next_week" + var PAX = Currency + var QUARTER_CONTRACT = "quarter" + var THIS_WEEK_CONTRACT = "this_week" + var UNKNOWN = Currency + var UNKNOWN_PAIR = CurrencyPair + var USD = Currency + var USDC = Currency + var USDT = Currency + func CancelAllUnfinishedOrders(api SpotAPI, currencyPair CurrencyPair) int + func Close(klines []Kline) (data []float64) + func CloseLog() + func Error(format string, v ...interface{}) + func FlateUnCompress(data []byte) ([]byte, error) + func FloatToString(v float64, n int) string + func GetCurrencyMap(ssm map[string]SymbolSetting) (cm map[string]struct{}) + 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 High(klines []Kline) (data []float64) + 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 HttpPostForm5(client *http.Client, reqUrl string, postData string, headers map[string]string) ([]byte, error) + func HttpPostForm6(client *http.Client, reqUrl string, postData map[string]interface{}, ...) ([]byte, error) + func IntersectCurrencies(a, b map[string]struct{}) (currencies map[string]struct{}) + func IntersectSymbols(a, b map[string]SymbolSetting) (symbols map[string]SymbolSetting) + func IsLoging() bool + func Log(format string, v ...interface{}) + func Low(klines []Kline) (data []float64) + func NewHttpRequest(client *http.Client, reqType string, reqUrl string, postData string, ...) ([]byte, error) + func Open(klines []Kline) (data []float64) + func OpenLog() + func RE(retry int, method interface{}, params ...interface{}) interface + func SetLogger(l Logger) + func ToBool(v interface{}) bool + func ToFloat64(v interface{}) float64 + func ToInt(v interface{}) int + func ToInt64(v interface{}) int64 + func ToString(v interface{}) string + func ToUint64(v interface{}) uint64 + func ValuesToJson(v url.Values) ([]byte, 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 Connection struct + OnMessage func([]byte) error + func NewConnection(wsConn *websocket.Conn, onMessage func([]byte) error) (conn *Connection, err error) + func NewConnectionWithURL(wsurl, proxyurl string, onMessage func([]byte) error) (conn *Connection, err error) + func (conn *Connection) Close() + func (conn *Connection) ReceiveMessage() (data []byte, err error) + func (conn *Connection) SendMessage(data []byte) (err error) + type Currency struct + Name string + func NewCurrency(name string) Currency + func (c Currency) AdaptBccToBch() Currency + func (c Currency) AdaptBchToBcc() Currency + func (c Currency) Equal(c2 Currency) bool + func (c Currency) LowerSymbol() string + func (c Currency) String() string + func (c Currency) Symbol() string + type CurrencyPair struct + Money Currency + Stock Currency + func NewCurrencyPair(stock Currency, money Currency) CurrencyPair + func NewCurrencyPairFromString(market string) CurrencyPair + func (pair CurrencyPair) AdaptBccToBch() CurrencyPair + func (pair CurrencyPair) AdaptBchToBcc() CurrencyPair + func (pair CurrencyPair) AdaptUsdToUsdt() CurrencyPair + func (pair CurrencyPair) AdaptUsdtToUsd() CurrencyPair + func (pair CurrencyPair) Equal(c2 CurrencyPair) bool + func (pair CurrencyPair) Reverse() CurrencyPair + func (pair CurrencyPair) String() string + func (pair CurrencyPair) ToLowerSymbol(sep string) string + func (pair CurrencyPair) ToSymbol(sep string) string + type CurrencyStatus struct + Deposit bool + Withdraw bool + type Depth struct + AskList DepthRecords + BidList DepthRecords + ContractType string + Market CurrencyPair + Symbol string + TS int64 + 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 + ContractName string + Currency CurrencyPair + DealAmount float64 + Fee float64 + LeverRate int + OType int + OrderID int64 + OrderID2 string + OrderTime int64 + 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 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 Kline struct + Close float64 + High float64 + Low float64 + Market CurrencyPair + Open float64 + Symbol string + TS int64 + Vol float64 + type KlinePeriod int + const KLINE_DAY + const KLINE_H1 + const KLINE_H4 + const KLINE_M1 + const KLINE_M15 + const KLINE_M30 + const KLINE_M5 + const KLINE_MONTH + const KLINE_WEEK + type Logger interface + Write func(string) + type Order struct + Amount float64 + AvgPrice float64 + DealAmount float64 + Fee float64 + Market CurrencyPair + OrderID string + Price float64 + Side TradeSide + Status TradeStatus + Symbol string + TS int64 + type OrderDeal struct + DealID string + FilledAmount float64 + FilledCashAmount float64 + Market CurrencyPair + OrderID string + Price float64 + Side TradeSide + Symbol string + TS int64 + UnFilledAmount float64 + type SpotAPI interface + Cancel func(orderId string, pair CurrencyPair) (bool, error) + GetAccount func() (*Account, error) + GetAllCurrencyPair func() (map[string]SymbolSetting, error) + GetAllCurrencyStatus func() (map[string]CurrencyStatus, error) + GetAllTicker func() ([]Ticker, error) + GetCurrencyStatus func(currency Currency) (CurrencyStatus, error) + GetDepth func(pair CurrencyPair, size int, step int) (*Depth, error) + GetExchangeName func() string + GetFinishedOrders func(pair CurrencyPair) ([]Order, error) + GetKlineRecords func(pair CurrencyPair, period KlinePeriod, size, since int) ([]Kline, error) + GetOrder func(orderId string, pair CurrencyPair) (*Order, error) + GetOrderDeal func(orderId string, pair CurrencyPair) ([]OrderDeal, error) + GetPendingOrders func(pair CurrencyPair) ([]Order, error) + GetTicker func(pair CurrencyPair) (*Ticker, error) + GetTrades func(pair CurrencyPair, size int) ([]Trade, error) + GetURL func() string + GetUserTrades func(pair CurrencyPair) ([]Trade, error) + LimitBuy func(pair CurrencyPair, price, amount string) (*Order, error) + LimitSell func(pair CurrencyPair, price, amount string) (*Order, error) + MarketBuy func(pair CurrencyPair, amount string) (*Order, error) + MarketSell func(pair CurrencyPair, amount string) (*Order, error) + SetURL func(exurl string) + type SpotWebsocket interface + Close func() + FormatTopicName func(topic string, pair CurrencyPair) string + FormatTopicSubData func(topic string, pair CurrencyPair) []byte + FormatTopicUnsubData func(topic string, pair CurrencyPair) []byte + GetExchangeName func() string + GetProxyURL func() string + GetURL func() string + OnMessage func([]byte) error + Resubscribe func() (err error) + SetConnectHandler func(h func(*Connection) error) + SetHeartBeatHandler func(h func(*Connection) error) + SetProxyURL func(proxyURL string) + SetURL func(exURL string) + SubDepth func(pair CurrencyPair, cb func(*Depth) error) (err error) + SubTicker func(pair CurrencyPair, cb func(*Ticker) error) (err error) + SubTrade func(pair CurrencyPair, cb func([]Trade) error) (err error) + Unsubscribe func() (err error) + type SpotWsBase struct + Conn *Connection + HeartbeatIntervalTime time.Duration + OnConnect func(*Connection) error + OnDepth func(*Depth) error + OnHeartBeat func(*Connection) error + OnTicker func(*Ticker) error + OnTrade func([]Trade) error + ProxyURL string + TopicMap TopicMap + WsURL string + func (ws *SpotWsBase) Close() + func (ws *SpotWsBase) GetPairByStream(topic string) (pair CurrencyPair) + func (ws *SpotWsBase) GetProxyURL() string + func (ws *SpotWsBase) GetURL() string + func (ws *SpotWsBase) Loop() + func (ws *SpotWsBase) Pack(topic interface{}) []byte + func (ws *SpotWsBase) Resubscribe() (err error) + func (ws *SpotWsBase) SetConnectHandler(h func(*Connection) error) + func (ws *SpotWsBase) SetDisconnected(disconnected bool) + func (ws *SpotWsBase) SetHeartBeatHandler(h func(*Connection) error) + func (ws *SpotWsBase) SetProxyURL(proxyURL string) + func (ws *SpotWsBase) SetURL(exURL string) + func (ws *SpotWsBase) SubDepth(pair CurrencyPair, cb func(*Depth) error) (err error) + func (ws *SpotWsBase) SubTicker(pair CurrencyPair, cb func(*Ticker) error) (err error) + func (ws *SpotWsBase) SubTrade(pair CurrencyPair, cb func([]Trade) error) (err error) + func (ws *SpotWsBase) Unsubscribe() (err error) + type StreamType string + type SubAccount struct + Amount float64 + Currency Currency + FrozenAmount float64 + LoanAmount float64 + type SymbolSetting struct + Base string + MakerFee float64 + MinNotional float64 + MinPrice float64 + MinSize float64 + Quote string + Symbol string + TakerFee float64 + type Ticker struct + Buy float64 + High float64 + Last float64 + Low float64 + Market CurrencyPair + Open float64 + Sell float64 + Symbol string + TS int64 + Vol float64 + type TopicMap struct + func NewStreamMap() *TopicMap + func (m *TopicMap) Delete(k string) + func (m *TopicMap) Load(k string) (pair CurrencyPair, ok bool) + func (m *TopicMap) LoadOrStore(k string, pair CurrencyPair) (actualPair CurrencyPair, loaded bool) + func (m *TopicMap) Range(f func(k string, v CurrencyPair) bool) + func (m *TopicMap) Store(k string, v CurrencyPair) + type Trade struct + Amount float64 + Market CurrencyPair + Price float64 + Side TradeSide + Symbol string + TS int64 + Tid int64 + 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