From fdd1421cad9267a2cc29b48f815fd8f6975b4b9e Mon Sep 17 00:00:00 2001 From: chrisleekr Date: Thu, 13 Apr 2023 00:48:17 +1000 Subject: [PATCH] fix: minNotional (#623) --- CHANGELOG.md | 3 ++- .../__tests__/fixtures/binance-exchange-info.json | 8 +++++--- app/cronjob/trailingTradeHelper/common.js | 11 ++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0db9ede..1ac8b663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ All notable changes to this project will be documented in this file. -## [Unreleased] +## [0.0.98] - 2023-04-13 - Added the prefix to environment parameter for `TRADINGVIEW` related - [#616](https://github.com/chrisleekr/binance-trading-bot/pull/616) +- Fixed the issue with minNotional - [#623](https://github.com/chrisleekr/binance-trading-bot/pull/623) ## [0.0.97] - 2023-03-21 diff --git a/app/cronjob/trailingTradeHelper/__tests__/fixtures/binance-exchange-info.json b/app/cronjob/trailingTradeHelper/__tests__/fixtures/binance-exchange-info.json index f86f8ad5..b856926c 100644 --- a/app/cronjob/trailingTradeHelper/__tests__/fixtures/binance-exchange-info.json +++ b/app/cronjob/trailingTradeHelper/__tests__/fixtures/binance-exchange-info.json @@ -65,10 +65,12 @@ "stepSize": "0.01000000" }, { - "filterType": "MIN_NOTIONAL", + "filterType": "NOTIONAL", "minNotional": "10.00000000", - "applyToMarket": true, - "avgPriceMins": 5 + "applyMinToMarket": true, + "maxNotional": "10000.00000000", + "applyMaxToMarket": false, + "avgPriceMins": 1 }, { "filterType": "ICEBERG_PARTS", diff --git a/app/cronjob/trailingTradeHelper/common.js b/app/cronjob/trailingTradeHelper/common.js index 2c59a963..c8ca2dc1 100644 --- a/app/cronjob/trailingTradeHelper/common.js +++ b/app/cronjob/trailingTradeHelper/common.js @@ -62,14 +62,23 @@ const cacheExchangeSymbols = async logger => { const { symbols } = exchangeInfo; const exchangeSymbols = symbols.reduce((acc, symbol) => { + // For backward compatibility, MIN_NOTIONAL is deprecated. const minNotionalFilter = _.find(symbol.filters, { filterType: 'MIN_NOTIONAL' }); + + // New filter type is NOTIONAL. + const notionalFilter = _.find(symbol.filters, { + filterType: 'NOTIONAL' + }); + acc[symbol.symbol] = { symbol: symbol.symbol, status: symbol.status, quoteAsset: symbol.quoteAsset, - minNotional: parseFloat(minNotionalFilter.minNotional) + minNotional: minNotionalFilter + ? parseFloat(minNotionalFilter.minNotional) + : parseFloat(notionalFilter.minNotional) }; return acc;