Add endpoint to stop / reset backtesting

This commit is contained in:
Matthias 2020-09-18 20:56:20 +02:00
parent 1ed25a309f
commit 6a6ee6d718
2 changed files with 14 additions and 0 deletions

View File

@ -594,5 +594,14 @@ export default {
commit('updateBacktestResult', result.data.backtest_result);
}
},
async removeBacktest({ commit }) {
try {
const result = await api.delete('/backtest');
commit('updateBacktestRunning', result.data.running);
return Promise.resolve(result.data);
} catch (err) {
return Promise.reject(err);
}
},
},
};

View File

@ -14,6 +14,9 @@
<b-button variant="primary" :disabled="backtestRunning" @click="pollBacktest">
Load backtest result
</b-button>
<b-button variant="primary" :disabled="backtestRunning" @click="removeBacktest">
Reset Backtest
</b-button>
</div>
<div v-if="hasBacktestResult" class="text-center w-100 mt-2">
<b-tabs content-class="mt-3" class="mt-3">
@ -83,6 +86,8 @@ export default class Backtesting extends Vue {
@ftbot.Action pollBacktest!: () => void;
@ftbot.Action removeBacktest!: () => void;
get hasBacktestResult() {
return Object.keys(this.backtestResult).length !== 0;
}