JPStrydom / Crypto-Trading-Bot

Automated Bittrex crypto-currency technical analysis and trading tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not seeing balances

TradeCrafter opened this issue · comments

just added new api keys from bittrex, got python full working and deps tru pip... created json files and this outputs on log:
2018/04/30 09:02:00 AM - ERROR: 'NoneType' object is not iterable
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 49, in analyse_pauses
self.Database.get_previous_total_balance())
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\messenger.py", line 221, in send_balance_slack
for balance in balance_items:
TypeError: 'NoneType' object is not iterable
2018/04/30 09:02:30 AM - ERROR: Failed to fetch user Bittrex balances.
2018/04/30 09:02:30 AM - ERROR: 'NoneType' object is not iterable
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 49, in analyse_pauses
self.Database.get_previous_total_balance())
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\messenger.py", line 221, in send_balance_slack
for balance in balance_items:
TypeError: 'NoneType' object is not iterable
2018/04/30 09:02:41 AM - ERROR: Failed to fetch user Bittrex balances.
2018/04/30 09:02:41 AM - ERROR: 'NoneType' object is not iterable

Any chance your new API key doesn't have the correct permissions?

read info, trade limit and trade market enabled,new api and secret just created

was a typo error on the api key, and now seems to be running but showing other errors

TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
2018/04/30 10:36:13 AM - ERROR: Failed to fetch Bittrex market summary for the BTC-USDT market.
2018/04/30 10:36:13 AM - ERROR: unsupported operand type(s) for *: 'NoneType' and 'float'
Type error occurred. Waiting 10 seconds and then retrying.

what should be expected as an correct output ? the lines bellow keeps repeating on my powershell terminal

