/** * Enum representing the possible sides of an action. */ export const enum ActionSide { Buy, Sell, } /** * Represents an action taken on a stock, such as a buy or sell order. */ export class Action { /** * The symbol of the asset being traded. */ readonly symbol: string; /** * The quantity of the asset being traded. */ readonly quantity: number; /** * The side of the action, either "buy" or "sell". */ readonly side: ActionSide; /** * The price per share of the asset. */ readonly pricePerShare: number; /** * Represents a user Action. * @constructor * @param {string} symbol - The symbol of the asset being traded. * @param {number} quantity - The quantity of the asset being traded. * @param {ActionSide} side - The side of the trade (buy or sell). * @param {number} pricePerShare - The price per share of the asset being traded. */ constructor(symbol: string, quantity: number, side: ActionSide, pricePerShare: number) { this.symbol = symbol; this.quantity = quantity; this.side = side; this.pricePerShare = pricePerShare; } } /** * Enum representing the type of date filter used in an action fetch. * @enum {number} */ export const enum ActionDateType { On, After, Before, } /** * Represents options for a date filter in an action fetch. */ export class ActionDateOptions { /** * The date to filter on. */ readonly date: Date; /** * The type of date filter to use. */ readonly dateType: ActionDateType; /** * Creates a new ActionDateOptions instance. * @param date The date to filter on. * @param dateType The type of date filter to use. */ constructor(date: Date, dateType: ActionDateType) { this.date = date; this.dateType = dateType; } } /** * Represents the options for fetching actions. */ export class ActionFetchOptions { /** * The number of items to fetch per page. */ readonly pageSize?: number; /** * The date options for filtering actions. */ readonly dateOptions?: ActionDateOptions; } /** * Represents the response of a fetch action request. */ export interface ActionFetchResponse { /** * An array of `Action` objects. */ readonly actions: Action[]; /** * A function that fetches the next page of actions, if available. * Returns a promise that resolves to an `ActionFetchResponse` object. */ readonly fetchNextPage?: () => Promise; } /** * An interface representing an object that provides actions. */ export interface ActionProvider { /** * Fetches actions based on the provided options. * @param options - The options to use when fetching actions. * @returns A promise that resolves to an object containing the fetched actions. */ readonly fetchActions: (options: ActionFetchOptions) => Promise; }