-
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1550 from freqtrade/feat/backtest-comparison
Add backtest comparison view, allowing the comparison of multiple strategies
- Loading branch information
Showing
5 changed files
with
105 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="px-0 mw-100"> | ||
<div class="d-flex justify-content-center"> | ||
<h3>Backtest-result comparison</h3> | ||
</div> | ||
|
||
<!-- <div class="d-flex"> | ||
<div v-for="[key, result] in Object.entries(backtestResults)" :key="key" class="border m-1"> | ||
<BacktestResultSelectEntry :backtest-result="result" /> | ||
</div> | ||
</div> --> | ||
<div class="d-flex flex-column text-start ms-0 me-2 gap-2"> | ||
<div class="d-flex flex-column flex-xl-row"> | ||
<div class="px-0 px-xl-0 pt-2 pt-xl-0 ps-xl-1 flex-fill"> | ||
<b-table bordered :items="backtestResultStats" :fields="backtestResultFields"> | ||
<template | ||
v-for="[key, result] in Object.entries(backtestResults)" | ||
#[`head(${key})`] | ||
:key="key" | ||
> | ||
<BacktestResultSelectEntry :backtest-result="result" /> | ||
</template> | ||
</b-table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BacktestResultInMemory } from '@/types'; | ||
import { formatObjectForTable } from '@/shared/objectToTableItems'; | ||
import { computed } from 'vue'; | ||
import { generateBacktestMetricRows } from '@/shared/backtestMetrics'; | ||
import { TableField } from 'bootstrap-vue-next'; | ||
import BacktestResultSelectEntry from '@/components/ftbot/BacktestResultSelectEntry.vue'; | ||
const props = defineProps({ | ||
backtestResults: { required: true, type: Object as () => Record<string, BacktestResultInMemory> }, | ||
}); | ||
const backtestResultStats = computed(() => { | ||
const values = {}; | ||
Object.entries(props.backtestResults).forEach(([key, result]) => { | ||
const tmp = generateBacktestMetricRows(result.strategy); | ||
values[key] = tmp; | ||
}); | ||
console.log(values); | ||
// return ''; | ||
return formatObjectForTable(values, 'metric'); | ||
}); | ||
const backtestResultFields = computed<TableField[]>(() => { | ||
const res = [{ key: 'metric', label: 'Metric' }]; | ||
Object.entries(props.backtestResults).forEach(([key, value]) => { | ||
res.push({ key, label: value.metadata.strategyName }); | ||
}); | ||
return res; | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters