Documentation ¶
Index ¶
- Constants
- Variables
- type APIConfig
- type Account
- type ApiError
- type BorrowParameter
- type Currency
- type DepositWithdrawHistory
- type Depth
- type DepthRecord
- type DepthRecords
- type FutureAccount
- type FutureKline
- type FutureOrder
- type FuturePosition
- type FutureSubAccount
- type FutureTicker
- type FuturesContractInfo
- type HistoricalFunding
- type Kline
- type KlinePeriod
- type LimitOrderOptionalParameter
- type MarginAccount
- type MarginSubAccount
- type Order
- type OrderFeature
- type OrderType
- type RepaymentParameter
- type SubAccount
- type TickSize
- type Ticker
- type Trade
- type TradeSide
- type TradeStatus
- type TradingPair
- func (pair TradingPair) AdaptBccToBch() TradingPair
- func (pair TradingPair) AdaptBchToBcc() TradingPair
- func (pair TradingPair) AdaptUsdToUsdt() TradingPair
- func (pair TradingPair) AdaptUsdtToUsd() TradingPair
- func (c TradingPair) Equal(c2 TradingPair) bool
- func (pair TradingPair) Reverse() TradingPair
- func (c TradingPair) String() string
- func (pair TradingPair) ToLower() TradingPair
- func (pair TradingPair) ToSymbol(joinChar string) string
- func (pair TradingPair) ToSymbol2(joinChar string) string
- type TransferParameter
- type WithdrawParameter
Constants ¶
View Source
const ( OPEN_BUY = 1 + iota //开多 OPEN_SELL //开空 CLOSE_BUY //平多 CLOSE_SELL //平空 )
View Source
const ( KLINE_PERIOD_1MIN = 1 + iota KLINE_PERIOD_3MIN KLINE_PERIOD_5MIN KLINE_PERIOD_15MIN KLINE_PERIOD_30MIN KLINE_PERIOD_60MIN KLINE_PERIOD_1H KLINE_PERIOD_2H KLINE_PERIOD_3H KLINE_PERIOD_4H KLINE_PERIOD_6H KLINE_PERIOD_8H KLINE_PERIOD_12H KLINE_PERIOD_1DAY KLINE_PERIOD_3DAY KLINE_PERIOD_1WEEK KLINE_PERIOD_1MONTH KLINE_PERIOD_1YEAR )
k线周期
View Source
const ( ORDER_FEATURE_ORDINARY = 0 + iota ORDER_FEATURE_POST_ONLY ORDER_FEATURE_FOK ORDER_FEATURE_IOC ORDER_FEATURE_FAK ORDER_FEATURE_LIMIT )
View Source
const ( ORDER_TYPE_LIMIT = 1 + iota ORDER_TYPE_MARKET )
View Source
const ( KUCOIN = "kucoin.com" OKCOIN_COM = "okcoin.com" OKEX = "okex.com" OKEX_V3 = "okex.com_v3" OKEX_FUTURE = "okex.com_future" OKEX_SWAP = "okex.com_swap" HUOBI = "huobi.com" HUOBI_PRO = "huobi.pro" BITSTAMP = "bitstamp.net" KRAKEN = "kraken.com" ZB = "zb.com" BITFINEX = "bitfinex.com" BINANCE = "binance.com" BINANCE_SWAP = "binance.com_swap" POLONIEX = "poloniex.com" COINEX = "coinex.com" BITHUMB = "bithumb.com" GATEIO = "gate.io" BITTREX = "bittrex.com" GDAX = "gdax.com" BIGONE = "big.one" FCOIN = "fcoin.com" FCOIN_MARGIN = "fcoin.com_margin" FMEX = "fmex.com" HITBTC = "hitbtc.com" BITMEX = "bitmex.com" BITMEX_TEST = "testnet.bitmex.com" CRYPTOPIA = "cryptopia.co.nz" HBDM = "hbdm.com" COINBENE = "coinbene.com" ATOP = "a.top" )
exchanges const
View Source
const ( SUB_ACCOUNT = iota //子账户 SPOT // 币币交易 FUTURE //交割合约 C2C //法币 SPOT_MARGIN //币币杠杆交易 WALLET // 资金账户 TIPS //余币宝 SWAP //永续合约 )
Variables ¶
View Source
var ( API_ERR = ApiError{ErrCode: "EX_ERR_0000", ErrMsg: "unknown error"} HTTP_ERR_CODE = ApiError{ErrCode: "HTTP_ERR_0001", ErrMsg: "http request error"} EX_ERR_API_LIMIT = ApiError{ErrCode: "EX_ERR_1000", ErrMsg: "api limited"} EX_ERR_SIGN = ApiError{ErrCode: "EX_ERR_0001", ErrMsg: "signature error"} EX_ERR_NOT_FIND_SECRETKEY = ApiError{ErrCode: "EX_ERR_0002", ErrMsg: "not find secretkey"} EX_ERR_NOT_FIND_APIKEY = ApiError{ErrCode: "EX_ERR_0003", ErrMsg: "not find apikey"} EX_ERR_INSUFFICIENT_BALANCE = ApiError{ErrCode: "EX_ERR_0004", ErrMsg: "Insufficient Balance"} EX_ERR_PLACE_ORDER_FAIL = ApiError{ErrCode: "EX_ERR_0005", ErrMsg: "place order failure"} EX_ERR_CANCEL_ORDER_FAIL = ApiError{ErrCode: "EX_ERR_0006", ErrMsg: "cancel order failure"} EX_ERR_INVALID_CURRENCY_PAIR = ApiError{ErrCode: "EX_ERR_0007", ErrMsg: "invalid currency pair"} EX_ERR_NOT_FIND_ORDER = ApiError{ErrCode: "EX_ERR_0008", ErrMsg: "not find order"} EX_ERR_SYMBOL_ERR = ApiError{ErrCode: "EX_ERR_0009", ErrMsg: "symbol error"} )
View Source
var ( THIS_WEEK_CONTRACT = "this_week" //周合约 NEXT_WEEK_CONTRACT = "next_week" //次周合约 QUARTER_CONTRACT = "quarter" //季度合约 BI_QUARTER_CONTRACT = "bi_quarter" // NEXT QUARTER SWAP_CONTRACT = "swap" //永续合约 )
View Source
var ( UNKNOWN = Currency{"UNKNOWN", ""} USD = Currency{"USD", ""} USDT = Currency{"USDT", ""} BUSD = Currency{"BUSD", ""} PAX = Currency{"PAX", ""} USDC = Currency{"USDC", ""} EUR = Currency{"EUR", ""} KRW = Currency{"KRW", ""} BTC = Currency{"BTC", ""} XBT = Currency{"XBT", ""} BCC = Currency{"BCC", ""} BCH = Currency{"BCH", ""} BCX = Currency{"BCX", ""} LTC = Currency{"LTC", ""} ETH = Currency{"ETH", ""} ETC = Currency{"ETC", ""} EOS = Currency{"EOS", ""} BTS = Currency{"BTS", ""} QTUM = Currency{"QTUM", ""} SC = Currency{"SC", ""} ANS = Currency{"ANS", ""} ZEC = Currency{"ZEC", ""} DCR = Currency{"DCR", ""} XRP = Currency{"XRP", ""} BTG = Currency{"BTG", ""} BCD = Currency{"BCD", ""} NEO = Currency{"NEO", ""} HSR = Currency{"HSR", ""} BSV = Currency{"BSV", ""} OKB = Currency{"OKB", ""} HT = Currency{"HT", ""} BNB = Currency{"BNB", ""} TRX = Currency{"TRX", ""} XMR = Currency{"XMR", ""} )
supported token list
View Source
var ( BTC_KRW = TradingPair{BTC, KRW} ETH_KRW = TradingPair{ETH, KRW} ETC_KRW = TradingPair{ETC, KRW} LTC_KRW = TradingPair{LTC, KRW} BCH_KRW = TradingPair{BCH, KRW} BTC_USD = TradingPair{BTC, USD} LTC_USD = TradingPair{LTC, USD} ETH_USD = TradingPair{ETH, USD} ETC_USD = TradingPair{ETC, USD} BCH_USD = TradingPair{BCH, USD} BCC_USD = TradingPair{BCC, USD} XRP_USD = TradingPair{XRP, USD} BCD_USD = TradingPair{BCD, USD} EOS_USD = TradingPair{EOS, USD} BTG_USD = TradingPair{BTG, USD} BSV_USD = TradingPair{BSV, USD} BTC_USDT = TradingPair{BTC, USDT} LTC_USDT = TradingPair{LTC, USDT} BCH_USDT = TradingPair{BCH, USDT} BCC_USDT = TradingPair{BCC, USDT} ETC_USDT = TradingPair{ETC, USDT} ETH_USDT = TradingPair{ETH, USDT} BCD_USDT = TradingPair{BCD, USDT} NEO_USDT = TradingPair{NEO, USDT} EOS_USDT = TradingPair{EOS, USDT} XRP_USDT = TradingPair{XRP, USDT} HSR_USDT = TradingPair{HSR, USDT} BSV_USDT = TradingPair{BSV, USDT} OKB_USDT = TradingPair{OKB, USDT} HT_USDT = TradingPair{HT, USDT} BNB_USDT = TradingPair{BNB, USDT} PAX_USDT = TradingPair{PAX, USDT} TRX_USDT = TradingPair{TRX, USDT} BTC_BUSD = TradingPair{BTC, BUSD} LTC_BUSD = TradingPair{LTC, BUSD} BCH_BUSD = TradingPair{BCH, BUSD} BCC_BUSD = TradingPair{BCC, BUSD} ETC_BUSD = TradingPair{ETC, BUSD} ETH_BUSD = TradingPair{ETH, BUSD} BCD_BUSD = TradingPair{BCD, BUSD} NEO_BUSD = TradingPair{NEO, BUSD} EOS_BUSD = TradingPair{EOS, BUSD} XRP_BUSD = TradingPair{XRP, BUSD} HSR_BUSD = TradingPair{HSR, BUSD} BSV_BUSD = TradingPair{BSV, BUSD} OKB_BUSD = TradingPair{OKB, BUSD} HT_BUSD = TradingPair{HT, BUSD} BNB_BUSD = TradingPair{BNB, BUSD} PAX_BUSD = TradingPair{PAX, BUSD} TRX_BUSD = TradingPair{TRX, BUSD} XMR_BUSD = TradingPair{XMR, BUSD} LTC_BTC = TradingPair{LTC, BTC} ETH_BTC = TradingPair{ETH, BTC} ETC_BTC = TradingPair{ETC, BTC} BCC_BTC = TradingPair{BCC, BTC} BCH_BTC = TradingPair{BCH, BTC} DCR_BTC = TradingPair{DCR, BTC} XRP_BTC = TradingPair{XRP, BTC} BTG_BTC = TradingPair{BTG, BTC} BCD_BTC = TradingPair{BCD, BTC} NEO_BTC = TradingPair{NEO, BTC} EOS_BTC = TradingPair{EOS, BTC} HSR_BTC = TradingPair{HSR, BTC} BSV_BTC = TradingPair{BSV, BTC} OKB_BTC = TradingPair{OKB, BTC} HT_BTC = TradingPair{HT, BTC} BNB_BTC = TradingPair{BNB, BTC} TRX_BTC = TradingPair{TRX, BTC} ETC_ETH = TradingPair{ETC, ETH} EOS_ETH = TradingPair{EOS, ETH} ZEC_ETH = TradingPair{ZEC, ETH} NEO_ETH = TradingPair{NEO, ETH} HSR_ETH = TradingPair{HSR, ETH} LTC_ETH = TradingPair{LTC, ETH} UNKNOWN_PAIR = TradingPair{UNKNOWN, UNKNOWN} )
supported trading pair
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Exchange string Asset float64 //总资产 NetAsset float64 //净资产 SubAccounts map[Currency]SubAccount }
type BorrowParameter ¶
type BorrowParameter struct { CurrencyPair TradingPair Currency Currency Amount float64 }
type DepositWithdrawHistory ¶
type DepositWithdrawHistory struct { WithdrawalId string `json:"withdrawal_id,omitempty"` Currency string `json:"currency"` Txid string `json:"txid"` Amount float64 `json:"amount,string"` From string `json:"from,omitempty"` To string `json:"to"` Memo string `json:"memo,omitempty"` Fee string `json:"fee"` Status int `json:"status,string"` Timestamp time.Time `json:"timestamp"` }
type Depth ¶
type Depth struct { ContractType string `json:"contract_type,omitempty"` //for futures ContractId string `json:"contract_id,omitempty"` // for futures Pair TradingPair UTime time.Time AskList DepthRecords // Descending order BidList DepthRecords // Descending order }
type DepthRecord ¶
type DepthRecords ¶
type DepthRecords []DepthRecord
func (DepthRecords) Len ¶
func (dr DepthRecords) Len() int
func (DepthRecords) Less ¶
func (dr DepthRecords) Less(i, j int) bool
func (DepthRecords) Swap ¶
func (dr DepthRecords) Swap(i, j int)
type FutureAccount ¶
type FutureAccount struct {
FutureSubAccounts map[Currency]FutureSubAccount
}
type FutureKline ¶
type FutureOrder ¶
type FutureOrder struct { ClientOid string //自定义ID,GoEx内部自动生成 OrderID2 string //请尽量用这个字段替代OrderID字段 Price float64 Amount float64 AvgPrice float64 DealAmount float64 OrderID int64 //deprecated OrderTime int64 Status TradeStatus Currency TradingPair OrderType int //ORDINARY=0 POST_ONLY=1 FOK= 2 IOC= 3 OType int //1:开多 2:开空 3:平多 4: 平空 LeverRate float64 //倍数 Fee float64 //手续费 ContractName string FinishedTime int64 // finished timestamp //策略委托单 TriggerPrice float64 AlgoType int //1:限价 2:市场价;触发价格类型,默认是限价;为市场价时,委托价格不必填; }
type FuturePosition ¶
type FuturePosition struct { BuyAmount float64 BuyAvailable float64 BuyPriceAvg float64 BuyPriceCost float64 BuyProfitReal float64 CreateDate int64 LeverRate float64 SellAmount float64 SellAvailable float64 SellPriceAvg float64 SellPriceCost float64 SellProfitReal float64 Symbol TradingPair //btc_usd:比特币,ltc_usd:莱特币 ContractType string ContractId int64 ForceLiquPrice float64 //预估爆仓价 ShortPnlRatio float64 //空仓收益率 LongPnlRatio float64 //多仓收益率 }
type FutureSubAccount ¶
type FutureTicker ¶
type FuturesContractInfo ¶
type HistoricalFunding ¶
type KlinePeriod ¶
type KlinePeriod int
type LimitOrderOptionalParameter ¶
type LimitOrderOptionalParameter int
const ( PostOnly LimitOrderOptionalParameter = iota + 1 Ioc Fok )
func (LimitOrderOptionalParameter) String ¶
func (opt LimitOrderOptionalParameter) String() string
type MarginAccount ¶
type MarginAccount struct { Sub map[Currency]MarginSubAccount LiquidationPrice float64 RiskRate float64 MarginRatio float64 }
type MarginSubAccount ¶
type Order ¶
type Order struct { Price float64 Amount float64 AvgPrice float64 DealAmount float64 Fee float64 Cid string //客户端自定义ID OrderID2 string OrderID int //deprecated Status TradeStatus Currency TradingPair Side TradeSide Type string //limit / market OrderType int //0:default,1:maker,2:fok,3:ioc OrderTime int // create timestamp FinishedTime int64 //finished timestamp }
type OrderFeature ¶
type OrderFeature int
func (OrderFeature) String ¶
func (of OrderFeature) String() string
type RepaymentParameter ¶
type RepaymentParameter struct { BorrowParameter BorrowId string }
type SubAccount ¶
type TradeStatus ¶
type TradeStatus int
const ( ORDER_UNFINISH TradeStatus = iota ORDER_PART_FINISH ORDER_FINISH ORDER_CANCEL ORDER_REJECT ORDER_CANCEL_ING ORDER_FAIL )
func (TradeStatus) String ¶
func (ts TradeStatus) String() string
type TradingPair ¶
trading pair from A to B
func NewCurrencyPair ¶
func NewCurrencyPair(currencyA Currency, currencyB Currency) TradingPair
func NewCurrencyPair2 ¶
func NewCurrencyPair2(currencyPairSymbol string) TradingPair
func NewCurrencyPair3 ¶
func NewCurrencyPair3(currencyPairSymbol string, sep string) TradingPair
func (TradingPair) AdaptBccToBch ¶
func (pair TradingPair) AdaptBccToBch() TradingPair
func (TradingPair) AdaptBchToBcc ¶
func (pair TradingPair) AdaptBchToBcc() TradingPair
It is currently applicable to binance and zb
func (TradingPair) AdaptUsdToUsdt ¶
func (pair TradingPair) AdaptUsdToUsdt() TradingPair
func (TradingPair) AdaptUsdtToUsd ¶
func (pair TradingPair) AdaptUsdtToUsd() TradingPair
func (TradingPair) Equal ¶
func (c TradingPair) Equal(c2 TradingPair) bool
func (TradingPair) Reverse ¶
func (pair TradingPair) Reverse() TradingPair
func (TradingPair) String ¶
func (c TradingPair) String() string
func (TradingPair) ToLower ¶
func (pair TradingPair) ToLower() TradingPair
for to symbol lower , Not practical '==' operation method
func (TradingPair) ToSymbol ¶
func (pair TradingPair) ToSymbol(joinChar string) string
func (TradingPair) ToSymbol2 ¶
func (pair TradingPair) ToSymbol2(joinChar string) string
type TransferParameter ¶
Click to show internal directories.
Click to hide internal directories.