usxi/src/interface/actions.ts

49 lines
1.1 KiB
TypeScript

export enum ActionSide {
Buy,
Sell,
}
export class Action {
readonly symbol: string;
readonly quantity: number;
readonly side: ActionSide;
readonly pricePerShare: number;
constructor(symbol: string, quantity: number, side: ActionSide, pricePerShare: number) {
this.symbol = symbol;
this.quantity = quantity;
this.side = side;
this.pricePerShare = pricePerShare;
}
}
export enum ActionDateType {
On,
After,
Before,
}
export class ActionDateOptions {
readonly date: Date;
readonly dateType: ActionDateType;
constructor(date: Date, dateType: ActionDateType) {
this.date = date;
this.dateType = dateType;
}
}
export class ActionFetchOptions {
readonly pageSize?: number;
readonly dateOptions?: ActionDateOptions;
}
export interface ActionFetchResponse {
readonly actions: Action[];
readonly fetchNextPage?: () => Promise<ActionFetchResponse>;
}
export interface ActionProvider {
readonly fetchActions: (options: ActionFetchOptions) => Promise<ActionFetchResponse>;
}