re-organized code; implemented `getAggregate()` where it was missing
parent
15a5d7c67b
commit
d6762fdae5
@ -0,0 +1,24 @@
|
|||||||
|
import type { AggregateDatabase } from "../interfaces.js";
|
||||||
|
|
||||||
|
export type CalendarKey = {
|
||||||
|
symbol: string;
|
||||||
|
type: "call" | "put";
|
||||||
|
strike: number;
|
||||||
|
frontExpirationDate: string;
|
||||||
|
backExpirationDate: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CalendarDatabase = AggregateDatabase<CalendarKey> & {
|
||||||
|
getCalendars: AggregateDatabase<CalendarKey>["getKeys"];
|
||||||
|
getTargetPriceByProbability: ({
|
||||||
|
symbol,
|
||||||
|
calendarSpan,
|
||||||
|
strikePercentageFromTheMoney,
|
||||||
|
historicalProbabilityOfSuccess,
|
||||||
|
}: {
|
||||||
|
symbol: string;
|
||||||
|
calendarSpan: number;
|
||||||
|
strikePercentageFromTheMoney: number;
|
||||||
|
historicalProbabilityOfSuccess: number;
|
||||||
|
}) => Promise<number>;
|
||||||
|
};
|
@ -1,4 +1,4 @@
|
|||||||
import { optionContractDatabase } from "../optiondb/lmdbx.js";
|
import { optionContractDatabase } from "../OptionContract/lmdbx.js";
|
||||||
import type { CalendarDatabase } from "./interfaces.js";
|
import type { CalendarDatabase } from "./interfaces.js";
|
||||||
|
|
||||||
/** Largest possible key according to the `ordered-binary` (used by lmdbx) docs. */
|
/** Largest possible key according to the `ordered-binary` (used by lmdbx) docs. */
|
@ -1,24 +0,0 @@
|
|||||||
import type { AggregateDatabase } from "../interfaces.js";
|
|
||||||
|
|
||||||
export type CalendarKey = {
|
|
||||||
symbol: string;
|
|
||||||
type: "call" | "put";
|
|
||||||
strike: number;
|
|
||||||
frontExpirationDate: string;
|
|
||||||
backExpirationDate: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type CalendarDatabase = AggregateDatabase<CalendarKey> & {
|
|
||||||
getCalendars: AggregateDatabase<CalendarKey>["getKeys"];
|
|
||||||
getTargetPriceByProbability: ({
|
|
||||||
symbol,
|
|
||||||
calendarSpan,
|
|
||||||
strikePercentageFromTheMoney,
|
|
||||||
historicalProbabilityOfSuccess,
|
|
||||||
}: {
|
|
||||||
symbol: string;
|
|
||||||
calendarSpan: number;
|
|
||||||
strikePercentageFromTheMoney: number;
|
|
||||||
historicalProbabilityOfSuccess: number;
|
|
||||||
}) => Promise<number>;
|
|
||||||
};
|
|
Loading…
Reference in New Issue