mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 13:35:17 +00:00
Improve botComparisonList ...
This commit is contained in:
parent
4f19e9e326
commit
4cd0a1344a
|
@ -13,8 +13,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { formatPrice } from '@/shared/formatters';
|
||||||
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
|
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
|
||||||
import { BotDescriptors, ProfitInterface } from '@/types';
|
import { BotDescriptors, BotState, ProfitInterface } from '@/types';
|
||||||
import { Component, Vue } from 'vue-property-decorator';
|
import { Component, Vue } from 'vue-property-decorator';
|
||||||
import { namespace } from 'vuex-class';
|
import { namespace } from 'vuex-class';
|
||||||
|
|
||||||
|
@ -24,26 +25,50 @@ const ftbot = namespace('ftbot');
|
||||||
export default class BotComparisonList extends Vue {
|
export default class BotComparisonList extends Vue {
|
||||||
@ftbot.Getter [MultiBotStoreGetters.allProfit]!: Record<string, ProfitInterface>;
|
@ftbot.Getter [MultiBotStoreGetters.allProfit]!: Record<string, ProfitInterface>;
|
||||||
|
|
||||||
|
@ftbot.Getter [MultiBotStoreGetters.allOpenTradeCount]!: Record<string, number>;
|
||||||
|
|
||||||
|
@ftbot.Getter [MultiBotStoreGetters.allBotState]!: Record<string, BotState>;
|
||||||
|
|
||||||
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]!: BotDescriptors;
|
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]!: BotDescriptors;
|
||||||
|
|
||||||
get tableItems() {
|
get tableItems() {
|
||||||
const val: any[] = [];
|
const val: any[] = [];
|
||||||
|
let closedSum = 0;
|
||||||
|
let openProfitSum = 0;
|
||||||
|
let decimals = 3;
|
||||||
Object.entries(this.allProfit).forEach(([k, v]) => {
|
Object.entries(this.allProfit).forEach(([k, v]) => {
|
||||||
// TODO: handle one inactive bot ...
|
// TODO: handle one inactive bot ...
|
||||||
val.push({
|
val.push({
|
||||||
botId: this.allAvailableBots[k].botName,
|
botId: this.allAvailableBots[k].botName,
|
||||||
profitClosed: `${v.profit_closed_coin || 'N/A'} `,
|
trades: `${this.allOpenTradeCount[k]} / ${this.allBotState[k]?.max_open_trades}`,
|
||||||
profitClosedPercent: `${v.profit_closed_percent_sum || 'N/A'} %`,
|
profitClosed: `${
|
||||||
|
formatPrice(v.profit_closed_coin, this.allBotState[k]?.stake_currency_decimals) || 'N/A'
|
||||||
|
} `,
|
||||||
|
profitClosedPercent: `${v.profit_closed_percent_sum || 'N/A'}`,
|
||||||
profitOpenPercent: v.profit_all_percent_sum,
|
profitOpenPercent: v.profit_all_percent_sum,
|
||||||
profitOpen: v.profit_all_coin,
|
profitOpen: v.profit_all_coin,
|
||||||
winVsLoss: `${v.winning_trades || 'N/A'} / ${v.losing_trades || 'N/A'}`,
|
winVsLoss: `${v.winning_trades || 'N/A'} / ${v.losing_trades || 'N/A'}`,
|
||||||
});
|
});
|
||||||
|
if (v.profit_closed_coin !== undefined) {
|
||||||
|
closedSum += v.profit_closed_coin;
|
||||||
|
openProfitSum += v.profit_all_coin;
|
||||||
|
decimals = this.allBotState[k]?.stake_currency_decimals || decimals;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
val.push({
|
||||||
|
botId: 'Summary',
|
||||||
|
profitClosed: formatPrice(closedSum, decimals),
|
||||||
|
profitClosedPercent: '',
|
||||||
|
profitOpenPercent: '',
|
||||||
|
profitOpen: '',
|
||||||
|
winVsLoss: '',
|
||||||
});
|
});
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
tableFields: Record<string, string | Function>[] = [
|
tableFields: Record<string, string | Function>[] = [
|
||||||
{ key: 'botId', label: 'ID' },
|
{ key: 'botId', label: 'Bot' },
|
||||||
|
{ key: 'trades', label: 'Trades' },
|
||||||
{ key: 'profitClosed', label: 'Closed Profit' },
|
{ key: 'profitClosed', label: 'Closed Profit' },
|
||||||
{ key: 'profitClosedPercent', label: 'Closed Profit %' },
|
{ key: 'profitClosedPercent', label: 'Closed Profit %' },
|
||||||
{ key: 'winVsLoss', label: 'W/L' },
|
{ key: 'winVsLoss', label: 'W/L' },
|
||||||
|
|
|
@ -21,8 +21,11 @@ export enum MultiBotStoreGetters {
|
||||||
// Automatically created entries
|
// Automatically created entries
|
||||||
allIsBotOnline = 'allIsBotOnline',
|
allIsBotOnline = 'allIsBotOnline',
|
||||||
allAutoRefresh = 'allAutoRefresh',
|
allAutoRefresh = 'allAutoRefresh',
|
||||||
allClosedTrades = 'allClosedTrades',
|
|
||||||
allProfit = 'allProfit',
|
allProfit = 'allProfit',
|
||||||
|
allOpenTrades = 'allOpenTrades',
|
||||||
|
allOpenTradeCount = 'allOpenTradeCount',
|
||||||
|
allClosedTrades = 'allClosedTrades',
|
||||||
|
allBotState = 'allBotState',
|
||||||
}
|
}
|
||||||
|
|
||||||
const createAllGetters = [
|
const createAllGetters = [
|
||||||
|
@ -31,7 +34,9 @@ const createAllGetters = [
|
||||||
'closedTrades',
|
'closedTrades',
|
||||||
'profit',
|
'profit',
|
||||||
'openTrades',
|
'openTrades',
|
||||||
|
'openTradeCount',
|
||||||
'closedTrades',
|
'closedTrades',
|
||||||
|
'botState',
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function createBotStore(store) {
|
export default function createBotStore(store) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user