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: 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; @Prop({ required: false, default: false }) historicView!: boolean;

View File

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