miro-ka / mosquito

Trading Bot with focus on Evolutionary Algorithms and Machine Learning
GNU General Public License v3.0
261 stars 53 forks source link

Exception: inputs are all NaN #40

Closed crack00r closed 7 years ago

crack00r commented 7 years ago

Thu Aug 10 11:02:31 2017, close:0.000184 | 0.21007453USDT| 0.05832026BTC| 0.25185452ETH| 534.37500002XRP | $: -0.16%, b&h: -0.16% going to sleep for: 281 seconds. Error in macd.py: passed not enough data! Required: 26 passed: 24 Error in macd.py: passed not enough data! Required: 26 passed: 24 Error in macd.py: passed not enough data! Required: 26 passed: 23 Couldn't find exchange rate for: USDT Couldn't find exchange rate for: USDT Thu Aug 10 11:07:32 2017, close:0.000185 | 0.21007453USDT| 0.05832026BTC| 0.25185452ETH| 534.37500002XRP | $: -0.12%, b&h: -0.12% going to sleep for: 279 seconds. Error in macd.py: passed not enough data! Required: 26 passed: 24 Error in macd.py: passed not enough data! Required: 26 passed: 24 Error in macd.py: passed not enough data! Required: 26 passed: 23 Couldn't find exchange rate for: USDT Couldn't find exchange rate for: USDT Thu Aug 10 11:12:31 2017, close:0.000186 | 0.21007453USDT| 0.05832026BTC| 0.25185452ETH| 534.37500002XRP | $: -0.17%, b&h: -0.17% going to sleep for: 280 seconds. macd_value: -1.98717948716e-09 signal_line: 8.56623931624e-08 Got negative macd, skipping pair: BTC_NAV macd_value: -1.28205128205e-10 signal_line: 6.63184552074e-10 Got negative macd, skipping pair: BTC_BCN Traceback (most recent call last): File "mosquito.py", line 35, in main(args) File "mosquito.py", line 9, in main engine.run() File "/root/mosquito/core/engine.py", line 159, in run self.actions = self.strategy.calculate(self.look_back, self.wallet) File "/root/mosquito/strategies/mosquito.py", line 88, in calculate macd_value, signal_line = macd(close, numpy.asarray(prev_pair_macds)) File "/root/mosquito/lib/indicators/macd.py", line 29, in macd signal_line = talib.EMA(previous_macds[-signal_period:], timeperiod=signal_period)[-1] File "talib/func.pyx", line 7092, in talib.func.EMA (talib/func.c:79408) Exception: inputs are all NaN root@j314793:~/mosquito#

miro-ka commented 7 years ago

Thanks for reporting this again. I have added one exception handing + more debug info to find our more why this happens. Please, can you paste then the debug info when it will occur again?

crack00r commented 7 years ago

signal_line: 6.56837606838e-08 rsi: 43.5424354244 sma1: 6.3175e-05 sma2: 6.32177777778e-05 ema1: 6.3175e-05 ema2: 6.32633333333e-05 macd_value: 6.70641025641e-07 signal_line: 1.90974358974e-06 Got negative macd, skipping pair: BTC_BLK Traceback (most recent call last): File "/root/mosquito/lib/indicators/macd.py", line 27, in macd signal_line = talib.EMA(previous_macds[-signal_period:], timeperiod=signal_period)[-1] File "talib/func.pyx", line 7092, in talib.func.EMA (talib/func.c:79408) Exception: inputs are all NaN

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "mosquito.py", line 35, in main(args) File "mosquito.py", line 9, in main engine.run() File "/root/mosquito/core/engine.py", line 159, in run self.actions = self.strategy.calculate(self.look_back, self.wallet) File "/root/mosquito/strategies/mosquito.py", line 88, in calculate macd_value, signal_line = macd(close, numpy.asarray(prev_pair_macds)) File "/root/mosquito/lib/indicators/macd.py", line 29, in macd print('Got Exception in macd.py. Details: ' + str(e) + '. Data: ' + signal_period) TypeError: Can't convert 'int' object to str implicitly root@j314793:~/mosquito#

miro-ka commented 7 years ago

Thanks, I have pushed a fix (develop branch). Please, when you have time, can you try it again?

crack00r commented 7 years ago

running

miro-ka commented 7 years ago

