Skip to content

Commit

Permalink
Sort by close_date, then by trade_id
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Apr 27, 2021
1 parent 9765f25 commit af28257
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/store/modules/ftbot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';
Expand Down

0 comments on commit af28257

Please sign in to comment.