diff --git a/src/store/modules/ftbot/index.ts b/src/store/modules/ftbot/index.ts index 8938fc3f..0f7e0c33 100644 --- a/src/store/modules/ftbot/index.ts +++ b/src/store/modules/ftbot/index.ts @@ -82,7 +82,14 @@ export default { }, [BotStoreGetters.closedTrades](state: FtbotStateType) { // Sort by trade_id desc - return state.trades.filter((item) => !item.is_open).sort((a, b) => b.trade_id - a.trade_id); + return state.trades + .filter((item) => !item.is_open) + .sort((a, b) => + // Sort by close timestamp, then by tradeid + b.close_timestamp && a.close_timestamp + ? b.close_timestamp - a.close_timestamp + : b.trade_id - a.trade_id, + ); }, [BotStoreGetters.timeframe](state: FtbotStateType): string { return state.botState?.timeframe || '';