askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.08k stars 3.93k forks source link

As #2222 is closed : [binance.js] Error -1100: Illegal characters found in parameter 'price' #2287

Closed Tralala44 closed 6 years ago

Tralala44 commented 6 years ago

Note: this is the technical bug tracker, please use other platforms for getting support and starting a (non technical) discussion. See the getting help page for details.

I'm submitting a ... [ X] bug report [ ] question about the decisions made in the repository

Action taken (what you did) Fresh install and same output.

Expected result (what you hoped would happen) working trade.

Actual result (unexpected outcome) buying BTC @ 5.8e-7 <-- POST /api/getCandles --> POST /api/getCandles 200 495ms 1.47kb handleCreate [binance.js] Error -1100: Illegal characters found in parameter 'price'; legal range is '^([0-9]{1,20})(.[0-9]{1,20})?$'. RECEIVED ERROR IN GEKKO INSTANCE 2018-07-08-00-14-tradebot-266139359109518 { name: 'AbortError', message: '[binance.js] Error -1100: Illegal characters found in parameter \'price\'; legal range is \'^([0-9]{1,20})(\.[0-9]{1,20})?$\'.' }

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc) I know it's Sunday :) But from what i can imagine may it could be "just" the price format to change (eg 5.8e-7 by 0.00000058)

Thank You

askmike commented 6 years ago

Thanks for the report!

But from what i can imagine may it could be "just" the price format to change (eg 5.8e-7 by 0.00000058)

Just to be sure, on what market where you trading?

Tralala44 commented 6 years ago

Hi It was on btc pundi x

After my night i thaught it may be linked to my distrib. I used the Ubuntu from the Windows store but maybe others dont have this issue... Thanks

Le dim. 8 juil. 2018 à 07:42, Mike van Rossum notifications@github.com a écrit :

Thanks for the report!

But from what i can imagine may it could be "just" the price format to change (eg 5.8e-7 by 0.00000058)

Just to be sure, on what market where you trading?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2287#issuecomment-403264197, or mute the thread https://github.com/notifications/unsubscribe-auth/AnB2HF3gqxb0XTKoB92krI8iLPnMME42ks5uEZvagaJpZM4VGhBT .

askmike commented 6 years ago

Just pushed a fix to the develop branch, please download that one and try again!

Tralala44 commented 6 years ago

Arf as i'm new also to git i struggle on how to do that. nonetheless i took the new lines of the binance.js and removed the old ones but still :

buying BTC @ 6.1e-7 <-- POST /api/getCandles --> POST /api/getCandles 200 440ms 1.94kb handleCreate [binance.js] Error -1100: Illegal characters found in parameter 'price'; legal range is '^([0-9]{1,20})(.[0-9]{1,20})?$'. RECEIVED ERROR IN GEKKO INSTANCE 2018-07-08-15-12-tradebot-177197138346324 { name: 'AbortError', message: '[binance.js] Error -1100: Illegal characters found in parameter \'price\'; legal range is \'^([0-9]{1,20})(\.[0-9]{1,20})?$\'.' }

Can you help me with the correct way to get this specific commit ?

Tralala44 commented 6 years ago

nevermind, i've added the price var with this.scientificToDecimal and it works.

askmike commented 6 years ago

Cool, you can also download a new release I just published: https://github.com/askmike/gekko/releases

If you do make sure to read the update doc: https://gekko.wizb.it/docs/installation/updating_gekko.html

six101 commented 6 years ago

I have the same problem, maybe you can help me. The new 6.2 update doesn't work for me either. In which file and where did you change price var "this.scientificToDecimal"? thx

askmike commented 6 years ago

The new 6.2 update doesn't work for me either.

What do you mean?

In which file and where did you change price var "this.scientificToDecimal"?

inside exchange/wrappers/binance.js

six101 commented 6 years ago

I have made a fresh installation of the 0.6.2 patch but I still have the same "[binance.js] Error -1100: Illegal characters found in parameter 'price'" error. Markets I have tested are BCN, NPXS and KEY. To exclude that it is not a windows bash error, I did 2 test installations with the new patch. One windows 10 bash ubuntu and one native windows 10 installation. Both show the error.

