forked from freqtrade/freqtrade
-
Notifications
You must be signed in to change notification settings - Fork 3
SQL Helper
Gérald LONLAS edited this page Dec 21, 2017
·
2 revisions
Ubuntu/Debian installation
sudo apt-get install sqlite3sqlite3
.open <filepath>List tables
.tablesDisplay table structure
.schema <table_name>Trade table structure
CREATE TABLE trades (
id INTEGER NOT NULL,
exchange VARCHAR NOT NULL,
pair VARCHAR NOT NULL,
is_open BOOLEAN NOT NULL,
fee FLOAT NOT NULL,
open_rate FLOAT,
close_rate FLOAT,
close_profit FLOAT,
stake_amount FLOAT NOT NULL,
amount FLOAT,
open_date DATETIME NOT NULL,
close_date DATETIME,
open_order_id VARCHAR,
PRIMARY KEY (id),
CHECK (is_open IN (0, 1))
);SELECT * FROM trades;UPDATE trades
SET is_open=0, close_date=<close_date>, close_rate=<close_rate>, close_profit=close_rate/open_rate
WHERE id=<trade_ID_to_update>;Example:
UPDATE trades
SET is_open=0, close_date='2017-12-20 03:08:45.103418', close_rate=0.19638016, close_profit=0.0496
WHERE id=31;Once PR#200 will be merged.
UPDATE trades SET fee=0.0025 WHERE fee=0.005;