Add Alpaca equities ingest adapter
Adds an Alpaca-backed equities adapter with exchange metadata mapping for conservative off-exchange tagging and a small helper test suite.
This commit is contained in:
parent
debbc1046b
commit
1175dd00cc
4 changed files with 393 additions and 0 deletions
29
services/ingest-equities/tests/alpaca.test.ts
Normal file
29
services/ingest-equities/tests/alpaca.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { describe, expect, test } from "bun:test";
|
||||
import { inferOffExchangeFlag } from "../src/adapters/alpaca";
|
||||
|
||||
describe("alpaca equities adapter helpers", () => {
|
||||
test("inferOffExchangeFlag tags FINRA/TRF venues as off-exchange", () => {
|
||||
const map = new Map<string, string>([
|
||||
["D", "FINRA / Nasdaq TRF"],
|
||||
["N", "FINRA / NYSE TRF"],
|
||||
["Q", "NASDAQ"],
|
||||
["P", "NYSE ARCA"],
|
||||
["O", "OTC Markets"]
|
||||
]);
|
||||
|
||||
expect(inferOffExchangeFlag("D", map)).toBe(true);
|
||||
expect(inferOffExchangeFlag("N", map)).toBe(true);
|
||||
expect(inferOffExchangeFlag("O", map)).toBe(true);
|
||||
expect(inferOffExchangeFlag("Q", map)).toBe(false);
|
||||
expect(inferOffExchangeFlag("P", map)).toBe(false);
|
||||
});
|
||||
|
||||
test("inferOffExchangeFlag falls back conservatively when no mapping", () => {
|
||||
const empty = new Map<string, string>();
|
||||
|
||||
expect(inferOffExchangeFlag(undefined, empty)).toBe(false);
|
||||
expect(inferOffExchangeFlag("", empty)).toBe(false);
|
||||
expect(inferOffExchangeFlag("D", empty)).toBe(true);
|
||||
expect(inferOffExchangeFlag("N", empty)).toBe(false);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue