Skip to content

Commit

Permalink
fix option viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Apr 18, 2024
1 parent e24ed56 commit 8c3dd14
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/stock-options-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const StockOptionsView = (props: ITickerProps) => {
case 'ASK_PRICE':
return po?.a;
case 'AVG_PRICE':
return (po?.a - po?.b)/2;
return (po?.a + po?.b) ? (po?.a + po?.b)/2 : null;
default:
return po?.b;
}
Expand Down Expand Up @@ -127,7 +127,7 @@ export const StockOptionsView = (props: ITickerProps) => {
return (sellCost / data.currentPrice) * (365 / numberofdays);
}
default:
return price
return price?.toFixed(2);
}
})();
});
Expand All @@ -151,6 +151,7 @@ export const StockOptionsView = (props: ITickerProps) => {
<MenuItem value="LAST_PRICE">LAST_PRICE</MenuItem>
<MenuItem value="BID_PRICE">BID_PRICE</MenuItem>
<MenuItem value="ASK_PRICE">ASK_PRICE</MenuItem>
<MenuItem value="AVG_PRICE">AVG_PRICE</MenuItem>
</Select>
</FormControl>
<FormControl sx={{ m: 1 }} variant="standard">
Expand Down

0 comments on commit 8c3dd14

Please sign in to comment.