mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 21:15:15 +00:00
Improve some type safety
This commit is contained in:
parent
84e2632e13
commit
15945c0487
|
@ -34,7 +34,7 @@
|
|||
<ReloadIcon />
|
||||
</button>
|
||||
<button
|
||||
v-if="botState.forcebuy_enabled"
|
||||
v-if="botState && botState.forcebuy_enabled"
|
||||
class="btn btn-secondary btn-sm ml-1"
|
||||
:disabled="!isTrading || !isRunning"
|
||||
title="Force Buy - Immediately buy an asset at an optional price. Sells are then handled according to strategy rules."
|
||||
|
@ -76,7 +76,7 @@ const ftbot = namespace('ftbot');
|
|||
export default class BotControls extends Vue {
|
||||
forcebuyShow = false;
|
||||
|
||||
@ftbot.State botState!: BotState;
|
||||
@ftbot.State botState?: BotState;
|
||||
|
||||
@ftbot.Action startBot;
|
||||
|
||||
|
@ -93,7 +93,7 @@ export default class BotControls extends Vue {
|
|||
@ftbot.Getter [BotStoreGetters.isWebserverMode]!: boolean;
|
||||
|
||||
get isRunning(): boolean {
|
||||
return this.botState.state === 'running';
|
||||
return this.botState?.state === 'running';
|
||||
}
|
||||
|
||||
initiateForcebuy() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-if="botState">
|
||||
<p>
|
||||
Running Freqtrade <strong>{{ version }}</strong>
|
||||
</p>
|
||||
|
@ -49,7 +49,7 @@ export default class BotStatus extends Vue {
|
|||
|
||||
@ftbot.State profit;
|
||||
|
||||
@ftbot.State botState!: BotState;
|
||||
@ftbot.State botState?: BotState;
|
||||
|
||||
formatPercent = formatPercent;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import {
|
|||
BotState,
|
||||
Trade,
|
||||
PlotConfig,
|
||||
EMPTY_PLOTCONFIG,
|
||||
StrategyResult,
|
||||
BalanceInterface,
|
||||
DailyReturnValue,
|
||||
|
@ -24,24 +23,24 @@ export interface FtbotStateType {
|
|||
blacklist: string[];
|
||||
// TODO: type me
|
||||
profit: {};
|
||||
botState: BotState | undefined;
|
||||
botState?: BotState;
|
||||
balance: BalanceInterface | {};
|
||||
dailyStats: DailyReturnValue | {};
|
||||
pairlistMethods: string[];
|
||||
detailTradeId: number | undefined;
|
||||
detailTradeId?: number;
|
||||
selectedPair: string;
|
||||
// TODO: type me
|
||||
candleData: {};
|
||||
// TODO: type me
|
||||
history: {};
|
||||
strategyPlotConfig: PlotConfig | {};
|
||||
strategyPlotConfig?: PlotConfig;
|
||||
customPlotConfig: PlotConfigStorage;
|
||||
plotConfigName: string;
|
||||
availablePlotConfigNames: string[];
|
||||
strategyList: string[];
|
||||
strategy: StrategyResult | {};
|
||||
pairlist: string[];
|
||||
currentLocks: LockResponse | undefined;
|
||||
currentLocks?: LockResponse;
|
||||
}
|
||||
const state: FtbotStateType = {
|
||||
version: '',
|
||||
|
@ -62,7 +61,7 @@ const state: FtbotStateType = {
|
|||
selectedPair: '',
|
||||
candleData: {},
|
||||
history: {},
|
||||
strategyPlotConfig: {},
|
||||
strategyPlotConfig: undefined,
|
||||
customPlotConfig: {},
|
||||
plotConfigName: getPlotConfigName(),
|
||||
availablePlotConfigNames: getAllPlotConfigNames(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user