55 lines
2.1 KiB
TypeScript
55 lines
2.1 KiB
TypeScript
// ORATS connector placeholder.
|
|
//
|
|
// When ORATS credentials are supplied via the `ORATS_API_KEY` environment
|
|
// variable, this client should call the relevant ORATS Data API endpoints
|
|
// and return responses shaped exactly like the types in `shared/schema.ts`.
|
|
//
|
|
// Suggested ORATS endpoints for the MVP feature set:
|
|
// - GET https://api.orats.io/datav2/strikes?ticker=SPY (strike-level gamma + OI)
|
|
// - GET https://api.orats.io/datav2/summaries?ticker=SPY (IV, IVR, expected move)
|
|
// - GET https://api.orats.io/datav2/cores?ticker=SPY (spot, daily series)
|
|
// - GET https://api.orats.io/datav2/monies/implied?ticker=SPY (implied skew curves)
|
|
//
|
|
// Required transformations (left as TODO for future wiring):
|
|
// * Aggregate strike-level gamma * OI * 100 * spot^2 * 0.01 to produce the
|
|
// bars used by `GexProfile`.
|
|
// * Derive call wall = strike with max positive call gamma exposure.
|
|
// * Derive put wall = strike with min (most negative) put gamma exposure.
|
|
// * HVL/gamma flip = strike where cumulative net gamma crosses zero.
|
|
//
|
|
// Until ORATS is wired up the routes call into `marketData.ts` instead.
|
|
|
|
export interface OratsClientConfig {
|
|
apiKey?: string;
|
|
baseUrl?: string;
|
|
}
|
|
|
|
export class OratsClient {
|
|
private apiKey: string;
|
|
private baseUrl: string;
|
|
|
|
constructor(config: OratsClientConfig = {}) {
|
|
this.apiKey = config.apiKey ?? process.env.ORATS_API_KEY ?? "";
|
|
this.baseUrl = config.baseUrl ?? "https://api.orats.io/datav2";
|
|
}
|
|
|
|
isConfigured(): boolean {
|
|
return this.apiKey.length > 0;
|
|
}
|
|
|
|
// Future wiring: throws until implemented so callers can fall back to mocks.
|
|
async fetchStrikes(_ticker: string): Promise<never> {
|
|
throw new Error("OratsClient.fetchStrikes not yet implemented");
|
|
}
|
|
|
|
async fetchSummary(_ticker: string): Promise<never> {
|
|
throw new Error("OratsClient.fetchSummary not yet implemented");
|
|
}
|
|
|
|
async fetchMonies(_ticker: string): Promise<never> {
|
|
throw new Error("OratsClient.fetchMonies not yet implemented");
|
|
}
|
|
}
|
|
|
|
export const oratsClient = new OratsClient();
|