2022-10-30 11:02:48 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="row">
|
2022-10-30 13:26:23 +00:00
|
|
|
<div class="col-md-11 text-start">
|
2022-10-30 11:02:48 +00:00
|
|
|
<p>
|
|
|
|
Graph will always show the latest values for the selected strategy. Timerange:
|
|
|
|
{{ timerange }} - {{ strategy }}
|
|
|
|
</p>
|
|
|
|
</div>
|
2022-10-30 13:26:23 +00:00
|
|
|
<div class="col-md-1 text-end">
|
2022-10-30 11:02:48 +00:00
|
|
|
<b-button
|
|
|
|
aria-label="Close"
|
|
|
|
title="Trade Navigation"
|
|
|
|
size="sm"
|
|
|
|
@click="showRightBar = !showRightBar"
|
|
|
|
>{{ showRightBar ? '>' : '<' }}
|
|
|
|
</b-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row text-center h-100 d-flex align-items-stretch">
|
|
|
|
<PairSummary
|
|
|
|
class="col-md-2 overflow-auto"
|
|
|
|
style="max-height: calc(100vh - 200px)"
|
2022-10-30 11:55:14 +00:00
|
|
|
:pairlist="pairlist"
|
|
|
|
:trades="trades"
|
2022-10-30 11:02:48 +00:00
|
|
|
sort-method="profit"
|
|
|
|
:backtest-mode="true"
|
|
|
|
/>
|
|
|
|
<CandleChartContainer
|
2022-10-30 11:55:14 +00:00
|
|
|
:available-pairs="pairlist"
|
2022-10-30 11:02:48 +00:00
|
|
|
:historic-view="!!true"
|
|
|
|
:timeframe="timeframe"
|
|
|
|
:timerange="timerange"
|
|
|
|
:strategy="strategy"
|
2022-10-30 11:55:14 +00:00
|
|
|
:trades="trades"
|
2022-10-30 11:02:48 +00:00
|
|
|
:class="`${
|
|
|
|
showRightBar ? 'col-md-8' : 'col-md-10'
|
|
|
|
} candle-chart-container px-0 w-100 h-100 align-self-stretch`"
|
|
|
|
:slider-position="sliderPosition"
|
|
|
|
>
|
|
|
|
</CandleChartContainer>
|
|
|
|
<TradeListNav
|
|
|
|
v-if="showRightBar"
|
|
|
|
class="overflow-auto col-md-2"
|
|
|
|
style="max-height: calc(100vh - 200px)"
|
2022-10-30 11:55:14 +00:00
|
|
|
:trades="trades.filter((t) => t.pair === botStore.activeBot.selectedPair)"
|
2022-10-30 11:02:48 +00:00
|
|
|
@trade-select="navigateChartToTrade"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<b-card header="Single trades" class="row mt-2 w-100">
|
2022-10-30 11:55:14 +00:00
|
|
|
<TradeList class="row trade-history mt-2 w-100" :trades="trades" :show-filter="true" />
|
2022-10-30 11:02:48 +00:00
|
|
|
</b-card>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
|
|
|
import TradeList from '@/components/ftbot/TradeList.vue';
|
|
|
|
import TradeListNav from '@/components/ftbot/TradeListNav.vue';
|
|
|
|
import PairSummary from '@/components/ftbot/PairSummary.vue';
|
|
|
|
import CandleChartContainer from '@/components/charts/CandleChartContainer.vue';
|
|
|
|
import { defineComponent, ref } from 'vue';
|
|
|
|
import { ChartSliderPosition, Trade } from '@/types';
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'BacktestResultChart',
|
|
|
|
components: {
|
|
|
|
CandleChartContainer,
|
|
|
|
PairSummary,
|
|
|
|
TradeList,
|
|
|
|
TradeListNav,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
timeframe: { required: true, type: String },
|
|
|
|
strategy: { required: true, type: String },
|
|
|
|
timerange: { required: true, type: String },
|
2022-10-30 11:55:14 +00:00
|
|
|
pairlist: { required: true, type: Array as () => string[] },
|
|
|
|
trades: { required: true, type: Array as () => Trade[] },
|
2022-10-30 11:02:48 +00:00
|
|
|
},
|
|
|
|
setup() {
|
|
|
|
const botStore = useBotStore();
|
|
|
|
const showRightBar = ref(true);
|
|
|
|
const sliderPosition = ref<ChartSliderPosition>();
|
|
|
|
|
|
|
|
const navigateChartToTrade = (trade: Trade) => {
|
|
|
|
sliderPosition.value = {
|
|
|
|
startValue: trade.open_timestamp,
|
|
|
|
endValue: trade.close_timestamp,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
return { botStore, showRightBar, navigateChartToTrade, sliderPosition };
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.candle-chart-container {
|
|
|
|
// TODO: Rough estimate - still to fix correctly
|
|
|
|
// Applies to all "calc" usages in this file.
|
|
|
|
height: calc(100vh - 250px) !important;
|
|
|
|
}
|
|
|
|
</style>
|