Documented the action interface.
This commit is contained in:
parent
20a8920a30
commit
dd72d4a717
@ -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<ActionFetchResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<ActionFetchResponse>;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user