Huobi: V2 subscription support (#1703)

* Huobi: assertify tests

* Testing: Add FixtureToDataHandlerWithErrors

* Huobi: Add V2 websocket support

* Huobi: Fix tests racing on updatePairsOnce

* Huobi: Remove unnecessary funnelData

* Huobi: Clarify V1/V2 pings

* Huobi: Switch to types.Time

* Huobi: Disable websocket Futures and CoinMarginedFutures support

* Huobi: Fix test failures on futureContracts

Per-instance future codes not getting cached causin occassional fails

* Huobi: Fix idiosyncratic naming using TestWs instead of TestWS

* Huobi: Run WS tests in parallel
This commit is contained in:
Gareth Kirwan
2025-02-19 05:42:25 +00:00
committed by GitHub
parent 08e015a125
commit dc2d7770fb
17 changed files with 1900 additions and 3100 deletions

View File

@@ -1,5 +1,7 @@
package huobi
import "github.com/thrasher-corp/gocryptotrader/types"
// WsSwapReqKline stores req kline data for swap websocket
type WsSwapReqKline struct {
Rep string `json:"rep"`
@@ -19,22 +21,22 @@ type WsSwapReqKline struct {
// WsSwapReqTradeDetail stores requested trade detail data for swap websocket
type WsSwapReqTradeDetail struct {
Rep string `json:"rep"`
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Rep string `json:"rep"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Data []struct {
ID int64 `json:"id"`
Price float64 `json:"price"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
Timestamp int64 `json:"ts"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
Timestamp types.Time `json:"ts"`
} `json:"data"`
}
// SwapWsSubPremiumKline stores subscribed premium kline data for futures websocket
type SwapWsSubPremiumKline struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
Volume float64 `json:"vol"`
@@ -49,10 +51,10 @@ type SwapWsSubPremiumKline struct {
// SwapWsReqPremiumKline stores requested premium kline data for futures websocket
type SwapWsReqPremiumKline struct {
Rep string `json:"rep"`
ID string `json:"id"`
WsID int64 `json:"wsid"`
Timestamp int64 `json:"ts"`
Rep string `json:"rep"`
ID string `json:"id"`
WsID int64 `json:"wsid"`
Timestamp types.Time `json:"ts"`
Data []struct {
Volume float64 `json:"vol"`
Count float64 `json:"count"`
@@ -67,8 +69,8 @@ type SwapWsReqPremiumKline struct {
// SwapWsSubEstimatedFunding stores estimated funding rate data for swap websocket
type SwapWsSubEstimatedFunding struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
Volume float64 `json:"vol,string"`
@@ -83,10 +85,10 @@ type SwapWsSubEstimatedFunding struct {
// SwapWsReqEstimatedFunding stores requested estimated funding data for swap websocket
type SwapWsReqEstimatedFunding struct {
Rep string `json:"rep"`
ID string `json:"id"`
WsID int64 `json:"wsid"`
Timestamp int64 `json:"ts"`
Rep string `json:"rep"`
ID string `json:"id"`
WsID int64 `json:"wsid"`
Timestamp types.Time `json:"ts"`
Data []struct {
Volume float64 `json:"vol,string"`
Count float64 `json:"count,string"`
@@ -101,8 +103,8 @@ type SwapWsReqEstimatedFunding struct {
// SwapWsSubBasisData stores subscribed basis data for swap websocket
type SwapWsSubBasisData struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick []struct {
ID int64 `json:"id"`
ContractPrice float64 `json:"contract_price,string"`
@@ -114,10 +116,10 @@ type SwapWsSubBasisData struct {
// SwapWsReqBasisData stores requested basis data for swap websocket
type SwapWsReqBasisData struct {
Rep string `json:"rep"`
ID string `json:"id"`
WsID int64 `json:"wsid"`
Timestamp int64 `json:"ts"`
Rep string `json:"rep"`
ID string `json:"id"`
WsID int64 `json:"wsid"`
Timestamp types.Time `json:"ts"`
Data []struct {
ID int64 `json:"id"`
ContractPrice float64 `json:"contract_price"`
@@ -129,33 +131,33 @@ type SwapWsReqBasisData struct {
// SwapWsSubOrderData stores subscribed order data for swap websocket
type SwapWsSubOrderData struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
Status int64 `json:"status"`
LeverateRate float64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
OrderSource string `json:"order_source"`
OrderType int64 `json:"order_type"`
CreatedAt int64 `json:"created_at"`
CanceledAt int64 `json:"canceled_at"`
TradeVolume float64 `json:"trade_volume"`
TradeTurnover float64 `json:"trade_turnover"`
Fee float64 `json:"fee"`
FeeAsset string `json:"fee_asset"`
TradeAvgPrice float64 `json:"trade_avg_price"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
Status int64 `json:"status"`
LeverateRate float64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
OrderSource string `json:"order_source"`
OrderType int64 `json:"order_type"`
CreatedAt int64 `json:"created_at"`
CanceledAt int64 `json:"canceled_at"`
TradeVolume float64 `json:"trade_volume"`
TradeTurnover float64 `json:"trade_turnover"`
Fee float64 `json:"fee"`
FeeAsset string `json:"fee_asset"`
TradeAvgPrice float64 `json:"trade_avg_price"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
Trade []struct {
ID string `json:"id"`
TradeID int64 `json:"trade_id"`
@@ -172,19 +174,19 @@ type SwapWsSubOrderData struct {
// SwapWsSubMatchOrderData stores subscribed match order data for swap websocket
type SwapWsSubMatchOrderData struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Status int64 `json:"status"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
OrderType string `json:"order_type"`
TradeVolume int64 `json:"trade_volume"`
Volume float64 `json:"volume"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Status int64 `json:"status"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
OrderType string `json:"order_type"`
TradeVolume int64 `json:"trade_volume"`
Volume float64 `json:"volume"`
Trade []struct {
ID string `json:"id"`
TradeID int64 `json:"trade_id"`
@@ -198,11 +200,11 @@ type SwapWsSubMatchOrderData struct {
// SwapWsSubEquityData stores subscribed account data for swap account equity updates through websocket
type SwapWsSubEquityData struct {
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp int64 `json:"ts"`
UID string `json:"uid"`
Event string `json:"event"`
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp types.Time `json:"ts"`
UID string `json:"uid"`
Event string `json:"event"`
Data []struct {
Symbol string `json:"symbol"`
MarginBalance float64 `json:"margin_balance"`
@@ -222,11 +224,11 @@ type SwapWsSubEquityData struct {
// SwapWsSubPositionUpdates stores subscribed position updates data for swap websocket
type SwapWsSubPositionUpdates struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Event string `json:"event"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Event string `json:"event"`
Data []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -247,9 +249,9 @@ type SwapWsSubPositionUpdates struct {
// SwapWsSubLiquidationOrders stores subscribed liquidation orders data for swap futures
type SwapWsSubLiquidationOrders struct {
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp int64 `json:"ts"`
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp types.Time `json:"ts"`
OrdersData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -263,9 +265,9 @@ type SwapWsSubLiquidationOrders struct {
// SwapWsSubFundingData stores funding rate data for swap websocket
type SwapWsSubFundingData struct {
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp int64 `json:"ts"`
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp types.Time `json:"ts"`
FundingData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -279,10 +281,10 @@ type SwapWsSubFundingData struct {
// SwapWsSubContractInfo stores funding rate data for swap websocket
type SwapWsSubContractInfo struct {
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp int64 `json:"ts"`
Event string `json:"event"`
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp types.Time `json:"ts"`
Event string `json:"event"`
ContractData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -330,9 +332,9 @@ type SwapWsSubTriggerOrderUpdates struct {
// SwapIndexPriceData gets price of a perpetual swap
type SwapIndexPriceData struct {
Data []struct {
ContractCode string `json:"contract_code"`
IndexPrice float64 `json:"index_price"`
IndexTimestamp int64 `json:"index_ts"`
ContractCode string `json:"contract_code"`
IndexPrice float64 `json:"index_price"`
IndexTimestamp types.Time `json:"index_ts"`
} `json:"data"`
}
@@ -364,7 +366,7 @@ type SwapMarketDepthData struct {
Channel string `json:"ch"`
ID int64 `json:"id"`
MRID int64 `json:"mrid"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Version int64 `json:"version"`
} `json:"tick"`
}
@@ -372,14 +374,14 @@ type SwapMarketDepthData struct {
// SwapKlineData stores kline data for perpetual swaps
type SwapKlineData struct {
Data []struct {
Volume float64 `json:"vol"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
IDTimestamp int64 `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Amount float64 `json:"amount"`
Volume float64 `json:"vol"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
IDTimestamp types.Time `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Amount float64 `json:"amount"`
} `json:"data"`
}
@@ -387,17 +389,17 @@ type SwapKlineData struct {
type MarketOverviewData struct {
Channel string `json:"ch"`
Tick struct {
Vol float64 `json:"vol,string"`
Ask []float64 `json:"ask"`
Bid []float64 `json:"bid"`
Close float64 `json:"close,string"`
Count float64 `json:"count"`
High float64 `json:"high,string"`
ID int64 `json:"id"`
Low float64 `json:"low,string"`
Open float64 `json:"open,string"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount,string"`
Vol float64 `json:"vol,string"`
Ask []float64 `json:"ask"`
Bid []float64 `json:"bid"`
Close float64 `json:"close,string"`
Count float64 `json:"count"`
High float64 `json:"high,string"`
ID int64 `json:"id"`
Low float64 `json:"low,string"`
Open float64 `json:"open,string"`
Timestamp types.Time `json:"ts"`
Amount float64 `json:"amount,string"`
} `json:"tick"`
}
@@ -406,11 +408,11 @@ type LastTradeData struct {
Ch string `json:"ch"`
Tick struct {
Data []struct {
Amount float64 `json:"amount,string"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price,string"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount,string"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price,string"`
Timestamp types.Time `json:"ts"`
} `json:"data"`
} `json:"tick"`
}
@@ -418,17 +420,17 @@ type LastTradeData struct {
// BatchTradesData stores batch trades for a given swap contract
type BatchTradesData struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []CoinMarginedFuturesTrade `json:"data"`
}
// CoinMarginedFuturesTrade holds coinmarginedfutures trade data
type CoinMarginedFuturesTrade struct {
Amount float64 `json:"amount"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Timestamp types.Time `json:"ts"`
}
// InsuranceAndClawbackData stores insurance fund's and clawback rate's data
@@ -447,8 +449,8 @@ type HistoricalInsuranceFundBalance struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Tick []struct {
InsuranceFund float64 `json:"insurance_fund"`
Timestamp int64 `json:"ts"`
InsuranceFund float64 `json:"insurance_fund"`
Timestamp types.Time `json:"ts"`
} `json:"tick"`
TotalPage int64 `json:"total_page"`
TotalSize int64 `json:"total_size"`
@@ -479,9 +481,9 @@ type OpenInterestData struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
Tick []struct {
Volume float64 `json:"volume"`
AmountType float64 `json:"amountType"`
Timestamp int64 `json:"ts"`
Volume float64 `json:"volume"`
AmountType float64 `json:"amountType"`
Timestamp types.Time `json:"ts"`
} `json:"tick"`
} `json:"data"`
}
@@ -507,10 +509,10 @@ type TraderSentimentIndexAccountData struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
List []struct {
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
LockedRatio float64 `json:"locked_ratio"`
Timestamp int64 `json:"ts"`
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
LockedRatio float64 `json:"locked_ratio"`
Timestamp types.Time `json:"ts"`
} `json:"list"`
} `json:"data"`
}
@@ -521,9 +523,9 @@ type TraderSentimentIndexPositionData struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
List []struct {
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
Timestamp int64 `json:"ts"`
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
Timestamp types.Time `json:"ts"`
} `json:"list"`
} `json:"data"`
}
@@ -594,7 +596,7 @@ type PremiumIndexKlineData struct {
Open float64 `json:"open,string"`
Amount float64 `json:"amount,string"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// EstimatedFundingRateData stores estimated funding rate data
@@ -610,7 +612,7 @@ type EstimatedFundingRateData struct {
Open float64 `json:"open"`
Amount float64 `json:"amount"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// BasisData stores basis data for swaps
@@ -623,7 +625,7 @@ type BasisData struct {
ID int64 `json:"id"`
IndexPrice string `json:"index_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// SwapAccountInformation stores swap account information
@@ -668,7 +670,7 @@ type SwapPositionInfo struct {
// SwapAssetsAndPositionsData stores positions and assets data for swaps
type SwapAssetsAndPositionsData struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -705,7 +707,7 @@ type SwapAssetsAndPositionsData struct {
// SubAccountsAssetData stores asset data for all subaccounts
type SubAccountsAssetData struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []struct {
SubUID int64 `json:"sub_uid"`
List []struct {
@@ -720,7 +722,7 @@ type SubAccountsAssetData struct {
// SingleSubAccountAssetsInfo stores asset info for a single subaccount
type SingleSubAccountAssetsInfo struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -741,7 +743,7 @@ type SingleSubAccountAssetsInfo struct {
// SingleSubAccountPositionsInfo stores single subaccount's positions data
type SingleSubAccountPositionsInfo struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -766,19 +768,19 @@ type AvailableLeverageData struct {
ContractCode string `json:"contract_code"`
AvailableLeverage string `json:"available_level_rate"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
Timestamp types.Time `json:"timestamp"`
}
// FinancialRecordData stores an accounts financial records
type FinancialRecordData struct {
Data struct {
FinancialRecord []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
OrderType int64 `json:"type"`
Amount float64 `json:"amount"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
OrderType int64 `json:"type"`
Amount float64 `json:"amount"`
} `json:"financial_record"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
@@ -797,7 +799,7 @@ type SwapOrderLimitInfo struct {
CloseLimit float64 `json:"close_limit"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// SwapTradingFeeData stores trading fee data for swaps
@@ -811,7 +813,7 @@ type SwapTradingFeeData struct {
CloseMakerFee float64 `json:"close_maker_fee,string"`
CloseTakerFee float64 `json:"close_taker_fee,string"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// TransferLimitData stores transfer limits
@@ -830,7 +832,7 @@ type TransferLimitData struct {
NetTransferInMaxDaily float64 `json:"net_transfer_in_max_daily"`
NetTransferOutMaxDaily float64 `json:"net_transfer_out_max_daily"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
Timestamp types.Time `json:"timestamp"`
}
// PositionLimitData stores position limit data
@@ -841,7 +843,7 @@ type PositionLimitData struct {
BuyLimit float64 `json:"buy_limit"`
SellLimit float64 `json:"sell_limit"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// InternalAccountTransferData stores transfer data between subaccounts and main account
@@ -854,16 +856,16 @@ type InternalAccountTransferData struct {
// InternalAccountTransferRecords stores data for transfer records within the account
type InternalAccountTransferRecords struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data struct {
TransferRecord []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
SubUID int64 `json:"sub_uid"`
SubAccountName string `json:"sub_account_name"`
TransferType int64 `json:"transfer_type"`
Amount float64 `json:"amount"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
SubUID int64 `json:"sub_uid"`
SubAccountName string `json:"sub_account_name"`
TransferType int64 `json:"transfer_type"`
Amount float64 `json:"amount"`
} `json:"transfer_record"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
@@ -878,7 +880,7 @@ type SwapOrderData struct {
OrderIDString string `json:"order_id_string"`
ClientOrderID int64 `json:"client_order_id"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// BatchOrderData stores data for batch orders
@@ -895,7 +897,7 @@ type BatchOrderData struct {
OrderIDString string `json:"order_id_str"`
} `json:"success"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// BatchOrderRequestType stores batch order request data
@@ -921,8 +923,8 @@ type CancelOrdersData struct {
ErrCode int64 `json:"err_code"`
ErrMsg string `json:"err_msg"`
} `json:"errors"`
Successes string `json:"successes"`
Timestamp int64 `json:"ts"`
Successes string `json:"successes"`
Timestamp types.Time `json:"ts"`
}
// LightningCloseOrderData stores order data from a lightning close order
@@ -932,7 +934,7 @@ type LightningCloseOrderData struct {
OrderIDString string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
}
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// SwapOrderInfo stores info for swap orders
@@ -962,7 +964,7 @@ type SwapOrderInfo struct {
FeeAsset float64 `json:"fee_asset"`
LiquidationType int64 `json:"liquidation_type"`
}
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// OrderDetailData acquires order details
@@ -1006,7 +1008,7 @@ type OrderDetailData struct {
TotalSize int64 `json:"total_size"`
CurrentPage int64 `json:"current_page"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// SwapOpenOrdersData stores open orders data for swaps
@@ -1039,7 +1041,7 @@ type SwapOpenOrdersData struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// SwapOrderHistory gets order history for swaps
@@ -1073,7 +1075,7 @@ type SwapOrderHistory struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// AccountTradeHistoryData stores account trade history for swaps
@@ -1102,7 +1104,7 @@ type AccountTradeHistoryData struct {
FeeAsset string `json:"fee_asset"`
} `json:"trades"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// TriggerOrderData stores trigger order data
@@ -1123,7 +1125,7 @@ type CancelTriggerOrdersData struct {
} `json:"errors"`
Successes string `json:"successes"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// TriggerOpenOrdersData stores trigger open orders data
@@ -1151,7 +1153,7 @@ type TriggerOpenOrdersData struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// TriggerOrderHistory stores trigger order history data for swaps
@@ -1186,7 +1188,7 @@ type TriggerOrderHistory struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// TransferMarginBetweenAccountsData stores margin transfer data between spot and swap accounts

View File

@@ -1,18 +1,20 @@
package huobi
import "github.com/thrasher-corp/gocryptotrader/types"
// FContractInfoData gets contract info data for futures
type FContractInfoData struct {
Data []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
ContractSize float64 `json:"contract_size"`
PriceTick float64 `json:"price_tick"`
DeliveryDate string `json:"delivery_date"`
DeliveryTime int64 `json:"delivery_time,string"`
CreateDate string `json:"create_date"`
ContractStatus int64 `json:"contract_status"`
SettlementTime int64 `json:"settlement_time,string"`
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
ContractSize float64 `json:"contract_size"`
PriceTick float64 `json:"price_tick"`
DeliveryDate string `json:"delivery_date"`
DeliveryTime types.Time `json:"delivery_time"`
CreateDate string `json:"create_date"`
ContractStatus int64 `json:"contract_status"`
SettlementTime types.Time `json:"settlement_time"`
}
}
@@ -22,7 +24,7 @@ type FContractIndexPriceInfo struct {
Symbol string `json:"symbol"`
IndexPrice float64 `json:"index_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FContractPriceLimits gets limits for futures contracts
@@ -34,13 +36,13 @@ type FContractPriceLimits struct {
ContractCode string `json:"contract_code"`
ContractType string `json:"contract_type"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FContractOIData stores open interest data for futures contracts
type FContractOIData struct {
Data []UContractOpenInterest `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// UContractOpenInterest stores open interest data for futures contracts
@@ -63,19 +65,19 @@ type FEstimatedDeliveryPriceInfo struct {
Data struct {
DeliveryPrice float64 `json:"delivery_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FMarketDepth gets orderbook data for futures
type FMarketDepth struct {
Ch string `json:"ch"`
Timestamp int64 `json:"ts"`
Ch string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
MRID int64 `json:"mrid"`
ID int64 `json:"id"`
Bids [][2]float64 `json:"bids"`
Asks [][2]float64 `json:"asks"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Version int64 `json:"version"`
Ch string `json:"ch"`
} `json:"tick"`
@@ -97,16 +99,16 @@ type obItem struct {
type FKlineData struct {
Ch string `json:"ch"`
Data []struct {
Volume float64 `json:"vol"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
IDTimestamp int64 `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Amount float64 `json:"amount"`
Volume float64 `json:"vol"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
IDTimestamp types.Time `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Amount float64 `json:"amount"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FMarketOverviewData stores overview data for futures
@@ -116,16 +118,16 @@ type FMarketOverviewData struct {
Vol float64 `json:"vol,string"`
Ask [2]float64
Bid [2]float64
Close float64 `json:"close,string"`
Count float64 `json:"count"`
High float64 `json:"high,string"`
ID int64 `jso:"id"`
Low float64 `json:"low,string"`
Open float64 `json:"open,string"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount,string"`
Close float64 `json:"close,string"`
Count float64 `json:"count"`
High float64 `json:"high,string"`
ID int64 `jso:"id"`
Low float64 `json:"low,string"`
Open float64 `json:"open,string"`
Timestamp types.Time `json:"ts"`
Amount float64 `json:"amount,string"`
} `json:"tick"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FLastTradeData stores last trade's data for a contract
@@ -133,41 +135,41 @@ type FLastTradeData struct {
Ch string `json:"ch"`
Tick struct {
Data []struct {
Amount float64 `json:"amount,string"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price,string"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount,string"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price,string"`
Timestamp types.Time `json:"ts"`
} `json:"data"`
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
} `json:"tick"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FBatchTradesForContractData stores batch of trades data for a contract
type FBatchTradesForContractData struct {
Ch string `json:"ch"`
Timestamp int64 `json:"ts"`
Ch string `json:"ch"`
Timestamp types.Time `json:"ts"`
Data []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []FuturesTrade `json:"data"`
} `json:"data"`
}
// FuturesTrade is futures trade data
type FuturesTrade struct {
Amount float64 `json:"amount"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Timestamp int64 `json:"ts"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Timestamp types.Time `json:"ts"`
}
// FClawbackRateAndInsuranceData stores clawback rate and insurance data for futures
type FClawbackRateAndInsuranceData struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []struct {
Symbol string `json:"symbol"`
InsuranceFund float64 `json:"insurance_fund"`
@@ -177,12 +179,12 @@ type FClawbackRateAndInsuranceData struct {
// FHistoricalInsuranceRecordsData stores historical records of insurance fund balances for futures
type FHistoricalInsuranceRecordsData struct {
Timestamp int64 `json:"timestamp"`
Timestamp types.Time `json:"timestamp"`
Data struct {
Symbol string `json:"symbol"`
Tick []struct {
InsuranceFund float64 `json:"insurance_fund"`
Timestamp int64 `json:"ts"`
InsuranceFund float64 `json:"insurance_fund"`
Timestamp types.Time `json:"ts"`
} `json:"tick"`
} `json:"data"`
}
@@ -201,7 +203,7 @@ type FTieredAdjustmentFactorInfo struct {
} `json:"ladders"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FOIData gets oi data on futures
@@ -210,12 +212,12 @@ type FOIData struct {
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
Tick []struct {
Volume float64 `json:"volume,string"`
AmountType int64 `json:"amount_type"`
Timestamp int64 `json:"ts"`
Volume float64 `json:"volume,string"`
AmountType int64 `json:"amount_type"`
Timestamp types.Time `json:"ts"`
} `json:"tick"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FInfoSystemStatusData stores system status info for futures
@@ -228,21 +230,21 @@ type FInfoSystemStatusData struct {
TransferIn int64 `json:"transfer_in"`
TransferOut int64 `json:"transfer_out"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTopAccountsLongShortRatio stores long/short ratio for top futures accounts
type FTopAccountsLongShortRatio struct {
Data struct {
List []struct {
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
LockedRatio float64 `json:"locked_ratio"`
Timestamp int64 `json:"ts"`
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
LockedRatio float64 `json:"locked_ratio"`
Timestamp types.Time `json:"ts"`
} `json:"list"`
Symbol string `json:"symbol"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTopPositionsLongShortRatio stores long short ratio for top futures positions
@@ -250,12 +252,12 @@ type FTopPositionsLongShortRatio struct {
Data struct {
Symbol string `json:"symbol"`
List []struct {
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
Timestamp int64 `json:"timestamp"`
BuyRatio float64 `json:"buy_ratio"`
SellRatio float64 `json:"sell_ratio"`
Timestamp types.Time `json:"timestamp"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
Timestamp types.Time `json:"timestamp"`
}
// FLiquidationOrdersInfo stores data of futures liquidation orders
@@ -274,7 +276,7 @@ type FLiquidationOrdersInfo struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FIndexKlineData stores index kline data for futures
@@ -290,7 +292,7 @@ type FIndexKlineData struct {
Open float64 `json:"open"`
Amount float64 `json:"amount"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FBasisData stores basis data for futures
@@ -303,7 +305,7 @@ type FBasisData struct {
ID int64 `json:"id"`
IndexPrice float64 `json:"index_price,string"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FUserAccountData stores user account data info for futures
@@ -323,7 +325,7 @@ type FUserAccountData struct {
AdjustFactor float64 `json:"adjust_factor"`
MarginStatic float64 `json:"margin_static"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FUsersPositionsInfo stores positions data for futures
@@ -345,12 +347,12 @@ type FUsersPositionsInfo struct {
Direction string `json:"direction"`
LastPrice float64 `json:"last_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FSubAccountAssetsInfo gets subaccounts asset data
type FSubAccountAssetsInfo struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data []struct {
SubUID int64 `json:"sub_uid"`
List []struct {
@@ -379,7 +381,7 @@ type FSingleSubAccountAssetsInfo struct {
LeverageRate float64 `json:"lever_rate"`
MarginStatic float64 `json:"margin_static"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FSingleSubAccountPositionsInfo stores futures positions' info for a single subaccount
@@ -401,24 +403,24 @@ type FSingleSubAccountPositionsInfo struct {
Direction string `json:"direction"`
LastPrice float64 `json:"last_price"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FFinancialRecords stores financial records data for futures
type FFinancialRecords struct {
Data struct {
FinancialRecord []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
RecordType int64 `json:"type"`
Amount float64 `json:"amount"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
RecordType int64 `json:"type"`
Amount float64 `json:"amount"`
} `json:"financial_record"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FSettlementRecords stores user's futures settlement records
@@ -452,7 +454,7 @@ type FSettlementRecords struct {
TotalPage int64 `json:"total_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FContractInfoOnOrderLimit stores contract info on futures order limit
@@ -468,7 +470,7 @@ type FContractInfoOnOrderLimit struct {
} `json:"types"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FContractTradingFeeData stores contract trading fee data
@@ -482,7 +484,7 @@ type FContractTradingFeeData struct {
DeliveryFee float64 `json:"delivery_fee,string"`
FeeAsset string `json:"fee_asset"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTransferLimitData stores transfer limit data for futures
@@ -498,7 +500,7 @@ type FTransferLimitData struct {
NetTransferInMaxDaily float64 `json:"net_transfer_in_max_daily"`
NetTransferOutMaxDaily float64 `json:"net_transfer_out_max_daily"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FPositionLimitData stores information on futures positions limit
@@ -511,7 +513,7 @@ type FPositionLimitData struct {
SellLimit float64 `json:"sell_limit"`
} `json:"list"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FAssetsAndPositionsData stores assets and positions data for futures
@@ -531,8 +533,8 @@ type FAssetsAndPositionsData struct {
// FAccountTransferData stores internal transfer data for futures
type FAccountTransferData struct {
Status string `json:"status"`
Timestamp int64 `json:"ts"`
Status string `json:"status"`
Timestamp types.Time `json:"ts"`
Data struct {
OrderID string `json:"order_id"`
} `json:"data"`
@@ -540,16 +542,16 @@ type FAccountTransferData struct {
// FTransferRecords gets transfer records data
type FTransferRecords struct {
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Data struct {
TransferRecord []struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
SubUID int64 `json:"sub_uid"`
SubAccountName string `json:"sub_account_name"`
TransferType int64 `json:"transfer_type"`
Amount float64 `json:"amount"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
SubUID int64 `json:"sub_uid"`
SubAccountName string `json:"sub_account_name"`
TransferType int64 `json:"transfer_type"`
Amount float64 `json:"amount"`
} `json:"transfer_record"`
TotalPage int64 `json:"total_page"`
CurrentPage int64 `json:"current_page"`
@@ -563,7 +565,7 @@ type FAvailableLeverageData struct {
Symbol string `json:"symbol"`
AvailableLeverageRate string `json:"available_level_rate"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
Timestamp types.Time `json:"timestamp"`
}
// FOrderData stores order data for futures
@@ -573,7 +575,7 @@ type FOrderData struct {
OrderIDStr string `json:"order_id_str"`
ClientOrderID int64 `json:"client_order_id"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
type fBatchOrderData struct {
@@ -604,7 +606,7 @@ type FCancelOrderData struct {
} `json:"errors"`
Successes string `json:"successes"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FOrderInfo stores order info
@@ -636,7 +638,7 @@ type FOrderInfo struct {
Volume float64 `json:"volume"`
LiquidationType int64 `json:"liquidation_type"`
} `json:"data"`
Timestamp int64 `json:"timestamp"`
Timestamp types.Time `json:"timestamp"`
}
// FOrderDetailsData stores order details for futures orders
@@ -682,7 +684,7 @@ type FOrderDetailsData struct {
TotalSize int64 `json:"total_size"`
CurrentPage int64 `json:"current_page"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FOpenOrdersData stores open orders data for futures
@@ -716,7 +718,7 @@ type FOpenOrdersData struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FOrderHistoryData stores order history data
@@ -751,7 +753,7 @@ type FOrderHistoryData struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTradeHistoryData stores trade history data for futures
@@ -781,7 +783,7 @@ type FTradeHistoryData struct {
FeeAsset string `json:"fee_asset"`
} `json:"trades"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTriggerOrderData stores trigger order data
@@ -790,7 +792,7 @@ type FTriggerOrderData struct {
OrderID int64 `json:"order_id"`
OrderIDStr string `json:"order_id_str"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTriggerOpenOrders stores trigger open orders data
@@ -819,7 +821,7 @@ type FTriggerOpenOrders struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// FTriggerOrderHistoryData stores trigger order history for futures
@@ -855,5 +857,5 @@ type FTriggerOrderHistoryData struct {
CurrentPage int64 `json:"current_page"`
TotalSize int64 `json:"total_size"`
} `json:"data"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@ type errorCapture struct {
ErrMsgType1 string `json:"err-msg"`
CodeType2 interface{} `json:"err_code"`
ErrMsgType2 string `json:"err_msg"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
}
// MarketSummary24Hr stores past 24hr market summary data of a given symbol
@@ -61,8 +61,8 @@ type CurrenciesChainData struct {
// WsKlineData stores kline data for futures and swap websocket
type WsKlineData struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
MRID int64 `json:"mrid"`
@@ -78,14 +78,14 @@ type WsKlineData struct {
// WsMarketDepth stores market depth data for futures and swap websocket
type WsMarketDepth struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
MRID int64 `json:"mrid"`
ID int64 `json:"id"`
Bids [][2]float64 `json:"bids"`
Asks [][2]float64 `json:"asks"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Version int64 `json:"version"`
Channel string `json:"ch"`
} `json:"tick"`
@@ -93,14 +93,14 @@ type WsMarketDepth struct {
// WsIncrementalMarketDepth stores incremental market depth data for swap and futures websocket
type WsIncrementalMarketDepth struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
MRID int64 `json:"mrid"`
ID int64 `json:"id"`
Bids [][2]float64 `json:"bids"`
Asks [][2]float64 `json:"asks"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Version int64 `json:"version"`
Channel string `json:"ch"`
Event string `json:"event"`
@@ -109,8 +109,8 @@ type WsIncrementalMarketDepth struct {
// WsMarketDetail stores market detail data for futures and swap websocket
type WsMarketDetail struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
MRID int64 `json:"mrid"`
@@ -126,32 +126,32 @@ type WsMarketDetail struct {
// WsMarketBBOData stores BBO data for futures and swap websocket
type WsMarketBBOData struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
Channel string `json:"ch"`
MRID int64 `json:"mrid"`
ID int64 `json:"id"`
Bid [2]float64 `json:"bid"`
Ask [2]float64 `json:"ask"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Version int64 `json:":version"`
} `json:"tick"`
}
// WsSubTradeDetail stores trade detail data for futures websocket
type WsSubTradeDetail struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Data []struct {
Amount float64 `json:"amount"`
Timestamp int64 `json:"ts"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Direction string `json:"direction"`
Amount float64 `json:"amount"`
Timestamp types.Time `json:"ts"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Direction string `json:"direction"`
} `json:"data"`
} `json:"tick"`
}
@@ -179,22 +179,22 @@ type FWsRequestKline struct {
// FWsReqTradeDetail stores requested trade detail data for futures websocket
type FWsReqTradeDetail struct {
Rep string `json:"rep"`
ID string `json:"id"`
Timestamp int64 `json:"ts"`
Rep string `json:"rep"`
ID string `json:"id"`
Timestamp types.Time `json:"ts"`
Data []struct {
ID int64 `json:"id"`
Price float64 `json:"price"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
Timestamp int64 `json:"ts"`
ID int64 `json:"id"`
Price float64 `json:"price"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
Timestamp types.Time `json:"ts"`
} `json:"data"`
}
// FWsSubKlineIndex stores subscribed kline index data for futures websocket
type FWsSubKlineIndex struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID string `json:"id"`
Open float64 `json:"open,string"`
@@ -209,10 +209,10 @@ type FWsSubKlineIndex struct {
// FWsReqKlineIndex stores requested kline index data for futures websocket
type FWsReqKlineIndex struct {
ID string `json:"id"`
Rep string `json:"rep"`
WsID int64 `json:"wsid"`
Timestamp int64 `json:"ts"`
ID string `json:"id"`
Rep string `json:"rep"`
WsID int64 `json:"wsid"`
Timestamp types.Time `json:"ts"`
Data []struct {
ID int64 `json:"id"`
Open float64 `json:"open"`
@@ -227,8 +227,8 @@ type FWsReqKlineIndex struct {
// FWsSubBasisData stores subscribed basis data for futures websocket
type FWsSubBasisData struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
IndexPrice float64 `json:"index_price,string"`
@@ -240,10 +240,10 @@ type FWsSubBasisData struct {
// FWsReqBasisData stores requested basis data for futures websocket
type FWsReqBasisData struct {
ID string `json:"id"`
Rep string `json:"rep"`
Timestamp int64 `json:"ts"`
WsID int64 `json:"wsid"`
ID string `json:"id"`
Rep string `json:"rep"`
Timestamp types.Time `json:"ts"`
WsID int64 `json:"wsid"`
Tick struct {
ID int64 `json:"id"`
IndexPrice float64 `json:"index_price,string"`
@@ -255,34 +255,34 @@ type FWsReqBasisData struct {
// FWsSubOrderData stores subscribed order data for futures websocket
type FWsSubOrderData struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
Status int64 `json:"status"`
LeverageRate int64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_string"`
ClientOrderID int64 `json:"client_order_id"`
OrderSource string `json:"order_source"`
OrderType int64 `json:"order_type"`
CreatedAt int64 `json:"created_at"`
TradeVolume float64 `json:"trade_volume"`
TradeTurnover float64 `json:"trade_turnover"`
Fee float64 `json:"fee"`
TradeAvgPrice float64 `json:"trade_avg_price"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
FeeAsset string `json:"fee_asset"`
CancelledAt int64 `json:"canceled_at"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Volume float64 `json:"volume"`
Price float64 `json:"price"`
OrderPriceType string `json:"order_price_type"`
Direction string `json:"direction"`
Offset string `json:"offset"`
Status int64 `json:"status"`
LeverageRate int64 `json:"lever_rate"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_string"`
ClientOrderID int64 `json:"client_order_id"`
OrderSource string `json:"order_source"`
OrderType int64 `json:"order_type"`
CreatedAt int64 `json:"created_at"`
TradeVolume float64 `json:"trade_volume"`
TradeTurnover float64 `json:"trade_turnover"`
Fee float64 `json:"fee"`
TradeAvgPrice float64 `json:"trade_avg_price"`
MarginFrozen float64 `json:"margin_frozen"`
Profit float64 `json:"profit"`
FeeAsset string `json:"fee_asset"`
CancelledAt int64 `json:"canceled_at"`
Trade []struct {
ID string `json:"id"`
TradeID int64 `json:"trade_id"`
@@ -298,20 +298,20 @@ type FWsSubOrderData struct {
// FWsSubMatchOrderData stores subscribed match order data for futures websocket
type FWsSubMatchOrderData struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Status int64 `json:"status"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_string"`
OrderType string `json:"order_type"`
Volume float64 `json:"volume"`
TradeVolume float64 `json:"trade_volume"`
ClientOrderID int64 `json:"client_order_id"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Symbol string `json:"symbol"`
ContractType string `json:"contract_type"`
ContractCode string `json:"contract_code"`
Status int64 `json:"status"`
OrderID int64 `json:"order_id"`
OrderIDString string `json:"order_id_string"`
OrderType string `json:"order_type"`
Volume float64 `json:"volume"`
TradeVolume float64 `json:"trade_volume"`
ClientOrderID int64 `json:"client_order_id"`
Trade []struct {
ID string `json:"id"`
TradeID int64 `json:"trade_id"`
@@ -325,11 +325,11 @@ type FWsSubMatchOrderData struct {
// FWsSubEquityUpdates stores account equity updates data for futures websocket
type FWsSubEquityUpdates struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Event string `json:"event"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Event string `json:"event"`
Data []struct {
Symbol string `json:"symbol"`
MarginBalance float64 `json:"margin_balance"`
@@ -349,11 +349,11 @@ type FWsSubEquityUpdates struct {
// FWsSubPositionUpdates stores subscribed position updates data for futures websocket
type FWsSubPositionUpdates struct {
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp int64 `json:"ts"`
Event string `json:"event"`
Operation string `json:"op"`
Topic string `json:"topic"`
UID string `json:"uid"`
Timestamp types.Time `json:"ts"`
Event string `json:"event"`
PositionsData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -375,9 +375,9 @@ type FWsSubPositionUpdates struct {
// FWsSubLiquidationOrders stores subscribed liquidation orders data for futures websocket
type FWsSubLiquidationOrders struct {
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp int64 `json:"ts"`
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp types.Time `json:"ts"`
OrdersData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -391,10 +391,10 @@ type FWsSubLiquidationOrders struct {
// FWsSubContractInfo stores contract info data for futures websocket
type FWsSubContractInfo struct {
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp int64 `json:"ts"`
Event string `json:"event"`
Operation string `json:"op"`
Topic string `json:"topic"`
Timestamp types.Time `json:"ts"`
Event string `json:"event"`
ContractData []struct {
Symbol string `json:"symbol"`
ContractCode string `json:"contract_code"`
@@ -445,11 +445,11 @@ type FWsSubTriggerOrderUpdates struct {
// Response stores the Huobi response information
type Response struct {
Status string `json:"status"`
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
ErrorCode string `json:"err-code"`
ErrorMessage string `json:"err-msg"`
Status string `json:"status"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
ErrorCode string `json:"err-code"`
ErrorMessage string `json:"err-msg"`
}
// MarginRatesData stores margin rates data
@@ -487,14 +487,14 @@ type SwapMarketsData struct {
// KlineItem stores a kline item
type KlineItem struct {
IDTimestamp int64 `json:"id"`
Open float64 `json:"open"`
Close float64 `json:"close"`
Low float64 `json:"low"`
High float64 `json:"high"`
Amount float64 `json:"amount"`
Volume float64 `json:"vol"`
Count int `json:"count"`
IDTimestamp types.Time `json:"id"`
Open float64 `json:"open"`
Close float64 `json:"close"`
Low float64 `json:"low"`
High float64 `json:"high"`
Amount float64 `json:"amount"`
Volume float64 `json:"vol"`
Count int `json:"count"`
}
// CancelOpenOrdersBatch stores open order batch response data
@@ -524,7 +524,7 @@ type Tickers struct {
// FuturesBatchTicker holds ticker data
type FuturesBatchTicker struct {
ID float64 `json:"id"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Ask [2]float64 `json:"ask"`
Bid [2]float64 `json:"bid"`
BusinessType string `json:"business_type"`
@@ -587,31 +587,31 @@ type Orderbook struct {
// Trade stores the trade data
type Trade struct {
TradeID float64 `json:"trade-id"`
Price float64 `json:"price"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
Timestamp int64 `json:"ts"`
TradeID float64 `json:"trade-id"`
Price float64 `json:"price"`
Amount float64 `json:"amount"`
Direction string `json:"direction"`
Timestamp types.Time `json:"ts"`
}
// TradeHistory stores the trade history data
type TradeHistory struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
Trades []Trade `json:"data"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Trades []Trade `json:"data"`
}
// Detail stores the ticker detail data
type Detail struct {
Amount float64 `json:"amount"`
Open float64 `json:"open"`
Close float64 `json:"close"`
High float64 `json:"high"`
Timestamp int64 `json:"timestamp"`
ID int64 `json:"id"`
Count int `json:"count"`
Low float64 `json:"low"`
Volume float64 `json:"vol"`
Amount float64 `json:"amount"`
Open float64 `json:"open"`
Close float64 `json:"close"`
High float64 `json:"high"`
Timestamp types.Time `json:"timestamp"`
ID int64 `json:"id"`
Count int `json:"count"`
Low float64 `json:"low"`
Volume float64 `json:"vol"`
}
// Symbol stores the symbol data
@@ -807,30 +807,11 @@ type KlinesRequestParams struct {
Size int // Size; [1-2000]
}
// WsRequest defines a request data structure
type WsRequest struct {
Topic string `json:"req,omitempty"`
Subscribe string `json:"sub,omitempty"`
Unsubscribe string `json:"unsub,omitempty"`
ClientID int64 `json:"cid,string,omitempty"`
}
// WsResponse defines a response from the websocket connection when there
// is an error
type WsResponse struct {
Op string `json:"op"`
TS int64 `json:"ts"`
Status string `json:"status"`
// ErrorCode returns either an integer or a string
ErrorCode interface{} `json:"err-code"`
ErrorMessage string `json:"err-msg"`
Ping int64 `json:"ping"`
Channel string `json:"ch"`
Rep string `json:"rep"`
Topic string `json:"topic"`
Subscribed string `json:"subbed"`
UnSubscribed string `json:"unsubbed"`
ClientID int64 `json:"cid,string"`
// wsSubReq is a request to subscribe to or unubscribe from a topic for public channels (private channels use generic wsReq)
type wsSubReq struct {
ID string `json:"id,omitempty"`
Sub string `json:"sub,omitempty"`
Unsub string `json:"unsub,omitempty"`
}
// WsHeartBeat defines a heartbeat request
@@ -840,20 +821,20 @@ type WsHeartBeat struct {
// WsDepth defines market depth websocket response
type WsDepth struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
Bids [][]interface{} `json:"bids"`
Asks [][]interface{} `json:"asks"`
Timestamp int64 `json:"ts"`
Timestamp types.Time `json:"ts"`
Version int64 `json:"version"`
} `json:"tick"`
}
// WsKline defines market kline websocket response
type WsKline struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
Open float64 `json:"open"`
@@ -868,222 +849,133 @@ type WsKline struct {
// WsTick stores websocket ticker data
type WsTick struct {
Channel string `json:"ch"`
Rep string `json:"rep"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Rep string `json:"rep"`
Timestamp types.Time `json:"ts"`
Tick struct {
Amount float64 `json:"amount"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
ID float64 `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Timestamp float64 `json:"ts"`
Volume float64 `json:"vol"`
Amount float64 `json:"amount"`
Close float64 `json:"close"`
Count float64 `json:"count"`
High float64 `json:"high"`
ID float64 `json:"id"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Timestamp types.Time `json:"ts"`
Volume float64 `json:"vol"`
} `json:"tick"`
}
// WsTrade defines market trade websocket response
type WsTrade struct {
Channel string `json:"ch"`
Timestamp int64 `json:"ts"`
Channel string `json:"ch"`
Timestamp types.Time `json:"ts"`
Tick struct {
ID int64 `json:"id"`
Timestamp int64 `json:"ts"`
ID int64 `json:"id"`
Timestamp types.Time `json:"ts"`
Data []struct {
Amount float64 `json:"amount"`
Timestamp int64 `json:"ts"`
TradeID float64 `json:"tradeId"`
Price float64 `json:"price"`
Direction string `json:"direction"`
Amount float64 `json:"amount"`
Timestamp types.Time `json:"ts"`
TradeID float64 `json:"tradeId"`
Price float64 `json:"price"`
Direction string `json:"direction"`
} `json:"data"`
}
}
// WsAuthenticationRequest data for login
type WsAuthenticationRequest struct {
Op string `json:"op"`
AccessKeyID string `json:"AccessKeyId"`
SignatureMethod string `json:"SignatureMethod"`
SignatureVersion string `json:"SignatureVersion"`
Timestamp string `json:"Timestamp"`
Signature string `json:"Signature"`
ClientID int64 `json:"cid,string,omitempty"`
// wsReq contains authentication login fields
type wsReq struct {
Action string `json:"action"`
Channel string `json:"ch"`
Params any `json:"params"`
}
// WsMessage defines read data from the websocket connection
type WsMessage struct {
Raw []byte
URL string
// wsAuthReq contains authentication login fields
type wsAuthReq struct {
AuthType string `json:"authType"`
AccessKey string `json:"accessKey"`
SignatureMethod string `json:"signatureMethod"`
SignatureVersion string `json:"signatureVersion"`
Timestamp string `json:"timestamp"`
Signature string `json:"signature"`
}
// WsAuthenticatedSubscriptionRequest request for subscription on authenticated connection
type WsAuthenticatedSubscriptionRequest struct {
Op string `json:"op"`
AccessKeyID string `json:"AccessKeyId"`
SignatureMethod string `json:"SignatureMethod"`
SignatureVersion string `json:"SignatureVersion"`
Timestamp string `json:"Timestamp"`
Signature string `json:"Signature"`
Topic string `json:"topic"`
ClientID int64 `json:"cid,string,omitempty"`
type wsAccountUpdateMsg struct {
Data WsAccountUpdate `json:"data"`
}
// WsAuthenticatedAccountsListRequest request for account list authenticated connection
type WsAuthenticatedAccountsListRequest struct {
Op string `json:"op"`
AccessKeyID string `json:"AccessKeyId"`
SignatureMethod string `json:"SignatureMethod"`
SignatureVersion string `json:"SignatureVersion"`
Timestamp string `json:"Timestamp"`
Signature string `json:"Signature"`
Topic string `json:"topic"`
Symbol string `json:"symbol"`
ClientID int64 `json:"cid,string,omitempty"`
// WsAccountUpdate contains account updates to balances
type WsAccountUpdate struct {
Currency string `json:"currency"`
AccountID int64 `json:"accountId"`
Balance float64 `json:"balance,string"`
Available float64 `json:"available,string"`
ChangeType string `json:"changeType"`
AccountType string `json:"accountType"`
ChangeTime types.Time `json:"changeTime"`
SeqNum int64 `json:"seqNum"`
}
// WsAuthenticatedOrderDetailsRequest request for order details authenticated connection
type WsAuthenticatedOrderDetailsRequest struct {
Op string `json:"op"`
AccessKeyID string `json:"AccessKeyId"`
SignatureMethod string `json:"SignatureMethod"`
SignatureVersion string `json:"SignatureVersion"`
Timestamp string `json:"Timestamp"`
Signature string `json:"Signature"`
Topic string `json:"topic"`
OrderID string `json:"order-id"`
ClientID int64 `json:"cid,string,omitempty"`
type wsOrderUpdateMsg struct {
Data WsOrderUpdate `json:"data"`
}
// WsAuthenticatedOrdersListRequest request for orderslist authenticated connection
type WsAuthenticatedOrdersListRequest struct {
Op string `json:"op"`
AccessKeyID string `json:"AccessKeyId"`
SignatureMethod string `json:"SignatureMethod"`
SignatureVersion string `json:"SignatureVersion"`
Timestamp string `json:"Timestamp"`
Signature string `json:"Signature"`
Topic string `json:"topic"`
States string `json:"states"`
AccountID int64 `json:"account-id"`
Symbol string `json:"symbol"`
ClientID int64 `json:"cid,string,omitempty"`
// WsOrderUpdate contains updates to orders
type WsOrderUpdate struct {
EventType string `json:"eventType"`
Symbol string `json:"symbol"`
AccountID int64 `json:"accountId"`
OrderID int64 `json:"orderId"`
TradeID int64 `json:"tradeId"`
ClientOrderID string `json:"clientOrderId"`
Source string `json:"orderSource"`
Price float64 `json:"orderPrice,string"`
Size float64 `json:"orderSize,string"`
Value float64 `json:"orderValue,string"`
OrderType string `json:"type"`
TradePrice float64 `json:"tradePrice,string"`
TradeVolume float64 `json:"tradeVolume,string"`
RemainingAmount float64 `json:"remainAmt,string"`
ExecutedAmount float64 `json:"execAmt,string"`
IsTaker bool `json:"aggressor"`
Side order.Side `json:"orderSide"`
OrderStatus string `json:"orderStatus"`
LastActTime types.Time `json:"lastActTime"`
CreateTime types.Time `json:"orderCreateTime"`
TradeTime types.Time `json:"tradeTime"`
ErrCode int64 `json:"errCode"`
ErrMessage string `json:"errMessage"`
}
// WsAuthenticatedAccountsResponse response from Accounts authenticated subscription
type WsAuthenticatedAccountsResponse struct {
WsResponse
Data WsAuthenticatedAccountsResponseData `json:"data"`
type wsTradeUpdateMsg struct {
Data WsTradeUpdate `json:"data"`
}
// WsAuthenticatedAccountsResponseData account data
type WsAuthenticatedAccountsResponseData struct {
Event string `json:"event"`
List []WsAuthenticatedAccountsResponseDataList `json:"list"`
}
// WsAuthenticatedAccountsResponseDataList detailed account data
type WsAuthenticatedAccountsResponseDataList struct {
AccountID int64 `json:"account-id"`
Currency string `json:"currency"`
Type string `json:"type"`
Balance float64 `json:"balance,string"`
}
// WsAuthenticatedOrdersUpdateResponse response from OrdersUpdate authenticated subscription
type WsAuthenticatedOrdersUpdateResponse struct {
WsResponse
Data WsAuthenticatedOrdersUpdateResponseData `json:"data"`
}
// WsAuthenticatedOrdersUpdateResponseData order update data
type WsAuthenticatedOrdersUpdateResponseData struct {
UnfilledAmount float64 `json:"unfilled-amount,string"`
FilledAmount float64 `json:"filled-amount,string"`
Price float64 `json:"price,string"`
OrderID int64 `json:"order-id"`
Symbol string `json:"symbol"`
MatchID int64 `json:"match-id"`
FilledCashAmount float64 `json:"filled-cash-amount,string"`
Role string `json:"role"`
OrderState string `json:"order-state"`
OrderType string `json:"order-type"`
}
// WsAuthenticatedOrdersResponse response from Orders authenticated subscription
type WsAuthenticatedOrdersResponse struct {
WsResponse
Data []WsAuthenticatedOrdersResponseData `json:"data"`
}
// WsOldOrderUpdate response from Orders authenticated subscription
type WsOldOrderUpdate struct {
WsResponse
Data WsAuthenticatedOrdersResponseData `json:"data"`
}
// WsAuthenticatedOrdersResponseData order data
type WsAuthenticatedOrdersResponseData struct {
SeqID int64 `json:"seq-id"`
OrderID int64 `json:"order-id"`
Symbol string `json:"symbol"`
AccountID int64 `json:"account-id"`
OrderAmount float64 `json:"order-amount,string"`
OrderPrice float64 `json:"order-price,string"`
CreatedAt int64 `json:"created-at"`
OrderType string `json:"order-type"`
OrderSource string `json:"order-source"`
OrderState string `json:"order-state"`
Role string `json:"role"`
Price float64 `json:"price,string"`
FilledAmount float64 `json:"filled-amount,string"`
UnfilledAmount float64 `json:"unfilled-amount,string"`
FilledCashAmount float64 `json:"filled-cash-amount,string"`
FilledFees float64 `json:"filled-fees,string"`
}
// WsAuthenticatedAccountsListResponse response from AccountsList authenticated endpoint
type WsAuthenticatedAccountsListResponse struct {
WsResponse
Data []WsAuthenticatedAccountsListResponseData `json:"data"`
}
// WsAuthenticatedAccountsListResponseData account data
type WsAuthenticatedAccountsListResponseData struct {
ID int64 `json:"id"`
Type string `json:"type"`
State string `json:"state"`
List []WsAuthenticatedAccountsListResponseDataList `json:"list"`
}
// WsAuthenticatedAccountsListResponseDataList detailed account data
type WsAuthenticatedAccountsListResponseDataList struct {
Currency string `json:"currency"`
Type string `json:"type"`
Balance float64 `json:"balance,string"`
}
// WsAuthenticatedOrdersListResponse response from OrdersList authenticated endpoint
type WsAuthenticatedOrdersListResponse struct {
WsResponse
Data []OrderInfo `json:"data"`
}
// WsAuthenticatedOrderDetailResponse response from OrderDetail authenticated endpoint
type WsAuthenticatedOrderDetailResponse struct {
WsResponse
Data OrderInfo `json:"data"`
}
// WsPong sent for pong messages
type WsPong struct {
Pong int64 `json:"pong"`
}
type authenticationPing struct {
OP string `json:"op"`
TS int64 `json:"ts"`
// WsTradeUpdate contains trade updates to orders
type WsTradeUpdate struct {
EventType string `json:"eventType"`
Symbol string `json:"symbol"`
OrderID int64 `json:"orderId"`
TradePrice float64 `json:"tradePrice,string"`
TradeVolume float64 `json:"tradeVolume,string"`
Side order.Side `json:"orderSide"`
OrderType string `json:"orderType"`
IsTaker bool `json:"aggressor"`
TradeID int64 `json:"tradeId"`
TradeTime types.Time `json:"tradeTime"`
TransactFee float64 `json:"transactFee,string"`
FeeCurrency string `json:"feeCurrency"`
FeeDeduct string `json:"feeDeduct"`
FeeDeductType string `json:"feeDeductType"`
AccountID int64 `json:"accountId"`
Source string `json:"orderSource"`
OrderPrice float64 `json:"orderPrice,string"`
OrderSize float64 `json:"orderSize,string"`
Value float64 `json:"orderValue,string"`
ClientOrderID string `json:"clientOrderId"`
StopPrice string `json:"stopPrice"`
Operator string `json:"operator"`
OrderCreateTime types.Time `json:"orderCreateTime"`
OrderStatus string `json:"orderStatus"`
}
// OrderVars stores side, status and type for any order/trade
@@ -1277,6 +1169,6 @@ type WithdrawalData struct {
State string `json:"state"`
ErrorCode string `json:"error-code"`
ErrorMessage string `json:"error-message"`
CreatedAt int64 `json:"created-at"`
UpdatedAt int64 `json:"updated-at"`
CreatedAt types.Time `json:"created-at"`
UpdatedAt types.Time `json:"updated-at"`
}

File diff suppressed because it is too large Load Diff

View File

@@ -80,6 +80,12 @@ func (h *HUOBI) SetDefaults() {
log.Errorln(log.ExchangeSys, err)
}
for _, a := range []asset.Item{asset.Futures, asset.CoinMarginedFutures} {
if err = h.DisableAssetWebsocketSupport(a); err != nil {
log.Errorf(log.ExchangeSys, "%s error disabling `%s` asset type websocket support: %s", h.Name, a, err)
}
}
h.Features = exchange.Features{
Supports: exchange.FeaturesSupported{
REST: true,
@@ -176,7 +182,7 @@ func (h *HUOBI) SetDefaults() {
exchange.RestSpot: huobiAPIURL,
exchange.RestFutures: huobiFuturesURL,
exchange.RestCoinMargined: huobiFuturesURL,
exchange.WebsocketSpot: wsMarketURL,
exchange.WebsocketSpot: wsSpotURL + wsPublicPath,
})
if err != nil {
log.Errorln(log.ExchangeSys, err)
@@ -220,7 +226,7 @@ func (h *HUOBI) Setup(exch *config.Exchange) error {
err = h.Websocket.Setup(&stream.WebsocketSetup{
ExchangeConfig: exch,
DefaultURL: wsMarketURL,
DefaultURL: wsSpotURL + wsPublicPath,
RunningURL: wsRunningURL,
Connector: h.WsConnect,
Subscriber: h.Subscribe,
@@ -245,7 +251,7 @@ func (h *HUOBI) Setup(exch *config.Exchange) error {
RateLimit: request.NewWeightedRateLimitByDuration(20 * time.Millisecond),
ResponseCheckTimeout: exch.WebsocketResponseCheckTimeout,
ResponseMaxLimit: exch.WebsocketResponseMaxLimit,
URL: wsAccountsOrdersURL,
URL: wsSpotURL + wsPrivatePath,
Authenticated: true,
})
}
@@ -301,7 +307,8 @@ func (h *HUOBI) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.
}
pairs = make([]currency.Pair, 0, len(symbols.Data))
expiryCodeDates := map[string]currency.Code{}
for _, c := range symbols.Data {
for i := range symbols.Data {
c := symbols.Data[i]
if c.ContractStatus != 1 {
continue
}
@@ -397,7 +404,7 @@ func (h *HUOBI) UpdateTickers(ctx context.Context, a asset.Item) error {
}
continue
}
tt := time.UnixMilli(ticks[i].Timestamp)
tt := ticks[i].Timestamp.Time()
err = ticker.ProcessTicker(&ticker.Price{
High: ticks[i].High.Float64(),
Low: ticks[i].Low.Float64(),
@@ -465,7 +472,7 @@ func (h *HUOBI) UpdateTickers(ctx context.Context, a asset.Item) error {
Pair: cp,
ExchangeName: h.Name,
AssetType: a,
LastUpdated: time.UnixMilli(ticks[i].Timestamp),
LastUpdated: ticks[i].Timestamp.Time(),
})
if err != nil {
errs = common.AppendError(errs, err)
@@ -676,72 +683,50 @@ func (h *HUOBI) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (ac
info.Exchange = h.Name
switch assetType {
case asset.Spot:
if h.Websocket.CanUseAuthenticatedWebsocketForWrapper() {
resp, err := h.wsGetAccountsList(ctx)
accounts, err := h.GetAccountID(ctx)
if err != nil {
return info, err
}
for i := range accounts {
if accounts[i].Type != "spot" {
continue
}
acc.ID = strconv.FormatInt(accounts[i].ID, 10)
balances, err := h.GetAccountBalance(ctx, acc.ID)
if err != nil {
return info, err
}
var currencyDetails []account.Balance
for i := range resp.Data {
if len(resp.Data[i].List) == 0 {
continue
balance:
for j := range balances {
frozen := balances[j].Type == "frozen"
for i := range currencyDetails {
if currencyDetails[i].Currency.String() == balances[j].Currency {
if frozen {
currencyDetails[i].Hold = balances[j].Balance
} else {
currencyDetails[i].Total = balances[j].Balance
}
continue balance
}
}
currData := account.Balance{
Currency: currency.NewCode(resp.Data[i].List[0].Currency),
Total: resp.Data[i].List[0].Balance,
if frozen {
currencyDetails = append(currencyDetails,
account.Balance{
Currency: currency.NewCode(balances[j].Currency),
Hold: balances[j].Balance,
})
} else {
currencyDetails = append(currencyDetails,
account.Balance{
Currency: currency.NewCode(balances[j].Currency),
Total: balances[j].Balance,
})
}
if len(resp.Data[i].List) > 1 && resp.Data[i].List[1].Type == "frozen" {
currData.Hold = resp.Data[i].List[1].Balance
}
currencyDetails = append(currencyDetails, currData)
}
acc.Currencies = currencyDetails
} else {
accounts, err := h.GetAccountID(ctx)
if err != nil {
return info, err
}
for i := range accounts {
if accounts[i].Type != "spot" {
continue
}
acc.ID = strconv.FormatInt(accounts[i].ID, 10)
balances, err := h.GetAccountBalance(ctx, acc.ID)
if err != nil {
return info, err
}
var currencyDetails []account.Balance
balance:
for j := range balances {
frozen := balances[j].Type == "frozen"
for i := range currencyDetails {
if currencyDetails[i].Currency.String() == balances[j].Currency {
if frozen {
currencyDetails[i].Hold = balances[j].Balance
} else {
currencyDetails[i].Total = balances[j].Balance
}
continue balance
}
}
if frozen {
currencyDetails = append(currencyDetails,
account.Balance{
Currency: currency.NewCode(balances[j].Currency),
Hold: balances[j].Balance,
})
} else {
currencyDetails = append(currencyDetails,
account.Balance{
Currency: currency.NewCode(balances[j].Currency),
Total: balances[j].Balance,
})
}
}
acc.Currencies = currencyDetails
}
}
case asset.CoinMarginedFutures:
@@ -867,7 +852,7 @@ func (h *HUOBI) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a as
resp[i] = exchange.WithdrawalHistory{
Status: withdrawals.Data[i].State,
TransferID: withdrawals.Data[i].TransactionHash,
Timestamp: time.UnixMilli(withdrawals.Data[i].CreatedAt),
Timestamp: withdrawals.Data[i].CreatedAt.Time(),
Currency: withdrawals.Data[i].Currency.String(),
Amount: withdrawals.Data[i].Amount,
Fee: withdrawals.Data[i].Fee,
@@ -911,7 +896,7 @@ func (h *HUOBI) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.It
Side: side,
Price: sTrades[i].Trades[j].Price,
Amount: sTrades[i].Trades[j].Amount,
Timestamp: time.UnixMilli(sTrades[i].Timestamp),
Timestamp: sTrades[i].Timestamp.Time(),
})
}
}
@@ -938,7 +923,7 @@ func (h *HUOBI) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.It
Side: side,
Price: fTrades.Data[i].Data[j].Price,
Amount: fTrades.Data[i].Data[j].Amount,
Timestamp: time.UnixMilli(fTrades.Data[i].Data[j].Timestamp),
Timestamp: fTrades.Data[i].Data[j].Timestamp.Time(),
})
}
}
@@ -964,7 +949,7 @@ func (h *HUOBI) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.It
Side: side,
Price: cTrades.Data[i].Price,
Amount: cTrades.Data[i].Amount,
Timestamp: time.UnixMilli(cTrades.Data[i].Timestamp),
Timestamp: cTrades.Data[i].Timestamp.Time(),
})
}
}
@@ -1285,24 +1270,15 @@ func (h *HUOBI) GetOrderInfo(ctx context.Context, orderID string, pair currency.
var orderDetail order.Detail
switch assetType {
case asset.Spot:
var respData *OrderInfo
if h.Websocket.CanUseAuthenticatedWebsocketForWrapper() {
resp, err := h.wsGetOrderDetails(ctx, orderID)
if err != nil {
return nil, err
}
respData = &resp.Data
} else {
oID, err := strconv.ParseInt(orderID, 10, 64)
if err != nil {
return nil, err
}
resp, err := h.GetOrder(ctx, oID)
if err != nil {
return nil, err
}
respData = &resp
oID, err := strconv.ParseInt(orderID, 10, 64)
if err != nil {
return nil, err
}
resp, err := h.GetOrder(ctx, oID)
if err != nil {
return nil, err
}
respData := &resp
if respData.ID == 0 {
return nil, fmt.Errorf("%s - order not found for orderid %s", h.Name, orderID)
}
@@ -1512,87 +1488,34 @@ func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.MultiOrderReques
if req.Side == order.Sell {
side = req.Side.Lower()
}
if h.Websocket.CanUseAuthenticatedWebsocketForWrapper() {
for i := range req.Pairs {
resp, err := h.wsGetOrdersList(ctx, -1, req.Pairs[i])
if err != nil {
return orders, err
}
for j := range resp.Data {
sideData := strings.Split(resp.Data[j].OrderState, "-")
side = sideData[0]
var orderID = strconv.FormatInt(resp.Data[j].OrderID, 10)
orderSide, err := order.StringToOrderSide(side)
if err != nil {
h.Websocket.DataHandler <- order.ClassificationError{
Exchange: h.Name,
OrderID: orderID,
Err: err,
}
}
orderType, err := order.StringToOrderType(sideData[1])
if err != nil {
h.Websocket.DataHandler <- order.ClassificationError{
Exchange: h.Name,
OrderID: orderID,
Err: err,
}
}
orderStatus, err := order.StringToOrderStatus(resp.Data[j].OrderState)
if err != nil {
h.Websocket.DataHandler <- order.ClassificationError{
Exchange: h.Name,
OrderID: orderID,
Err: err,
}
}
orders = append(orders, order.Detail{
Exchange: h.Name,
AccountID: strconv.FormatInt(resp.Data[j].AccountID, 10),
OrderID: orderID,
Pair: req.Pairs[i],
Type: orderType,
Side: orderSide,
Date: time.UnixMilli(resp.Data[j].CreatedAt),
Status: orderStatus,
Price: resp.Data[j].Price,
Amount: resp.Data[j].OrderAmount,
ExecutedAmount: resp.Data[j].FilledAmount,
RemainingAmount: resp.Data[j].UnfilledAmount,
Fee: resp.Data[j].FilledFees,
})
}
}
} else {
creds, err := h.GetCredentials(ctx)
creds, err := h.GetCredentials(ctx)
if err != nil {
return nil, err
}
for i := range req.Pairs {
resp, err := h.GetOpenOrders(ctx,
req.Pairs[i],
creds.ClientID,
side,
500)
if err != nil {
return nil, err
}
for i := range req.Pairs {
resp, err := h.GetOpenOrders(ctx,
req.Pairs[i],
creds.ClientID,
side,
500)
if err != nil {
return nil, err
}
for x := range resp {
orderDetail := order.Detail{
OrderID: strconv.FormatInt(resp[x].ID, 10),
Price: resp[x].Price,
Amount: resp[x].Amount,
ExecutedAmount: resp[x].FilledAmount,
RemainingAmount: resp[x].Amount - resp[x].FilledAmount,
Pair: req.Pairs[i],
Exchange: h.Name,
Date: time.UnixMilli(resp[x].CreatedAt),
AccountID: strconv.FormatInt(resp[x].AccountID, 10),
Fee: resp[x].FilledFees,
}
setOrderSideStatusAndType(resp[x].State, resp[x].Type, &orderDetail)
orders = append(orders, orderDetail)
for x := range resp {
orderDetail := order.Detail{
OrderID: strconv.FormatInt(resp[x].ID, 10),
Price: resp[x].Price,
Amount: resp[x].Amount,
ExecutedAmount: resp[x].FilledAmount,
RemainingAmount: resp[x].Amount - resp[x].FilledAmount,
Pair: req.Pairs[i],
Exchange: h.Name,
Date: time.UnixMilli(resp[x].CreatedAt),
AccountID: strconv.FormatInt(resp[x].AccountID, 10),
Fee: resp[x].FilledFees,
}
setOrderSideStatusAndType(resp[x].State, resp[x].Type, &orderDetail)
orders = append(orders, orderDetail)
}
}
case asset.CoinMarginedFutures:
@@ -1919,7 +1842,7 @@ func (h *HUOBI) GetHistoricCandles(ctx context.Context, pair currency.Pair, a as
}
for x := range candles {
timestamp := time.Unix(candles[x].IDTimestamp, 0)
timestamp := candles[x].IDTimestamp.Time()
if timestamp.Before(req.Start) || timestamp.After(req.End) {
continue
}
@@ -1940,7 +1863,7 @@ func (h *HUOBI) GetHistoricCandles(ctx context.Context, pair currency.Pair, a as
return nil, err
}
for x := range candles.Data {
timestamp := time.Unix(candles.Data[x].IDTimestamp, 0)
timestamp := candles.Data[x].IDTimestamp.Time()
if timestamp.Before(req.Start) || timestamp.After(req.End) {
continue
}
@@ -1961,7 +1884,7 @@ func (h *HUOBI) GetHistoricCandles(ctx context.Context, pair currency.Pair, a as
return nil, err
}
for x := range candles.Data {
timestamp := time.Unix(candles.Data[x].IDTimestamp, 0)
timestamp := candles.Data[x].IDTimestamp.Time()
if timestamp.Before(req.Start) || timestamp.After(req.End) {
continue
}
@@ -2001,7 +1924,7 @@ func (h *HUOBI) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pa
}
for x := range candles.Data {
// align response data
timestamp := time.Unix(candles.Data[x].IDTimestamp, 0).UTC()
timestamp := candles.Data[x].IDTimestamp.Time()
if timestamp.Before(req.Start) || timestamp.After(req.End) {
continue
}
@@ -2026,7 +1949,7 @@ func (h *HUOBI) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pa
}
for x := range candles.Data {
// align response data
timestamp := time.Unix(candles.Data[x].IDTimestamp, 0)
timestamp := candles.Data[x].IDTimestamp.Time()
if timestamp.Before(req.Start) || timestamp.After(req.End) {
continue
}
@@ -2181,10 +2104,10 @@ func (h *HUOBI) GetFuturesContractDetails(ctx context.Context, item asset.Item)
if err != nil {
return nil, err
}
if result.Data[x].DeliveryTime > 0 {
e = time.UnixMilli(result.Data[x].DeliveryTime)
if result.Data[x].DeliveryTime.Time().IsZero() {
e = result.Data[x].DeliveryTime.Time()
} else {
e = time.UnixMilli(result.Data[x].SettlementTime)
e = result.Data[x].SettlementTime.Time()
}
contractLength := e.Sub(s)
var ct futures.ContractType

View File

@@ -0,0 +1 @@
{"ch":"market.btcusdt.trade.detail","ts":1630994963175,"tick":{"id":137005445109,"ts":1630994963173,"data":[{"id":137005445109359290000000000,"ts":1630994963173,"tradeId":102523573486,"amount":0.006754,"price":52648.62,"direction":"buy"}]}}

View File

@@ -0,0 +1 @@
{"ch":"market.btcusdt.kline.1min","ts":1489474082831,"tick":{"id":1489464480,"amount":1821.49,"count":4,"open":7962.62,"close":8014.56,"low":5110.14,"high":14962.77,"vol":4.4}}

View File

@@ -0,0 +1,3 @@
{"action":"push","ch":"accounts.update#2","data":{"currency":"btc","accountId":123456,"balance":"23.111","changeType":"transfer","accountType":"trade","seqNum":1,"changeTime":1568601800000}}
{"action":"push","ch":"accounts.update#2","data":{"currency":"btc","accountId":33385,"available":"2028.69","changeType":"order.match","accountType":"trade","seqNum":2,"changeTime":1574393385167}}
{"action":"push","ch":"accounts.update#2","data":{"currency":"usdt","accountId":14884859,"balance":"20.29388158","available":"20.29388158","changeType":null,"accountType":"trade","changeTime":null,"seqNum":3}}

View File

@@ -0,0 +1,4 @@
{"action":"push","ch":"orders#*","data":{"orderSide":"buy","lastActTime":1583853365586,"clientOrderId":"test1","orderStatus":"rejected","symbol":"btcusdt","eventType":"trigger","errCode":2002,"errMessage":"invalid.client.order.id (NT)"}}
{"action":"push","ch":"orders#*","data":{"orderSide":"buy","lastActTime":1583853365586,"clientOrderId":"test2","orderStatus":"canceled","symbol":"btcusdt","eventType":"deletion"}}
{"action":"push","ch":"orders#*","data":{"orderSize":"2.000000000000000000","orderCreateTime":1583853365586,"accountld":992701,"orderPrice":"77.000000000000000000","type":"sell-limit","orderId":27163533,"clientOrderId":"test3","orderSource":"spot-api","orderStatus":"submitted","symbol":"btcusdt","eventType":"creation"}}
{"action":"push","ch":"orders#*","data":{"orderSource":"spot-web","accountId":16820007,"orderPrice":"70000","orderSize":"0.000157","orderCreateTime":1731039387696,"symbol":"btcusdt","eventType":"creation","type":"buy-limit","orderId":1199329381585359,"clientOrderId":"","orderStatus":"submitted"}}

View File

@@ -0,0 +1 @@
{"ch":"trade.clearing#btcusdt#1","data":{"eventType":"trade","symbol":"btcusdt","orderId":99998888,"tradePrice":"9999.99","tradeVolume":"0.96","orderSide":"buy","aggressor":true,"tradeId":919219323232,"tradeTime":1583853365996,"transactFee":"19.88","feeDeduct ":"0","feeDeductType":"","feeCurrency":"btc","accountId":9912791,"source":"spot-api","orderPrice":"10000","orderSize":"1","clientOrderId":"a001","orderCreateTime":1583853365586,"orderStatus":"partial-filled"}}

View File

@@ -0,0 +1 @@
{"ch":"market.btcusdt.depth.step0","ts":1630983549503,"tick":{"bids":[[52690.69,0.36281],[52690.68,0.2]],"asks":[[52690.7,0.372591],[52691.26,0.13]],"version":136998124622,"ts":1630983549500}}

View File

@@ -0,0 +1 @@
{"ch":"market.btcusdt.detail","ts":1630998026649,"tick":{"id":273956868110,"low":51000,"high":52924.14,"open":51823.62,"close":52379.99,"vol":727676440.200527,"amount":13991.028076056185,"version":273956868110,"count":471348}}

View File

@@ -201,8 +201,7 @@ type ModifyResponse struct {
}
// Detail contains all properties of an order
// Each exchange has their own requirements, so not all fields
// are required to be populated
// Each exchange has their own requirements, so not all fields are required to be populated
type Detail struct {
ImmediateOrCancel bool
HiddenOrder bool

View File

@@ -1189,15 +1189,15 @@ func StringToOrderStatus(status string) (Status, error) {
switch status {
case AnyStatus.String():
return AnyStatus, nil
case New.String(), "PLACED", "ACCEPTED":
case New.String(), "PLACED", "ACCEPTED", "SUBMITTED":
return New, nil
case Active.String(), "STATUS_ACTIVE", "LIVE":
return Active, nil
case PartiallyFilled.String(), "PARTIALLY MATCHED", "PARTIALLY FILLED":
case PartiallyFilled.String(), "PARTIAL-FILLED", "PARTIALLY MATCHED", "PARTIALLY FILLED":
return PartiallyFilled, nil
case Filled.String(), "FULLY MATCHED", "FULLY FILLED", "ORDER_FULLY_TRANSACTED", "EFFECTIVE":
return Filled, nil
case PartiallyCancelled.String(), "PARTIALLY CANCELLED", "ORDER_PARTIALLY_TRANSACTED":
case PartiallyCancelled.String(), "PARTIAL-CANCELED", "PARTIALLY CANCELLED", "ORDER_PARTIALLY_TRANSACTED":
return PartiallyCancelled, nil
case PartiallyFilledCancelled.String(), "PARTIALLYFILLEDCANCELED":
return PartiallyFilledCancelled, nil

View File

@@ -118,23 +118,45 @@ func MockWsInstance[T any, PT interface {
return e
}
// FixtureToDataHandler squirts the contents of a file to a reader function (probably e.wsHandleData)
// FixtureError contains an error and the message that caused it
type FixtureError struct {
Err error
Msg []byte
}
// FixtureToDataHandler squirts the contents of a file to a reader function (probably e.wsHandleData) and asserts no errors are returned
func FixtureToDataHandler(tb testing.TB, fixturePath string, reader func([]byte) error) {
tb.Helper()
for _, e := range FixtureToDataHandlerWithErrors(tb, fixturePath, reader) {
assert.NoErrorf(tb, e.Err, "Should not error handling message:\n%s", e.Msg)
}
}
// FixtureToDataHandlerWithErrors squirts the contents of a file to a reader function (probably e.wsHandleData) and returns handler errors
// Any errors setting up the fixture will fail tests
func FixtureToDataHandlerWithErrors(tb testing.TB, fixturePath string, reader func([]byte) error) []FixtureError {
tb.Helper()
fixture, err := os.Open(fixturePath)
assert.NoError(tb, err, "Opening fixture '%s' should not error", fixturePath)
require.NoError(tb, err, "Opening fixture '%s' must not error", fixturePath)
defer func() {
assert.NoError(tb, fixture.Close(), "Closing the fixture file should not error")
}()
errs := []FixtureError{}
s := bufio.NewScanner(fixture)
for s.Scan() {
msg := s.Bytes()
err := reader(msg)
assert.NoErrorf(tb, err, "Fixture message should not error:\n%s", msg)
if err := reader(msg); err != nil {
errs = append(errs, FixtureError{
Err: err,
Msg: msg,
})
}
}
assert.NoError(tb, s.Err(), "Fixture Scanner should not error")
return errs
}
var setupWsMutex sync.Mutex
@@ -178,6 +200,7 @@ var updatePairsOnce = make(map[string]*currency.PairsManager)
// UpdatePairsOnce ensures pairs are only updated once in parallel tests
// A clone of the cache of the updated pairs is used to populate duplicate requests
// Any pairs enabled after this is called will be lost on the next call
func UpdatePairsOnce(tb testing.TB, e exchange.IBotExchange) {
tb.Helper()

View File

@@ -1838,7 +1838,7 @@
},
"spot": {
"assetEnabled": true,
"enabled": "BTC-USDT",
"enabled": "BTC-USDT,ETH-BTC",
"available": "PROPY-ETH,IOTA-BTC,UGAS-ETH,PAI-USDT,BSV-HUSD,MTX-ETH,BCH-BTC,LTC-HT,SOC-USDT,WXT-BTC,SALT-BTC,RCN-ETH,PNT-ETH,TT-USDT,AIDOC-ETH,BIX-BTC,OCN-USDT,QTUM-ETH,KCASH-ETH,SNT-USDT,LUN-BTC,QASH-BTC,ITC-BTC,NAS-BTC,XMR-BTC,TNT-ETH,UC-ETH,FAIR-BTC,PC-ETH,YEE-BTC,PAY-ETH,XMX-BTC,CRE-USDT,BAT-ETH,BHT-USDT,CKB-HT,LAMB-HT,AE-USDT,QUN-ETH,LYM-BTC,BCH-HT,BHT-BTC,RUFF-ETH,CNN-BTC,FOR-USDT,GTC-ETH,TRX-ETH,ELA-USDT,ACT-ETH,SMT-ETH,BUT-ETH,BCH-USDT,ICX-BTC,MEET-BTC,NCC-BTC,APPC-BTC,GVE-ETH,TNB-BTC,STEEM-ETH,18C-ETH,LBA-BTC,EKO-BTC,REQ-BTC,SOC-BTC,BOX-ETH,ELF-BTC,ZRX-ETH,LET-USDT,HT-BTC,TUSD-HUSD,EGCC-BTC,WTC-BTC,ATP-USDT,DOCK-USDT,PAI-BTC,ONT-ETH,IRIS-BTC,BTT-ETH,SC-BTC,XZC-BTC,LBA-USDT,HT-USDT,VET-ETH,KMD-ETH,SHE-ETH,PORTAL-BTC,ONE-BTC,BIX-USDT,RCCC-BTC,SKM-USDT,XTZ-ETH,SWFTC-BTC,RSR-BTC,LINK-ETH,DATX-BTC,HPT-HT,GET-ETH,BLZ-ETH,CTXC-USDT,CNNS-USDT,PVT-HT,ITC-USDT,LTC-BTC,NCASH-BTC,HOT-ETH,ADA-USDT,ADX-BTC,NODE-USDT,TRIO-BTC,GXC-ETH,SNT-BTC,FOR-BTC,DBC-BTC,UUU-USDT,CVCOIN-ETH,RSR-USDT,CRO-USDT,OCN-BTC,NEW-USDT,EGT-USDT,MANA-BTC,CMT-USDT,WXT-HT,XRP-BTC,MT-ETH,PAX-HUSD,LSK-ETH,IOTA-USDT,SRN-ETH,ZIL-ETH,ELF-USDT,LXT-ETH,LAMB-BTC,CRE-HT,CKB-BTC,XVG-BTC,BSV-BTC,BFT-BTC,WPR-ETH,HT-HUSD,POWR-BTC,MANA-ETH,ENG-ETH,ZJLT-ETH,SNC-ETH,ATOM-ETH,WICC-USDT,KAN-ETH,DGD-BTC,VSYS-HT,BCD-BTC,BTM-ETH,DOGE-USDT,MEX-BTC,BTG-BTC,DAC-ETH,DAT-BTC,GRS-ETH,ADX-ETH,EM-HT,GXC-USDT,CVC-BTC,OMG-ETH,SSP-ETH,OGO-HT,CMT-ETH,POLY-ETH,XZC-USDT,THETA-USDT,XEM-USDT,LOL-USDT,BCH-HUSD,GSC-BTC,DOGE-ETH,MDS-BTC,BTS-ETH,CTXC-BTC,MCO-BTC,BCX-BTC,ZLA-ETH,EKT-USDT,MAN-BTC,BLZ-BTC,ATOM-USDT,LOL-BTC,HPT-USDT,EM-BTC,EOS-USDT,WAN-BTC,GNT-BTC,CRO-BTC,MANA-USDT,SEELE-USDT,FSN-BTC,VIDY-HT,USDC-HUSD,LTC-HUSD,XRP-USDT,VSYS-BTC,STORJ-BTC,LOOM-ETH,SKM-BTC,LINK-USDT,TT-HT,QSP-ETH,ETN-BTC,FSN-HT,NODE-BTC,HC-USDT,PHX-BTC,XLM-BTC,RCCC-ETH,LTC-USDT,UUU-BTC,SEELE-ETH,PVT-BTC,HC-ETH,REN-ETH,KAN-USDT,EOS-ETH,BSV-USDT,BTS-USDT,KMD-BTC,OGO-USDT,THETA-ETH,MUSK-BTC,CNNS-HT,ETC-BTC,COVA-BTC,BTT-TRX,XMR-USDT,MTN-ETH,QUN-BTC,NAS-USDT,ELA-ETH,HIT-ETH,BTT-USDT,EKT-ETH,TOS-BTC,GAS-ETH,DCR-USDT,ONT-BTC,NEW-HT,NEXO-BTC,ETH-USDT,WXT-USDT,FOR-HT,ADA-BTC,EVX-ETH,VET-BTC,ZEC-USDT,NANO-ETH,IOST-HT,BCV-ETH,REN-USDT,NULS-ETH,ACT-USDT,LET-ETH,BTM-USDT,MEET-ETH,AKRO-HT,ARDR-BTC,DCR-ETH,NANO-USDT,BTC-HUSD,ALGO-BTC,IIC-ETH,BHD-BTC,KNC-ETH,ATP-BTC,ZRX-BTC,ABT-BTC,18C-BTC,XMR-ETH,WAXP-BTC,CVNT-BTC,MX-USDT,OST-ETH,NKN-BTC,TOPC-BTC,GNX-BTC,FTT-USDT,ONE-HT,DGB-ETH,NULS-USDT,DASH-BTC,UIP-BTC,KCASH-HT,WICC-ETH,EKO-ETH,EGT-HT,IRIS-USDT,STK-ETH,MXC-BTC,NAS-ETH,OMG-USDT,SMT-BTC,BUT-BTC,HIT-USDT,BAT-BTC,IRIS-ETH,NKN-HT,PC-BTC,TOP-USDT,GTC-BTC,LSK-BTC,ITC-ETH,DTA-BTC,HOT-BTC,BTT-BTC,FAIR-ETH,DOCK-ETH,QTUM-BTC,ZEN-BTC,ZIL-BTC,RCN-BTC,FTI-BTC,BHD-USDT,VIDY-USDT,LUN-ETH,DBC-ETH,TOPC-ETH,IIC-BTC,STEEM-USDT,IOTA-ETH,KCASH-BTC,RUFF-BTC,APPC-ETH,MT-BTC,SOC-ETH,GT-HT,PROPY-BTC,AIDOC-BTC,ACT-BTC,LYM-ETH,CHAT-BTC,SWFTC-ETH,ETH-BTC,UIP-USDT,UGAS-BTC,XRP-HUSD,ALGO-USDT,TNT-BTC,ONT-USDT,YEE-ETH,AKRO-BTC,TRX-USDT,OCN-ETH,SRN-BTC,DASH-USDT,XMX-ETH,NANO-BTC,QASH-ETH,EOS-HT,GT-BTC,XTZ-USDT,ARPA-USDT,SALT-ETH,BKBT-ETH,MTX-BTC,SMT-USDT,GXC-BTC,VIDY-BTC,FTT-HT,LAMB-ETH,TRX-BTC,TRIO-ETH,BFT-ETH,LINK-BTC,AE-ETH,NULS-BTC,BHD-HT,AST-ETH,NEO-USDT,EDU-BTC,CVCOIN-BTC,GVE-BTC,GET-BTC,ZRX-USDT,ELF-ETH,DATX-ETH,ADA-ETH,TOP-HT,NCASH-ETH,QTUM-USDT,ETC-HT,ZIL-USDT,TNB-ETH,BIX-ETH,SHE-BTC,PNT-BTC,BTC-USDT,PORTAL-ETH,WAVES-USDT,XZC-ETH,HT-ETH,POLY-BTC,MCO-ETH,MUSK-ETH,PAI-ETH,LXT-USDT,UTK-BTC,RTE-BTC,NCC-ETH,HB10-USDT,BOX-BTC,RDN-ETH,ARPA-BTC,LBA-ETH,CNN-ETH,AAC-ETH,XTZ-BTC,IDT-BTC,AKRO-USDT,IOST-BTC,GT-USDT,WAN-ETH,ETN-ETH,PVT-USDT,NEO-BTC,WAVES-ETH,ONE-USDT,ZEC-BTC,SKM-HT,IOST-ETH,NPXS-ETH,CVC-ETH,CMT-BTC,COVA-ETH,ARDR-ETH,RDN-BTC,DCR-BTC,REN-BTC,YCC-ETH,MX-HT,NEXO-ETH,XLM-ETH,YCC-BTC,ENG-BTC,CNNS-BTC,ZLA-BTC,QSP-BTC,MAN-ETH,UUU-ETH,ETH-HUSD,RTE-ETH,ATP-HT,BTM-BTC,DAC-BTC,TOS-ETH,LAMB-USDT,DASH-HT,NPXS-BTC,NEW-BTC,FTT-BTC,EOS-HUSD,GRS-BTC,POWR-ETH,VET-USDT,AAC-BTC,MX-BTC,MTN-BTC,XVG-ETH,GNX-ETH,SSP-BTC,WAVES-BTC,EGT-BTC,CTXC-ETH,IDT-ETH,STK-BTC,WICC-BTC,UTK-ETH,CRO-HT,LXT-BTC,GSC-ETH,OMG-BTC,XRP-HT,DGB-BTC,IOST-USDT,CVNT-ETH,GAS-BTC,HIT-BTC,CKB-USDT,ARPA-HT,RUFF-USDT,HC-BTC,WTC-ETH,MDS-USDT,ABT-ETH,ALGO-ETH,BIFI-BTC,KNC-BTC,TT-BTC,LET-BTC,NKN-USDT,PAY-BTC,DTA-USDT,AE-BTC,UC-BTC,VSYS-USDT,USDT-HUSD,EOS-BTC,STEEM-BTC,DOGE-BTC,NODE-HT,MDS-ETH,CRE-BTC,GNT-USDT,UIP-ETH,AST-BTC,XEM-BTC,ZEN-ETH,EDU-ETH,MEX-ETH,EKT-BTC,CVC-USDT,WAXP-ETH,REQ-ETH,OST-BTC,STORJ-USDT,SBTC-BTC,DGD-ETH,SC-ETH,WTC-USDT,THETA-BTC,DTA-ETH,BCV-BTC,SNC-BTC,RSR-HT,KAN-BTC,ELA-BTC,ATOM-BTC,BKBT-BTC,FSN-USDT,EM-USDT,WPR-BTC,TOP-BTC,BTS-BTC,EGCC-ETH,MTL-BTC,GNT-ETH,SEELE-BTC,EVX-BTC,FTI-ETH,BAT-USDT,MT-HT,LOL-HT,ICX-ETH,LOOM-BTC,ZJLT-BTC,XLM-USDT,OGO-BTC,DOCK-BTC,CHAT-ETH,DAT-ETH,ETC-USDT,HPT-BTC,BHT-HT"
}
}