tudorelu / tudorials

A repsitory hosting all the code written for my tutorials.
158 stars 126 forks source link

Error No such column: True #4

Open elkiwi opened 4 years ago

elkiwi commented 4 years ago

aps = database.GetActivePairsOfBot(bot)

File "/var/www/sites/python/trading/Database.py", line 252, in GetActivePairsOfBot c.execute('SELECT * FROM pairs Where bot_id = ? and is_active = True', (bot['id'],)) sqlite3.OperationalError: no such column: True

I deleted the db file too and ran again but same problem.

elkiwi commented 4 years ago

Probably shouldn't be running BotRunner.py

tudorelu commented 4 years ago

Hey man, yes, you actually do run BotRunner.py. I am not getting that error myself but others mentioned it. Did you find a fix?

erenyildiz commented 4 years ago

Hi there

A more detailed error message is here when you create a bot at startup:

←[K←[?25hTraceback (most recent call last): File "BotRunner.py", line 536, in Main() File "BotRunner.py", line 531, in Main prog.StartExecution(bot_symbol_datas) File "BotRunner.py", line 437, in StartExecution aps = database.GetActivePairsOfBot(bot) File "C:\Users\yumun\Documents\Final Version\Database.py", line 252, in GetActivePairsOfBot c.execute('SELECT * FROM pairs Where bot_id = ? and is_active = True', (bot['id'],)) sqlite3.OperationalError: no such column: True

And here is the error when you do not create a bot at startup:

⠇←[0m Getting balances of all bots...←[KTraceback (most recent call last): File "BotRunner.py", line 536, in Main() File "BotRunner.py", line 531, in Main prog.StartExecution(bot_symbol_datas) File "BotRunner.py", line 408, in StartExecution self.all_symbol_datas[pair['symbol']] = sd[pair['symbol']] KeyError: 'BEARUSDT' ⠋←[0m Getting balances of all bots...←[K

erenyildiz commented 4 years ago

I think the second error is generated because the symbols vary from platform to platform. We need to delete the database file first and start BotRunner anew.

The first issue seems to be due to a column not generated in the database, BotRunner can not see any active bots.

erenyildiz commented 4 years ago

Solved the issue as below:

Line 252 in Database.py should read as follows:

    c.execute('SELECT * FROM pairs Where bot_id = ? and is_active = 1', (bot['id'],))

NOT as below. Let me know if this solved the issue for you @elkiwi

    c.execute('SELECT * FROM pairs Where bot_id = ? and is_active = True', (bot['id'],))