14 =
"CREATE TABLE IF NOT EXISTS trades (trade_id INTEGER PRIMARY "
15 "KEY, symbol TEXT, buy_order_id INTEGER, sell_order_id INTEGER, "
16 "quantity INTEGER, price REAL, timestamp INTEGER);";
18 =
"INSERT INTO trades (trade_id, symbol, buy_order_id, "
19 "sell_order_id, quantity, price, timestamp) VALUES (?, ?, ?, ?, "
24 =
"CREATE TABLE IF NOT EXISTS trade_id (id INTEGER PRIMARY KEY);";
27 =
"INSERT OR REPLACE INTO trade_id (id) VALUES (?);";
32 =
"CREATE TABLE IF NOT EXISTS orders (core_order_id INTEGER "
34 "KEY, client_order_id INTEGER, client_id TEXT, sender_comp_id "
35 "TEXT, symbol TEXT, side TEXT, type TEXT, "
36 "time_in_force TEXT, price REAL, original_quantity INTEGER, "
37 "remaining_quantity INTEGER, status TEXT, timestamp INTEGER);";
39 =
"INSERT INTO orders (core_order_id, client_order_id, client_id, "
40 "sender_comp_id, symbol, side, type, "
41 "time_in_force, price, original_quantity, remaining_quantity, "
42 "status, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
45 =
"SELECT core_order_id, client_order_id, client_id, "
46 "sender_comp_id, symbol, side, type, time_in_force, "
47 "price, original_quantity, remaining_quantity, status, timestamp "
48 "FROM orders WHERE symbol = ? AND (status = 'New' OR status = "
49 "'PartiallyFilled');";
51 =
"DELETE FROM orders WHERE core_order_id = ?;";
53 "?, status = ? WHERE core_order_id = ?;";
57 =
"CREATE TABLE IF NOT EXISTS clients (sender_comp_id TEXT PRIMARY "
58 "KEY, is_active INTEGER);";
60 =
"INSERT OR IGNORE INTO clients (sender_comp_id, is_active) "
63 =
"SELECT sender_comp_id FROM clients WHERE is_active = 1;";
68 =
"CREATE TABLE IF NOT EXISTS FIX_Sequences ("
69 "compId TEXT PRIMARY KEY NOT NULL,"
70 "inSeqNum INTEGER NOT NULL,"
71 "outSeqNum INTEGER NOT NULL"
74 "FIX_Sequences WHERE compId = ?";
76 =
"INSERT INTO FIX_Sequences (compId, "
77 "inSeqNum, outSeqNum) "
79 "ON CONFLICT(compId) DO UPDATE SET "
80 "inSeqNum=excluded.inSeqNum, "
81 "outSeqNum=excluded.outSeqNum;";
85 =
"CREATE TABLE IF NOT EXISTS candles (symbol TEXT, interval INTEGER, "
86 "timestamp INTEGER, open REAL, high REAL, low REAL, close REAL, volume INTEGER, "
87 "PRIMARY KEY(symbol, interval, timestamp));";
89 =
"INSERT OR REPLACE INTO candles (symbol, interval, timestamp, open, high, "
90 "low, close, volume) VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
92 =
"SELECT symbol, interval, timestamp, open, high, low, close, volume "
93 "FROM candles WHERE symbol = ? AND interval = ? ORDER BY timestamp DESC LIMIT ?;";
constexpr auto createCandleTableQuery
Definition Query.h:85
constexpr auto updateOrderQuery
Definition Query.h:52
constexpr auto insertIntoTradeTableQuery
Definition Query.h:18
constexpr auto truncateClientsQuery
Definition Query.h:64
constexpr auto loadHistoryQuery
Definition Query.h:92
constexpr auto insertClientQuery
Definition Query.h:60
constexpr auto createOrderTableQuery
Definition Query.h:32
constexpr auto truncateTradeIdQuery
Definition Query.h:28
constexpr auto removeOrderQuery
Definition Query.h:51
constexpr auto loadOrdersForInstrumentQuery
Definition Query.h:45
constexpr auto createTradeTableQuery
Definition Query.h:14
constexpr auto insertCandleQuery
Definition Query.h:89
constexpr auto insertIntoOrderTableQuery
Definition Query.h:39
constexpr auto getTradeIdQuery
Definition Query.h:25
constexpr auto getSequenceNumberQuery
Definition Query.h:73
constexpr auto createSequenceTable
Definition Query.h:68
constexpr auto createTradeIdTableQuery
Definition Query.h:24
constexpr auto loadClientsQuery
Definition Query.h:63
constexpr auto updateSequenceNumberQuery
Definition Query.h:76
constexpr auto createClientTableQuery
Definition Query.h:57
constexpr auto setTradeIdQuery
Definition Query.h:27