Add timestamp to actions.
This commit is contained in:
parent
5b66bcd2c0
commit
27b49dc6dc
@ -37,7 +37,8 @@ export class AlpacaActionProvider {
|
||||
activity.symbol,
|
||||
parseInt(activity.qty, 10),
|
||||
activity.side === "buy" ? ActionSide.Buy : ActionSide.Sell,
|
||||
parseFloat(activity.price)
|
||||
parseFloat(activity.price),
|
||||
new Date(activity.transaction_time),
|
||||
);
|
||||
}),
|
||||
undefined
|
||||
|
@ -30,6 +30,11 @@ export class Action {
|
||||
*/
|
||||
readonly pricePerShare: number;
|
||||
|
||||
/**
|
||||
* The timestamp of the action
|
||||
*/
|
||||
readonly timestamp: Date;
|
||||
|
||||
/**
|
||||
* Represents a user Action.
|
||||
* @constructor
|
||||
@ -37,12 +42,14 @@ export class Action {
|
||||
* @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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user