mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 19:15:15 +00:00
feat: Add initial plotTemplates composable
This commit is contained in:
parent
c33655951b
commit
c3764d1a73
3
src/auto-imports.d.ts
vendored
3
src/auto-imports.d.ts
vendored
|
@ -277,6 +277,7 @@ declare global {
|
|||
const usePerformanceObserver: typeof import('@vueuse/core')['usePerformanceObserver']
|
||||
const usePermission: typeof import('@vueuse/core')['usePermission']
|
||||
const usePlotConfigStore: typeof import('./stores/plotConfig')['usePlotConfigStore']
|
||||
const usePlotTemplates: typeof import('./composables/plotTemplates')['usePlotTemplates']
|
||||
const usePointer: typeof import('@vueuse/core')['usePointer']
|
||||
const usePointerLock: typeof import('@vueuse/core')['usePointerLock']
|
||||
const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
|
||||
|
@ -645,6 +646,7 @@ declare module 'vue' {
|
|||
readonly usePerformanceObserver: UnwrapRef<typeof import('@vueuse/core')['usePerformanceObserver']>
|
||||
readonly usePermission: UnwrapRef<typeof import('@vueuse/core')['usePermission']>
|
||||
readonly usePlotConfigStore: UnwrapRef<typeof import('./stores/plotConfig')['usePlotConfigStore']>
|
||||
readonly usePlotTemplates: UnwrapRef<typeof import('./composables/plotTemplates')['usePlotTemplates']>
|
||||
readonly usePointer: UnwrapRef<typeof import('@vueuse/core')['usePointer']>
|
||||
readonly usePointerLock: UnwrapRef<typeof import('@vueuse/core')['usePointerLock']>
|
||||
readonly usePointerSwipe: UnwrapRef<typeof import('@vueuse/core')['usePointerSwipe']>
|
||||
|
@ -997,6 +999,7 @@ declare module '@vue/runtime-core' {
|
|||
readonly usePerformanceObserver: UnwrapRef<typeof import('@vueuse/core')['usePerformanceObserver']>
|
||||
readonly usePermission: UnwrapRef<typeof import('@vueuse/core')['usePermission']>
|
||||
readonly usePlotConfigStore: UnwrapRef<typeof import('./stores/plotConfig')['usePlotConfigStore']>
|
||||
readonly usePlotTemplates: UnwrapRef<typeof import('./composables/plotTemplates')['usePlotTemplates']>
|
||||
readonly usePointer: UnwrapRef<typeof import('@vueuse/core')['usePointer']>
|
||||
readonly usePointerLock: UnwrapRef<typeof import('@vueuse/core')['usePointerLock']>
|
||||
readonly usePointerSwipe: UnwrapRef<typeof import('@vueuse/core')['usePointerSwipe']>
|
||||
|
|
44
src/composables/plotTemplates.ts
Normal file
44
src/composables/plotTemplates.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { ChartType, PlotConfig, PlotConfigTemplate } from '@/types';
|
||||
|
||||
const plotTemplates: PlotConfigTemplate = {
|
||||
RSI: {
|
||||
subplots: {
|
||||
RSI: {
|
||||
rsi: {
|
||||
color: 'orange',
|
||||
type: ChartType.line,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MACD: {
|
||||
subplots: {
|
||||
MACD: {
|
||||
macdsignal: {
|
||||
color: 'orange',
|
||||
type: ChartType.line,
|
||||
},
|
||||
macd: {
|
||||
color: 'blue',
|
||||
type: ChartType.line,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export function usePlotTemplates() {
|
||||
function applyPlotTemplate(templateName: string, currentConfig: PlotConfig) {
|
||||
const template = plotTemplates[templateName];
|
||||
if (!template) {
|
||||
return currentConfig;
|
||||
}
|
||||
return deepMerge(currentConfig, template);
|
||||
}
|
||||
|
||||
return {
|
||||
plotTemplates,
|
||||
applyPlotTemplate,
|
||||
plotTemplateNames: Object.keys(plotTemplates),
|
||||
};
|
||||
}
|
|
@ -19,4 +19,8 @@ export interface PlotConfigStorage {
|
|||
[key: string]: PlotConfig;
|
||||
}
|
||||
|
||||
export interface PlotConfigTemplate {
|
||||
[key: string]: Partial<PlotConfig>;
|
||||
}
|
||||
|
||||
export const EMPTY_PLOTCONFIG: PlotConfig = { main_plot: {}, subplots: {} };
|
||||
|
|
Loading…
Reference in New Issue
Block a user