Stock transactions can now influence forecast in addition to price. Several more minor bug/UI fixes

This commit is contained in:
danielyxie
2019-05-01 15:20:14 -07:00
parent 8726946d4a
commit 585e1ac7aa
18 changed files with 155 additions and 61 deletions
@@ -25,7 +25,7 @@ export class StockTickerPositionText extends React.Component<IProps, any> {
// Caculate total returns
const totalCost = stock.playerShares * stock.playerAvgPx;
const gains = (stock.price - stock.playerAvgPx) * stock.playerShares;
const gains = (stock.getBidPrice() - stock.playerAvgPx) * stock.playerShares;
let percentageGains = gains / totalCost;
if (isNaN(percentageGains)) { percentageGains = 0; }
@@ -56,7 +56,7 @@ export class StockTickerPositionText extends React.Component<IProps, any> {
// Caculate total returns
const totalCost = stock.playerShortShares * stock.playerAvgShortPx;
const gains = (stock.playerAvgShortPx - stock.price) * stock.playerShortShares;
const gains = (stock.playerAvgShortPx - stock.getAskPrice()) * stock.playerShortShares;
let percentageGains = gains / totalCost;
if (isNaN(percentageGains)) { percentageGains = 0; }