JPStrydom / Crypto-Trading-Bot

Automated Bittrex crypto-currency technical analysis and trading tool
MIT License
298 stars 102 forks source link

not seeing balances #15

Open TradeCrafter opened 6 years ago

TradeCrafter commented 6 years ago

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

JPStrydom commented 6 years ago

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

TradeCrafter commented 6 years ago

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

TradeCrafter commented 6 years ago

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

 See the latest log file for more information.  Resuming tracking on all 192 markets.  Failed to fetch Bittrex market summary for the BTC-USDT market. See the latest log file for more information.   Type error occurred. Waiting 10 seconds and then retrying. See the latest log file for more information.  Resuming tracking on all 192 markets.  Failed to fetch Bittrex market summary for the BTC-USDT market. See the latest log file for more information.   Type error occurred. Waiting 10 seconds and then retrying. See the latest log file for more information.  Resuming tracking on all 192 markets.

TradeCrafter commented 6 years ago

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_zerobalances return py.map_(non_zero_balances, lambda balance: self.create_balanceobject(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'

JPStrydom commented 6 years ago

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?

JPStrydom commented 6 years ago

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

TradeCrafter commented 6 years ago

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_zerobalances return py.map_(non_zero_balances, lambda balance: self.create_balanceobject(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'

TradeCrafter commented 6 years ago

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

JPStrydom commented 6 years ago

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 👍

JPStrydom commented 6 years ago

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

TradeCrafter commented 6 years ago

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

JPStrydom commented 6 years ago

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

TradeCrafter commented 6 years ago

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 !!

TradeCrafter commented 6 years ago

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

JPStrydom commented 6 years ago

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.

JPStrydom commented 6 years ago

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

TradeCrafter commented 6 years ago

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'

TradeCrafter commented 6 years ago

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

TradeCrafter commented 6 years ago

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

JPStrydom commented 6 years ago

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).

TradeCrafter commented 6 years ago

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'

JPStrydom commented 6 years ago

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

TradeCrafter commented 6 years ago

i have not used your bot anymore, i´ve been trying this gekko bot... have you updated ?

2018-05-23 20:39 GMT-03:00 JP Strydom notifications@github.com:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JPStrydom/Crypto-Trading-Bot/issues/15#issuecomment-391537572, or mute the thread https://github.com/notifications/unsubscribe-auth/AWbCpA3D8QoQy5XS_OFPx31xFBumnUkgks5t1fNEgaJpZM4TsjP0 .

romali commented 6 years ago

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'
JPStrydom commented 6 years ago

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