fix: render basis with explicit sign and absolute delta
Format basis row as +/-$abs(delta) to match the spec and avoid awkward %+s formatting behavior. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,20 @@ func TestRenderRichTokenMessage_SpotAndFuture(t *testing.T) {
|
||||
MarginAPRPercent: 5.11,
|
||||
})
|
||||
|
||||
assertContainsAll(t, msg, "🪙 SOL", "💵 Spot:", "📈 Future:", "🧭 Basis:", "💸 Funding:", "🏦 Margin:")
|
||||
assertContainsAll(t, msg, "🪙 SOL", "💵 Spot:", "📈 Future:", "🧭 Basis: +$0.6000", "💸 Funding:", "🏦 Margin:")
|
||||
assertContainsNone(t, msg, "🅰️ Alpha:", "📊 Alpha 24h:")
|
||||
}
|
||||
|
||||
func TestRenderRichTokenMessage_SpotAndFutureNegativeBasis(t *testing.T) {
|
||||
msg := RenderRichTokenMessage(RichTokenMessageInput{
|
||||
Token: "ADA",
|
||||
HasSpot: true,
|
||||
SpotPrice: 1.2,
|
||||
HasFuture: true,
|
||||
FuturePrice: 1.1,
|
||||
FundingRate: 0.000011,
|
||||
FundingTimeMs: 1740000000000,
|
||||
})
|
||||
|
||||
assertContainsAll(t, msg, "🧭 Basis: -$0.10000 (-8.33%)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user