Remove deprecated trade_profit

This commit is contained in:
Matthias 2020-12-02 20:03:17 +01:00
parent 8564908a9e
commit eb128b89ce
5 changed files with 7 additions and 28 deletions

View File

@ -44,7 +44,7 @@ export default class HourlyChart extends Vue {
if (trade.close_timestamp) {
const hour = timestampHour(trade.close_timestamp);
res[hour].profit += trade.close_profit;
res[hour].profit += trade.profit_ratio;
res[hour].count += 1;
}
}

View File

@ -14,15 +14,11 @@
<span v-if="comb.locks" :title="comb.lockReason"> &#128274; </span>
</div>
<b-badge
:variant="
comb.trade && comb.trade.current_profit && comb.trade.current_profit > 0
? 'success'
: 'danger'
"
:variant="comb.trade && comb.trade.profit_ratio > 0 ? 'success' : 'danger'"
pill
:title="comb.profitString"
>{{
comb.trade && comb.trade.current_profit ? formatPercent(comb.trade.current_profit) : ''
comb.trade && comb.trade.profit_ratio ? formatPercent(comb.trade.profit_ratio) : ''
}}</b-badge
>
</b-list-group-item>
@ -77,8 +73,8 @@ export default class PairSummary extends Vue {
lockReason = `${timestampms(locks.lock_end_timestamp)} - ${locks.reason}`;
}
let profitString = '';
if (trade && trade.current_profit) {
profitString = `Current profit: ${formatPercent(trade.current_profit)}
if (trade && trade.profit_ratio) {
profitString = `Current profit: ${formatPercent(trade.profit_ratio)}
Open since: ${timestampms(trade.open_timestamp)}`;
}
comb.push({ pair, trade, locks, lockReason, profitString });

View File

@ -13,7 +13,7 @@ export default class ProfitSymbol extends Vue {
@Prop({ required: true }) trade!: Trade;
get isProfitable() {
const res = (this.trade.close_profit ?? 0) > 0 || (this.trade.current_profit ?? 0) > 0;
const res = (this.trade.profit_ratio ?? 0) > 0;
return res;
}
}

View File

@ -16,8 +16,6 @@ export interface Trade {
close_date?: string;
close_timestamp?: number;
close_rate?: number;
close_profit?: number;
close_profit_abs?: number;
fee_close?: number;
fee_close_cost?: number;
fee_close_currency?: string;
@ -29,12 +27,6 @@ export interface Trade {
profit_pct: number;
/** Current absolute profit */
profit_abs: number;
/** Deprecated */
current_profit?: number;
/** Deprecated */
current_profit_abs?: number;
/** Deprecated */
current_profit_pct?: number;
sell_reason?: string;
min_rate?: number;
@ -64,10 +56,7 @@ export interface ClosedTrade extends Trade {
close_date: string;
close_timestamp: number;
close_rate: number;
/** Deprecated */
close_profit: number;
/** Deprecated */
close_profit_abs: number;
fee_close: number;
fee_close_cost?: number;
fee_close_currency?: string;

View File

@ -11,8 +11,6 @@ describe('ProfitSymbol.vue', () => {
});
it('calculates isProfitable with negative profit', () => {
const trade = {
close_profit: -0.5,
current_profit: -0.5,
profit_ratio: -0.5,
};
cmp.setProps({ trade });
@ -32,8 +30,6 @@ describe('ProfitSymbol.vue', () => {
it('renders triangle down when profit is negative', async () => {
const trade = {
close_profit: -0.5,
current_profit: -0.5,
profit_ratio: -0.5,
};
cmp.setProps({ trade });
@ -44,8 +40,6 @@ describe('ProfitSymbol.vue', () => {
it('renders triangle up when profit is positive', async () => {
const trade = {
close_profit: 0.5,
current_profit: 0.5,
profit_ratio: 0.5,
};
cmp.setProps({ trade });