瀏覽代碼

fix: Discord 通知改为显示区间范围,移除价格信息

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lushdog@outlook.com 1 周之前
父節點
當前提交
50b5c1bc0b
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/discord/index.ts

+ 7 - 4
src/discord/index.ts

@@ -52,11 +52,14 @@ export async function sendDiscordMessage(positionDetails: OpenPositionEvent['pos
 		}
 	}
 
-	// 添加价格信息
-	if (mintA?.price && mintB?.price) {
+	// 添加区间信息
+	if (positionDetails.lowerTick !== undefined && positionDetails.upperTick !== undefined && mintA && mintB) {
+		const decimalsAdj = Math.pow(10, mintB.decimals - mintA.decimals)
+		const priceLower = Math.pow(1.0001, positionDetails.lowerTick) * decimalsAdj
+		const priceUpper = Math.pow(1.0001, positionDetails.upperTick) * decimalsAdj
 		embed.fields.push({
-			name: '💹 价格信息',
-			value: `${mintASymbol}: $${Number(mintA.price).toFixed(6)}\n${mintBSymbol}: $${Number(mintB.price).toFixed(6)}`,
+			name: '📊 区间范围',
+			value: `${priceLower.toPrecision(6)} ~ ${priceUpper.toPrecision(6)} ${mintBSymbol}/${mintASymbol}`,
 			inline: false
 		})
 	}