This commit is contained in:
parent
85ad7f7387
commit
e9e2723c28
30 changed files with 380 additions and 44 deletions
|
|
@ -59,7 +59,6 @@ import {
|
|||
fetchSmartMoneyEventsBefore,
|
||||
fetchFlowPacketsAfter,
|
||||
fetchFlowPacketById,
|
||||
fetchAlertContextByTraceId,
|
||||
fetchFlowPacketsByMemberTraceIds,
|
||||
fetchFlowPacketsBefore,
|
||||
fetchRecentAlerts,
|
||||
|
|
@ -108,6 +107,7 @@ import {
|
|||
InferredDarkEventSchema,
|
||||
NewsStorySchema,
|
||||
LiveClientMessageSchema,
|
||||
type LiveChannel,
|
||||
LiveServerMessage,
|
||||
LiveSubscription,
|
||||
LiveSubscriptionSchema,
|
||||
|
|
@ -118,6 +118,7 @@ import {
|
|||
SmartMoneyEventSchema,
|
||||
OptionNBBOSchema,
|
||||
OptionPrintSchema,
|
||||
type OptionPrint,
|
||||
getSubscriptionKey
|
||||
} from "@islandflow/types";
|
||||
import { createClient } from "redis";
|
||||
|
|
@ -598,11 +599,8 @@ const parseLiveEquityPrintFilters = (url: URL): EquityPrintQueryFilters => ({
|
|||
|
||||
const matchesScopedOptionSubscription = (
|
||||
print: { underlying_id?: string; option_contract_id: string },
|
||||
subscription: LiveSubscription
|
||||
subscription: Extract<LiveSubscription, { channel: "options" }>
|
||||
): boolean => {
|
||||
if (subscription.channel !== "options") {
|
||||
return false;
|
||||
}
|
||||
if (subscription.option_contract_id && subscription.option_contract_id !== print.option_contract_id) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1016,7 +1014,7 @@ const run = async () => {
|
|||
const fanoutLive = async (
|
||||
subscription: LiveSubscription,
|
||||
item: unknown,
|
||||
ingestChannel: "options" | "nbbo" | "equities" | "equity-quotes" | "equity-candles" | "equity-overlay" | "equity-joins" | "flow" | "classifier-hits" | "alerts" | "inferred-dark" | "news"
|
||||
ingestChannel: LiveChannel
|
||||
) => {
|
||||
const watermark = await liveState.ingest(ingestChannel, item);
|
||||
|
||||
|
|
@ -1033,7 +1031,7 @@ const run = async () => {
|
|||
return;
|
||||
}
|
||||
|
||||
const optionItem = ingestChannel === "options" ? (item as Parameters<typeof matchesOptionPrintFilters>[0]) : null;
|
||||
const optionItem = ingestChannel === "options" ? (item as OptionPrint) : null;
|
||||
const equityItem = ingestChannel === "equities" ? (item as Parameters<typeof matchesScopedEquitySubscription>[0]) : null;
|
||||
const flowItem = ingestChannel === "flow" ? (item as Parameters<typeof matchesFlowPacketFilters>[0]) : null;
|
||||
let matchedSubscriptions = 0;
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ const matchesScopedOptionSnapshot = (
|
|||
}
|
||||
|
||||
const allowed = new Set(subscription.underlying_ids.map((value) => value.toUpperCase()));
|
||||
return allowed.has(item.underlying_id.toUpperCase());
|
||||
return item.underlying_id ? allowed.has(item.underlying_id.toUpperCase()) : false;
|
||||
};
|
||||
|
||||
const matchesScopedEquitySnapshot = (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ const decodePayload = (data: WebSocket.RawData): unknown => {
|
|||
return JSON.parse(new TextDecoder().decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength))) as unknown;
|
||||
}
|
||||
|
||||
return JSON.parse(new TextDecoder().decode(new Uint8Array(data as ArrayBuffer))) as unknown;
|
||||
return JSON.parse(new TextDecoder().decode(new Uint8Array(data as unknown as ArrayBuffer))) as unknown;
|
||||
};
|
||||
|
||||
const extractExchangeMeta = (payload: unknown): AlpacaExchangeMetaEntry[] => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ const decodePayload = (data: WebSocket.RawData): unknown => {
|
|||
if (ArrayBuffer.isView(data)) {
|
||||
return JSON.parse(new TextDecoder().decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength))) as unknown;
|
||||
}
|
||||
return JSON.parse(new TextDecoder().decode(new Uint8Array(data as ArrayBuffer))) as unknown;
|
||||
return JSON.parse(new TextDecoder().decode(new Uint8Array(data as unknown as ArrayBuffer))) as unknown;
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "tests/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ const decodePayload = (data: WebSocket.RawData): unknown => {
|
|||
return decode(new Uint8Array(data.buffer, data.byteOffset, data.byteLength));
|
||||
}
|
||||
|
||||
return decode(new Uint8Array(data as ArrayBuffer));
|
||||
return decode(new Uint8Array(data as unknown as ArrayBuffer));
|
||||
};
|
||||
|
||||
const parseTimestamp = (value: string): number => {
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ const nbboHistoryByContract: ContextHistory<OptionNBBO> = new Map();
|
|||
const equityQuoteHistoryByUnderlying: ContextHistory<EquityQuote> = new Map();
|
||||
const OPTION_CONTEXT_PRUNE_INTERVAL_MS = 60_000;
|
||||
|
||||
const pruneContextHistory = <T extends { ts: number }>(
|
||||
const pruneContextHistory = <T extends { ts: number; seq: number }>(
|
||||
history: ContextHistory<T>,
|
||||
maxKeys: number,
|
||||
ttlMs: number,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
"types": ["bun"]
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue