frequi_origin/src/stores/ftbot.ts

75 lines
2.1 KiB
TypeScript
Raw Normal View History

2022-04-17 08:21:19 +00:00
import { getAllPlotConfigNames, getPlotConfigName } from '@/shared/storage';
import {
BotState,
Trade,
PlotConfig,
StrategyResult,
BalanceInterface,
DailyReturnValue,
LockResponse,
PlotConfigStorage,
ProfitInterface,
BacktestResult,
StrategyBacktestResult,
BacktestSteps,
LogLine,
SysInfoResponse,
LoadingStatus,
BacktestHistoryEntry,
} from '@/types';
import { defineStore } from 'pinia';
export const useBotStore = defineStore('ftbot', {
state: () => {
return {
ping: '',
botStatusAvailable: false,
isBotOnline: false,
autoRefresh: false,
refreshing: false,
version: '',
lastLogs: [] as LogLine[],
refreshRequired: true,
trades: [] as Trade[],
openTrades: [] as Trade[],
tradeCount: 0,
performanceStats: [] as Performance[],
whitelist: [] as string[],
blacklist: [] as string[],
profit: {} as ProfitInterface,
botState: {} as BotState,
balance: {} as BalanceInterface,
dailyStats: {} as DailyReturnValue,
pairlistMethods: [] as string[],
detailTradeId: undefined as number | undefined,
selectedPair: '',
// TODO: type me
candleData: {},
candleDataStatus: LoadingStatus.loading,
// TODO: type me
history: {},
historyStatus: LoadingStatus.loading,
strategyPlotConfig: undefined as PlotConfig | undefined,
customPlotConfig: {} as PlotConfigStorage,
plotConfigName: getPlotConfigName(),
availablePlotConfigNames: getAllPlotConfigNames(),
strategyList: [] as string[],
strategy: {} as StrategyResult,
pairlist: [] as string[],
currentLocks: undefined as LockResponse | undefined,
// backtesting
backtestRunning: false,
backtestProgress: 0.0,
backtestStep: BacktestSteps.none,
backtestTradeCount: 0,
backtestResult: undefined as BacktestResult | undefined,
selectedBacktestResultKey: '',
backtestHistory: {} as Record<string, StrategyBacktestResult>,
backtestHistoryList: [] as BacktestHistoryEntry[],
sysinfo: {} as SysInfoResponse,
};
},
getters: {},
actions: {},
});