I have now also pushed also fix for the 'Couldn't find exchange rate for: USDT' problem,...

btw: I'm going to spend finally more time on the multi-currency strategy together with reinforcement learning, so hopefully we will get some positive results.

crack00r commented 7 years ago

buying works great, but then again a crash


Setting buy order: 0.08440148BTC_XBC
Bought: 0.08440148BTC_XBC
Couldn't find exchange rate for: USDT
Couldn't find exchange rate for: USDT
Local timestamp: Thu Aug 17 07:33:04 2017, close:0.001330 | 0.16838096XBC| 8.76e-06USDT| 1.95450271NEOS| 0.04617303BTC | $: 0.04%, b&h: 0.0%
going to sleep for:  277  seconds.
sorted_indicators: 23 items: [('BTC_PINK', 33.46456692913387), ('BTC_XVC', 13.597246127366578), ('BTC_DASH', 8.41705936614533), ('BTC_DOGE', 7.692307692307658), ('BTC_RIC', 7.631991636173528), ('BTC_EMC2', 7.502467917077999), ('BTC_NAV',1), ('BTC_NEOS', 4.350854139290426), ('BTC_GNT', 3.936348408710211), ('BTC_ETH', 3.6707725321888183), ('BTC_ZEC', 3.5973316314162638), ('BTC_OMNI', 3.3665169787344364), ('BTC_STEEM', 2.5843222985633716), ('BTC_MAID', 2.443243243243253), 556472608430732), ('BTC_NXT', 1.492537313432801), ('BTC_NAUT', 1.2532042153232577), ('BTC_NMC', 1.004268139593296), ('BTC_XEM', 0.5202215136768064)]
Processing live-action: TradeState.buy, amount: 592.88537549, pair: BTC_PINK, rate: 2.53e-06, buy_sell_all: False
Setting buy order: 592.88537549BTC_PINK
Not filled 100% buy txn. Unfilled amount: 592.88537549BTC_PINK
Couldn't find exchange rate for: USDT
Couldn't find exchange rate for: USDT
Local timestamp: Thu Aug 17 07:38:04 2017, close:0.001328 | 0.16838096XBC| 8.76e-06USDT| 1.95450271NEOS| 0.04617303BTC | $: 0.06%, b&h: 0.0%
going to sleep for:  280  seconds.
sorted_indicators: 14 items: [('BTC_BURST', 12.101910828025485), ('BTC_NAUT', 10.184119677790575), ('BTC_STRAT', 5.816826223143783), ('BTC_POT', 5.318138651471955), ('BTC_LSK', 4.277348044212584), ('BTC_BCY', 3.863615306216964), ('BTC_SJ1904), ('BTC_LTC', 1.779552366718041), ('BTC_CLAM', 1.434588291552497), ('BTC_BELA', 1.166234727878549), ('BTC_REP', 1.0750615439602655), ('BTC_XEM', 0.2515090543259619)]
Processing live-action: TradeState.buy, amount: 931.67701863, pair: BTC_BURST, rate: 1.61e-06, buy_sell_all: False
Setting buy order: 931.67701863BTC_BURST
Bought: 931.67701863BTC_BURST
Couldn't find exchange rate for: USDT
Couldn't find exchange rate for: USDT
Local timestamp: Thu Aug 17 07:43:05 2017, close:0.001306 | 0.16838096XBC| 8.76e-06USDT| 929.3478261BURST| 1.95450271NEOS| 0.04467304BTC | $: 0.05%, b&h: 0.0%
going to sleep for:  275  seconds.
sorted_indicators: 23 items: [('BTC_PINK', 40.551181102362236), ('BTC_XVC', 18.261991826199218), ('BTC_DOGE', 12.820512820512779), ('BTC_NEOS', 12.639395345753508), ('BTC_DASH', 12.057754750174446), ('BTC_EMC2', 9.270216962524666), ('BTC054970083), ('BTC_LBC', 4.168778509883449), ('BTC_MAID', 3.696897632688392), ('BTC_ETH', 3.3662538265044164), ('BTC_XEM', 2.8619528619528514), ('BTC_GNT', 2.760685182105429), ('BTC_ZEC', 2.59102175753726), ('BTC_GAME', 2.432011760128008).10547473681563), ('BTC_NXT', 2.0959290608625354), ('BTC_DGB', 1.277955271565483), ('BTC_STEEM', 1.1092947220924965), ('BTC_SC', 0.5952380952380896)]
Processing live-action: TradeState.buy, amount: 533.80782918, pair: BTC_PINK, rate: 2.81e-06, buy_sell_all: False
Setting buy order: 533.80782918BTC_PINK
Not filled 100% buy txn. Unfilled amount: 533.80782918BTC_PINK
Couldn't find exchange rate for: USDT
Couldn't find exchange rate for: USDT
Local timestamp: Thu Aug 17 07:48:05 2017, close:0.001307 | 0.16838096XBC| 8.76e-06USDT| 929.3478261BURST| 1.95450271NEOS| 0.04467304BTC | $: 0.05%, b&h: 0.0%
going to sleep for:  279  seconds.
sorted_indicators: 17 items: [('BTC_VIA', 13.58093842905768), ('BTC_GAME', 5.05852571453298), ('BTC_DOGE', 5.000000000000005), ('BTC_BURST', 4.4025157232704375), ('BTC_EXP', 4.38404012359499), ('BTC_POT', 4.276729559748408), ('BTC_NOTE',55546), ('BTC_LSK', 1.2803918835500676), ('BTC_SC', 1.1904761904761791), ('BTC_STRAT', 1.1683863853776728), ('BTC_LTC', 1.0103747518248558), ('BTC_CLAM', 0.888341211307527), ('BTC_XMR', 0.7225852654193685), ('BTC_NXT', 0.1202886928629037
Processing live-action: TradeState.buy, amount: 5.99760096, pair: BTC_VIA, rate: 0.0002501, buy_sell_all: False
Setting buy order: 5.99760096BTC_VIA
Not filled 100% buy txn. Unfilled amount: 5.99760096BTC_VIA
Couldn't find exchange rate for: USDT
Couldn't find exchange rate for: USDT
Local timestamp: Thu Aug 17 07:53:04 2017, close:0.001307 | 0.16838096XBC| 8.76e-06USDT| 929.3478261BURST| 1.95450271NEOS| 0.04467304BTC | $: 0.04%, b&h: 0.0%
going to sleep for:  275  seconds.
Couldn't find exchange rate for: USDT
Couldn't find exchange rate for: USDT
Local timestamp: Thu Aug 17 07:58:04 2017, close:0.001307 | 0.16838096XBC| 8.76e-06USDT| 929.3478261BURST| 1.95450271NEOS| 0.04467304BTC | $: 0.11%, b&h: 0.0%
going to sleep for:  281  seconds.
Traceback (most recent call last):
  File "mosquito.py", line 35, in <module>
    main(args)
  File "mosquito.py", line 9, in main
    engine.run()
  File "/root/mosquito/core/engine.py", line 159, in run
    self.actions = self.strategy.calculate(self.look_back, self.wallet)
  File "/root/mosquito/strategies/mosquito.py", line 71, in calculate
    adx = talib.ADX(high, low, close, timeperiod=3)
  File "talib/func.pyx", line 379, in talib.func.ADX (talib/func.c:7406)
Exception: inputs are all NaN
root@j314793:~/mosquito#
miro-ka commented 7 years ago

sorry for that,..will take a look at it later. To be honest I'm not very happy with Talib - (implementation and documentation). I will look for some other alternatives, or we just might need to implement the indicators by our self.

miro-ka commented 7 years ago

again, PLEASE be VERY CAREFUL with LIVE.

So far I didn't find a proper setting for the mosquito strategy, where I would get positive results (testing in bittrex, with around 200 pairs). I'm now starting to plug some ML algorithms, to help me out with this..

crack00r commented 7 years ago

for me, it find good results... i let him just with 0.0015BTC buying, and he just buy into good coins... but on sell, he crash

miro-ka commented 7 years ago

this one looks very promising as Talib alternative (will take a look at it later): https://github.com/panpanpandas/ultrafinance

miro-ka commented 7 years ago

Issue should be fixed now (0b398a3).

Problem with ADX indicator was that we are receiving low, high values only in history ticker and not real-time ticker. Because of this I have switch ADX with SMA logic. This means that the mosquito-strategy should be backtestet.

miro-ka commented 7 years ago

I had it run now full day, without any issues. I thing the fix above did the trick. Closing.