Add detail view for margin trades

This commit is contained in:
Matthias 2022-02-01 07:02:38 +01:00
parent 4aef20ca86
commit 4702a0d057
2 changed files with 27 additions and 3 deletions

View File

@ -5,9 +5,10 @@
<h5 class="detail-header">General</h5>
<ValuePair description="TradeId">{{ trade.trade_id }}</ValuePair>
<ValuePair description="Pair">{{ trade.pair }}</ValuePair>
<ValuePair description="Stake">{{
formatPriceCurrency(trade.stake_amount, stakeCurrency)
}}</ValuePair>
<ValuePair description="Stake"
>{{ formatPriceCurrency(trade.stake_amount, stakeCurrency) }}
{{ trade.leverage ? `(${trade.leverage}x)` : '' }}</ValuePair
>
<ValuePair description="Open date">{{ timestampms(trade.open_timestamp) }}</ValuePair>
<ValuePair v-if="trade.buy_tag" description="Buy tag">{{ trade.buy_tag }}</ValuePair>
<ValuePair description="Open Rate">{{ formatPrice(trade.open_rate) }}</ValuePair>
@ -53,6 +54,17 @@
<ValuePair v-if="trade.stoploss_last_update_timestamp" description="Stoploss last updated">
{{ timestampms(trade.stoploss_last_update_timestamp) }}
</ValuePair>
<div v-if="trade.trading_mode !== undefined && trade.trading_mode !== 'SPOT'">
<h5 class="detail-header">Futures/Margin</h5>
<ValuePair description="Short"> {{ trade.is_short ? 'short' : 'long' }} </ValuePair>
<ValuePair description="Leverage"> {{ trade.leverage }} </ValuePair>
<ValuePair v-if="trade.funding_fees !== undefined" description="Funding fees">
{{ formatPrice(trade.funding_fees) }}
</ValuePair>
<ValuePair v-if="trade.interest_rate !== undefined" description="Interest rate">
{{ formatPrice(trade.interest_rate) }}
</ValuePair>
</div>
</div>
</div>
</div>

View File

@ -1,3 +1,9 @@
export enum TradingMode {
SPOT = 'SPOT',
MARGIN = 'MARGIN',
FUTURES = 'FUTURES',
}
export interface Trade {
/**
* corresponds to the UI (ftbot.1) - does NOT relate to the backend!
@ -64,6 +70,12 @@ export interface Trade {
stoploss_current_dist_ratio?: number;
stoploss_current_dist_pct?: number;
open_order_id?: string;
/** Short properties - only available in API versions 2.x and up */
is_short?: boolean;
leverage?: number;
interest_rate?: number;
funding_fees?: number;
trading_mode?: string;
}
export interface ClosedTrade extends Trade {