Fix contract-focused options tape hydration
This commit is contained in:
parent
73e25ddf70
commit
b73e62bdba
8 changed files with 657 additions and 171 deletions
59
services/api/tests/option-queries.test.ts
Normal file
59
services/api/tests/option-queries.test.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import { describe, expect, it } from "bun:test";
|
||||
import { parseOptionPrintQuery } from "../src/option-queries";
|
||||
|
||||
describe("parseOptionPrintQuery", () => {
|
||||
it("keeps broad option flow filters for non-contract requests", () => {
|
||||
const url = new URL(
|
||||
"http://localhost/prints/options?view=signal&security=stock&side=A&type=call&min_notional=500000&underlying_ids=AAPL,MSFT"
|
||||
);
|
||||
|
||||
expect(parseOptionPrintQuery(url)).toEqual({
|
||||
scope: {
|
||||
underlyingIds: ["AAPL", "MSFT"],
|
||||
optionContractId: undefined
|
||||
},
|
||||
flowFilters: {
|
||||
view: "signal",
|
||||
securityTypes: ["stock"],
|
||||
nbboSides: ["A"],
|
||||
optionTypes: ["call"],
|
||||
minNotional: 500000
|
||||
},
|
||||
storageFilters: {
|
||||
view: "signal",
|
||||
security: "stock",
|
||||
nbboSides: ["A"],
|
||||
optionTypes: ["call"],
|
||||
minNotional: 500000,
|
||||
underlyingIds: ["AAPL", "MSFT"],
|
||||
optionContractId: undefined
|
||||
},
|
||||
isContractDrilldown: false
|
||||
});
|
||||
});
|
||||
|
||||
it("switches contract requests to raw contract-only storage filters", () => {
|
||||
const url = new URL(
|
||||
"http://localhost/replay/options?view=signal&security=stock&side=A&type=call&min_notional=500000&underlying_id=AAPL&option_contract_id=AAPL-2025-01-17-200-C"
|
||||
);
|
||||
|
||||
expect(parseOptionPrintQuery(url)).toEqual({
|
||||
scope: {
|
||||
underlyingIds: ["AAPL"],
|
||||
optionContractId: "AAPL-2025-01-17-200-C"
|
||||
},
|
||||
flowFilters: {
|
||||
view: "signal",
|
||||
securityTypes: ["stock"],
|
||||
nbboSides: ["A"],
|
||||
optionTypes: ["call"],
|
||||
minNotional: 500000
|
||||
},
|
||||
storageFilters: {
|
||||
view: "raw",
|
||||
optionContractId: "AAPL-2025-01-17-200-C"
|
||||
},
|
||||
isContractDrilldown: true
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue