Seed only NQ, GC and CL as enabled instruments
The other 17 symbols still seed, so they remain listed and can be switched on from the Instruments page — they just start disabled. Affects fresh installs only: the seed block runs only when the instruments table is empty, so existing databases keep their current selection. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fc08a41c4b
commit
3bef7dea9e
@@ -199,11 +199,15 @@ export function setSetting(key: string, value: string): void {
|
||||
|
||||
const SYMBOLS = ['NQ','MNQ','ES','MES','YM','MYM','RTY','M2K','GC','MGC','SI','CL','MCL','NG','ZB','ZN','ZF','6E','6J','6B'];
|
||||
|
||||
// Enabled on a fresh install. The rest still seed, so they can be switched on
|
||||
// from the Instruments page, they just start off.
|
||||
const DEFAULT_ENABLED = new Set(['NQ', 'GC', 'CL']);
|
||||
|
||||
// Seed instruments table if empty
|
||||
const instrCount = (db.prepare('SELECT COUNT(*) as count FROM instruments').get() as { count: number }).count;
|
||||
if (instrCount === 0) {
|
||||
const ins = db.prepare('INSERT INTO instruments (symbol, enabled) VALUES (?, 1)');
|
||||
for (const s of SYMBOLS) ins.run(s);
|
||||
const ins = db.prepare('INSERT INTO instruments (symbol, enabled) VALUES (?, ?)');
|
||||
for (const s of SYMBOLS) ins.run(s, DEFAULT_ENABLED.has(s) ? 1 : 0);
|
||||
}
|
||||
|
||||
export interface InstrumentRow {
|
||||
|
||||
Reference in New Issue
Block a user