diff --git a/src/components/ftbot/BotComparisonList.vue b/src/components/ftbot/BotComparisonList.vue
index 7da994c2..ab7a1272 100644
--- a/src/components/ftbot/BotComparisonList.vue
+++ b/src/components/ftbot/BotComparisonList.vue
@@ -8,6 +8,16 @@
:items="tableItems"
:fields="tableFields"
>
+
+
+
+ {{ row.value }}
+
+
[] = [
- { key: 'botId', label: 'Bot' },
+ { key: 'botName', label: 'Bot' },
{ key: 'trades', label: 'Trades' },
{ key: 'profitOpen', label: 'Open Profit' },
{ key: 'profitClosed', label: 'Closed Profit' },
@@ -66,9 +76,10 @@ export default defineComponent({
const tableItems = computed(() => {
console.log('tableItems called');
- const val: any[] = [];
- const summary = {
- botId: 'Summary',
+ const val: ComparisonTableItems[] = [];
+ const summary: ComparisonTableItems = {
+ botId: undefined,
+ botName: 'Summary',
profitClosed: 0,
profitClosedRatio: 0,
profitOpen: 0,
@@ -87,7 +98,8 @@ export default defineComponent({
// TODO: handle one inactive bot ...
val.push({
- botId: botStore.availableBots[k].botName,
+ botId: k,
+ botName: botStore.availableBots[k].botName,
trades: `${botStore.allOpenTradeCount[k]} / ${
botStore.allBotState[k]?.max_open_trades || 'N/A'
}`,
@@ -117,6 +129,7 @@ export default defineComponent({
formatPrice,
tableFields,
tableItems,
+ botStore,
};
},
});
diff --git a/src/stores/ftbot.ts b/src/stores/ftbot.ts
index 40e10f40..8582b649 100644
--- a/src/stores/ftbot.ts
+++ b/src/stores/ftbot.ts
@@ -44,7 +44,7 @@ import {
TradeResponse,
ClosedTrade,
} from '@/types';
-import axios, { AxiosInstance, AxiosResponse } from 'axios';
+import axios, { AxiosResponse } from 'axios';
import { defineStore } from 'pinia';
import { showAlert } from './alerts';
@@ -55,6 +55,7 @@ export function createBotSubStore(botId: string, botName: string) {
const useBotStore = defineStore(botId, {
state: () => {
return {
+ isSelected: true,
ping: '',
botStatusAvailable: false,
isBotOnline: false,
diff --git a/src/stores/ftbotwrapper.ts b/src/stores/ftbotwrapper.ts
index 5d8735c1..78a7edc1 100644
--- a/src/stores/ftbotwrapper.ts
+++ b/src/stores/ftbotwrapper.ts
@@ -14,7 +14,6 @@ import {
RenameBotPayload,
Trade,
} from '@/types';
-import { AxiosInstance } from 'axios';
import { defineStore } from 'pinia';
import { createBotSubStore } from './ftbot';
const AUTH_SELECTED_BOT = 'ftSelectedBot';
@@ -89,36 +88,42 @@ export const useBotStore = defineStore('wrapper', {
return result;
},
- allOpenTradesAllBots: (state): Trade[] => {
+ allOpenTradesSelectedBots: (state): Trade[] => {
const result: Trade[] = [];
Object.entries(state.botStores).forEach(([, botStore]) => {
- result.push(...botStore.openTrades);
+ if (botStore.isSelected) {
+ result.push(...botStore.openTrades);
+ }
});
return result;
},
- allTradesAllBots: (state): ClosedTrade[] => {
+ allTradesSelectedBots: (state): ClosedTrade[] => {
const result: ClosedTrade[] = [];
Object.entries(state.botStores).forEach(([, botStore]) => {
- result.push(...botStore.trades);
+ if (botStore.isSelected) {
+ result.push(...botStore.trades);
+ }
});
return result;
},
- allDailyStatsAllBots: (state): DailyReturnValue => {
+ allDailyStatsSelectedBots: (state): DailyReturnValue => {
// Return aggregated daily stats for all bots - sorted ascending.
const resp: Record = {};
Object.entries(state.botStores).forEach(([, botStore]) => {
- botStore.dailyStats?.data?.forEach((d) => {
- if (!resp[d.date]) {
- resp[d.date] = { ...d };
- } else {
- // eslint-disable-next-line @typescript-eslint/camelcase
- resp[d.date].abs_profit += d.abs_profit;
- // eslint-disable-next-line @typescript-eslint/camelcase
- resp[d.date].fiat_value += d.fiat_value;
- // eslint-disable-next-line @typescript-eslint/camelcase
- resp[d.date].trade_count += d.trade_count;
- }
- });
+ if (botStore.isSelected) {
+ botStore.dailyStats?.data?.forEach((d) => {
+ if (!resp[d.date]) {
+ resp[d.date] = { ...d };
+ } else {
+ // eslint-disable-next-line @typescript-eslint/camelcase
+ resp[d.date].abs_profit += d.abs_profit;
+ // eslint-disable-next-line @typescript-eslint/camelcase
+ resp[d.date].fiat_value += d.fiat_value;
+ // eslint-disable-next-line @typescript-eslint/camelcase
+ resp[d.date].trade_count += d.trade_count;
+ }
+ });
+ }
});
const dailyReturn: DailyReturnValue = {
diff --git a/src/types/botComparison.ts b/src/types/botComparison.ts
new file mode 100644
index 00000000..4c1a49a3
--- /dev/null
+++ b/src/types/botComparison.ts
@@ -0,0 +1,14 @@
+export interface ComparisonTableItems {
+ botId: string | undefined;
+ botName: string;
+ trades?: string;
+ profitClosed: number;
+ profitClosedRatio: number;
+ profitOpen: number;
+ profitOpenRatio: number;
+ stakeCurrency: string;
+ wins: number;
+ losses: number;
+ balance?: number;
+ stakeCurrencyDecimals?: number;
+}
diff --git a/src/types/index.ts b/src/types/index.ts
index 24aae10d..de4063fa 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -1,7 +1,8 @@
export * from './auth';
-export * from './balance';
export * from './backtest';
+export * from './balance';
export * from './blacklist';
+export * from './botComparison';
export * from './chart';
export * from './daily';
export * from './locks';
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue
index 1199d609..b50e02e8 100644
--- a/src/views/Dashboard.vue
+++ b/src/views/Dashboard.vue
@@ -26,8 +26,8 @@
>
@@ -57,7 +57,11 @@
drag-allow-from=".drag-header"
>
-
+
-
+
-
+