Skip to content

Commit

Permalink
fix: issue#399当日收益计算字段更换
Browse files Browse the repository at this point in the history
  • Loading branch information
linminghuang committed Mar 8, 2024
1 parent 0982a61 commit 13bd2bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/statusbar/Profit.ts
Expand Up @@ -126,7 +126,7 @@ export class ProfitStatusBar {
stockList.forEach((s) => {
let tmp = {} as StockInfoType;
const { id, info } = s;
const { high, low, open, percent, price, name } = info;
const { high, low, open, yestclose, percent, price, name } = info;
if (id && open && price) {
const config = stockPrice[id];
if (!config || config.amount === 0 || config.unitPrice === 0) {
Expand All @@ -137,7 +137,8 @@ export class ProfitStatusBar {
// const incomeTotal = amount * (Number(price).toFixed(2) - unitPrice.toFixed(2));
// const incomeToday = amount * (Number(price).toFixed(2) - Number(open).toFixed(2));
const incomeTotal = (amount * (Number(price) - unitPrice)).toFixed(2);
const incomeToday = (amount * (Number(price) - Number(open))).toFixed(2);
// fix #399,在昨日收盘价没有的时候使用今日开盘价
const incomeToday = (amount * (Number(price) - Number(yestclose || open))).toFixed(2);
const percentTotal = ((Number(incomeTotal) / (unitPrice * amount)) * 100).toFixed(2);
tmp = {
id,
Expand Down

0 comments on commit 13bd2bd

Please sign in to comment.