Bug Description
QuoteContext.warrant_list() returns incorrect values for several fields in the WarrantInfo object. The fields implied_volatility, delta, effective_leverage, strike_price, and itm_otm all return the same value as last_done, instead of their actual values.
Environment
- SDK version:
longport 3.0.22 (Python, latest as of 2026-03-17)
- Platform: macOS aarch64, Python 3.13
- Subscription: HK LV2 Advanced Quotes (OpenAPI)
Reproduction
from longport.openapi import Config, QuoteContext, WarrantSortBy, SortOrderType, WarrantType
config = Config.from_env()
ctx = QuoteContext(config)
warrants = ctx.warrant_list(
'700.HK',
WarrantSortBy.Turnover,
SortOrderType.Descending,
warrant_type=[WarrantType.Call],
)
w = warrants[0]
print(f"last_done: {w.last_done}")
print(f"implied_volatility: {w.implied_volatility}")
print(f"delta: {w.delta}")
print(f"effective_leverage: {w.effective_leverage}")
print(f"strike_price: {w.strike_price}")
print(f"itm_otm: {w.itm_otm}")
print(f"premium: {w.premium}") # This one is correct
print(f"leverage_ratio: {w.leverage_ratio}") # This one is correct
Actual Output
=== 26200.HK JPTENCT@EC2608A ===
last_done: 0.153
implied_volatility: 0.153 ← WRONG (should be ~0.30-0.50)
delta: 0.153 ← WRONG (should be 0.0-1.0 range)
effective_leverage: 0.153 ← WRONG
strike_price: 0.153 ← WRONG (should be ~559.0 for this warrant)
itm_otm: 0.153 ← WRONG
premium: 0.2268 ✓ correct
leverage_ratio: 36.536 ✓ correct
All 5 broken fields return exactly the same Decimal value as last_done. Other fields like premium, leverage_ratio, volume, turnover, outstanding_ratio, change_rate return correct distinct values.
Expected Behavior
Each field should return its own value as documented in the API reference:
implied_volatility: ~0.30-0.80 range (引伸波幅)
delta: -1.0 to 1.0 range (对冲值)
effective_leverage: distinct from last_done (有效杠杆)
strike_price: the warrant's exercise price (行权价)
itm_otm: in/out of the money percentage (价内/价外 %)
Analysis
This looks like a field offset / deserialization bug in the native (Rust) binding. The SDK correctly deserializes premium, leverage_ratio, etc., but maps 5 other fields to the same memory offset as last_done.
Tested with 1300+ warrant records across 27 underlying stocks — 100% of records show implied_volatility == last_done.
Bug Description
QuoteContext.warrant_list()returns incorrect values for several fields in theWarrantInfoobject. The fieldsimplied_volatility,delta,effective_leverage,strike_price, anditm_otmall return the same value aslast_done, instead of their actual values.Environment
longport 3.0.22(Python, latest as of 2026-03-17)Reproduction
Actual Output
All 5 broken fields return exactly the same
Decimalvalue aslast_done. Other fields likepremium,leverage_ratio,volume,turnover,outstanding_ratio,change_ratereturn correct distinct values.Expected Behavior
Each field should return its own value as documented in the API reference:
implied_volatility: ~0.30-0.80 range (引伸波幅)delta: -1.0 to 1.0 range (对冲值)effective_leverage: distinct from last_done (有效杠杆)strike_price: the warrant's exercise price (行权价)itm_otm: in/out of the money percentage (价内/价外 %)Analysis
This looks like a field offset / deserialization bug in the native (Rust) binding. The SDK correctly deserializes
premium,leverage_ratio, etc., but maps 5 other fields to the same memory offset aslast_done.Tested with 1300+ warrant records across 27 underlying stocks — 100% of records show
implied_volatility == last_done.