24 lines
880 B
TypeScript
24 lines
880 B
TypeScript
import { doublePrecision, jsonb, pgTable, primaryKey, serial, text, timestamp, varchar } from 'drizzle-orm/pg-core';
|
|
|
|
export const candles = pgTable(
|
|
'candles',
|
|
{
|
|
pair: varchar('pair', { length: 16 }).notNull(),
|
|
ts: timestamp('ts', { withTimezone: true }).notNull(),
|
|
open: doublePrecision('open').notNull(),
|
|
high: doublePrecision('high').notNull(),
|
|
low: doublePrecision('low').notNull(),
|
|
close: doublePrecision('close').notNull(),
|
|
volume: doublePrecision('volume').notNull(),
|
|
},
|
|
(t) => [primaryKey({ columns: [t.pair, t.ts] })],
|
|
);
|
|
|
|
export const backtestRuns = pgTable('backtest_runs', {
|
|
id: serial('id').primaryKey(),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
kind: text('kind').notNull(), // 'single' | 'walkforward'
|
|
config: jsonb('config').notNull(),
|
|
result: jsonb('result').notNull(),
|
|
});
|