In an older develop branch installation I tried to change var price in binance.js but without luck. Haven't found a var price in binance.js. My programming skills are rather limited, so I asked where exactly.

askmike commented 6 years ago

Very strange, are you able to share more logs?

six101 commented 6 years ago

strangely enough, the logs don't show any errors. It just stops. here the last lines of the tradebot log: 2018-07-09 13:23:37 (DEBUG): calculated RSI properties for candle: 2018-07-09 13:23:37 (DEBUG): rsi: 26.31573632 2018-07-09 13:23:37 (DEBUG): price: 0.00000045 2018-07-09 13:23:37 (DEBUG): In low since 1 candle(s) 2018-07-09 13:23:37 (INFO): Trader Received advice to go long. Buying BCN 2018-07-09 13:23:43 (DEBUG): [ORDER] statusChange: SUBMITTED

console window: handleCreate [binance.js] Error -1100: Illegal characters found in parameter 'price'; legal range is '^([0-9]{1,20})(.[0-9]{1,20})?$'. RECEIVED ERROR IN GEKKO INSTANCE 2018-07-09-13-19-tradebot-928605191674484 { name: 'AbortError', message: '[binance.js] Error -1100: Illegal characters found in parameter \'price\'; legal range is \'^([0-9]{1,20})(\.[0-9]{1,20})?$\'.' }

browser: In the browser window an orange message popps up with: This is an archived Gekko, it is currently not running anymore. This is Gekko crashed with the following error: { "name": "AbortError", "message": "[binance.js] Error -1100: Illegal characters found in parameter 'price'; legal range is '^([0-9]{1,20})(\.[0-9]{1,20})?$'." }

BTC-NPXS only issues an empty error message: console: RECEIVED ERROR IN GEKKO INSTANCE 2018-07-09-13-17-tradebot-829084883261726 {}

Except for the error message and the tradebot stop, gekko continues to run normally.

askmike commented 6 years ago

I think I found the problem! Here are my trade logs:

2018-07-09 21:08:43 (INFO):         [EVENT advice]
 { id: 'advice-1',
  recommendation: 'short',
  date: moment.utc("2018-07-09T13:08:00.000+00:00") }
2018-07-09 21:08:43 (INFO):         [EVENT portfolioValueChange]
 { balance: 0.004157699999999999 }
2018-07-09 21:08:43 (INFO):         [EVENT tradeInitiated]
 { id: 'trade-1',
  adviceId: 'advice-1',
  action: 'sell',
  portfolio: { currency: 0.000272, asset: 6370 },
  balance: 0.004157699999999999 }
2018-07-09 21:10:44 (INFO):         [EVENT tradeCompleted]
 { id: 'trade-1',
  adviceId: 'advice-1',
  action: 'sell',
  cost: 0.000001845555,
  amount: 6051,
  price: 6.1e-7,
  portfolio: { currency: 0.00396311, asset: 319 },
  balance: 0.004157699999999999,
  date: moment("2018-07-09T21:09:18.040"),
  feePercent: 0.05,
  effectivePrice: 6.09695e-7 }
askmike commented 6 years ago

I am quite positive this is fixed now in the latest develop branch, please update and try again :)

six101 commented 6 years ago

Unfortunately it still doesn't work for me. I'm on the latest dev branch. Now gekko crashes with an empty error message.

RECEIVED ERROR IN GEKKO INSTANCE 2018-07-09-16-23-tradebot-7025096271114903 {}

I tested with bcn and npxs.

tradebotlog: 2018-07-09 16:33:11 (DEBUG): calculated RSI properties for candle: 2018-07-09 16:33:11 (DEBUG): rsi: 6.03650177 2018-07-09 16:33:11 (DEBUG): price: 0.00000046 2018-07-09 16:33:11 (DEBUG): In low since 1 candle(s) 2018-07-09 16:33:11 (INFO): Trader Received advice to go long. Buying BCN 2018-07-09 16:33:11 (DEBUG): Creating order to buy 259.18478260869557 BCN 2018-07-09 16:33:16 (DEBUG): [ORDER] statusChange: SUBMITTED

