Documentation ¶
Index ¶
- Constants
- Variables
- 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
- type APIConfig
- type Account
- type ApiError
- type BorrowParameter
- type Currency
- type CurrencyPair
- func (pair CurrencyPair) AdaptBccToBch() CurrencyPair
- func (pair CurrencyPair) AdaptBchToBcc() CurrencyPair
- func (pair CurrencyPair) AdaptUsdToUsdt() CurrencyPair
- func (pair CurrencyPair) AdaptUsdtToUsd() CurrencyPair
- func (c CurrencyPair) Eq(c2 CurrencyPair) bool
- func (pair CurrencyPair) Reverse() CurrencyPair
- func (c CurrencyPair) String() string
- func (pair CurrencyPair) ToLower() CurrencyPair
- func (pair CurrencyPair) ToSymbol(joinChar string) string
- func (pair CurrencyPair) ToSymbol2(joinChar string) string
- type Depth
- type DepthRecord
- type DepthRecords
- type FutureAccount
- type FutureKline
- type FutureOrder
- type FuturePosition
- type FutureRestAPI
- type FutureSubAccount
- type FutureTicker
- type Kline
- type KlinePeriod
- type MarginAccount
- type MarginSubAccount
- type OderType
- type Order
- type OrderType
- type RepaymentParameter
- type SubAccount
- type Ticker
- type Trade
- type TradeSide
- type TradeStatus
- type 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
- type WsConn
- 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()
Constants ¶
View Source
const ( BUY = 1 + iota SELL BUY_MARKET SELL_MARKET )
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_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_TYPE_LIMIT = 1 + iota ORDER_TYPE_MARKET ORDER_TYPE_FOK ORDER_TYPE_FAK ORDER_TYPE_POST_ONLY ORDER_TYPE_IOC = ORDER_TYPE_FAK )
View Source
const ( OKCOIN_CN = "okcoin.cn" 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" POLONIEX = "poloniex.com" COINEX = "coinex.com" BITHUMB = "bithumb.com" GATEIO = "gate.io" BITTREX = "bittrex.com" GDAX = "gdax.com" WEX_NZ = "wex.nz" BIGONE = "big.one" COIN58 = "58coin.com" FCOIN = "fcoin.com" HITBTC = "hitbtc.com" BITMEX = "bitmex.com" CRYPTOPIA = "cryptopia.co.nz" HBDM = "hbdm.com" )
exchanges const
View Source
const ( ORDINARY = 0 // normal order POST_ONLY = 1 // only maker FOK = 2 // fill or kill IOC = 3 // Immediate or Cancel )
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" //季度合约 SWAP_CONTRACT = "swap" //永续合约 )
View Source
var ( UNKNOWN = Currency{"UNKNOWN", ""} CNY = Currency{"CNY", ""} USD = Currency{"USD", ""} USDT = Currency{"USDT", ""} PAX = Currency{"PAX", "https://www.paxos.com/"} USDC = Currency{"USDC", "https://www.centre.io/"} EUR = Currency{"EUR", ""} KRW = Currency{"KRW", ""} JPY = Currency{"JPY", ""} BTC = Currency{"BTC", "https://bitcoin.org/"} 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", "OKB is a global utility token issued by OK Blockchain Foundation"} HT = Currency{"HT", "HuoBi Token"} BNB = Currency{"BNB", "BNB, or Binance Coin, is a cryptocurrency created by Binance."} BTC_CNY = CurrencyPair{BTC, CNY} LTC_CNY = CurrencyPair{LTC, CNY} BCC_CNY = CurrencyPair{BCC, CNY} ETH_CNY = CurrencyPair{ETH, CNY} ETC_CNY = CurrencyPair{ETC, CNY} EOS_CNY = CurrencyPair{EOS, CNY} BTS_CNY = CurrencyPair{BTS, CNY} QTUM_CNY = CurrencyPair{QTUM, CNY} SC_CNY = CurrencyPair{SC, CNY} ANS_CNY = CurrencyPair{ANS, CNY} ZEC_CNY = CurrencyPair{ZEC, CNY} BTC_KRW = CurrencyPair{BTC, KRW} ETH_KRW = CurrencyPair{ETH, KRW} ETC_KRW = CurrencyPair{ETC, KRW} LTC_KRW = CurrencyPair{LTC, KRW} BCH_KRW = CurrencyPair{BCH, KRW} BTC_USD = CurrencyPair{BTC, USD} LTC_USD = CurrencyPair{LTC, USD} ETH_USD = CurrencyPair{ETH, USD} ETC_USD = CurrencyPair{ETC, USD} BCH_USD = CurrencyPair{BCH, USD} BCC_USD = CurrencyPair{BCC, USD} XRP_USD = CurrencyPair{XRP, USD} BCD_USD = CurrencyPair{BCD, USD} EOS_USD = CurrencyPair{EOS, USD} BTG_USD = CurrencyPair{BTG, USD} BSV_USD = CurrencyPair{BSV, USD} BTC_USDT = CurrencyPair{BTC, USDT} LTC_USDT = CurrencyPair{LTC, USDT} BCH_USDT = CurrencyPair{BCH, USDT} BCC_USDT = CurrencyPair{BCC, USDT} ETC_USDT = CurrencyPair{ETC, USDT} ETH_USDT = CurrencyPair{ETH, USDT} BCD_USDT = CurrencyPair{BCD, USDT} NEO_USDT = CurrencyPair{NEO, USDT} EOS_USDT = CurrencyPair{EOS, USDT} XRP_USDT = CurrencyPair{XRP, USDT} HSR_USDT = CurrencyPair{HSR, USDT} BSV_USDT = CurrencyPair{BSV, USDT} OKB_USDT = CurrencyPair{OKB, USDT} HT_USDT = CurrencyPair{HT, USDT} BNB_USDT = CurrencyPair{BNB, USDT} XRP_EUR = CurrencyPair{XRP, EUR} BTC_JPY = CurrencyPair{BTC, JPY} LTC_JPY = CurrencyPair{LTC, JPY} ETH_JPY = CurrencyPair{ETH, JPY} ETC_JPY = CurrencyPair{ETC, JPY} BCH_JPY = CurrencyPair{BCH, JPY} LTC_BTC = CurrencyPair{LTC, BTC} ETH_BTC = CurrencyPair{ETH, BTC} ETC_BTC = CurrencyPair{ETC, BTC} BCC_BTC = CurrencyPair{BCC, BTC} BCH_BTC = CurrencyPair{BCH, BTC} DCR_BTC = CurrencyPair{DCR, BTC} XRP_BTC = CurrencyPair{XRP, BTC} BTG_BTC = CurrencyPair{BTG, BTC} BCD_BTC = CurrencyPair{BCD, BTC} NEO_BTC = CurrencyPair{NEO, BTC} EOS_BTC = CurrencyPair{EOS, BTC} HSR_BTC = CurrencyPair{HSR, BTC} BSV_BTC = CurrencyPair{BSV, BTC} OKB_BTC = CurrencyPair{OKB, BTC} HT_BTC = CurrencyPair{HT, BTC} BNB_BTC = CurrencyPair{BNB, BTC} ETC_ETH = CurrencyPair{ETC, ETH} EOS_ETH = CurrencyPair{EOS, ETH} ZEC_ETH = CurrencyPair{ZEC, ETH} NEO_ETH = CurrencyPair{NEO, ETH} HSR_ETH = CurrencyPair{HSR, ETH} LTC_ETH = CurrencyPair{LTC, ETH} UNKNOWN_PAIR = CurrencyPair{UNKNOWN, UNKNOWN} )
Functions ¶
func CancelAllUnfinishedFutureOrders ¶
func CancelAllUnfinishedFutureOrders(api FutureRestAPI, contractType string, currencyPair CurrencyPair) int
*
- call all unfinished future orders
- @return c 成功撤单数量
func CancelAllUnfinishedOrders ¶
func CancelAllUnfinishedOrders(api API, currencyPair CurrencyPair) int
*
- call all unfinished orders
func FloatToString ¶
n :保留的小数点位数,去除末尾多余的0(StripTrailingZeros)
func GetParamHmacSHA256Base64Sign ¶
func GetParamHmacSHA512Base64Sign ¶
func GetParamHmacSha384Sign ¶
for bitfinex.com
func HttpDeleteForm ¶
func HttpGet2 ¶
func HttpGet3 ¶
func HttpGet4 ¶
func HttpGet5 ¶
func HttpPostForm ¶
func HttpPostForm2 ¶
func HttpPostForm3 ¶
func HttpPostForm4 ¶
func NewHttpRequest ¶
func RE ¶
*
本函数只适合,返回两个参数的API重试调用,其中一个参数必须是error @retry 重试次数 @delay 每次重试延迟时间间隔 @method 调用的函数,比如: api.GetTicker ,注意:不是api.GetTicker(...) @params 参数,顺序一定要按照实际调用函数入参顺序一样 @return 返回
Types ¶
type API ¶
type API interface { LimitBuy(amount, price string, currency CurrencyPair) (*Order, error) LimitSell(amount, price string, currency CurrencyPair) (*Order, error) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error) MarketSell(amount, price string, currency CurrencyPair) (*Order, error) CancelOrder(orderId string, currency CurrencyPair) (bool, error) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error) GetUnfinishOrders(currency CurrencyPair) ([]Order, error) GetOrderHistorys(currency CurrencyPair, currentPage, pageSize int) ([]Order, error) GetAccount() (*Account, error) GetTicker(currency CurrencyPair) (*Ticker, error) GetDepth(size int, currency CurrencyPair) (*Depth, error) GetKlineRecords(currency CurrencyPair, period, size, since int) ([]Kline, error) //非个人,整个交易所的交易记录 GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error) GetExchangeName() string }
type APIConfig ¶
type Account ¶
type Account struct { Exchange string Asset float64 //总资产 NetAsset float64 //净资产 SubAccounts map[Currency]SubAccount }
type BorrowParameter ¶
type BorrowParameter struct { CurrencyPair CurrencyPair Currency Currency Amount float64 }
type Currency ¶
type CurrencyPair ¶
A->B(A兑换为B)
func NewCurrencyPair ¶
func NewCurrencyPair(currencyA Currency, currencyB Currency) CurrencyPair
func NewCurrencyPair2 ¶
func NewCurrencyPair2(currencyPairSymbol string) CurrencyPair
func (CurrencyPair) AdaptBccToBch ¶
func (pair CurrencyPair) AdaptBccToBch() CurrencyPair
func (CurrencyPair) AdaptBchToBcc ¶
func (pair CurrencyPair) AdaptBchToBcc() CurrencyPair
It is currently applicable to binance and zb
func (CurrencyPair) AdaptUsdToUsdt ¶
func (pair CurrencyPair) AdaptUsdToUsdt() CurrencyPair
func (CurrencyPair) AdaptUsdtToUsd ¶
func (pair CurrencyPair) AdaptUsdtToUsd() CurrencyPair
func (CurrencyPair) Eq ¶
func (c CurrencyPair) Eq(c2 CurrencyPair) bool
func (CurrencyPair) Reverse ¶
func (pair CurrencyPair) Reverse() CurrencyPair
func (CurrencyPair) String ¶
func (c CurrencyPair) String() string
func (CurrencyPair) ToLower ¶
func (pair CurrencyPair) ToLower() CurrencyPair
for to symbol lower , Not practical '==' operation method
func (CurrencyPair) ToSymbol ¶
func (pair CurrencyPair) ToSymbol(joinChar string) string
func (CurrencyPair) ToSymbol2 ¶
func (pair CurrencyPair) ToSymbol2(joinChar string) string
type Depth ¶
type Depth struct { ContractType string //for future Pair CurrencyPair UTime time.Time AskList DepthRecords // Descending order BidList DepthRecords // Descending order }
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 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 CurrencyPair OrderType int //ORDINARY=0 POST_ONLY=1 FOK= 2 IOC= 3 OType int //1:开多 2:开空 3:平多 4: 平空 LeverRate int //倍数 Fee float64 //手续费 ContractName string }
type FuturePosition ¶
type FuturePosition struct { BuyAmount float64 BuyAvailable float64 BuyPriceAvg float64 BuyPriceCost float64 BuyProfitReal float64 CreateDate int64 LeverRate int SellAmount float64 SellAvailable float64 SellPriceAvg float64 SellPriceCost float64 SellProfitReal float64 Symbol CurrencyPair //btc_usd:比特币,ltc_usd:莱特币 ContractType string ContractId int64 ForceLiquPrice float64 //预估爆仓价 }
type FutureRestAPI ¶
type FutureRestAPI interface { /** *获取交易所名字 */ GetExchangeName() string /** *获取交割预估价 */ GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error) /** * 期货行情 * @param currency_pair btc_usd:比特币 ltc_usd :莱特币 * @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度 */ GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error) /** * 期货深度 * @param currencyPair btc_usd:比特币 ltc_usd :莱特币 * @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度 * @param size 获取深度档数 * @return */ GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error) /** * 期货指数 * @param currencyPair btc_usd:比特币 ltc_usd :莱特币 */ GetFutureIndex(currencyPair CurrencyPair) (float64, error) /** *全仓账户 */ GetFutureUserinfo() (*FutureAccount, error) /** * @deprecated * 期货下单 * @param currencyPair btc_usd:比特币 ltc_usd :莱特币 * @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度 * @param price 价格 * @param amount 委托数量 * @param openType 1:开多 2:开空 3:平多 4:平空 * @param matchPrice 是否为对手价 0:不是 1:是 ,当取值为1时,price无效 */ PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice, leverRate int) (string, error) /** * 取消订单 * @param symbol btc_usd:比特币 ltc_usd :莱特币 * @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度 * @param orderId 订单ID */ FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error) /** * 用户持仓查询 * @param symbol btc_usd:比特币 ltc_usd :莱特币 * @param contractType 合约类型: this_week:当周 next_week:下周 month:当月 quarter:季度 * @return */ GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error) /** *获取订单信息 */ GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error) /** *获取单个订单信息 */ GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error) /** *获取未完成订单信息 */ GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error) /** *获取交易费 */ GetFee() (float64, error) /** *获取每张合约价值 */ GetContractValue(currencyPair CurrencyPair) (float64, error) /** *获取交割时间 星期(0,1,2,3,4,5,6),小时,分,秒 */ GetDeliveryTime() (int, int, int, int) /** * 获取K线数据 */ GetKlineRecords(contract_type string, currency CurrencyPair, period, size, since int) ([]FutureKline, error) /** * 获取Trade数据 */ GetTrades(contract_type string, currencyPair CurrencyPair, since int64) ([]Trade, error) }
type FutureSubAccount ¶
type FutureTicker ¶
type Kline ¶
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 OrderTime int Status TradeStatus Currency CurrencyPair Side TradeSide Type string //limit / market OrderType int //0:default,1:maker,2:fok,3:ioc }
type RepaymentParameter ¶
type RepaymentParameter struct { BorrowParameter BorrowId string }
type SubAccount ¶
type Ticker ¶
type Ticker struct { Pair CurrencyPair `json:"-"` Last float64 `json:"last,string"` Buy float64 `json:"buy,string"` Sell float64 `json:"sell,string"` High float64 `json:"high,string"` Low float64 `json:"low,string"` Vol float64 `json:"vol,string"` Open float64 `json:"open,string"` Date uint64 `json:"date"` // 单位:ms }
type Trade ¶
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 WsBuilder ¶
type WsBuilder struct {
// contains filtered or unexported fields
}
func (*WsBuilder) ErrorHandleFunc ¶
func (*WsBuilder) Heartbeat ¶
func (*WsBuilder) Heartbeat2 ¶
func (*WsBuilder) ProtoHandleFunc ¶
func (*WsBuilder) ReconnectIntervalTime ¶
func (*WsBuilder) UnCompressFunc ¶
type WsConfig ¶
type WsConfig struct { WsUrl string ProxyUrl string ReqHeaders map[string][]string //连接的时候加入的头部信息 HeartbeatIntervalTime time.Duration // HeartbeatData []byte //心跳数据 HeartbeatFunc func() interface{} //心跳数据2 ReconnectIntervalTime time.Duration //定时重连时间间隔 ProtoHandleFunc func([]byte) error //协议处理函数 UnCompressFunc func([]byte) ([]byte, error) //解压函数 ErrorHandleFunc func(err error) IsDump bool }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.