mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-14 04:03:51 +00:00
Add freqAI Model selection to backtesting
This commit is contained in:
parent
1a686fab57
commit
1579200bc8
43
src/components/ftbot/FreqaiModelSelect.vue
Normal file
43
src/components/ftbot/FreqaiModelSelect.vue
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="w-100 d-flex">
|
||||||
|
<b-form-select
|
||||||
|
id="freqaiModel-select"
|
||||||
|
v-model="locFreqaiModel"
|
||||||
|
:options="botStore.activeBot.freqaiModelList"
|
||||||
|
>
|
||||||
|
</b-form-select>
|
||||||
|
<div class="ms-2">
|
||||||
|
<b-button @click="botStore.activeBot.getFreqAIModelList">↻</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
||||||
|
import { computed, onMounted } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
modelValue: { type: String, required: true },
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
const botStore = useBotStore();
|
||||||
|
|
||||||
|
const locFreqaiModel = computed({
|
||||||
|
get() {
|
||||||
|
return props.modelValue;
|
||||||
|
},
|
||||||
|
set(freqaiModel: string) {
|
||||||
|
emit('update:modelValue', freqaiModel);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (botStore.activeBot.freqaiModelList.length === 0) {
|
||||||
|
botStore.activeBot.getFreqAIModelList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
|
@ -41,6 +41,7 @@ import { showAlert } from './alerts';
|
||||||
import { useWebSocket } from '@vueuse/core';
|
import { useWebSocket } from '@vueuse/core';
|
||||||
import { FTWsMessage, FtWsMessageTypes } from '@/types/wsMessageTypes';
|
import { FTWsMessage, FtWsMessageTypes } from '@/types/wsMessageTypes';
|
||||||
import { showNotification } from '@/shared/notifications';
|
import { showNotification } from '@/shared/notifications';
|
||||||
|
import { FreqAIModelListResult } from '../types/types';
|
||||||
|
|
||||||
export function createBotSubStore(botId: string, botName: string) {
|
export function createBotSubStore(botId: string, botName: string) {
|
||||||
const userService = useUserService(botId);
|
const userService = useUserService(botId);
|
||||||
|
@ -81,6 +82,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
historyStatus: LoadingStatus.loading,
|
historyStatus: LoadingStatus.loading,
|
||||||
strategyPlotConfig: undefined as PlotConfig | undefined,
|
strategyPlotConfig: undefined as PlotConfig | undefined,
|
||||||
strategyList: [] as string[],
|
strategyList: [] as string[],
|
||||||
|
freqaiModelList: [] as string[],
|
||||||
strategy: {} as StrategyResult,
|
strategy: {} as StrategyResult,
|
||||||
pairlist: [] as string[],
|
pairlist: [] as string[],
|
||||||
currentLocks: undefined as LockResponse | undefined,
|
currentLocks: undefined as LockResponse | undefined,
|
||||||
|
@ -432,6 +434,16 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async getFreqAIModelList() {
|
||||||
|
try {
|
||||||
|
const { data } = await api.get<FreqAIModelListResult>('/freqaimodels');
|
||||||
|
this.freqaiModelList = data.freqaimodels;
|
||||||
|
return Promise.resolve(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
async getAvailablePairs(payload: AvailablePairPayload) {
|
async getAvailablePairs(payload: AvailablePairPayload) {
|
||||||
try {
|
try {
|
||||||
const { data } = await api.get<AvailablePairResult>('/available_pairs', {
|
const { data } = await api.get<AvailablePairResult>('/available_pairs', {
|
||||||
|
|
|
@ -11,6 +11,7 @@ export interface BacktestPayload {
|
||||||
stake_amount?: string;
|
stake_amount?: string;
|
||||||
dry_run_wallet?: number;
|
dry_run_wallet?: number;
|
||||||
enable_protections?: boolean;
|
enable_protections?: boolean;
|
||||||
|
freqaimodel?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PairResult {
|
export interface PairResult {
|
||||||
|
|
|
@ -175,6 +175,10 @@ export interface StrategyResult {
|
||||||
code: string;
|
code: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FreqAIModelListResult {
|
||||||
|
freqaimodels: string[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface AvailablePairPayload {
|
export interface AvailablePairPayload {
|
||||||
timeframe?: string;
|
timeframe?: string;
|
||||||
stake_currency?: string;
|
stake_currency?: string;
|
||||||
|
|
|
@ -194,6 +194,17 @@
|
||||||
v-model="enableProtections"
|
v-model="enableProtections"
|
||||||
></b-form-checkbox>
|
></b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
|
<template v-if="botStore.activeBot.botApiVersion >= 2.22">
|
||||||
|
<b-form-group
|
||||||
|
label-cols-sm="5"
|
||||||
|
label="Enable FreqAI:"
|
||||||
|
label-align-sm="right"
|
||||||
|
label-for="enable-freqai"
|
||||||
|
>
|
||||||
|
<b-form-checkbox id="enable-freqai" v-model="enableFreqAI"></b-form-checkbox>
|
||||||
|
</b-form-group>
|
||||||
|
<FreqaiModelSelect v-if="enableFreqAI" v-model="freqaiModel"></FreqaiModelSelect>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- <b-form-group label-cols-sm="5" label="Fee:" label-align-sm="right" label-for="fee">
|
<!-- <b-form-group label-cols-sm="5" label="Fee:" label-align-sm="right" label-for="fee">
|
||||||
<b-form-input
|
<b-form-input
|
||||||
|
@ -277,6 +288,7 @@ import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
|
||||||
import BacktestResultView from '@/components/ftbot/BacktestResultView.vue';
|
import BacktestResultView from '@/components/ftbot/BacktestResultView.vue';
|
||||||
import BacktestResultSelect from '@/components/ftbot/BacktestResultSelect.vue';
|
import BacktestResultSelect from '@/components/ftbot/BacktestResultSelect.vue';
|
||||||
import StrategySelect from '@/components/ftbot/StrategySelect.vue';
|
import StrategySelect from '@/components/ftbot/StrategySelect.vue';
|
||||||
|
import FreqaiModelSelect from '@/components/ftbot/FreqaiModelSelect.vue';
|
||||||
import TimeframeSelect from '@/components/ftbot/TimeframeSelect.vue';
|
import TimeframeSelect from '@/components/ftbot/TimeframeSelect.vue';
|
||||||
import BacktestHistoryLoad from '@/components/ftbot/BacktestHistoryLoad.vue';
|
import BacktestHistoryLoad from '@/components/ftbot/BacktestHistoryLoad.vue';
|
||||||
import BacktestGraphsView from '@/components/ftbot/BacktestGraphsView.vue';
|
import BacktestGraphsView from '@/components/ftbot/BacktestGraphsView.vue';
|
||||||
|
@ -309,6 +321,8 @@ const selectedDetailTimeframe = ref('');
|
||||||
const timerange = ref('');
|
const timerange = ref('');
|
||||||
const showLeftBar = ref(false);
|
const showLeftBar = ref(false);
|
||||||
const enableProtections = ref(false);
|
const enableProtections = ref(false);
|
||||||
|
const enableFreqAI = ref(false);
|
||||||
|
const freqaiModel = ref('');
|
||||||
const stakeAmountUnlimited = ref(false);
|
const stakeAmountUnlimited = ref(false);
|
||||||
const maxOpenTrades = ref('');
|
const maxOpenTrades = ref('');
|
||||||
const stakeAmount = ref('');
|
const stakeAmount = ref('');
|
||||||
|
@ -367,6 +381,9 @@ const clickBacktest = () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||||
btPayload.timeframe_detail = selectedDetailTimeframe.value;
|
btPayload.timeframe_detail = selectedDetailTimeframe.value;
|
||||||
}
|
}
|
||||||
|
if (enableFreqAI.value) {
|
||||||
|
btPayload.freqaimodel = freqaiModel.value;
|
||||||
|
}
|
||||||
|
|
||||||
botStore.activeBot.startBacktest(btPayload);
|
botStore.activeBot.startBacktest(btPayload);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user