coltoneshaw / 3cpm

The 3C Portfolio Manager is an essential addon to your 3Commas experience. It enables you to manage your DCA bots with greater analytics, real-time alerting, and tons of additional features.
GNU General Public License v3.0
120 stars 21 forks source link

SqliteError: table deals has no column named last_known_position_info #124

Closed doharvey closed 2 years ago

doharvey commented 2 years ago

Describe the bug

Console Actions.ts:228 Error: Error invoking remote method 'api-updateData': SqliteError: table deals has no column named last_known_position_info


cat logs/main.log [2022-04-20 09:24:33.054] [info] migrating the config store to 1.0.0 [2022-04-20 09:24:33.070] [info] migrating the config store to 2.0.0 [2022-04-20 09:24:33.159] [info] Converting 3cdd68f7-d76d-417c-b06c-ae9df7aa1bf0 to it's own database [2022-04-20 09:24:33.245] [debug] Completed initial database setup. [2022-04-20 09:24:33.280] [info] Deleted db.sqlite3 file from user directory [2022-04-20 09:24:33.407] [debug] Primary profile was undefined / default. Switching to 3cdd68f7-d76d-417c-b06c-ae9df7aa1bf0 [2022-04-20 09:24:33.408] [debug] Database directory exists [2022-04-20 09:24:33.478] [debug] Completed initial database setup. [2022-04-20 09:25:24.578] [info] attempting to check if tables exist yet. [2022-04-20 09:25:35.428] [debug] { responseArrayLength: 396, currentResponse: 396, offset: 0, sync: { oldest: 1650097245956, newest: 1650460939158 }, newLastSyncTime: 1650460939158, lastSyncTime: 0 } [2022-04-20 09:25:35.430] [info] Response data Length: 396 [2022-04-20 09:55:46.489] [info] attempting to check if tables exist yet. [2022-04-20 09:55:48.190] [debug] { responseArrayLength: 398, currentResponse: 398, offset: 0, sync: { oldest: 1650097245956, newest: 1650462798271 }, newLastSyncTime: 1650462798271, lastSyncTime: 0 } [2022-04-20 09:55:48.190] [info] Response data Length: 398 [2022-04-20 10:17:23.264] [info] attempting to check if tables exist yet. [2022-04-20 10:17:25.003] [debug] { responseArrayLength: 400, currentResponse: 400, offset: 0, sync: { oldest: 1650097245956, newest: 1650464158011 }, newLastSyncTime: 1650464158011, lastSyncTime: 0 } [2022-04-20 10:17:25.003] [info] Response data Length: 400 [dharvey@dominic-box 3C Portfolio Manager]$

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

doharvey commented 2 years ago

sqlite> .schema deals CREATE TABLE deals ( id NUMBER PRIMARY KEY UNIQUE, type TEXT, bot_id NUMBER, max_safety_orders NUMBER, deal_has_error BOOLEAN, from_currency_id NUMBER, to_currency_id NUMBER, account_id NUMBER, active_safety_orders_count NUMBER, created_at TEXT, updated_at TEXT, closed_at TEXT, closed_at_iso_string NUMBER, finished BOOLEAN, current_active_safety_orders_count BOOLEAN, current_active_safety_orders NUMBER, completed_safety_orders_count NUMBER, completed_manual_safety_orders_count NUMBER, cancellable BOOLEAN, panic_sellable BOOLEAN, trailing_enabled BOOLEAN, tsl_enabled BOOLEAN, stop_loss_timeout_enabled BOOLEAN, stop_loss_timeout_in_seconds NUMBER, active_manual_safety_orders NUMBER, pair TEXT, status TEXT, localized_status TEXT, take_profit NUMBER, base_order_volume NUMBER, safety_order_volume NUMBER, safety_order_step_percentage NUMBER, leverage_type TEXT, leverage_custom_value NUMBER, bought_amount NUMBER, bought_volume NUMBER, bought_average_price NUMBER, base_order_average_price NUMBER, sold_amount NUMBER, sold_volume NUMBER, sold_average_price NUMBER, take_profit_type TEXT, final_profit NUMBER, martingale_coefficient NUMBER, martingale_volume_coefficient NUMBER, martingale_step_coefficient NUMBER, stop_loss_percentage NUMBER, error_message TEXT, profit_currency TEXT, stop_loss_type TEXT, safety_order_volume_type TEXT, base_order_volume_type TEXT, from_currency TEXT, to_currency TEXT, current_price NUMBER, take_profit_price NUMBER, stop_loss_price NUMBER, final_profit_percentage NUMBER, actual_profit_percentage NUMBER, bot_name TEXT, account_name TEXT, usd_final_profit NUMBER, actual_profit NUMBER, actual_usd_profit NUMBER, failed_message TEXT, reserved_base_coin NUMBER, reserved_second_coin NUMBER, trailing_deviation NUMBER, trailing_max_price NUMBER, tsl_max_price NUMBER, strategy TEXT, reserved_quote_funds TEXT, reserved_base_funds TEXT, realized_actual_profit_usd NUMBER, deal_hours NUMBER, currency TEXT, max_deal_funds NUMBER, profitPercent NUMBER, impactFactor NUMBER ); sqlite>

coltoneshaw commented 2 years ago

Hey. Sorry 3C added a profile field that's not in the database currently.

It should be open up the console with menu > view > dev tools then console.

If you scroll up you should see profileID =“” in one of the queries. If you copy that ID string and do


await window.ThreeCPM.Repository.Database.run(“thatpProfileID”, “ALTER TABLE deals ADD last_known_position_info text;”)

I'm actually away right now with only mobile, great time to have it break.

doharvey commented 2 years ago

Thank you for your response.

I have try to alter table in sqlite3 instead and it worked. ;) Here is what i did:

[dharvey@dominic-box databases]$ pwd
/home/dharvey/.config/3C Portfolio Manager/databases

[dharvey@dominic-box databases]$ sqlite3 3cdd68f7-d76d-417c-b06c-ae9df7aa1bf0.sqlite3 
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> ALTER TABLE deals ADD last_known_position_info text;
sqlite> .exit
[dharvey@dominic-box databases]$