mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
CI, sonic: Replace backend-arm64 docker build with native GHA runner, disable sonic for arm64 (#1794)
* CI: Replace docker amd64 with native runner, switch Docker test arch to amd64 * tests: Remove spaces and new lines from test JSON timestamp fields * builds: Disable sonic for arm64 due to OKX unmarshal issue * nits: Improve Dockerfile comment and fix build tag
This commit is contained in:
@@ -2205,8 +2205,7 @@ func TestWsBalanceUpdate(t *testing.T) {
|
||||
"E": 1573200697110,
|
||||
"a": "BTC",
|
||||
"d": "100.00000000",
|
||||
"T": 1573200697068
|
||||
}}`)
|
||||
"T": 1573200697068}}`)
|
||||
err := b.wsHandleData(pressXToJSON)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -1604,9 +1604,7 @@ var balanceUpdateInputJSON = `
|
||||
"E": 1573200697110,
|
||||
"a": "BTC",
|
||||
"d": "100.00000000",
|
||||
"T": 1573200697068
|
||||
}
|
||||
}`
|
||||
"T": 1573200697068}}`
|
||||
|
||||
func TestWebsocketBalanceUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -3164,9 +3164,9 @@ var pushDataMap = map[string]string{
|
||||
"Orderbook Snapshot": `{"topic":"orderbook.50.BTCUSDT","ts":1731035685326,"type":"snapshot","data":{"s":"BTCUSDT","b":[["75848.74","0.067669"],["75848.63","0.004772"],["75848.61","0.00659"],["75848.05","0.000329"],["75847.68","0.00159"],["75846.88","0.00159"],["75845.97","0.026366"],["75845.87","0.013185"],["75845.41","0.077259"],["75845.4","0.132228"],["75844.61","0.00159"],["75844.44","0.026367"],["75844.2","0.013185"],["75844","0.00039"],["75843.13","0.00159"],["75843.07","0.013185"],["75842.33","0.00159"],["75841.99","0.006"],["75841.75","0.019538"],["75841.74","0.04"],["75841.71","0.031817"],["75841.36","0.017336"],["75841.33","0.000072"],["75841.16","0.001872"],["75841.11","0.172641"],["75841.04","0.029772"],["75841","0.000065"],["75840.93","0.015244"],["75840.86","0.00159"],["75840.79","0.000072"],["75840.38","0.043333"],["75840.32","0.092539"],["75840.3","0.132228"],["75840.2","0.054966"],["75840.06","0.00159"],["75840","0.20726"],["75839.64","0.003744"],["75839.29","0.006592"],["75838.58","0.00159"],["75838.52","0.049778"],["75838.14","0.003955"],["75838","0.000065"],["75837.78","0.00159"],["75837.75","0.000587"],["75837.53","0.322245"],["75837.52","0.593323"],["75837.37","0.00384"],["75837.29","0.044335"],["75837.24","0.119228"],["75837.13","0.152844"]],"a":[["75848.75","0.747137"],["75848.89","0.060306"],["75848.9","0.1"],["75851.43","0.00159"],["75851.44","0.080754"],["75852.23","0.00159"],["75852.54","0.131067"],["75852.65","0.003955"],["75853.71","0.00159"],["75853.86","0.003955"],["75854.43","0.015684"],["75854.5","0.130389"],["75854.51","0.00159"],["75855.21","0.031168"],["75855.23","0.271494"],["75855.73","0.042698"],["75855.98","0.00159"],["75856.04","0.01346"],["75856.33","0.001872"],["75856.78","0.00159"],["75857.15","0.000072"],["75857.17","0.015127"],["75857.8","0.043322"],["75857.81","0.045305"],["75857.85","0.003792"],["75858.09","0.026344"],["75858.26","0.00159"],["75859.06","0.031618"],["75859.07","0.025"],["75859.1","0.006592"],["75859.98","0.013183"],["75860.12","0.00384"],["75860.54","0.00159"],["75860.74","0.051204"],["75860.75","0.065861"],["75861.18","0.031222"],["75861.33","0.00159"],["75861.64","0.003888"],["75861.96","0.042213"],["75862.28","0.000777"],["75862.79","0.013184"],["75862.81","0.00159"],["75862.84","0.027959"],["75863.16","0.003888"],["75863.51","0.043628"],["75863.52","0.002525"],["75863.61","0.00159"],["75864.2","0.003955"],["75864.76","0.000072"],["75864.81","0.002018"]],"u":2876700,"seq":47474967795},"cts":1731035685323}`,
|
||||
"Orderbook Update": `{"topic":"orderbook.50.BTCUSDT","ts":1731035685345,"type":"delta","data":{"s":"BTCUSDT","b":[["75848.62","0.014895"],["75837.13","0"]],"a":[["75848.89","0.088149"],["75851.44","0.078379"],["75852.65","0"],["75855.23","0.260219"],["75857.74","0.049778"]],"u":2876701,"seq":47474967823},"cts":1731035685342}`,
|
||||
"Public Trade": `{"topic":"publicTrade.BTCUSDT","ts":1690720953113,"type":"snapshot","data":[{"i":"2200000000067341890","T":1690720953111,"p":"3.6279","v":"1.3637","S":"Sell","s":"BTCUSDT","BT":false}]}`,
|
||||
"Public Kline": `{ "topic": "kline.5.BTCUSDT", "data": [ { "start": 1672324800000, "end": 1672325099999, "interval": "5", "open": "16649.5", "close": "16677", "high": "16677", "low": "16608", "volume": "2.081", "turnover": "34666.4005", "confirm": false, "timestamp": 1672324988882 } ], "ts": 1672324988882,"type": "snapshot"}`,
|
||||
"Public Liquidiation": `{ "data": { "price": "0.03803", "side": "Buy", "size": "1637", "symbol": "GALAUSDT", "updatedTime": 1673251091822 }, "topic": "liquidation.GALAUSDT", "ts": 1673251091822, "type": "snapshot" }`,
|
||||
"Public LT Kline": `{ "type": "snapshot", "topic": "kline_lt.5.BTCUSDT", "data": [ { "start": 1672325100000, "end": 1672325399999, "interval": "5", "open": "0.416039541212402799", "close": "0.41477848043290448", "high": "0.416039541212402799", "low": "0.409734237314911206", "confirm": false, "timestamp": 1672325322393 } ], "ts": 1672325322393 }`,
|
||||
"Public Kline": `{ "topic": "kline.5.BTCUSDT", "data": [ { "start": 1672324800000, "end": 1672325099999, "interval": "5", "open": "16649.5", "close": "16677", "high": "16677", "low": "16608", "volume": "2.081", "turnover": "34666.4005", "confirm": false, "timestamp": 1672324988882} ], "ts": 1672324988882,"type": "snapshot"}`,
|
||||
"Public Liquidiation": `{ "data": { "price": "0.03803", "side": "Buy", "size": "1637", "symbol": "GALAUSDT", "updatedTime": 1673251091822}, "topic": "liquidation.GALAUSDT", "ts": 1673251091822, "type": "snapshot" }`,
|
||||
"Public LT Kline": `{ "type": "snapshot", "topic": "kline_lt.5.BTCUSDT", "data": [ { "start": 1672325100000, "end": 1672325399999, "interval": "5", "open": "0.416039541212402799", "close": "0.41477848043290448", "high": "0.416039541212402799", "low": "0.409734237314911206", "confirm": false, "timestamp": 1672325322393} ], "ts": 1672325322393}`,
|
||||
"Public LT Ticker": `{ "topic": "tickers_lt.BTCUSDT", "ts": 1672325446847, "type": "snapshot", "data": { "symbol": "BTCUSDT", "lastPrice": "0.41477848043290448", "highPrice24h": "0.435285472510871305", "lowPrice24h": "0.394601507960931382", "prevPrice24h": "0.431502290172376349", "price24hPcnt": "-0.0388" } }`,
|
||||
"Public LT Navigation": `{ "topic": "lt.EOS3LUSDT", "ts": 1672325564669, "type": "snapshot", "data": { "symbol": "BTCUSDT", "time": 1672325564554, "nav": "0.413517419653406162", "basketPosition": "1.261060779498318641", "leverage": "2.656197506416192150", "basketLoan": "-0.684866519289629374", "circulation": "72767.309468460367138199", "basket": "91764.000000292013277472" } }`,
|
||||
"Private Position": `{"id": "59232430b58efe-5fc5-4470-9337-4ce293b68edd", "topic": "position", "creationTime": 1672364174455, "data": [ { "positionIdx": 0, "tradeMode": 0, "riskId": 41, "riskLimitValue": "200000", "symbol": "XRPUSDT", "side": "Buy", "size": "75", "entryPrice": "0.3615", "leverage": "10", "positionValue": "27.1125", "positionBalance": "0", "markPrice": "0.3374", "positionIM": "2.72589075", "positionMM": "0.28576575", "takeProfit": "0", "stopLoss": "0", "trailingStop": "0", "unrealisedPnl": "-1.8075", "cumRealisedPnl": "0.64782276", "createdTime": "1672121182216", "updatedTime": "1672364174449", "tpslMode": "Full", "liqPrice": "", "bustPrice": "", "category": "linear","positionStatus":"Normal","adlRankIndicator":2}]}`,
|
||||
|
||||
@@ -941,7 +941,7 @@ func TestWSCancelTransferByID(t *testing.T) {
|
||||
assert.NotNil(t, result)
|
||||
}
|
||||
|
||||
const getTransferResponseJSON = `{"count": 2, "data":[{"amount": 0.2, "created_timestamp": 1550579457727, "currency": "BTC", "direction": "payment", "id": 2, "other_side": "2MzyQc5Tkik61kJbEpJV5D5H9VfWHZK9Sgy", "state": "prepared", "type": "user", "updated_timestamp": 1550579457727 }, { "amount": 0.3, "created_timestamp": 1550579255800, "currency": "BTC", "direction": "payment", "id": 1, "other_side": "new_user_1_1", "state": "confirmed", "type": "subaccount", "updated_timestamp": 1550579255800 } ] }`
|
||||
const getTransferResponseJSON = `{"count": 2, "data":[{"amount": 0.2, "created_timestamp": 1550579457727, "currency": "BTC", "direction": "payment", "id": 2, "other_side": "2MzyQc5Tkik61kJbEpJV5D5H9VfWHZK9Sgy", "state": "prepared", "type": "user", "updated_timestamp": 1550579457727}, { "amount": 0.3, "created_timestamp": 1550579255800, "currency": "BTC", "direction": "payment", "id": 1, "other_side": "new_user_1_1", "state": "confirmed", "type": "subaccount", "updated_timestamp": 1550579255800} ] }`
|
||||
|
||||
func TestGetTransfers(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -968,7 +968,7 @@ func TestWSRetrieveTransfers(t *testing.T) {
|
||||
assert.NotNil(t, result)
|
||||
}
|
||||
|
||||
const cancelWithdrawlPushDataJSON = `{"address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBz", "amount": 0.5, "confirmed_timestamp": null, "created_timestamp": 1550571443070, "currency": "BTC", "fee": 0.0001, "id": 1, "priority": 0.15, "state": "cancelled", "transaction_id": null, "updated_timestamp": 1550571443070 }`
|
||||
const cancelWithdrawlPushDataJSON = `{"address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBz", "amount": 0.5, "confirmed_timestamp": null, "created_timestamp": 1550571443070, "currency": "BTC", "fee": 0.0001, "id": 1, "priority": 0.15, "state": "cancelled", "transaction_id": null, "updated_timestamp": 1550571443070}`
|
||||
|
||||
func TestCancelWithdrawal(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -1043,7 +1043,7 @@ func TestWSRetrieveCurrentDepositAddress(t *testing.T) {
|
||||
assert.NotNil(t, result)
|
||||
}
|
||||
|
||||
const getDepositPushDataJSON = `{"count": 1, "data": [ { "address": "2N35qDKDY22zmJq9eSyiAerMD4enJ1xx6ax", "amount": 5, "currency": "BTC", "received_timestamp": 1549295017670, "state": "completed", "transaction_id": "230669110fdaf0a0dbcdc079b6b8b43d5af29cc73683835b9bc6b3406c065fda", "updated_timestamp": 1549295130159 } ] }`
|
||||
const getDepositPushDataJSON = `{"count": 1, "data": [ { "address": "2N35qDKDY22zmJq9eSyiAerMD4enJ1xx6ax", "amount": 5, "currency": "BTC", "received_timestamp": 1549295017670, "state": "completed", "transaction_id": "230669110fdaf0a0dbcdc079b6b8b43d5af29cc73683835b9bc6b3406c065fda", "updated_timestamp": 1549295130159} ] }`
|
||||
|
||||
func TestGetDeposits(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -1070,7 +1070,7 @@ func TestWSRetrieveDeposits(t *testing.T) {
|
||||
assert.NotNil(t, result)
|
||||
}
|
||||
|
||||
const getWithdrawalResponseJSON = `{"count": 1, "data": [ { "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBz", "amount": 0.5, "confirmed_timestamp": null, "created_timestamp": 1550571443070, "currency": "BTC", "fee": 0.0001, "id": 1, "priority": 0.15, "state": "unconfirmed", "transaction_id": null, "updated_timestamp": 1550571443070 } ] }`
|
||||
const getWithdrawalResponseJSON = `{"count": 1, "data": [ { "address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBz", "amount": 0.5, "confirmed_timestamp": null, "created_timestamp": 1550571443070, "currency": "BTC", "fee": 0.0001, "id": 1, "priority": 0.15, "state": "unconfirmed", "transaction_id": null, "updated_timestamp": 1550571443070} ] }`
|
||||
|
||||
func TestGetWithdrawals(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -1187,7 +1187,7 @@ func TestWSSubmitTransferToUser(t *testing.T) {
|
||||
assert.NotNil(t, result)
|
||||
}
|
||||
|
||||
const submitWithdrawalResponseJSON = `{"address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBz", "amount": 0.4, "confirmed_timestamp": null, "created_timestamp": 1550574558607, "currency": "BTC", "fee": 0.0001, "id": 4, "priority": 1, "state": "unconfirmed", "transaction_id": null, "updated_timestamp": 1550574558607 }`
|
||||
const submitWithdrawalResponseJSON = `{"address": "2NBqqD5GRJ8wHy1PYyCXTe9ke5226FhavBz", "amount": 0.4, "confirmed_timestamp": null, "created_timestamp": 1550574558607, "currency": "BTC", "fee": 0.0001, "id": 4, "priority": 1, "state": "unconfirmed", "transaction_id": null, "updated_timestamp": 1550574558607}`
|
||||
|
||||
func TestSubmitWithdraw(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -2658,7 +2658,7 @@ func TestOptionsUnderlyingTradesPushData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const optionsUnderlyingPricePushDataJSON = `{ "time": 1630576356, "channel": "options.ul_price", "event": "update", "result": { "underlying": "BTC_USDT", "price": 49653.24,"time": 1639143988,"time_ms": 1639143988931 }}`
|
||||
const optionsUnderlyingPricePushDataJSON = `{ "time": 1630576356, "channel": "options.ul_price", "event": "update", "result": { "underlying": "BTC_USDT", "price": 49653.24,"time": 1639143988,"time_ms": 1639143988931}}`
|
||||
|
||||
func TestOptionsUnderlyingPricePushData(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -2667,7 +2667,7 @@ func TestOptionsUnderlyingPricePushData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const optionsMarkPricePushDataJSON = `{ "time": 1630576356, "channel": "options.mark_price", "event": "update", "result": { "contract": "BTC_USDT-20211231-59800-P", "price": 11021.27, "time": 1639143401, "time_ms": 1639143401676 }}`
|
||||
const optionsMarkPricePushDataJSON = `{ "time": 1630576356, "channel": "options.mark_price", "event": "update", "result": { "contract": "BTC_USDT-20211231-59800-P", "price": 11021.27, "time": 1639143401, "time_ms": 1639143401676}}`
|
||||
|
||||
func TestOptionsMarkPricePushData(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -2676,7 +2676,7 @@ func TestOptionsMarkPricePushData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const optionsSettlementsPushDataJSON = `{ "time": 1630576356, "channel": "options.settlements", "event": "update", "result": { "contract": "BTC_USDT-20211130-55000-P", "orderbook_id": 2, "position_size": 1, "profit": 0.5, "settle_price": 70000, "strike_price": 65000, "tag": "WEEK", "trade_id": 1, "trade_size": 1, "underlying": "BTC_USDT", "time": 1639051907, "time_ms": 1639051907000 }}`
|
||||
const optionsSettlementsPushDataJSON = `{ "time": 1630576356, "channel": "options.settlements", "event": "update", "result": { "contract": "BTC_USDT-20211130-55000-P", "orderbook_id": 2, "position_size": 1, "profit": 0.5, "settle_price": 70000, "strike_price": 65000, "tag": "WEEK", "trade_id": 1, "trade_size": 1, "underlying": "BTC_USDT", "time": 1639051907, "time_ms": 1639051907000}}`
|
||||
|
||||
func TestSettlementsPushData(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -2685,7 +2685,7 @@ func TestSettlementsPushData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const optionsContractPushDataJSON = `{"time": 1630576356, "channel": "options.contracts", "event": "update", "result": { "contract": "BTC_USDT-20211130-50000-P", "create_time": 1637917026, "expiration_time": 1638230400, "init_margin_high": 0.15, "init_margin_low": 0.1, "is_call": false, "maint_margin_base": 0.075, "maker_fee_rate": 0.0004, "mark_price_round": 0.1, "min_balance_short": 0.5, "min_order_margin": 0.1, "multiplier": 0.0001, "order_price_deviate": 0, "order_price_round": 0.1, "order_size_max": 1, "order_size_min": 10, "orders_limit": 100000, "ref_discount_rate": 0.1, "ref_rebate_rate": 0, "strike_price": 50000, "tag": "WEEK", "taker_fee_rate": 0.0004, "underlying": "BTC_USDT", "time": 1639051907, "time_ms": 1639051907000 }}`
|
||||
const optionsContractPushDataJSON = `{"time": 1630576356, "channel": "options.contracts", "event": "update", "result": { "contract": "BTC_USDT-20211130-50000-P", "create_time": 1637917026, "expiration_time": 1638230400, "init_margin_high": 0.15, "init_margin_low": 0.1, "is_call": false, "maint_margin_base": 0.075, "maker_fee_rate": 0.0004, "mark_price_round": 0.1, "min_balance_short": 0.5, "min_order_margin": 0.1, "multiplier": 0.0001, "order_price_deviate": 0, "order_price_round": 0.1, "order_size_max": 1, "order_size_min": 10, "orders_limit": 100000, "ref_discount_rate": 0.1, "ref_rebate_rate": 0, "strike_price": 50000, "tag": "WEEK", "taker_fee_rate": 0.0004, "underlying": "BTC_USDT", "time": 1639051907, "time_ms": 1639051907000}}`
|
||||
|
||||
func TestOptionsContractPushData(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -2745,7 +2745,7 @@ func TestOptionUserTradesPushData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const optionsLiquidatesPushDataJSON = `{ "channel": "options.liquidates", "event": "update", "time": 1630654851, "result": [ { "user": "1xxxx", "init_margin": 1190, "maint_margin": 1042.5, "order_margin": 0, "time": 1639051907, "time_ms": 1639051907000 } ]}`
|
||||
const optionsLiquidatesPushDataJSON = `{ "channel": "options.liquidates", "event": "update", "time": 1630654851, "result": [ { "user": "1xxxx", "init_margin": 1190, "maint_margin": 1042.5, "order_margin": 0, "time": 1639051907, "time_ms": 1639051907000} ]}`
|
||||
|
||||
func TestOptionsLiquidatesPushData(t *testing.T) {
|
||||
t.Parallel()
|
||||
@@ -2781,7 +2781,7 @@ func TestOptionsBalancePushData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const optionsPositionPushDataJSON = `{"time": 1630654851, "channel": "options.positions", "event": "update", "error": null, "result": [ { "entry_price": 0, "realised_pnl": -13.028, "size": 0, "contract": "BTC_USDT-20211130-65000-C", "user": "9010", "time": 1639051907, "time_ms": 1639051907000 } ]}`
|
||||
const optionsPositionPushDataJSON = `{"time": 1630654851, "channel": "options.positions", "event": "update", "error": null, "result": [ { "entry_price": 0, "realised_pnl": -13.028, "size": 0, "contract": "BTC_USDT-20211130-65000-C", "user": "9010", "time": 1639051907, "time_ms": 1639051907000} ]}`
|
||||
|
||||
func TestOptionsPositionPushData(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -2690,8 +2690,8 @@ func TestCancelAllOrders(t *testing.T) {
|
||||
|
||||
const (
|
||||
subUserResponseJSON = `{"userId":"635002438793b80001dcc8b3", "uid":62356, "subName":"margin01", "status":2, "type":4, "access":"Margin", "createdAt":1666187844000, "remarks":null }`
|
||||
transferFuturesFundsResponseJSON = `{"applyId": "620a0bbefeaa6a000110e833", "bizNo": "620a0bbefeaa6a000110e832", "payAccountType": "CONTRACT", "payTag": "DEFAULT", "remark": "", "recAccountType": "MAIN", "recTag": "DEFAULT", "recRemark": "", "recSystem": "KUCOIN", "status": "PROCESSING", "currency": "USDT", "amount": "0.001", "fee": "0", "sn": 889048787670001, "reason": "", "createdAt": 1644825534000, "updatedAt": 1644825534000 }`
|
||||
modifySubAccountSpotAPIs = `{"subName": "AAAAAAAAAA0007", "remark": "remark", "apiKey": "630325e0e750870001829864", "apiSecret": "110f31fc-61c5-4baf-a29f-3f19a62bbf5d", "passphrase": "passphrase", "permission": "General", "ipWhitelist": "", "createdAt": 1661150688000 }`
|
||||
transferFuturesFundsResponseJSON = `{"applyId": "620a0bbefeaa6a000110e833", "bizNo": "620a0bbefeaa6a000110e832", "payAccountType": "CONTRACT", "payTag": "DEFAULT", "remark": "", "recAccountType": "MAIN", "recTag": "DEFAULT", "recRemark": "", "recSystem": "KUCOIN", "status": "PROCESSING", "currency": "USDT", "amount": "0.001", "fee": "0", "sn": 889048787670001, "reason": "", "createdAt": 1644825534000, "updatedAt": 1644825534000}`
|
||||
modifySubAccountSpotAPIs = `{"subName": "AAAAAAAAAA0007", "remark": "remark", "apiKey": "630325e0e750870001829864", "apiSecret": "110f31fc-61c5-4baf-a29f-3f19a62bbf5d", "passphrase": "passphrase", "permission": "General", "ipWhitelist": "", "createdAt": 1661150688000}`
|
||||
)
|
||||
|
||||
func TestCreateSubUser(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user