Use common profitvariable in profit_summary

This commit is contained in:
Matthias 2020-12-05 17:44:18 +01:00
parent 2ef746d8f8
commit 86fda37d51
2 changed files with 6 additions and 10 deletions

View File

@ -76,7 +76,7 @@ export default class CandleChartContainer extends Vue {
@Prop({ required: true }) readonly timeframe!: string;
@Prop({ required: false, default: [] }) readonly trades!: Array<Trade>;
@Prop({ required: false, default: () => [] }) readonly trades!: Array<Trade>;
@Prop({ required: false, default: false }) historicView!: boolean;

View File

@ -13,14 +13,9 @@
{{ comb.pair }}
<span v-if="comb.locks" :title="comb.lockReason"> &#128274; </span>
</div>
<b-badge
:variant="comb.trade && comb.trade.profit_ratio > 0 ? 'success' : 'danger'"
pill
:title="comb.profitString"
>{{
comb.trade && comb.trade.profit_ratio ? formatPercent(comb.trade.profit_ratio) : ''
}}</b-badge
>
<b-badge :variant="comb.profit > 0 ? 'success' : 'danger'" pill :title="comb.profitString">{{
comb.profit ? formatPercent(comb.profit) : ''
}}</b-badge>
</b-list-group-item>
</b-list-group>
</template>
@ -39,6 +34,7 @@ interface CombinedPairList {
profitString: string;
trade?: Trade;
locks?: Lock;
profit: number;
}
@Component({})
@ -84,7 +80,7 @@ export default class PairSummary extends Vue {
if (trade) {
profitString += `\nOpen since: ${timestampms(trade.open_timestamp)}`;
}
comb.push({ pair, trade, locks, lockReason, profitString });
comb.push({ pair, trade, locks, lockReason, profitString, profit });
});
// sort Pairs: "with open trade" -> available -> locked
comb.sort((a, b) => {