mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 04:55:15 +00:00
move Plotted Pair to store for easier reloads
This commit is contained in:
parent
74883723ce
commit
348cb8349b
|
@ -5,7 +5,7 @@
|
||||||
<div class="ms-1 ms-md-2 d-flex flex-wrap flex-md-nowrap align-items-center w-auto">
|
<div class="ms-1 ms-md-2 d-flex flex-wrap flex-md-nowrap align-items-center w-auto">
|
||||||
<span class="ms-md-2 text-nowrap">{{ strategyName }} | {{ timeframe || '' }}</span>
|
<span class="ms-md-2 text-nowrap">{{ strategyName }} | {{ timeframe || '' }}</span>
|
||||||
<v-select
|
<v-select
|
||||||
v-model="pair"
|
v-model="botStore.activeBot.plotPair"
|
||||||
class="ms-md-2"
|
class="ms-md-2"
|
||||||
:options="availablePairs"
|
:options="availablePairs"
|
||||||
style="min-width: 7em"
|
style="min-width: 7em"
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<b-button
|
<b-button
|
||||||
title="Refresh chart"
|
title="Refresh chart"
|
||||||
class="ms-2"
|
class="ms-2"
|
||||||
:disabled="!!!pair"
|
:disabled="!!!botStore.activeBot.plotPair"
|
||||||
size="sm"
|
size="sm"
|
||||||
@click="refresh"
|
@click="refresh"
|
||||||
>
|
>
|
||||||
|
@ -134,14 +134,13 @@ const colorStore = useColorStore();
|
||||||
const botStore = useBotStore();
|
const botStore = useBotStore();
|
||||||
const plotStore = usePlotConfigStore();
|
const plotStore = usePlotConfigStore();
|
||||||
|
|
||||||
const pair = ref('');
|
|
||||||
const showPlotConfig = ref<boolean>();
|
const showPlotConfig = ref<boolean>();
|
||||||
|
|
||||||
const dataset = computed((): PairHistory => {
|
const dataset = computed((): PairHistory => {
|
||||||
if (props.historicView) {
|
if (props.historicView) {
|
||||||
return botStore.activeBot.history[`${pair.value}__${props.timeframe}`]?.data;
|
return botStore.activeBot.history[`${botStore.activeBot.plotPair}__${props.timeframe}`]?.data;
|
||||||
}
|
}
|
||||||
return botStore.activeBot.candleData[`${pair.value}__${props.timeframe}`]?.data;
|
return botStore.activeBot.candleData[`${botStore.activeBot.plotPair}__${props.timeframe}`]?.data;
|
||||||
});
|
});
|
||||||
const strategyName = computed(() => props.strategy || dataset.value?.strategy || '');
|
const strategyName = computed(() => props.strategy || dataset.value?.strategy || '');
|
||||||
const datasetColumns = computed(() =>
|
const datasetColumns = computed(() =>
|
||||||
|
@ -184,11 +183,11 @@ function showConfigurator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
console.log('refresh', pair.value, props.timeframe);
|
// console.log('refresh', botStore.activeBot.plotPair, props.timeframe);
|
||||||
if (pair.value && props.timeframe) {
|
if (botStore.activeBot.plotPair && props.timeframe) {
|
||||||
if (props.historicView) {
|
if (props.historicView) {
|
||||||
botStore.activeBot.getPairHistory({
|
botStore.activeBot.getPairHistory({
|
||||||
pair: pair.value,
|
pair: botStore.activeBot.plotPair,
|
||||||
timeframe: props.timeframe,
|
timeframe: props.timeframe,
|
||||||
timerange: props.timerange,
|
timerange: props.timerange,
|
||||||
strategy: props.strategy,
|
strategy: props.strategy,
|
||||||
|
@ -196,7 +195,7 @@ function refresh() {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
botStore.activeBot.getPairCandles({
|
botStore.activeBot.getPairCandles({
|
||||||
pair: pair.value,
|
pair: botStore.activeBot.plotPair,
|
||||||
timeframe: props.timeframe,
|
timeframe: props.timeframe,
|
||||||
columns: plotStore.usedColumns,
|
columns: plotStore.usedColumns,
|
||||||
});
|
});
|
||||||
|
@ -207,8 +206,8 @@ function refresh() {
|
||||||
watch(
|
watch(
|
||||||
() => props.availablePairs,
|
() => props.availablePairs,
|
||||||
() => {
|
() => {
|
||||||
if (!props.availablePairs.find((p) => p === pair.value)) {
|
if (!props.availablePairs.find((p) => p === botStore.activeBot.plotPair)) {
|
||||||
[pair.value] = props.availablePairs;
|
[botStore.activeBot.plotPair] = props.availablePairs;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -217,7 +216,7 @@ watch(
|
||||||
watch(
|
watch(
|
||||||
() => botStore.activeBot.selectedPair,
|
() => botStore.activeBot.selectedPair,
|
||||||
() => {
|
() => {
|
||||||
pair.value = botStore.activeBot.selectedPair;
|
botStore.activeBot.plotPair = botStore.activeBot.selectedPair;
|
||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -225,9 +224,9 @@ watch(
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
showPlotConfig.value = props.plotConfigModal;
|
showPlotConfig.value = props.plotConfigModal;
|
||||||
if (botStore.activeBot.selectedPair) {
|
if (botStore.activeBot.selectedPair) {
|
||||||
pair.value = botStore.activeBot.selectedPair;
|
botStore.activeBot.plotPair = botStore.activeBot.selectedPair;
|
||||||
} else if (props.availablePairs.length > 0) {
|
} else if (props.availablePairs.length > 0) {
|
||||||
[pair.value] = props.availablePairs;
|
[botStore.activeBot.plotPair] = props.availablePairs;
|
||||||
}
|
}
|
||||||
plotStore.plotConfigChanged();
|
plotStore.plotConfigChanged();
|
||||||
if (!hasDataset.value) {
|
if (!hasDataset.value) {
|
||||||
|
|
|
@ -99,6 +99,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
pairlistMethods: [] as string[],
|
pairlistMethods: [] as string[],
|
||||||
detailTradeId: null as number | null,
|
detailTradeId: null as number | null,
|
||||||
selectedPair: '',
|
selectedPair: '',
|
||||||
|
plotPair: '',
|
||||||
// TODO: type me
|
// TODO: type me
|
||||||
candleData: {},
|
candleData: {},
|
||||||
candleDataStatus: LoadingStatus.loading,
|
candleDataStatus: LoadingStatus.loading,
|
||||||
|
@ -1066,7 +1067,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
case FtWsMessageTypes.newCandle: {
|
case FtWsMessageTypes.newCandle: {
|
||||||
const [pair, timeframe] = msg.data;
|
const [pair, timeframe] = msg.data;
|
||||||
// TODO: check for active bot ...
|
// TODO: check for active bot ...
|
||||||
if (pair === this.selectedPair) {
|
if (pair === this.plotPair) {
|
||||||
// Reload pair candles
|
// Reload pair candles
|
||||||
const plotStore = usePlotConfigStore();
|
const plotStore = usePlotConfigStore();
|
||||||
this.getPairCandles({ pair, timeframe, columns: plotStore.usedColumns });
|
this.getPairCandles({ pair, timeframe, columns: plotStore.usedColumns });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user