T-154: M2.3l — libs/data/questdb: pure TypeScript ILP v2 batch writer for bars_1m / fx_1m (ilp-v2-writer.ts, binary doubles + microsecond timestamps over an injected sink, byte-parity with tools/curate-etl/src/ilp.rs; no new deps, no live QuestDB)
This commit is contained in:
parent
18f1e6e471
commit
8ebc442512
2 changed files with 116 additions and 8 deletions
|
|
@ -481,19 +481,48 @@ export function createIlpV2BatchWriter(options: IlpV2BatchWriterOptions): IlpV2B
|
|||
}
|
||||
}
|
||||
|
||||
function snapshotBar1mRow(row: Bar1mIlpV2Row): Bar1mIlpV2Row {
|
||||
return {
|
||||
listing_id: row.listing_id,
|
||||
ts: row.ts,
|
||||
known_at: row.known_at,
|
||||
open: row.open,
|
||||
high: row.high,
|
||||
low: row.low,
|
||||
close: row.close,
|
||||
volume: row.volume,
|
||||
session: row.session,
|
||||
source: row.source,
|
||||
};
|
||||
}
|
||||
|
||||
function snapshotFx1mRow(row: Fx1mIlpV2Row): Fx1mIlpV2Row {
|
||||
return {
|
||||
pair: row.pair,
|
||||
source: row.source,
|
||||
open: row.open,
|
||||
high: row.high,
|
||||
low: row.low,
|
||||
close: row.close,
|
||||
ts: row.ts,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
writeBar1m(row: Bar1mIlpV2Row): Promise<void> {
|
||||
const snapshot = snapshotBar1mRow(row);
|
||||
return enqueue(async () => {
|
||||
assertHealthyForMutation('writeBar1m');
|
||||
const encoded = encodeBar1mIlpV2(row);
|
||||
const encoded = encodeBar1mIlpV2(snapshot);
|
||||
await enqueueEncodedRow(encoded);
|
||||
});
|
||||
},
|
||||
|
||||
writeFx1m(row: Fx1mIlpV2Row): Promise<void> {
|
||||
const snapshot = snapshotFx1mRow(row);
|
||||
return enqueue(async () => {
|
||||
assertHealthyForMutation('writeFx1m');
|
||||
const encoded = encodeFx1mIlpV2(row);
|
||||
const encoded = encodeFx1mIlpV2(snapshot);
|
||||
await enqueueEncodedRow(encoded);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue