Resolve "Add support for account action history" #30

Merged
clbertolini merged 7 commits from 13-add-support-for-account-action-history into main 2023-10-27 20:43:34 +00:00
2 changed files with 55 additions and 0 deletions
Showing only changes of commit 20a8920a30 - Show all commits

49
src/interface/actions.ts Normal file
View File

@ -0,0 +1,49 @@
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>;
}

View File

@ -1,5 +1,6 @@
import { PortfolioProvider } from "./portfolio";
import { QuoteProvider } from "./quote";
import { ActionProvider } from "./actions";
/**
* Represents an exchange, which provides access to a portfolio provider and a quote provider.
@ -16,6 +17,11 @@ export interface Exchange {
*/
readonly quoteProvider: QuoteProvider;
/**
* The action provider for the exchange.
*/
readonly actionProvider: ActionProvider;
/**
* The name of the exchange.
*/