Replace classes with interfaces in action.
This commit is contained in:
@ -9,7 +9,8 @@ export const enum ActionSide {
|
||||
/**
|
||||
* Represents an action taken on a stock, such as a buy or sell order.
|
||||
*/
|
||||
export class Action {
|
||||
export interface Action {
|
||||
|
||||
/**
|
||||
* The symbol of the asset being traded.
|
||||
*/
|
||||
@ -34,23 +35,6 @@ export class Action {
|
||||
* The timestamp of the action
|
||||
*/
|
||||
readonly timestamp: Date;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param {Date} timestamp - The timestamp of the action.
|
||||
*/
|
||||
constructor(symbol: string, quantity: number, side: ActionSide, pricePerShare: number, timestamp: Date) {
|
||||
this.symbol = symbol;
|
||||
this.quantity = quantity;
|
||||
this.side = side;
|
||||
this.pricePerShare = pricePerShare;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,7 +50,8 @@ export const enum ActionDateType {
|
||||
/**
|
||||
* Represents options for a date filter in an action fetch.
|
||||
*/
|
||||
export class ActionDateOptions {
|
||||
export interface ActionDateOptions {
|
||||
|
||||
/**
|
||||
* The date to filter on.
|
||||
*/
|
||||
@ -76,22 +61,13 @@ export class ActionDateOptions {
|
||||
* 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 {
|
||||
export interface ActionFetchOptions {
|
||||
|
||||
/**
|
||||
* The number of items to fetch per page.
|
||||
*/
|
||||
@ -101,23 +77,13 @@ export class ActionFetchOptions {
|
||||
* The date options for filtering actions.
|
||||
*/
|
||||
readonly dateOptions?: ActionDateOptions;
|
||||
|
||||
/**
|
||||
* Creates a set of options for an Action fetch.
|
||||
* @constructor
|
||||
* @param pageSize - The size of the page if paging is desired.
|
||||
* @param dateOptions - The options for Date filtering.
|
||||
*/
|
||||
constructor(pageSize?: number, dateOptions?: ActionDateOptions) {
|
||||
this.pageSize = pageSize;
|
||||
this.dateOptions = dateOptions;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the response of a fetch action request.
|
||||
*/
|
||||
export class ActionFetchResponse {
|
||||
export interface ActionFetchResponse {
|
||||
|
||||
/**
|
||||
* An array of `Action` objects.
|
||||
*/
|
||||
@ -128,17 +94,6 @@ export class ActionFetchResponse {
|
||||
* Returns a promise that resolves to an `ActionFetchResponse` object.
|
||||
*/
|
||||
readonly fetchNextPage?: () => Promise<ActionFetchResponse>;
|
||||
|
||||
/**
|
||||
* Creates an instance of the Actions class.
|
||||
* @constructor
|
||||
* @param actions The list of actions.
|
||||
* @param fetchNextPage A function that fetches the next page of actions.
|
||||
*/
|
||||
constructor(actions: Action[], fetchNextPage?: () => Promise<ActionFetchResponse>) {
|
||||
this.actions = actions;
|
||||
this.fetchNextPage = fetchNextPage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user