mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-13 03:33:50 +00:00
Allow different pairSummary sorting method
This commit is contained in:
parent
741afd6820
commit
86413a1518
|
@ -45,6 +45,9 @@ export default class PairSummary extends Vue {
|
||||||
|
|
||||||
@Prop({ required: true }) trades!: Trade[];
|
@Prop({ required: true }) trades!: Trade[];
|
||||||
|
|
||||||
|
/** Sort method, "normal" (sorts by open trades > pairlist -> locks) or "profit" */
|
||||||
|
@Prop({ required: false, default: 'normal' }) sortMethod!: string;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@ftbot.Action setSelectedPair!: (pair: string) => void;
|
@ftbot.Action setSelectedPair!: (pair: string) => void;
|
||||||
|
|
||||||
|
@ -82,16 +85,25 @@ export default class PairSummary extends Vue {
|
||||||
}
|
}
|
||||||
comb.push({ pair, trade, locks, lockReason, profitString, profit });
|
comb.push({ pair, trade, locks, lockReason, profitString, profit });
|
||||||
});
|
});
|
||||||
// sort Pairs: "with open trade" -> available -> locked
|
if (this.sortMethod === 'profit') {
|
||||||
comb.sort((a, b) => {
|
comb.sort((a, b) => {
|
||||||
if (a.trade && !b.trade) {
|
if (a.profit > b.profit) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!a.locks && b.locks) {
|
return 1;
|
||||||
return -1;
|
});
|
||||||
}
|
} else {
|
||||||
return 1;
|
// sort Pairs: "with open trade" -> available -> locked
|
||||||
});
|
comb.sort((a, b) => {
|
||||||
|
if (a.trade && !b.trade) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!a.locks && b.locks) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
return comb;
|
return comb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user