dexbot 1.4.23 → 1.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +1 -0
- package/analysis/README.md +49 -0
- package/analysis/ama_fitting/package.json +1 -1
- package/analysis/grid_correction_check.ts +896 -0
- package/analysis/trend_detection/package.json +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/tests/test_claw_mcp_transport.ts +2 -2
- package/dist/analysis/grid_correction_check.d.ts +90 -0
- package/dist/analysis/grid_correction_check.d.ts.map +1 -0
- package/dist/analysis/grid_correction_check.js +861 -0
- package/dist/analysis/grid_correction_check.js.map +1 -0
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +62 -6
- package/dist/dexbot.js.map +1 -1
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +53 -5
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +7 -10
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +26 -2
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +176 -21
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +21 -2
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +27 -0
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +15 -1
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +70 -6
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +31 -32
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +24 -0
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +66 -12
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +22 -17
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +646 -128
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +11 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +108 -1
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +17 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +215 -26
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts +1 -0
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +58 -7
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +55 -3
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts +12 -1
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +39 -1
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/key_store.d.ts.map +1 -1
- package/dist/modules/key_store.js +38 -1
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/order/accounting.d.ts.map +1 -1
- package/dist/modules/order/accounting.js +20 -3
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/grid.d.ts +1 -1
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +288 -31
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts +4 -2
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile.js +242 -222
- package/dist/modules/order/grid_reconcile.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts +11 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +132 -6
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/manager.d.ts +68 -14
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +241 -52
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/strategy.d.ts.map +1 -1
- package/dist/modules/order/strategy.js +25 -8
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +261 -166
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +47 -5
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +175 -11
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +16 -15
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +199 -32
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/slot.d.ts +8 -0
- package/dist/modules/order/utils/slot.d.ts.map +1 -0
- package/dist/modules/order/utils/slot.js +16 -0
- package/dist/modules/order/utils/slot.js.map +1 -0
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +3 -2
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.d.ts +5 -8
- package/dist/modules/order/utils/validate.d.ts.map +1 -1
- package/dist/modules/order/utils/validate.js +64 -82
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/order/working_grid.d.ts +5 -0
- package/dist/modules/order/working_grid.d.ts.map +1 -1
- package/dist/modules/order/working_grid.js +21 -0
- package/dist/modules/order/working_grid.js.map +1 -1
- package/dist/modules/paths.d.ts +4 -2
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +79 -24
- package/dist/modules/paths.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +23 -2
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts +2 -5
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +83 -1
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
- package/docs/DEXBOT_COMPARISON.md +15 -15
- package/docs/EVOLUTION.md +10 -8
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_RECALCULATION.md +6 -0
- package/docs/README.md +2 -2
- package/market_adapter/README.md +10 -0
- package/package.json +2 -1
- package/scripts/README.md +4 -0
package/claw/package.json
CHANGED
|
@@ -30,7 +30,7 @@ async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
|
|
|
30
30
|
capabilities: {},
|
|
31
31
|
clientInfo: {
|
|
32
32
|
name: 'claw-mcp-transport-test',
|
|
33
|
-
version: '1.4.
|
|
33
|
+
version: '1.4.25'
|
|
34
34
|
},
|
|
35
35
|
protocolVersion: '2024-11-05'
|
|
36
36
|
}
|
|
@@ -187,7 +187,7 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
|
|
|
187
187
|
capabilities: {},
|
|
188
188
|
clientInfo: {
|
|
189
189
|
name: 'claw-mcp-transport-test',
|
|
190
|
-
version: '1.4.
|
|
190
|
+
version: '1.4.25'
|
|
191
191
|
},
|
|
192
192
|
protocolVersion: '2024-11-05'
|
|
193
193
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface FillRecord {
|
|
3
|
+
time: string;
|
|
4
|
+
blockNum: number;
|
|
5
|
+
opNum: number;
|
|
6
|
+
orderId: string;
|
|
7
|
+
accountId: string;
|
|
8
|
+
pays: {
|
|
9
|
+
amount: number;
|
|
10
|
+
asset_id: string;
|
|
11
|
+
};
|
|
12
|
+
receives: {
|
|
13
|
+
amount: number;
|
|
14
|
+
asset_id: string;
|
|
15
|
+
};
|
|
16
|
+
fee: {
|
|
17
|
+
amount: number;
|
|
18
|
+
asset_id: string;
|
|
19
|
+
};
|
|
20
|
+
isMaker: boolean;
|
|
21
|
+
sort: any[];
|
|
22
|
+
}
|
|
23
|
+
interface TradeFill {
|
|
24
|
+
time: string;
|
|
25
|
+
orderId: string;
|
|
26
|
+
direction: 'buy' | 'sell';
|
|
27
|
+
baseAsset: string;
|
|
28
|
+
quoteAsset: string;
|
|
29
|
+
baseAmount: number;
|
|
30
|
+
quoteAmount: number;
|
|
31
|
+
price: number;
|
|
32
|
+
isMaker: boolean;
|
|
33
|
+
sequence: number;
|
|
34
|
+
}
|
|
35
|
+
interface Violation {
|
|
36
|
+
index: number;
|
|
37
|
+
pair: string;
|
|
38
|
+
direction: 'buy' | 'sell';
|
|
39
|
+
expected: string;
|
|
40
|
+
prev: TradeFill;
|
|
41
|
+
curr: TradeFill;
|
|
42
|
+
priceDelta: number;
|
|
43
|
+
priceDeltaPct: number;
|
|
44
|
+
pivot: number;
|
|
45
|
+
halfInc: number;
|
|
46
|
+
threshold: number;
|
|
47
|
+
}
|
|
48
|
+
interface AggregatedOrder {
|
|
49
|
+
orderId: string;
|
|
50
|
+
direction: 'buy' | 'sell';
|
|
51
|
+
baseAsset: string;
|
|
52
|
+
quoteAsset: string;
|
|
53
|
+
baseAmount: number;
|
|
54
|
+
quoteAmount: number;
|
|
55
|
+
price: number;
|
|
56
|
+
time: string;
|
|
57
|
+
sequence: number;
|
|
58
|
+
fillCount: number;
|
|
59
|
+
isMaker: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* LAST-FILL-GUARD helper — pivot ± halfIncrement (replaces price-tolerance).
|
|
63
|
+
* last fill @x with increment i: BUY < x*(1 - i/2/100), SELL > x*(1 + i/2/100)
|
|
64
|
+
* e.g. x=1000, i=0.5% => BUY < 997.5, SELL > 1002.5
|
|
65
|
+
* Cold (pivot null or lastType null) => disabled.
|
|
66
|
+
* @param {number} price - Target order price
|
|
67
|
+
* @param {string} type - buy/sell
|
|
68
|
+
* @param {number|null} lastPrice - Most recent fill price
|
|
69
|
+
* @param {string|null} lastType - Most recent fill side (buy/sell)
|
|
70
|
+
* @param {number|any} incrementPercent - Grid increment percent (e.g. 0.5). If not finite/<=0 falls back to DEFAULT_CONFIG.
|
|
71
|
+
* @returns {{blocked: boolean, pivot: number|null, halfInc: number, threshold: number|null}}
|
|
72
|
+
*/
|
|
73
|
+
declare function isLastFillGuardBlocked(price: any, type: any, lastPrice: any, lastType: any, incrementPercent: any): {
|
|
74
|
+
blocked: boolean;
|
|
75
|
+
pivot: number | null;
|
|
76
|
+
halfInc?: number;
|
|
77
|
+
threshold?: number | null;
|
|
78
|
+
};
|
|
79
|
+
declare function classifyFills(fills: FillRecord[]): {
|
|
80
|
+
trades: TradeFill[];
|
|
81
|
+
skipped: number;
|
|
82
|
+
};
|
|
83
|
+
declare function aggregateByOrder(trades: TradeFill[]): AggregatedOrder[];
|
|
84
|
+
declare function detectViolations(items: (TradeFill | AggregatedOrder)[], includeCrossPair: boolean, incrementPercent: number): {
|
|
85
|
+
violations: Violation[];
|
|
86
|
+
checkedPairs: number;
|
|
87
|
+
sameDirectionPairs: number;
|
|
88
|
+
};
|
|
89
|
+
export { isLastFillGuardBlocked, classifyFills, aggregateByOrder, detectViolations, TradeFill, FillRecord, Violation, AggregatedOrder };
|
|
90
|
+
//# sourceMappingURL=grid_correction_check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid_correction_check.d.ts","sourceRoot":"","sources":["../../analysis/grid_correction_check.ts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