edit: The order was transmitted to binance and also executed. After that the tradebot crashed. bcn can only be bought on binance in whole units. Maybe that has something to do with it?

Tralala44 commented 6 years ago

Hello six101 and askmike i didn't try the latest update but from the commit i have i've added that line :


Trader.prototype.addOrder = function(tradeType, amount, price, callback) { const setOrder = (err, data) => { if (err) return callback(err);

 const txid = data.orderId;

 callback(undefined, txid);

};

price = this.scientificToDecimal(price);

const reqData = { symbol: this.pair, side: tradeType.toUpperCase(), type: 'LIMIT', timeInForce: 'GTC', quantity: amount, price: price, timestamp: new Date().getTime() };


I doubt that it was the best place to add it but it did the job.

Although now i have another problem, the buy order is correctly sent to binance but my strategy on the next candle send a legitimate sell order whereas the buy order is not completed and so cancelled it...But i don't want to pollute this issue.

askmike commented 6 years ago

@tralala44 I'd rather have the fix to work across all exchanges where this issue might show up, which is what my commit does.

@six101 can you provide logs?

The order was transmitted to binance and also executed. After that the tradebot crashed.

So I take it you got a different error this time?

On Tue, Jul 10, 2018 at 12:00 AM, Tralala44 notifications@github.com wrote:

Hello six101 and askmike i didn't try the latest update but from the commit i have i've added that line :

Trader.prototype.addOrder = function(tradeType, amount, price, callback) { const setOrder = (err, data) => { if (err) return callback(err);

const txid = data.orderId;

callback(undefined, txid);

};

price = this.scientificToDecimal(price);

const reqData = { symbol: this.pair, side: tradeType.toUpperCase(), type: 'LIMIT', timeInForce: 'GTC', quantity: amount, price: price, timestamp: new Date().getTime() };

I doubt that it was the best place to add it but it did the job.

Although now i have another problem, the buy order is correctly sent to binance but my strategy on the next candle send a legitimate sell order whereas the buy order is not completed and so cancelled it...But i don't want to pollute this issue.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2287#issuecomment-403530134, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MD_qNfoPn4d5C8jYK7LiTHWPzq_mEks5uE34sgaJpZM4VGhBT .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc

Tralala44 commented 6 years ago

So Six, have you made it ? Reality seams way different of backtesting bcn or npxs for me :)

six101 commented 6 years ago

Sorry I'm just checking in, I'm in the middle of a move. I didn't have much time to test. I think sunday I can take a little time to re-test. . Then I will test bcn and npxs again.

@six101 can you provide logs?

previous tests showed only an empty error message: RECEIVED ERROR IN GEKKO INSTANCE 2018-07-09-16-16-tradebot-745727029157132 {} No entries in tradebotlog. Is it somehow possible to enable a higher log level?

But I can also report something positive. I tested a little with BTC-DENT and the bot went without any errors. But I hadn't tested DENT before and I have no idea if DENT caused errors before.

askmike commented 6 years ago

Sorry for being unable to fix this properly guys. It's very strange as I am unable to reproduce all binance bugs. For me personally it's running very smooth.

I did push some updates related to binance error handling to the develop branch (see #2302), so you can try pulling latest. If Gekko encounters a fatal error from binance (since that branch) it will now log that error multiple times.

On Fri, Jul 13, 2018 at 7:42 AM, six101 notifications@github.com wrote:

Sorry I'm just checking in, I'm in the middle of a move. I didn't have much time to test. I think sunday I can take a little time to re-test. . Then I will test bcn and npxs again.

@six101 https://github.com/six101 can you provide logs?

previous tests showed only an empty error message: RECEIVED ERROR IN GEKKO INSTANCE 2018-07-09-16-16-tradebot-745727029157132 {} No entries in tradebotlog. Is it somehow possible to enable a higher log level?

But I can also report something positive. I tested a little with BTC-DENT and the bot went without any errors. But I hadn't tested DENT before and I have no idea if DENT caused errors before.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/2287#issuecomment-404683562, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MDxmCbp300C85MdpCfqS3Sspg35_Vks5uF97tgaJpZM4VGhBT .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc