frequi_origin/src/components/ftbot/BacktestResultSelect.vue

40 lines
1.1 KiB
Vue
Raw Normal View History

2021-01-20 06:55:56 +00:00
<template>
2021-03-10 15:09:55 +00:00
<div class="container d-flex flex-column align-items-center">
<h3>Available results:</h3>
2021-01-20 06:55:56 +00:00
<b-list-group class="ml-2">
<b-list-group-item
v-for="[key, strat] in Object.entries(backtestHistory)"
:key="key"
button
:active="key === selectedBacktestResultKey"
class="d-flex justify-content-between align-items-center py-1"
@click="setBacktestResult(key)"
>
{{ key }} {{ strat.total_trades }} {{ formatPercent(strat.profit_total) }}
</b-list-group-item>
</b-list-group>
</div>
</template>
<script lang="ts">
import { formatPercent } from '@/shared/formatters';
import { StrategyBacktestResult } from '@/types';
import { Component, Emit, Prop, Vue } from 'vue-property-decorator';
@Component({})
2021-02-28 19:05:07 +00:00
export default class BacktestResultSelect extends Vue {
2021-01-20 06:55:56 +00:00
@Prop({ required: true }) backtestHistory!: StrategyBacktestResult[];
@Prop({ required: false, default: '' }) selectedBacktestResultKey!: string;
@Emit('selectionChange')
setBacktestResult(key) {
return key;
}
formatPercent = formatPercent;
}
</script>
<style scoped></style>