wolf icon indicating copy to clipboard operation
wolf copied to clipboard

Uncaught AssertionError

Open altcnews opened this issue 6 years ago • 10 comments

hi all, i've got this when trying npm test:

Binance ✓ should be able to ping Binance API (310ms) ✓ should be able to make signed requests (277ms) ✓ should be authorized to trade (281ms) ✓ should have enough balance to afford budget (281ms)

Ledger ✓ should be able construct Ledger ✓ should create a testLedger.csv file if one does not already exist ✓ should be able to write to the Ledger

Queue ✓ should be able construct Queue ✓ should be initialize Queue ✓ should be able access Queue meta data ✓ should be able validate valid transactions ✓ should be able reject invalid transactions ✓ should be able add to queue

Symbol ✓ should be able construct Symbol ✓ should be initialize Symbol (278ms) 1) should be able access Symbol meta data

Ticker ✓ should be able construct Ticker ✓ should be able to initialize Ticker (1196ms) ✓ should be able to execute array of callbacks (4000ms) ✓ should be able access Ticker meta data

19 passing (10s) 1 failing

  1. Symbol should be able access Symbol meta data: Uncaught AssertionError [ERR_ASSERTION]: NaN == true at Timeout.setTimeout [as _onTimeout] (test/symbol.js:42:21)

npm ERR! Test failed. See above for more details.

appreciate for any helps.

altcnews avatar Dec 18 '18 06:12 altcnews

Hi @altcnews,

Try running it a few more times and if that doesn't work...

in the .env that you're using what is your

TARGET_ASSET=
BASE_ASSET=

?

My hunch is some trading pairs might not be regulated as strongly as others on binance or their API might not be as consistent with some.

austinyearlykim avatar Dec 18 '18 18:12 austinyearlykim

[Hi] austinyearlykim, this is my .env DELETED screenshot and history for your own security*

and i still got the same error even if i just copied the default template.env.

Thanks & Regards.

altcnews avatar Dec 18 '18 19:12 altcnews

https://github.com/austinyearlykim/wolf/blob/master/test/symbol.js

This is the file for the Symbol tests. One of those checks to determine the existence of the properties is evaluating to 0 which is a falsey value in javascript making the assertion error trigger haha. This can actually be fixed by just checking if that property is typeof number instead. let me make a quick change for this

austinyearlykim avatar Dec 18 '18 20:12 austinyearlykim

https://github.com/austinyearlykim/wolf/pull/76

i will do the full pr including the version tag and release when i get home later tonight!

thanks @altcnews

austinyearlykim avatar Dec 18 '18 20:12 austinyearlykim

i tried using the updated file #76 and then got other error in npm test

wonder if is there anything else that i need to update? really appreciate for your helps @austinyearlykim thank you

altcnews avatar Dec 18 '18 23:12 altcnews

https://github.com/austinyearlykim/wolf/blob/master/modules/Symbol.js#L51

it's erroring out here because the stepsize doesn't have a 1 in it anymore. which is a little concerning because I'm not sure how else stepsize is quantified. This is more than likely due to prices getting too low and the hackiest way to fix this would be to just default the step size to 0. Let me think on this for a little. Hope this helped clarify things

austinyearlykim avatar Dec 19 '18 00:12 austinyearlykim

thank you @austinyearlykim you are very kind. hope this can be solved. seems like the bot is quite good and want to give it a try.

altcnews avatar Dec 19 '18 00:12 altcnews

I have the same issue on multiple versions, tried all kinds of assets same error every time, changed the modules/Symbols.js L51 to 0 no luck

Why is no one else having this problem?

dutchpatriot avatar Jan 08 '19 21:01 dutchpatriot

+1 defaulting the stepsize to 0 dosen't help!

npm test runs without errors...

But then this...

Screenshot 2019-03-29 at 13 07 30

Thanx for the fantastic bot...

rummand avatar Mar 28 '19 21:03 rummand

Replace the getters() function in the Symbol.js file as of following and your test and simulator will work smoothly:

getters() {
        return {
            get minPrice() { return Number(this.filters[0].minPrice) },
            get maxPrice() { return Number(this.filters[0].maxPrice) },
            get tickSize() { return Number(this.filters[0].tickSize) },
            get minQty() { return Number(this.filters[2].minQty) },
            get maxQty() { return Number(this.filters[2].maxQty) },
            get stepSize() { return Number(this.filters[2].stepSize) },
            get priceSigFig() { return Number(this.filters[0].tickSize.indexOf('1') - 1) },
            get quantitySigFig() {
                const sf = Number(this.filters[2].stepSize.indexOf('1') - 1);
                return sf >= 0 ? sf : 0;
            }
        }
    }

issue is with the filters[2] because stepSize is not in the filters[1]

umeshmoradiya avatar Aug 02 '19 08:08 umeshmoradiya