Add Maker Points strategy support in StandX. Introduce new configuration for Maker Points, including point bands and order management logic. Implement MakerPointsEngine for handling order placement and tracking. Update CLI and UI components to integrate Maker Points functionality, enhancing user experience and strategy options.

This commit is contained in:
discountry
2026-01-06 16:01:10 +08:00
parent 9a093459bc
commit 7aafc3b69d
11 changed files with 2032 additions and 12 deletions
+34
View File
@@ -0,0 +1,34 @@
export interface MakerPointsBandConfig {
band0To10: boolean;
band10To30: boolean;
band30To100: boolean;
}
export function buildBpsTargets(config: MakerPointsBandConfig): number[] {
const targets: number[] = [];
if (config.band0To10) targets.push(9);
if (config.band10To30) targets.push(29);
if (config.band30To100) targets.push(99);
return targets.sort((a, b) => a - b);
}
export function computeDislocationBps(
markPrice: number | null | undefined,
bestBid: number | null | undefined,
bestAsk: number | null | undefined
): number | null {
const mark = Number(markPrice);
if (!Number.isFinite(mark) || mark <= 0) return null;
const distances: number[] = [];
const bid = Number(bestBid);
const ask = Number(bestAsk);
if (Number.isFinite(bid)) {
distances.push(Math.abs(mark - bid) / mark * 10000);
}
if (Number.isFinite(ask)) {
distances.push(Math.abs(ask - mark) / mark * 10000);
}
if (!distances.length) return null;
const max = Math.max(...distances);
return Number.isFinite(max) ? max : null;
}