feat: Crypto.com-Client und Backfill-Script

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 20:58:27 +00:00
parent 27a10dc794
commit a007c9dc6f
3 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { expect, test } from 'bun:test';
import { parseCandlestickResponse } from './cryptocom';
test('parst Crypto.com-Candlestick-Response', () => {
const json = {
result: {
data: [
{ t: 900000, o: '1.0', h: '1.2', l: '0.9', c: '1.1', v: '1000' },
{ t: 1800000, o: '1.1', h: '1.3', l: '1.0', c: '1.2', v: '500' },
],
},
};
const out = parseCandlestickResponse(json);
expect(out).toHaveLength(2);
expect(out[0]).toEqual({ ts: 900000, open: 1, high: 1.2, low: 0.9, close: 1.1, volume: 1000 });
});
test('leere/fehlende Daten → leeres Array', () => {
expect(parseCandlestickResponse({})).toEqual([]);
expect(parseCandlestickResponse({ result: {} })).toEqual([]);
});