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

Problems trade status sync. 'NoneType' object has no attribute 'get' #47

Open
posido opened this issue Jun 8, 2024 · 8 comments
Open

Comments

@posido
Copy link

posido commented Jun 8, 2024

Hi,

I am running: python -m service.server -c configs/config.jsonc

I get the error message shown in the screenshot.

image

@asavinov
Copy link
Owner

asavinov commented Jun 8, 2024

Hi, it seems to be a problem with trader. It is not tested in latest versions and might be removed in future. Do you have more output like log or stacktrace?

@posido
Copy link
Author

posido commented Jun 8, 2024

Unfortunately, not. It seems to happen in Server.py:

image

Here you see the output "Balance: = 0.002...." misses the left side.

print(f"Balance: {App.config['base_asset']} = {str(App.base_quantity)}")
print(f"Balance: {App.config['quote_asset']} = {str(App.quote_quantity)}")

base_asset and quote_asset is not set in App.py. might that be the reason?

base_asset": "", # BTC ETH
quote_asset": "",

I did not set it as the readme says it is already configured for Bitcoin.

@asavinov
Copy link
Owner

asavinov commented Jun 8, 2024

If I use the sample config 'config-sample-v0.7.dev.jsonc' then I do not have any errors. This exception seems to be raised from 'trader.py' if I turn on the trade function by adding "actions": ["trade"] in the config. So if you want to run it without trade (and without this exceptions) then turn off trade mode by removing "trade" from "actions". It will not try to access your account where seem to be a problem.

@posido
Copy link
Author

posido commented Jun 8, 2024

Yes, without trade it works. But of course at the end I want to try to trade with it.

@asavinov
Copy link
Owner

asavinov commented Jun 9, 2024

Could you check what is in your collector.log file. There should be an exception message like this one:

2024-06-08 18:05:49,982 DEBUG https://api.binance.com:443 "GET /api/v3/openOrders?symbol=BTCUSDT&timestamp=1717862749666&signature=xyz HTTP/1.1" 401 70
2024-06-08 18:06:35,664 ERROR Binance exception in 'get_open_orders' APIError(code=-2015): Invalid API-key, IP, or permissions for action.

@posido
Copy link
Author

posido commented Jun 10, 2024

Right, didn't see that log before:

2024-06-08 18:16:01,347 INFO ===> Start trade task. Timestamp 1717870561347. Interval [1717870560000,1717870620000].
2024-06-08 18:16:01,348 ERROR Wrong status value None.
2024-06-08 18:16:01,348 ERROR Task exception was never retrieved
future: <Task finished name='Task-348' coro=<main_trader_task() done, defined at /home/posido/intelligent-trading-bot/service/trader.py:31> exception=AttributeError("'NoneType' object has no attribute 'get'")>
Traceback (most recent call last):
File "/home/posido/intelligent-trading-bot/service/trader.py", line 100, in main_trader_task
signal_side = signal.get("side")
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
2024-06-08 18:17:01,007 INFO ===> Start collector task. Timestamp 1717870621007. Interval [1717870620000,1717870680000].
2024-06-08 18:17:01,269 DEBUG https://api.binance.com:443 "GET /api/v3/klines?endTime=1717870621007&interval=1m&limit=4&symbol=BTCUSDT HTTP/1.1" 200 229
2024-06-08 18:17:01,271 DEBUG Stored klines. Total 2880 in db. Last kline end: 1717870620000. Current time: 1717870621270
2024-06-08 18:17:01,272 INFO <=== End collector task.
2024-06-08 18:17:01,272 INFO Analyze BTCUSDT. Last kline timestamp: 2024-06-08 18:16:00
2024-06-08 18:17:01,323 INFO Analyze finished. Close: 69,462 Signals: trade_score=-0.004, buy_signal_column=False, sell_signal_column=False
2024-06-08 18:17:01,346 INFO ===> Start trade task. Timestamp 1717870621346. Interval [1717870620000,1717870680000].
2024-06-08 18:17:01,347 ERROR Wrong status value None.
2024-06-08 18:17:01,347 ERROR Task exception was never retrieved
future: <Task finished name='Task-351' coro=<main_trader_task() done, defined at /home/posido/intelligent-trading-bot/service/trader.py:31> exception=AttributeError("'NoneType' object has no attribute 'get'")>
Traceback (most recent call last):
File "/home/posido/intelligent-trading-bot/service/trader.py", line 100, in main_trader_task
signal_side = signal.get("side")

@posido
Copy link
Author

posido commented Jun 13, 2024

Do you have an update on that issue? Many thanks!

@asavinov
Copy link
Owner

I tried to fix problems in binance trader but I cannot finally test it because I do not have a (working) API key. So let me know if you get any problems. Now actions attribute is not needed. To turn on Binance trading you need to set trade_model.trader_binance as well as all parameters after it. The logic is in the trader_binance.py in case you want to improve something.

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

2 participants