fix: recordSnapshot type annotation + datetime quotes
This commit is contained in:
parent
e97a2ca643
commit
03035b3965
1 changed files with 2 additions and 2 deletions
|
|
@ -208,13 +208,13 @@ export async function forcePoll(): Promise<void> {
|
|||
* Record a portfolio-level P&L snapshot after every fetch.
|
||||
* Called by both pollTick (market hours) and forcePoll (manual/startup).
|
||||
*/
|
||||
function recordSnapshot(positions: import(../angel/types.js).Position[]): void {
|
||||
function recordSnapshot(positions: Position[]): void {
|
||||
const totalUnrealised = positions.reduce((s, p) => s + p.unrealisedPnl, 0);
|
||||
const totalRealised = positions.reduce((s, p) => s + p.realisedPnl, 0);
|
||||
const totalPnl = totalUnrealised + totalRealised;
|
||||
|
||||
db.prepare(`
|
||||
INSERT INTO pnl_snapshots (total_unrealised, total_realised, total_pnl, open_positions, recorded_at)
|
||||
VALUES (?, ?, ?, ?, datetime(now))
|
||||
VALUES (?, ?, ?, ?, datetime('now'))
|
||||
`).run(totalUnrealised, totalRealised, totalPnl, positions.length);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue