ability to see orders in trade navigation

This commit is contained in:
Tako 2023-07-14 16:59:43 +00:00
parent 919a736fb2
commit 13ff896671

View File

@ -9,7 +9,7 @@
>Trade Navigation {{ sortNewestFirst ? '↓' : '↑' }} >Trade Navigation {{ sortNewestFirst ? '↓' : '↑' }}
</b-list-group-item> </b-list-group-item>
<b-list-group-item <b-list-group-item
v-for="trade in sortedTrades" v-for="(trade, i) in sortedTrades"
:key="trade.open_timestamp" :key="trade.open_timestamp"
button button
class="d-flex flex-wrap justify-content-between align-items-center py-1" class="d-flex flex-wrap justify-content-between align-items-center py-1"
@ -17,18 +17,34 @@
:active="trade.open_timestamp === selectedTrade.open_timestamp" :active="trade.open_timestamp === selectedTrade.open_timestamp"
@click="onTradeSelect(trade)" @click="onTradeSelect(trade)"
> >
<div class="d-flex flex-column">
<div> <div>
<span v-if="botStore.activeBot.botState.trading_mode !== 'spot'">{{ <span v-if="botStore.activeBot.botState.trading_mode !== 'spot'">{{
trade.is_short ? 'S-' : 'L-' trade.is_short ? 'S-' : 'L-'
}}</span> }}</span>
<DateTimeTZ :date="trade.open_timestamp" /> <DateTimeTZ :date="trade.open_timestamp" />
</div> </div>
<TradeProfit :trade="trade" /> <TradeProfit :trade="trade" class="my-1" />
<ProfitPill <ProfitPill
v-if="backtestMode" v-if="backtestMode"
:profit-ratio="trade.profit_ratio" :profit-ratio="trade.profit_ratio"
:stake-currency="botStore.activeBot.stakeCurrency" :stake-currency="botStore.activeBot.stakeCurrency"
/> />
</div>
<b-button size="sm" @click="ordersVisible[i] = !ordersVisible[i]"
><i-mdi-chevron-right v-if="!ordersVisible[i]" />
<i-mdi-chevron-down v-if="ordersVisible[i]" />
</b-button>
<b-collapse v-model="ordersVisible[i]">
<ul class="px-3 m-0">
<li
v-for="order in trade.orders?.filter((o) => o.order_filled_timestamp !== null)"
:key="order.order_timestamp"
>
{{ order.ft_order_side }} {{ order.amount }} at {{ order.safe_price }}
</li>
</ul>
</b-collapse>
</b-list-group-item> </b-list-group-item>
<b-list-group-item v-if="trades.length === 0">No trades to show...</b-list-group-item> <b-list-group-item v-if="trades.length === 0">No trades to show...</b-list-group-item>
</b-list-group> </b-list-group>
@ -39,7 +55,7 @@
import { Trade } from '@/types'; import { Trade } from '@/types';
import TradeProfit from '@/components/ftbot/TradeProfit.vue'; import TradeProfit from '@/components/ftbot/TradeProfit.vue';
import ProfitPill from '@/components/general/ProfitPill.vue'; import ProfitPill from '@/components/general/ProfitPill.vue';
import { computed, ref } from 'vue'; import { computed, ref, watch } from 'vue';
import { useBotStore } from '@/stores/ftbotwrapper'; import { useBotStore } from '@/stores/ftbotwrapper';
import DateTimeTZ from '@/components/general/DateTimeTZ.vue'; import DateTimeTZ from '@/components/general/DateTimeTZ.vue';
@ -67,6 +83,15 @@ const sortedTrades = computed(() => {
: a.open_timestamp - b.open_timestamp, : a.open_timestamp - b.open_timestamp,
); );
}); });
const ordersVisible = ref(sortedTrades.value.map(() => false));
watch(
() => botStore.activeBot.selectedPair,
() => {
ordersVisible.value = sortedTrades.value.map(() => false);
},
);
</script> </script>
<style scoped> <style scoped>