Store selected_pair in store

This commit is contained in:
Matthias 2020-10-31 08:47:07 +01:00
parent 833526fee2
commit d0fff3f76b
2 changed files with 15 additions and 0 deletions

View File

@ -66,6 +66,7 @@ import {
import CandleChart from '@/components/charts/CandleChart.vue';
import PlotConfigurator from '@/components/charts/PlotConfigurator.vue';
import { getCustomPlotConfig, getPlotConfigName } from '@/shared/storage';
import { BotStoreGetters } from '@/store/modules/ftbot';
const ftbot = namespace('ftbot');
@ -103,6 +104,8 @@ export default class CandleChartContainer extends Vue {
@ftbot.State history!: PairHistory;
@ftbot.Getter [BotStoreGetters.selectedPair]!: string;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ftbot.Action public getPairCandles!: (payload: PairCandlePayload) => void;
@ -159,6 +162,12 @@ export default class CandleChartContainer extends Vue {
[this.pair] = this.availablePairs;
this.refresh();
}
@Watch(BotStoreGetters.selectedPair)
watchSelectedPair() {
this.pair = this.selectedPair;
this.refresh();
}
}
</script>

View File

@ -32,6 +32,7 @@ import { showAlert } from './alerts';
export enum BotStoreGetters {
openTrades = 'openTrades',
tradeDetail = 'tradeDetail',
selectedPair = 'selectedPair',
closedTrades = 'closedTrades',
allTrades = 'allTrades',
currentLocks = 'currentLocks',
@ -57,6 +58,7 @@ export default {
dailyStats: [],
pairlistMethods: [],
detailTradeId: null,
selectedPair: '',
candleData: {},
history: {},
strategyPlotConfig: {},
@ -91,6 +93,9 @@ export default {
}
return dTrade;
},
[BotStoreGetters.selectedPair](state): Trade {
return state.selectedPair;
},
[BotStoreGetters.closedTrades](state) {
return state.trades.filter((item) => !item.is_open);
},
@ -139,6 +144,7 @@ export default {
},
setDetailTrade(state, trade: Trade) {
state.detailTradeId = trade ? trade.trade_id : null;
state.selectedPair = trade ? trade.pair : state.selectedPair;
},
updateStrategyList(state, result: StrategyListResult) {
state.strategyList = result.strategies;