Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not subscriptable #4

Closed
bp-santos opened this issue Feb 17, 2021 · 14 comments
Closed

TypeError: 'NoneType' object is not subscriptable #4

bp-santos opened this issue Feb 17, 2021 · 14 comments

Comments

@bp-santos
Copy link

After setting up the API and connecting to the Binance account the following message appears:

Traceback (most recent call last): File "tradoge.py", line 382, in <module> main() File "tradoge.py", line 297, in main menu(new_config, client) File "tradoge.py", line 117, in menu doge_balance = client.get_asset_balance(asset='DOGE')['free'] TypeError: 'NoneType' object is not subscriptable

@gschurck
Copy link
Owner

After setting up the API and connecting to the Binance account the following message appears:

Traceback (most recent call last): File "tradoge.py", line 382, in <module> main() File "tradoge.py", line 297, in main menu(new_config, client) File "tradoge.py", line 117, in menu doge_balance = client.get_asset_balance(asset='DOGE')['free'] TypeError: 'NoneType' object is not subscriptable

Do you use the Windows executable file or python script ?
Do you have the 'Connected on Binance' green message on login ?

@bp-santos
Copy link
Author

I used the Python Script and it showed the connected message. Is it possible that the error is shown because I don´t have any currency/coin in Binance?

@gschurck
Copy link
Owner

gschurck commented Feb 17, 2021

I don't think, because I tried with currency I don't have and it displays 0 for the amount and no error.
I'm looking for the error.

@gschurck
Copy link
Owner

What is you API configuration on Binance ?
Here is mine :
image

@bp-santos
Copy link
Author

Same thing here. I am looking for the error too.

@bp-santos
Copy link
Author

How is set your config file?

@gschurck
Copy link
Owner

Normally in the menu you can choose your configuration and it writes in file. But if there is an error in menu it's complicated.
Try with to print client.get_asset_balance(asset='DOGE') without ['free']

@gschurck
Copy link
Owner

And try to replace doge with other cryptocurrencies

@gschurck gschurck pinned this issue Feb 17, 2021
@bp-santos
Copy link
Author

bp-santos commented Feb 17, 2021

Without ['free'] the two variables are set to "None" so there will be an error in doge_value = float(doge_balance) * float(price)

image

@gschurck
Copy link
Owner

It seems like you are just not connected to your account. I think the way I check the connection on Binance is not good, it only pings the server via your client connection. I didn't think it would work even if you are not connected to your account.
Try :
print(client.get_account())

It will show something like that if you have access to your account :
image

@bp-santos
Copy link
Author

The balances are clear {'makerCommission': 10, 'takerCommission': 10, 'buyerCommission': 0, 'sellerCommission': 0, 'canTrade': True, 'canWithdraw': True, 'canDeposit': True, 'updateTime': 1613432228552, 'accountType': 'SPOT', 'balances': [], 'permissions': ['SPOT']}

@gschurck
Copy link
Owner

It's really strange ! Because it looks like you are connected to your account, but we don't see your balances..
I think the problem probably comes from your account more than TraDOGE.
I don't know if there are some limitations on Binance. Maybe you can try to send a little amount of a currency on your Binance account, if you really have 0 in every currencies.
And maybe try to create new API keys (type RESET when typing your password on login to set new API keys)

@bp-santos
Copy link
Author

The program is finally working. The problem was not in your code but simply because I did not have any currency in my Binance account. I will follow closely your good work! Cheers

@MorphyHu
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants