From d659436e3f71c1561f29f9b311ce82b50cdec313 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 6 Nov 2021 16:18:02 +0100 Subject: [PATCH] Move getVersion to show_config call --- src/store/modules/ftbot/index.ts | 13 +---------- src/types/types.ts | 40 ++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/store/modules/ftbot/index.ts b/src/store/modules/ftbot/index.ts index a5906f48..1b81eaa8 100644 --- a/src/store/modules/ftbot/index.ts +++ b/src/store/modules/ftbot/index.ts @@ -106,7 +106,6 @@ export enum BotStoreActions { setRefreshRequired = 'setRefreshRequired', refreshSlow = 'refreshSlow', refreshFrequent = 'refreshFrequent', - refreshOnce = 'refreshOnce', setDetailTrade = 'setDetailTrade', setSelectedPair = 'setSelectedPair', saveCustomPlotConfig = 'saveCustomPlotConfig', @@ -129,7 +128,6 @@ export enum BotStoreActions { getBalance = 'getBalance', getDaily = 'getDaily', getState = 'getState', - getVersion = 'getVersion', getLogs = 'getLogs', startBot = 'startBot', stopBot = 'stopBot', @@ -252,7 +250,7 @@ export function createBotSubStore(botId: string, botName: string) { return state.strategyPlotConfig; }, [BotStoreGetters.version](state: FtbotStateType): string { - return state.version; + return state.botState?.version || state.version; }, [BotStoreGetters.sysinfo](state: FtbotStateType): SysInfoResponse | {} { return state.sysinfo; @@ -475,9 +473,6 @@ export function createBotSubStore(botId: string, botName: string) { [BotStoreActions.setIsBotOnline]({ commit }, refreshRequired: boolean) { commit('setIsBotOnline', refreshRequired); }, - [BotStoreActions.refreshOnce]({ dispatch }) { - dispatch(BotStoreActions.getVersion); - }, async [BotStoreActions.refreshSlow]({ dispatch, getters, state }, forceUpdate = false) { if (state.refreshing && !forceUpdate) { return; @@ -757,12 +752,6 @@ export function createBotSubStore(botId: string, botName: string) { .then((result) => commit('updateState', result.data)) .catch(console.error); }, - [BotStoreActions.getVersion]({ commit }) { - return api - .get('/version') - .then((result) => commit('updateVersion', result.data)) - .catch(console.error); - }, [BotStoreActions.getLogs]({ commit }) { return api .get('/logs') diff --git a/src/types/types.ts b/src/types/types.ts index a67536e1..52c04120 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -43,11 +43,47 @@ export enum RunModes { OTHER = 'other', } +export interface UnfilledTimeout { + buy: number; + sell: number; + unit: string; + exit_timeout_count: number; +} + +export interface OrderTypes { + buy: string; + sell: string; + emergencysell?: string; + forcesell?: string; + forcebuy?: string; + stoploss: string; + stoploss_on_exchange: boolean; + stoploss_on_exchange_interval: number; +} + +export interface PriceBase { + price_side: string; + use_order_book: boolean; + order_book_top: number; +} + +export interface AskStrategy extends PriceBase { + bid_last_balance?: number; +} + +export interface BidStrategy extends PriceBase { + ask_last_balance?: number; + check_depth_of_market: object; +} + export interface BotState { + version: string; state: BotStates; runmode: RunModes; - bid_strategy: object; - ask_strategy: object; + bid_strategy: BidStrategy; + ask_strategy: AskStrategy; + unfilledtimeout: UnfilledTimeout; + order_types: OrderTypes; dry_run: boolean; exchange: string; forcebuy_enabled: boolean;