Sort by close_date, then by trade_id

This commit is contained in:
Matthias 2021-04-27 17:20:10 +02:00
parent 9765f25f55
commit af2825738d

View File

@ -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 || '';