-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1987 from freqtrade/feat/plot_template
Add Plot Template functionality
- Loading branch information
Showing
20 changed files
with
519 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+95.4 KB
e2e/chart.spec.ts-snapshots/Chart-Plot-with-BollingerBands-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+94.9 KB
e2e/chart.spec.ts-snapshots/Chart-Plot-with-BollingerBands-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+94.9 KB
e2e/chart.spec.ts-snapshots/Chart-Plot-with-BollingerBands-msedge-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+94.9 KB
e2e/chart.spec.ts-snapshots/Chart-Plot-with-BollingerBands-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<script setup lang="ts"> | ||
const visible = defineModel<boolean>('visible'); | ||
defineProps<{ | ||
columns: string[]; | ||
}>(); | ||
const { plotTemplateNames, applyPlotTemplate, getTemplateContent } = usePlotTemplates(); | ||
const plotStore = usePlotConfigStore(); | ||
function fromTemplateApply() { | ||
if (selTemplateName.value) { | ||
plotStore.editablePlotConfig = { | ||
...applyPlotTemplate(selTemplateName.value, plotStore.editablePlotConfig, indicatorMap.value), | ||
}; | ||
visible.value = false; | ||
} | ||
} | ||
function clickStartUseTemplate() { | ||
showIndicatorMapping.value = !showIndicatorMapping.value; | ||
indicatorMap.value = plotConfigColumns(getTemplateContent(selTemplateName.value)).reduce( | ||
(acc, indicator) => { | ||
acc[indicator] = indicator; | ||
return acc; | ||
}, | ||
{}, | ||
); | ||
} | ||
const selTemplateName = ref<string>(''); | ||
watch( | ||
() => visible.value, | ||
(v) => { | ||
if (v) { | ||
selTemplateName.value = ''; | ||
showIndicatorMapping.value = false; | ||
} | ||
}, | ||
); | ||
const indicatorMap = ref<Record<string, string>>({}); | ||
const showIndicatorMapping = ref(false); | ||
</script> | ||
|
||
<template> | ||
<div v-if="visible" class="pt-1"> | ||
<BFormGroup v-if="!showIndicatorMapping" label="Select Templates" label-for="selectTemplate"> | ||
<BFormSelect | ||
id="selectTemplate" | ||
v-model="selTemplateName" | ||
:options="plotTemplateNames" | ||
:select-size="4" | ||
> | ||
</BFormSelect> | ||
</BFormGroup> | ||
<div v-else> | ||
<h5 class="mt-1 text-center">Re-map indicators</h5> | ||
<div v-for="indicator in Object.keys(indicatorMap)" :key="indicator"> | ||
<div class="d-flex gap-2 align-items-center"> | ||
<span class="flex-grow-1 w-100">{{ indicator }}</span> | ||
<BFormSelect | ||
:id="`indicator-${indicator}`" | ||
v-model="indicatorMap[indicator]" | ||
class="flex-grow-1 w-100" | ||
:options="columns" | ||
> | ||
</BFormSelect> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="mt-2 d-flex gap-1 justify-content-end"> | ||
<BButton size="sm" title="Abort" variant="secondary" @click="visible = false"> | ||
<i-mdi-close /> | ||
</BButton> | ||
<BButton | ||
v-if="!showIndicatorMapping" | ||
:disabled="!selTemplateName" | ||
size="sm" | ||
style="width: 33%" | ||
title="Use template" | ||
variant="primary" | ||
@click="clickStartUseTemplate" | ||
> | ||
<i-mdi-check class="me-1" />Use Template | ||
</BButton> | ||
<BButton | ||
v-if="showIndicatorMapping" | ||
:disabled="!selTemplateName" | ||
size="sm" | ||
style="width: 33%" | ||
title="Apply template" | ||
variant="primary" | ||
@click="fromTemplateApply" | ||
> | ||
<i-mdi-check class="me-1" />Apply Template | ||
</BButton> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.