Load from strategy should be part of plotconfig

This commit is contained in:
Matthias 2020-07-28 20:39:58 +02:00
parent c78dc26aba
commit 3a6786b39d
2 changed files with 15 additions and 2 deletions

View File

@ -60,6 +60,10 @@
Add Add
</b-button> </b-button>
<b-button class="mx-1" variant="primary" @click="loadPlotConfig" size="sm">Load</b-button> <b-button class="mx-1" variant="primary" @click="loadPlotConfig" size="sm">Load</b-button>
<b-button class="mx-1" variant="primary" @click="loadPlotConfigFromStrategy" size="sm">
Load from strategy
</b-button>
<b-button <b-button
class="mx-1" class="mx-1"
variant="primary" variant="primary"
@ -121,6 +125,10 @@ export default class PlotConfigurator extends Vue {
return this.plotConfig; return this.plotConfig;
} }
@ftbot.Action getPlotConfig;
@ftbot.State strategyPlotConfig;
plotConfig: PlotConfig = EMPTY_PLOTCONFIG; plotConfig: PlotConfig = EMPTY_PLOTCONFIG;
plotOption = 'main_plot'; plotOption = 'main_plot';
@ -231,6 +239,11 @@ export default class PlotConfigurator extends Vue {
this.emitPlotConfig(); this.emitPlotConfig();
} }
} }
async loadPlotConfigFromStrategy() {
await this.getPlotConfig();
this.plotConfig = this.strategyPlotConfig;
}
} }
</script> </script>

View File

@ -40,7 +40,7 @@ export default {
detailTradeId: null, detailTradeId: null,
candleData: {}, candleData: {},
history: {}, history: {},
plotConfig: {}, strategyPlotConfig: {},
customPlotConfig: { ...EMPTY_PLOTCONFIG }, customPlotConfig: { ...EMPTY_PLOTCONFIG },
}, },
getters: { getters: {
@ -105,7 +105,7 @@ export default {
state.history = { [`${pair}__${timeframe}`]: data }; state.history = { [`${pair}__${timeframe}`]: data };
}, },
updatePlotConfig(state, plotConfig: PlotConfig) { updatePlotConfig(state, plotConfig: PlotConfig) {
state.plotConfig = plotConfig; state.strategyPlotConfig = plotConfig;
}, },
saveCustomPlotConfig(state, plotConfig: PlotConfig) { saveCustomPlotConfig(state, plotConfig: PlotConfig) {
state.customPlotConfig = plotConfig; state.customPlotConfig = plotConfig;