Skip to content

Conversation

@valentiniljaz
Copy link
Contributor

The actual property on the "symbol" object is called "notional". Changed the types to reflect the actual state.

@balthazar balthazar merged commit ba46b86 into ccxt:master Aug 28, 2023
@balthazar
Copy link
Collaborator

Thank you :)

@bennycode
Copy link
Contributor

@valentiniljaz what's your source of truth? The official Binance API documentation says it's "minNotional" and not "notional":

Source #1: https://binance-docs.github.io/apidocs/spot/en/#filters

image

Source #2: https://github.com/binance/binance-spot-api-docs/blob/0b14fadf8e1be3160a75721b2ec2d9123e48a774/filters.md?plain=1#L96

image

@balthazar have you tested this change?

@valentiniljaz
Copy link
Contributor Author

valentiniljaz commented Oct 9, 2023

My source of truth is the actual API response: /fapi/v1/exchangeInfo

{
    "timezone": "UTC",
    "serverTime": 1696831210908,
    "futuresType": "U_MARGINED",
    "rateLimits": [
        {
            "rateLimitType": "REQUEST_WEIGHT",
            "interval": "MINUTE",
            "intervalNum": 1,
            "limit": 2400
        },
        {
            "rateLimitType": "ORDERS",
            "interval": "MINUTE",
            "intervalNum": 1,
            "limit": 1200
        },
        {
            "rateLimitType": "ORDERS",
            "interval": "SECOND",
            "intervalNum": 10,
            "limit": 300
        }
    ],
    "exchangeFilters": [],
    "assets": [
        {
            "asset": "USDT",
            "marginAvailable": true,
            "autoAssetExchange": "-10000"
        },
        {
            "asset": "BTC",
            "marginAvailable": true,
            "autoAssetExchange": "-0.00100000"
        },
        {
            "asset": "BNB",
            "marginAvailable": true,
            "autoAssetExchange": "-10"
        },
        {
            "asset": "ETH",
            "marginAvailable": true,
            "autoAssetExchange": "-5"
        },
        {
            "asset": "XRP",
            "marginAvailable": true,
            "autoAssetExchange": "0"
        },
        {
            "asset": "BUSD",
            "marginAvailable": true,
            "autoAssetExchange": "-10000"
        },
        {
            "asset": "USDC",
            "marginAvailable": true,
            "autoAssetExchange": "0"
        },
        {
            "asset": "TUSD",
            "marginAvailable": true,
            "autoAssetExchange": "0"
        },
        {
            "asset": "USDP",
            "marginAvailable": true,
            "autoAssetExchange": "0"
        }
    ],
    "symbols": [
        {
            "symbol": "BTCUSDT",
            "pair": "BTCUSDT",
            "contractType": "PERPETUAL",
            "deliveryDate": 4133404800000,
            "onboardDate": 1569398400000,
            "status": "TRADING",
            "maintMarginPercent": "2.5000",
            "requiredMarginPercent": "5.0000",
            "baseAsset": "BTC",
            "quoteAsset": "USDT",
            "marginAsset": "USDT",
            "pricePrecision": 2,
            "quantityPrecision": 3,
            "baseAssetPrecision": 8,
            "quotePrecision": 8,
            "underlyingType": "COIN",
            "underlyingSubType": [
                "PoW"
            ],
            "settlePlan": 0,
            "triggerProtect": "0.0500",
            "liquidationFee": "0.012500",
            "marketTakeBound": "0.05",
            "maxMoveOrderLimit": 10000,
            "filters": [
                {
                    "filterType": "PRICE_FILTER",
                    "minPrice": "556.80",
                    "tickSize": "0.10",
                    "maxPrice": "4529764"
                },
                {
                    "stepSize": "0.001",
                    "filterType": "LOT_SIZE",
                    "minQty": "0.001",
                    "maxQty": "1000"
                },
                {
                    "minQty": "0.001",
                    "maxQty": "120",
                    "stepSize": "0.001",
                    "filterType": "MARKET_LOT_SIZE"
                },
                {
                    "filterType": "MAX_NUM_ORDERS",
                    "limit": 200
                },
                {
                    "limit": 10,
                    "filterType": "MAX_NUM_ALGO_ORDERS"
                },
                {
                    "filterType": "MIN_NOTIONAL",
                    "notional": "5"
                },
                {
                    "multiplierUp": "1.0500",
                    "multiplierDecimal": "4",
                    "filterType": "PERCENT_PRICE",
                    "multiplierDown": "0.9500"
                }
            ],
            "orderTypes": [
                "LIMIT",
                "MARKET",
                "STOP",
                "STOP_MARKET",
                "TAKE_PROFIT",
                "TAKE_PROFIT_MARKET",
                "TRAILING_STOP_MARKET"
            ],
            "timeInForce": [
                "GTC",
                "IOC",
                "FOK",
                "GTX",
                "GTD"
            ]
        },
        {
            "symbol": "ETHUSDT",
            "pair": "ETHUSDT",
            "contractType": "PERPETUAL",
            "deliveryDate": 4133404800000,
            "onboardDate": 1569398400000,
            "status": "TRADING",
            "maintMarginPercent": "2.5000",
            "requiredMarginPercent": "5.0000",
            "baseAsset": "ETH",
            "quoteAsset": "USDT",
            "marginAsset": "USDT",
            "pricePrecision": 2,
            "quantityPrecision": 3,
            "baseAssetPrecision": 8,
            "quotePrecision": 8,
            "underlyingType": "COIN",
            "underlyingSubType": [
                "Layer-1"
            ],
            "settlePlan": 0,
            "triggerProtect": "0.0500",
            "liquidationFee": "0.012500",
            "marketTakeBound": "0.05",
            "maxMoveOrderLimit": 10000,
            "filters": [
                {
                    "minPrice": "39.86",
                    "maxPrice": "306177",
                    "filterType": "PRICE_FILTER",
                    "tickSize": "0.01"
                },
                {
                    "stepSize": "0.001",
                    "minQty": "0.001",
                    "filterType": "LOT_SIZE",
                    "maxQty": "10000"
                },
                {
                    "filterType": "MARKET_LOT_SIZE",
                    "maxQty": "2000",
                    "stepSize": "0.001",
                    "minQty": "0.001"
                },
                {
                    "filterType": "MAX_NUM_ORDERS",
                    "limit": 200
                },
                {
                    "filterType": "MAX_NUM_ALGO_ORDERS",
                    "limit": 10
                },
                {
                    "filterType": "MIN_NOTIONAL",
                    "notional": "5"
                },
                {
                    "multiplierDecimal": "4",
                    "multiplierDown": "0.9500",
                    "filterType": "PERCENT_PRICE",
                    "multiplierUp": "1.0500"
                }
            ],
            "orderTypes": [
                "LIMIT",
                "MARKET",
                "STOP",
                "STOP_MARKET",
                "TAKE_PROFIT",
                "TAKE_PROFIT_MARKET",
                "TRAILING_STOP_MARKET"
            ],
            "timeInForce": [
                "GTC",
                "IOC",
                "FOK",
                "GTX",
                "GTD"
            ]
        },
...

Under symbols -> filters -> MIN_NOTIONAL it is clear that the value is stored in notional property.

@valentiniljaz
Copy link
Contributor Author

I see the confusion now. You are referring to the SPOT API and I was referring to the Futures. API calls for ExchangeInfo are different for Futures vs. Spot.

Actually all filters are defined differently on the Futures market. Maybe we should define FuturesSymbolFilter?

@bennycode
Copy link
Contributor

With the latest version of binance-api-node my code fails to compile with the following error message:

error TS2551: Property 'minNotional' does not exist on type 'SymbolMinNotionalFilter'. Did you mean 'notional'?

My code tries to use the Symbol interface and fails because Symbol.filters can be of the union type SymbolFilter but the SymbolMinNotionalFilter (of type SymbolFilter) doesn't include a minNotional property anymore (because it has been renamed to notional).

@bennycode
Copy link
Contributor

I am making my requests with client.exchangeInfo() and it looks like the "MIN_NOTIONAL" filter type got replaced by "NOTIONAL" but keeping the minNotional property.

Example Response Payload:

[
  {
    "symbol": "ETHBTC",
    "status": "TRADING",
    "baseAsset": "ETH",
    "baseAssetPrecision": 8,
    "quoteAsset": "BTC",
    "quotePrecision": 8,
    "quoteAssetPrecision": 8,
    "baseCommissionPrecision": 8,
    "quoteCommissionPrecision": 8,
    "orderTypes": [
      "LIMIT",
      "LIMIT_MAKER",
      "MARKET",
      "STOP_LOSS_LIMIT",
      "TAKE_PROFIT_LIMIT"
    ],
    "icebergAllowed": true,
    "ocoAllowed": true,
    "quoteOrderQtyMarketAllowed": true,
    "allowTrailingStop": true,
    "cancelReplaceAllowed": true,
    "isSpotTradingAllowed": true,
    "isMarginTradingAllowed": true,
    "filters": [
      {
        "filterType": "PRICE_FILTER",
        "minPrice": "0.00001000",
        "maxPrice": "922327.00000000",
        "tickSize": "0.00001000"
      },
      {
        "filterType": "LOT_SIZE",
        "minQty": "0.00010000",
        "maxQty": "100000.00000000",
        "stepSize": "0.00010000"
      },
      {
        "filterType": "ICEBERG_PARTS",
        "limit": 10
      },
      {
        "filterType": "MARKET_LOT_SIZE",
        "minQty": "0.00000000",
        "maxQty": "2883.77798242",
        "stepSize": "0.00000000"
      },
      {
        "filterType": "TRAILING_DELTA",
        "minTrailingAboveDelta": 10,
        "maxTrailingAboveDelta": 2000,
        "minTrailingBelowDelta": 10,
        "maxTrailingBelowDelta": 2000
      },
      {
        "filterType": "PERCENT_PRICE_BY_SIDE",
        "bidMultiplierUp": "5",
        "bidMultiplierDown": "0.2",
        "askMultiplierUp": "5",
        "askMultiplierDown": "0.2",
        "avgPriceMins": 5
      },
      {
        "filterType": "NOTIONAL",
        "minNotional": "0.00010000",
        "applyMinToMarket": true,
        "maxNotional": "9000000.00000000",
        "applyMaxToMarket": false,
        "avgPriceMins": 5
      },
      {
        "filterType": "MAX_NUM_ORDERS",
        "maxNumOrders": 200
      },
      {
        "filterType": "MAX_NUM_ALGO_ORDERS",
        "maxNumAlgoOrders": 5
      }
    ],
    "permissions": [
      "SPOT",
      "MARGIN",
      "TRD_GRP_004",
      "TRD_GRP_005",
      "TRD_GRP_006",
      "TRD_GRP_008",
      "TRD_GRP_009",
      "TRD_GRP_010",
      "TRD_GRP_011",
      "TRD_GRP_012",
      "TRD_GRP_013",
      "TRD_GRP_014",
      "TRD_GRP_015",
      "TRD_GRP_016",
      "TRD_GRP_017",
      "TRD_GRP_018",
      "TRD_GRP_019",
      "TRD_GRP_020",
      "TRD_GRP_021",
      "TRD_GRP_022",
      "TRD_GRP_023"
    ],
    "defaultSelfTradePreventionMode": "NONE",
    "allowedSelfTradePreventionModes": [
      "NONE",
      "EXPIRE_TAKER",
      "EXPIRE_MAKER",
      "EXPIRE_BOTH"
    ]
  },
  // ...
]

@valentiniljaz
Copy link
Contributor Author

I'll prepare new PR where I'll define new SymbolFilter type, specifically for Futures API.

@bennycode
Copy link
Contributor

bennycode commented Oct 9, 2023

That would be cool. In this PR we can also update the name of SymbolMinNotionalFilter from "MIN_NOTIONAL" to "NOTIONAL".

Source: https://binance-docs.github.io/apidocs/spot/en/#change-log

2022-06-15

image

@valentiniljaz
Copy link
Contributor Author

I have prepared new PR: #649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants