@clonegod/ttd-core 3.1.57 → 3.1.58
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.
|
@@ -28,10 +28,12 @@ export interface OrderbookTier {
|
|
|
28
28
|
pct: number;
|
|
29
29
|
price: number;
|
|
30
30
|
amount: number;
|
|
31
|
+
usdValue: number;
|
|
31
32
|
}
|
|
32
33
|
export interface OrderbookEntry {
|
|
33
34
|
price: number;
|
|
34
35
|
amount: number;
|
|
36
|
+
usdValue: number;
|
|
35
37
|
tiers: OrderbookTier[];
|
|
36
38
|
}
|
|
37
39
|
export declare function toOrderbookEntry(q: QuoteEntry): OrderbookEntry;
|
package/dist/quote/depth_tier.js
CHANGED
|
@@ -7,7 +7,8 @@ function toOrderbookEntry(q) {
|
|
|
7
7
|
return {
|
|
8
8
|
price: q.price,
|
|
9
9
|
amount: q.amount,
|
|
10
|
-
|
|
10
|
+
usdValue: q.amount_in_usd,
|
|
11
|
+
tiers: q.tiers.map(t => ({ pct: t.pct, price: t.price, amount: t.amount, usdValue: t.amount_in_usd })),
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
const PCT_LEVEL_DEFAULT = [0.1, 0.2, 0.3, 0.5, 1.0];
|
|
@@ -40,8 +40,8 @@ function to_price_message(appConfig, quote_amount_usd, tx_price, quote_ask_price
|
|
|
40
40
|
let mid_price;
|
|
41
41
|
let fee_rate_bps;
|
|
42
42
|
if (depth) {
|
|
43
|
-
ask = depth.ask;
|
|
44
|
-
bid = depth.bid;
|
|
43
|
+
ask = quote_ask_price > 0 ? Object.assign(Object.assign({}, depth.ask), { price: quote_ask_price.toFixed(12) }) : depth.ask;
|
|
44
|
+
bid = quote_bid_price > 0 ? Object.assign(Object.assign({}, depth.bid), { price: quote_bid_price.toFixed(12) }) : depth.bid;
|
|
45
45
|
mid_price = depth.mid_price;
|
|
46
46
|
fee_rate_bps = depth.fee_rate_bps;
|
|
47
47
|
}
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -349,15 +349,17 @@ export interface Ladder {
|
|
|
349
349
|
/** 默认主档(0.2%)目标价;字符串以保持 wire 兼容性 */
|
|
350
350
|
price: string
|
|
351
351
|
/** 默认主档(0.2%)可成交 base token 数量 */
|
|
352
|
-
|
|
352
|
+
qty: string
|
|
353
|
+
/** 默认主档(0.2%)该档位 USD 估值 */
|
|
354
|
+
usd_value: string
|
|
353
355
|
/** 多档完整数据(按 pct 升序:0.1, 0.2, 0.3, 0.5, 1.0) */
|
|
354
|
-
tiers: { pct: number; price: string;
|
|
356
|
+
tiers: { pct: number; price: string; qty: string; usd_value: string }[]
|
|
355
357
|
|
|
356
358
|
// 询价生成的价格,所对应的slot (account, vaultA, vaultB)
|
|
357
359
|
slot: string
|
|
358
360
|
|
|
359
361
|
// 区块号
|
|
360
|
-
|
|
362
|
+
block_number?: string
|
|
361
363
|
|
|
362
364
|
// 价格来源: "rpc:v1" | "{provider_id}:v2" | "{provider_id}:v3"
|
|
363
365
|
source?: string
|
|
@@ -940,7 +942,6 @@ export interface AnalyzeTierLevelType {
|
|
|
940
942
|
amount_in_usd: number
|
|
941
943
|
fee: number
|
|
942
944
|
fee_usd: number
|
|
943
|
-
cumulative_usd: number
|
|
944
945
|
tick_move?: string
|
|
945
946
|
}
|
|
946
947
|
|
|
@@ -1026,6 +1027,8 @@ export interface AnalyzeQuoteSnapshotType {
|
|
|
1026
1027
|
bid: string
|
|
1027
1028
|
block_number: number
|
|
1028
1029
|
source_txid: string
|
|
1030
|
+
/** 报价来源标签: 'rpc:v1' | '{provider}:v2' | '{provider}:v3' */
|
|
1031
|
+
source?: string
|
|
1029
1032
|
stream_recv_time: number
|
|
1030
1033
|
price_ready_time: number
|
|
1031
1034
|
}
|