Improve trade type, reduce duplicity

also, improve detail_view types
This commit is contained in:
Matthias 2020-10-20 07:57:30 +02:00
parent 9d041ec9a2
commit 5ceb84bea4
2 changed files with 33 additions and 23 deletions

View File

@ -7,13 +7,22 @@
<ValuePair description="Pair">{{ trade.pair }}</ValuePair> <ValuePair description="Pair">{{ trade.pair }}</ValuePair>
<ValuePair description="Open date">{{ timestampms(trade.open_timestamp) }}</ValuePair> <ValuePair description="Open date">{{ timestampms(trade.open_timestamp) }}</ValuePair>
<ValuePair description="Open Rate">{{ formatPrice(trade.open_rate) }}</ValuePair> <ValuePair description="Open Rate">{{ formatPrice(trade.open_rate) }}</ValuePair>
<ValuePair v-if="!trade.is_open" description="Close Rate">{{ formatPrice(trade.close_rate) }}</ValuePair> <ValuePair v-if="!trade.is_open && trade.close_rate" description="Close Rate">{{
<ValuePair description="Min Rate">{{ formatPrice(trade.min_rate) }}</ValuePair> formatPrice(trade.close_rate)
<ValuePair description="Max Rate">{{ formatPrice(trade.max_rate) }}</ValuePair> }}</ValuePair>
<ValuePair v-if="trade.min_rate" description="Min Rate">{{
formatPrice(trade.min_rate)
}}</ValuePair>
<ValuePair v-if="trade.max_rate" description="Max Rate">{{
formatPrice(trade.max_rate)
}}</ValuePair>
<ValuePair v-if="trade.close_timestamp" description="Close date">{{ <ValuePair v-if="trade.close_timestamp" description="Close date">{{
timestampms(trade.close_timestamp) timestampms(trade.close_timestamp)
}}</ValuePair> }}</ValuePair>
<ValuePair v-if="trade.current_profit" description="Current Profit"> <ValuePair
v-if="trade.current_profit && trade.current_profit_abs"
description="Current Profit"
>
{{ formatPercent(trade.current_profit) }} | {{ trade.current_profit_abs }} {{ formatPercent(trade.current_profit) }} | {{ trade.current_profit_abs }}
</ValuePair> </ValuePair>
<ValuePair v-if="trade.close_profit" description="Close Profit"> <ValuePair v-if="trade.close_profit" description="Close Profit">
@ -26,15 +35,21 @@
{{ formatPercent(trade.stop_loss_pct / 100) }} | {{ formatPercent(trade.stop_loss_pct / 100) }} |
{{ formatPrice(trade.stop_loss_abs) }} {{ formatPrice(trade.stop_loss_abs) }}
</ValuePair> </ValuePair>
<ValuePair description="Initial Stoploss"> <ValuePair
v-if="trade.initial_stop_loss_pct && trade.initial_stop_loss_abs"
description="Initial Stoploss"
>
{{ formatPercent(trade.initial_stop_loss_pct / 100) }} | {{ formatPercent(trade.initial_stop_loss_pct / 100) }} |
{{ formatPrice(trade.initial_stop_loss) }} {{ formatPrice(trade.initial_stop_loss_abs) }}
</ValuePair> </ValuePair>
<ValuePair v-if="trade.is_open" description="Current stoploss dist"> <ValuePair
v-if="trade.is_open && trade.stoploss_current_dist_ratio && trade.stoploss_current_dist"
description="Current stoploss dist"
>
{{ formatPercent(trade.stoploss_current_dist_ratio) }} | {{ formatPercent(trade.stoploss_current_dist_ratio) }} |
{{ formatPrice(trade.stoploss_current_dist) }} {{ formatPrice(trade.stoploss_current_dist) }}
</ValuePair> </ValuePair>
<ValuePair description="Stoploss last updated"> <ValuePair v-if="trade.stoploss_last_update_timestamp" description="Stoploss last updated">
{{ timestampms(trade.stoploss_last_update_timestamp) }} {{ timestampms(trade.stoploss_last_update_timestamp) }}
</ValuePair> </ValuePair>
</div> </div>

View File

@ -23,7 +23,10 @@ export interface Trade {
fee_close_currency?: string; fee_close_currency?: string;
current_rate?: number; current_rate?: number;
/** Current profit as ratio */
current_profit?: number; current_profit?: number;
current_profit_abs?: number;
current_profit_pct?: number;
sell_reason?: string; sell_reason?: string;
min_rate?: number; min_rate?: number;
max_rate?: number; max_rate?: number;
@ -37,6 +40,10 @@ export interface Trade {
initial_stop_loss_abs?: number; initial_stop_loss_abs?: number;
initial_stop_loss_ratio?: number; initial_stop_loss_ratio?: number;
initial_stop_loss_pct?: number; initial_stop_loss_pct?: number;
stoploss_current_dist?: number;
stoploss_current_dist_ratio?: number;
stoploss_current_dist_pct?: number;
open_order_id?: string; open_order_id?: string;
} }
@ -54,19 +61,7 @@ export interface ClosedTrade extends Trade {
fee_close_cost?: number; fee_close_cost?: number;
fee_close_currency?: string; fee_close_currency?: string;
current_rate?: number; sell_reason: string;
sell_reason?: string; min_rate: number;
min_rate?: number; max_rate: number;
max_rate?: number;
stop_loss_abs: number;
stop_loss_ratio: number;
stop_loss_pct: number;
stoploss_order_id?: string;
stoploss_last_update?: string;
stoploss_last_update_timestamp?: number;
initial_stop_loss_abs?: number;
initial_stop_loss_ratio?: number;
initial_stop_loss_pct?: number;
open_order_id?: string;
} }