Add botname to tradeslog

This commit is contained in:
Matthias 2021-09-18 19:56:06 +02:00
parent 8eada44433
commit 3470cb2c16
4 changed files with 14 additions and 7 deletions

View File

@ -62,7 +62,7 @@ export default class TradesLogChart extends Vue {
.sort((a, b) => (a.close_timestamp > b.close_timestamp ? 1 : -1));
for (let i = 0, len = sortedTrades.length; i < len; i += 1) {
const trade = sortedTrades[i];
const entry = [i, (trade.profit_ratio * 100).toFixed(2), trade.pair];
const entry = [i, (trade.profit_ratio * 100).toFixed(2), trade.pair, trade.botName];
res.push(entry);
}
@ -86,7 +86,7 @@ export default class TradesLogChart extends Vue {
tooltip: {
trigger: 'axis',
formatter: (params) => {
return `Profit %<br>${params[0].data[1]} % ${params[0].data[2]}`;
return `Profit %<br>${params[0].data[1]} % ${params[0].data[2]} | ${params[0].data[3]}`;
},
axisPointer: {
type: 'line',

View File

@ -196,7 +196,7 @@ export default function createBotStore(store) {
return;
}
console.log('add bot', bot);
store.registerModule(['ftbot', bot.botId], createBotSubStore(bot.botId));
store.registerModule(['ftbot', bot.botId], createBotSubStore(bot.botId, bot.botName));
dispatch(`${bot.botId}/botAdded`);
commit('addBot', bot);
},

View File

@ -139,10 +139,9 @@ export enum BotStoreActions {
logout = 'logout',
}
export function createBotSubStore(botId: string) {
export function createBotSubStore(botId: string, botName: string) {
const userService = useUserService(botId);
const { api } = useApi(userService, botId);
return {
namespaced: true,
state,
@ -524,6 +523,7 @@ export function createBotSubStore(botId: string) {
trades = trades.map((t) => ({
...t,
botId,
botName,
botTradeId: `${botId}__${t.trade_id}`,
}));
commit('updateTrades', { trades, tradesCount });
@ -579,6 +579,7 @@ export function createBotSubStore(botId: string) {
const openTrades = result.data.map((t) => ({
...t,
botId,
botName,
botTradeId: `${botId}__${t.trade_id}`,
}));

View File

@ -1,10 +1,16 @@
export interface Trade {
/**
* BotId - only available on "all" methods.
* corresponds to the UI (ftbot.1) - does NOT relate to the backend
* corresponds to the UI (ftbot.1) - does NOT relate to the backend!
*/
botId: string;
/**
* Corresponds to the UI botID + tradeid. Does not relate to backend!
*/
botTradeId: string;
/**
* Given bot Name (in the UI). Does not relate to backend!
*/
botName: string;
trade_id: number;
pair: string;
is_open: boolean;