mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 03:25:15 +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 { FTWsMessage, FtWsMessageTypes } from '@/types/wsMessageTypes';
|
||||
import { showNotification } from '@/shared/notifications';
|
||||
import { FreqAIModelListResult } from '../types/types';
|
||||
|
||||
export function createBotSubStore(botId: string, botName: string) {
|
||||
const userService = useUserService(botId);
|
||||
|
@ -81,6 +82,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
historyStatus: LoadingStatus.loading,
|
||||
strategyPlotConfig: undefined as PlotConfig | undefined,
|
||||
strategyList: [] as string[],
|
||||
freqaiModelList: [] as string[],
|
||||
strategy: {} as StrategyResult,
|
||||
pairlist: [] as string[],
|
||||
currentLocks: undefined as LockResponse | undefined,
|
||||
|
@ -432,6 +434,16 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
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) {
|
||||
try {
|
||||
const { data } = await api.get<AvailablePairResult>('/available_pairs', {
|
||||
|
|
|
@ -11,6 +11,7 @@ export interface BacktestPayload {
|
|||
stake_amount?: string;
|
||||
dry_run_wallet?: number;
|
||||
enable_protections?: boolean;
|
||||
freqaimodel?: string;
|
||||
}
|
||||
|
||||
export interface PairResult {
|
||||
|
|
|
@ -175,6 +175,10 @@ export interface StrategyResult {
|
|||
code: string;
|
||||
}
|
||||
|
||||
export interface FreqAIModelListResult {
|
||||
freqaimodels: string[];
|
||||
}
|
||||
|
||||
export interface AvailablePairPayload {
|
||||
timeframe?: string;
|
||||
stake_currency?: string;
|
||||
|
|
|
@ -194,6 +194,17 @@
|
|||
v-model="enableProtections"
|
||||
></b-form-checkbox>
|
||||
</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-input
|
||||
|
@ -277,6 +288,7 @@ import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
|
|||
import BacktestResultView from '@/components/ftbot/BacktestResultView.vue';
|
||||
import BacktestResultSelect from '@/components/ftbot/BacktestResultSelect.vue';
|
||||
import StrategySelect from '@/components/ftbot/StrategySelect.vue';
|
||||
import FreqaiModelSelect from '@/components/ftbot/FreqaiModelSelect.vue';
|
||||
import TimeframeSelect from '@/components/ftbot/TimeframeSelect.vue';
|
||||
import BacktestHistoryLoad from '@/components/ftbot/BacktestHistoryLoad.vue';
|
||||
import BacktestGraphsView from '@/components/ftbot/BacktestGraphsView.vue';
|
||||
|
@ -309,6 +321,8 @@ const selectedDetailTimeframe = ref('');
|
|||
const timerange = ref('');
|
||||
const showLeftBar = ref(false);
|
||||
const enableProtections = ref(false);
|
||||
const enableFreqAI = ref(false);
|
||||
const freqaiModel = ref('');
|
||||
const stakeAmountUnlimited = ref(false);
|
||||
const maxOpenTrades = ref('');
|
||||
const stakeAmount = ref('');
|
||||
|
@ -367,6 +381,9 @@ const clickBacktest = () => {
|
|||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
btPayload.timeframe_detail = selectedDetailTimeframe.value;
|
||||
}
|
||||
if (enableFreqAI.value) {
|
||||
btPayload.freqaimodel = freqaiModel.value;
|
||||
}
|
||||
|
||||
botStore.activeBot.startBacktest(btPayload);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user