�[0m
�[1m�[30mSee the latest log file for more information.
�[0m
�[1m�[33mResuming tracking on all 192 markets.�[0m
�[1m�[31m
Failed to fetch Bittrex market summary for the BTC-USDT market.�[0m
�[1m�[30mSee the latest log file for more information.
�[0m
�[1m�[31m
Type error occurred. Waiting 10 seconds and then retrying.�[0m
�[1m�[30mSee the latest log file for more information.
�[0m
�[1m�[33mResuming tracking on all 192 markets.�[0m
�[1m�[31m
Failed to fetch Bittrex market summary for the BTC-USDT market.�[0m
�[1m�[30mSee the latest log file for more information.
�[0m
�[1m�[31m
Type error occurred. Waiting 10 seconds and then retrying.�[0m
�[1m�[30mSee the latest log file for more information.
�[0m
�[1m�[33mResuming tracking on all 192 markets.�[0m

this is the log i got last

2018/04/30 10:36:13 AM - ERROR: Failed to fetch Bittrex market summary for the BTC-USDT market.
2018/04/30 10:36:13 AM - ERROR: unsupported operand type(s) for *: 'NoneType' and 'float'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 48, in analyse_pauses
current_balance = self.Messenger.send_balance_slack(self.get_non_zero_balances(),
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 412, in get_non_zero_balances
return py_.map_(non_zero_balances, lambda balance: self.create_balance_object(balance))
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\collections.py", line 538, in map_
return list(itermap(collection, iteratee))
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\collections.py", line 1102, in itermap
for result in iteriteratee(collection, iteratee):
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\helpers.py", line 80, in iteriteratee
yield (callit(cbk, item, key, obj, argcount=argcount),
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\helpers.py", line 37, in callit
return iteratee(*args[:argstop])
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 412, in
return py_.map_(non_zero_balances, lambda balance: self.create_balance_object(balance))
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 430, in create_balance_object
{"BtcValue": round(btc_price * balance_item["Balance"], 8), "IsTracked": is_tracked}
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

In your app-data.json file, does your pause time have have the following structure?

{
    "coinPairs": [],
    "pausedTrackedCoinPairs": [],
    "pauseTime": {
        "buy": "null or a number",
        "sell": "null or a number",
        "balance": "null or a number"
    },
    "previousBalance": "null or a number"
}

i.e. Do you have the "balance" key in your "pauseTime", and do you have "previousBalance" as null or as a number?

I just pushed an update that should hopefully fix your issue. Please check it out and lemme know if its :)

nope... my app-data.json has the same structure, but numbers, the previous balance is null... downloaded the new and no changes... remains the same error

2018/04/30 03:02:09 PM - ERROR: Failed to fetch Bittrex market summary for the BTC-USDT market.
2018/04/30 03:02:09 PM - ERROR: unsupported operand type(s) for *: 'NoneType' and 'float'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 48, in analyse_pauses
current_balance = self.Messenger.send_balance_slack(self.get_non_zero_balances(),
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 412, in get_non_zero_balances
return py_.map_(non_zero_balances, lambda balance: self.create_balance_object(balance))
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\collections.py", line 538, in map_
return list(itermap(collection, iteratee))
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\collections.py", line 1102, in itermap
for result in iteriteratee(collection, iteratee):
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\helpers.py", line 80, in iteriteratee
yield (callit(cbk, item, key, obj, argcount=argcount),
File "C:\Users\Leonardo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pydash\helpers.py", line 37, in callit
return iteratee(*args[:argstop])
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 412, in
return py_.map_(non_zero_balances, lambda balance: self.create_balance_object(balance))
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 430, in create_balance_object
{"BtcValue": round(btc_price * balance_item["Balance"], 8), "IsTracked": is_tracked}
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

what is expected to see when works ? it needs to let it running,i know but i wanna know how it behave

thanks for the fast repply, i am looking for a nice trading bot

So this functionality is purely to send balance summary slack messages. If you're not using the slack integration, or just want to leave out the balance notifications, I'd suggest just deleting "balance" object from "pauseParameters" inside your settings file. So it'll look like this ->

{
    "sound": false,
    "tradeParameters": {...},
    "pauseParameters": {
        "buy": {...},
        "sell": {...}
    }
}

The issue here is that Bittrex is failing to fetch the market price (which it sometimes does). It shouldn't crash the program (if it's crashing, please let me know), and it shouldn't cause any issues - but I'm looking into a fix now 👍

Just pushed the fix. Please let me know if it works.

now just dont run... it gives this message on command line:

PS C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src> python app.py
Please completed the settings.json file in your database directory

i am using your given example of settings.json

Please have a look at the README and make sure your settings file is correct. The bot needs those configurations to operate correctly.

i have looked, have edited app.py, got it running, but without some parameters, but deleted and downloaded again,created new APIs and settings file like readme... but the error seems the same:

2018/05/01 08:46:22 AM - ERROR: Failed to fetch Bittrex market summary for the BTC-USDT market.
2018/05/01 08:46:22 AM - ERROR: unsupported operand type(s) for *: 'NoneType' and 'float'
Traceback (most recent call last):
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 429, in create_balance_object
btc_value = round(btc_price * balance_item["Balance"], 8)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
2018/05/01 08:46:22 AM - ERROR: unsupported operand type(s) for +=: 'float' and 'str'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 49, in analyse_pauses
self.Database.get_previous_total_balance())
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\messenger.py", line 232, in send_balance_slack
total_balance += balance["BtcValue"]
TypeError: unsupported operand type(s) for +=: 'float' and 'str'
2018/05/01 08:46:34 AM - ERROR: Failed to fetch Bittrex market summary for the BTC-USDT market.
2018/05/01 08:46:34 AM - ERROR: unsupported operand type(s) for *: 'NoneType' and 'float'
Traceback (most recent call last):
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 429, in create_balance_object
btc_value = round(btc_price * balance_item["Balance"], 8)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'
2018/05/01 08:46:34 AM - ERROR: unsupported operand type(s) for +=: 'float' and 'str'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 49, in analyse_pauses
self.Database.get_previous_total_balance())
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\messenger.py", line 232, in send_balance_slack
total_balance += balance["BtcValue"]
TypeError: unsupported operand type(s) for +=: 'float' and 'str'

i am using windows 10 but all pyhton scripts mostly works fine to me

thanks for the response, and lets get it running !!

i am giving it up bro...now it replaces the content of json files with default values...

If it's overwriting the JSON file, it means it failed to read it and there's most likely an issue in your files formatting.

As for your initial error, it's still a Bittrex issue, but I believe I know how to work around it.

I just pushed a fix that should hopefully fix your crashing issue.

just find out, that when i put gmail credentials it causes the code to overwrite the entire json file, so i just put the API keys and got it running... but another error, check the log:

2018/05/01 05:08:51 PM - ERROR: 'buy'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 40, in analyse_pauses
if self.Database.check_resume(self.pause_params["buy"]["pauseTime"], "buy"):
KeyError: 'buy'
2018/05/01 05:09:47 PM - ERROR: 'buy'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 40, in analyse_pauses
if self.Database.check_resume(self.pause_params["buy"]["pauseTime"], "buy"):
KeyError: 'buy'
2018/05/01 05:11:47 PM - ERROR: 'buy'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 40, in analyse_pauses
if self.Database.check_resume(self.pause_params["buy"]["pauseTime"], "buy"):
KeyError: 'buy'

the BTC-USDT error seems to been fixed !!!

if its not trouble for you, lets keep it going till it runs properly ?

I'd suggest deleting your app-data.json file. And if your settings.json or secrets.json gets overwritten, it means there's an error on the file's formatting (i.e. you've entered invalid JSON).

deleting app-data.json just gets the bot to make another one, i am getting this error, i changed 3 times API keys on bittrex, but i dont think it is the bug...

2018/05/04 01:44:35 PM - ERROR: 'buy'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 40, in analyse_pauses
if self.Database.check_resume(self.pause_params["buy"]["pauseTime"], "buy"):
KeyError: 'buy'
2018/05/04 01:44:51 PM - ERROR: 'buy'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 40, in analyse_pauses
if self.Database.check_resume(self.pause_params["buy"]["pauseTime"], "buy"):
KeyError: 'buy'
2018/05/04 01:45:46 PM - ERROR: 'buy'
Traceback (most recent call last):
File "app.py", line 94, in
Trader.analyse_pauses()
File "C:\Users\Leonardo\Desktop\Crypto-Trading-Bot-master\src\trader.py", line 40, in analyse_pauses
if self.Database.check_resume(self.pause_params["buy"]["pauseTime"], "buy"):
KeyError: 'buy'

Mhhh are you sure all your JSON files are in the correct format and contain all the required key-value pairs?

I have the same issue under linux, following are in the log:

2018/06/14 03:20:49 PM - ERROR: Failed to fetch Bittrex market summary for the BTC-USDT market.
2018/06/14 03:20:49 PM - ERROR: unsupported operand type(s) for *: 'NoneType' and 'float'
Traceback (most recent call last):
  File "/home/xxxxxx/python/trade/Crypto-Trading-Bot/src/trader.py", line 429, in create_balance_object
    btc_value = round(btc_price * balance_item["Balance"], 8)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

Are you sure you're using the latest version of the repo?