mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Bybit: Add missing field min notional (#1574)
* bybit: Adds min notional value for contract trading * update tests --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -47,21 +47,17 @@ var (
|
||||
func TestGetInstrumentInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := b.GetInstrumentInfo(context.Background(), "spot", "", "", "", "", 0)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetInstrumentInfo(context.Background(), "linear", "", "", "", "", 0)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetInstrumentInfo(context.Background(), "inverse", "", "", "", "", 0)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetInstrumentInfo(context.Background(), "option", "", "", "", "", 0)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
payload, err := b.GetInstrumentInfo(context.Background(), "linear", "10000000AIDOGEUSDT", "", "", "", 0)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, payload.List)
|
||||
require.NotZero(t, payload.List[0].LotSizeFilter.MinNotionalValue)
|
||||
}
|
||||
|
||||
func TestGetKlines(t *testing.T) {
|
||||
@@ -621,29 +617,17 @@ func TestUpdateTickers(t *testing.T) {
|
||||
func TestGetTickersV5(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := b.GetTickers(context.Background(), "bruh", "", "", time.Time{})
|
||||
if !errors.Is(err, errInvalidCategory) {
|
||||
t.Errorf("expected %v, got %v", errInvalidCategory, err)
|
||||
}
|
||||
require.ErrorIs(t, err, errInvalidCategory)
|
||||
_, err = b.GetTickers(context.Background(), "option", "BTC-29DEC23-80000-C", "", time.Time{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetTickers(context.Background(), "spot", "", "", time.Time{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetTickers(context.Background(), "option", "", "BTC", time.Time{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetTickers(context.Background(), "inverse", "", "", time.Time{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
_, err = b.GetTickers(context.Background(), "linear", "", "", time.Time{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestGetFundingRateHistory(t *testing.T) {
|
||||
|
||||
@@ -94,6 +94,7 @@ type InstrumentInfo struct {
|
||||
QuotePrecision types.Number `json:"quotePrecision"`
|
||||
MinOrderAmt types.Number `json:"minOrderAmt"`
|
||||
MaxOrderAmt types.Number `json:"maxOrderAmt"`
|
||||
MinNotionalValue types.Number `json:"minNotionalValue"`
|
||||
} `json:"lotSizeFilter"`
|
||||
UnifiedMarginTrade bool `json:"unifiedMarginTrade"`
|
||||
FundingInterval int64 `json:"fundingInterval"`
|
||||
|
||||
54
testdata/http_mock/bybit/bybit.json
vendored
54
testdata/http_mock/bybit/bybit.json
vendored
@@ -168135,6 +168135,60 @@
|
||||
"queryString": "baseCoin=SOL\u0026category=option\u0026limit=1000\u0026status=Trading",
|
||||
"bodyParams": "",
|
||||
"headers": {}
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"result": {
|
||||
"category": "linear",
|
||||
"list": [
|
||||
{
|
||||
"baseCoin": "10000000AIDOGE",
|
||||
"contractType": "LinearPerpetual",
|
||||
"copyTrading": "none",
|
||||
"deliveryFeeRate": "",
|
||||
"deliveryTime": "0",
|
||||
"fundingInterval": 480,
|
||||
"isPreListing": false,
|
||||
"launchTime": "1709542899000",
|
||||
"leverageFilter": {
|
||||
"leverageStep": "0.01",
|
||||
"maxLeverage": "12.50",
|
||||
"minLeverage": "1"
|
||||
},
|
||||
"lotSizeFilter": {
|
||||
"maxMktOrderQty": "5000000",
|
||||
"maxOrderQty": "25000000",
|
||||
"minNotionalValue": "5",
|
||||
"minOrderQty": "100",
|
||||
"postOnlyMaxOrderQty": "25000000",
|
||||
"qtyStep": "100"
|
||||
},
|
||||
"lowerFundingRate": "-0.03",
|
||||
"preListingInfo": null,
|
||||
"priceFilter": {
|
||||
"maxPrice": "1.999998",
|
||||
"minPrice": "0.000001",
|
||||
"tickSize": "0.000001"
|
||||
},
|
||||
"priceScale": "6",
|
||||
"quoteCoin": "USDT",
|
||||
"settleCoin": "USDT",
|
||||
"status": "Trading",
|
||||
"symbol": "10000000AIDOGEUSDT",
|
||||
"unifiedMarginTrade": true,
|
||||
"upperFundingRate": "0.03"
|
||||
}
|
||||
],
|
||||
"nextPageCursor": ""
|
||||
},
|
||||
"retCode": 0,
|
||||
"retExtInfo": null,
|
||||
"retMsg": "OK",
|
||||
"time": 1720048559233
|
||||
},
|
||||
"queryString": "category=linear\u0026symbol=10000000AIDOGEUSDT",
|
||||
"bodyParams": "",
|
||||
"headers": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user