From dd72d4a7179f04a2bb3db0b5016de887845a7310 Mon Sep 17 00:00:00 2001 From: Carter Bertolini Date: Fri, 27 Oct 2023 16:10:11 -0400 Subject: [PATCH] Documented the action interface. --- src/interface/actions.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/interface/actions.ts b/src/interface/actions.ts index 29571fd..34b39d0 100644 --- a/src/interface/actions.ts +++ b/src/interface/actions.ts @@ -1,14 +1,43 @@ +/** + * Enum representing the possible sides of an action. + */ export 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; + /** + * Creates an instance of an 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; @@ -44,6 +73,14 @@ export interface ActionFetchResponse { 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; } \ No newline at end of file