austinyearlykim/wolf

(SOLVED) RangeError when quantitySigFig is -1

Closed this issue · 3 comments

When I want to trade USDT (as BASE) and BNB (as TARGET) and set BUDGET to 10 I get the following error right after starting.

PURCHASE ERROR:  RangeError: toFixed() digits argument must be between 0 and 100
    at Number.toFixed (<anonymous>)
    at Wolf.calculateQuantity (/Users/daniel/Documents/git_projects/wolf/modules/Wolf.js:122:55)
    at Wolf.purchase (/Users/daniel/Documents/git_projects/wolf/modules/Wolf.js:136:32)
    at Wolf.hunt (/Users/daniel/Documents/git_projects/wolf/modules/Wolf.js:50:14)
    at Wolf.init (/Users/daniel/Documents/git_projects/wolf/modules/Wolf.js:44:14)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

I guess the following line is problematic since it sets quantifySigFig to -1 in my case:

get quantitySigFig() { return Number(this.filters[2].minNotional.indexOf('1') - 1) }

This is how the symbol object looks like:

{ symbol: 'BNBUSDT',
  status: 'TRADING',
  baseAsset: 'BNB',
  baseAssetPrecision: 8,
  quoteAsset: 'USDT',
  quotePrecision: 8,
  orderTypes: 
   [ 'LIMIT',
     'LIMIT_MAKER',
     'MARKET',
     'STOP_LOSS_LIMIT',
     'TAKE_PROFIT_LIMIT' ],
  icebergAllowed: false,
  filters: 
   [ { filterType: 'PRICE_FILTER',
       minPrice: '0.00010000',
       maxPrice: '100000.00000000',
       tickSize: '0.00010000' },
     { filterType: 'LOT_SIZE',
       minQty: '0.01000000',
       maxQty: '10000000.00000000',
       stepSize: '0.01000000' },
     { filterType: 'MIN_NOTIONAL', minNotional: '10.00000000' } ] }

Hi @Flur3x!

Cool find, i’ll get a patch release out tonight with a fix for this. Thank you for such a detailed bug ticket, i appreciate it

Working on this as we speak...

9f53673

good night!