Show Orders in trade detail if possible

This commit is contained in:
Matthias 2022-03-02 20:28:23 +01:00
parent b406fe14d4
commit 8d9ff616bb
2 changed files with 30 additions and 1 deletions

View File

@ -80,6 +80,17 @@
{{ formatPrice(trade.interest_rate) }} {{ formatPrice(trade.interest_rate) }}
</ValuePair> </ValuePair>
</div> </div>
<details v-if="trade.orders">
<summary>Orders</summary>
<div v-for="(order, key) in trade.orders" :key="key">
<span>
(#{{ key + 1 }}) <DateTimeTZ :date="order.order_timestamp" show-timezone />
<b class="ml-1">{{ order.ft_order_side }}</b> for
<b>{{ formatPrice(order.safe_price) }}</b> | {{ order.remaining }} /
{{ order.filled }}</span
>
</div>
</details>
</div> </div>
</div> </div>
</div> </div>
@ -90,10 +101,11 @@ import { Component, Vue, Prop } from 'vue-property-decorator';
import { formatPercent, formatPriceCurrency, formatPrice, timestampms } from '@/shared/formatters'; import { formatPercent, formatPriceCurrency, formatPrice, timestampms } from '@/shared/formatters';
import ValuePair from '@/components/general/ValuePair.vue'; import ValuePair from '@/components/general/ValuePair.vue';
import TradeProfit from '@/components/ftbot/TradeProfit.vue'; import TradeProfit from '@/components/ftbot/TradeProfit.vue';
import DateTimeTZ from '@/components/general/DateTimeTZ.vue';
import { Trade } from '@/types'; import { Trade } from '@/types';
@Component({ @Component({
components: { ValuePair, TradeProfit }, components: { ValuePair, TradeProfit, DateTimeTZ },
}) })
export default class TradeDetail extends Vue { export default class TradeDetail extends Vue {
@Prop({ type: Object, required: true }) trade!: Trade; @Prop({ type: Object, required: true }) trade!: Trade;

View File

@ -4,6 +4,22 @@ export enum TradingMode {
FUTURES = 'FUTURES', FUTURES = 'FUTURES',
} }
export interface Order {
pair: string;
order_id: string;
status: string;
remaining: number;
amount: number;
safe_price: number;
cost: number;
filled: number;
ft_order_side: string;
order_type: string;
is_open: boolean;
order_timestamp?: number;
order_filled_timestamp?: number;
}
export interface Trade { export interface Trade {
/** /**
* corresponds to the UI (ftbot.1) - does NOT relate to the backend! * corresponds to the UI (ftbot.1) - does NOT relate to the backend!
@ -76,6 +92,7 @@ export interface Trade {
interest_rate?: number; interest_rate?: number;
funding_fees?: number; funding_fees?: number;
trading_mode?: string; trading_mode?: string;
orders?: Order[];
} }
export interface ClosedTrade extends Trade { export interface ClosedTrade extends Trade {