Last active
January 22, 2020 19:07
-
-
Save rajuashok/8cf2f6a77123dbc56e51e319934a55db to your computer and use it in GitHub Desktop.
Portfolio Positions Orders Trades
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Trade { | |
id: string | |
security: Security | |
strategy: Strategy | |
legs: Legs[] | |
} | |
interface TradePosition { | |
id: string | |
portfolioId: string | |
tradeId: string | |
status: TradePositionStatus // {OPEN, FILLED, EXPIRED, EXIT_REQUEST, CLOSED} | |
contracts: number | |
startPrice: number | |
premiumCaptured: number | |
gainLoss: number | |
gainLossPct: number | |
fillDate: number | |
} | |
interface TradeOrder { | |
id: string | |
userId: string | |
tradePositionId: string | |
orderDate: number | |
status: TradeOrderStatus // {OPEN, FILLED, EXPIRED, EXIT_REQUEST, CLOSED} | |
expectedGain?: number // non-null for EXIT_REQUEST orders | |
} | |
interface Portfolio { | |
id: string | |
userId: string | |
cash: number | |
buyingPower: number | |
invested: number | |
// Calculate accountValue, gainLoss(Pct) on demand as they will change depending on performance of positions | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment