Skip to content

Commit fd78d75

Browse files
committed
Fix forex snapshot last_quote ask/bid prices
TickerSnapshot.last_quote reuses the stock LastQuote model, which reads ask/bid prices from P/p. Forex snapshot quotes send a/b instead, so get_snapshot_ticker/all/direction for forex returned ask_price and bid_price as None. Fall back to a/b when P/p are absent.
1 parent 5d97632 commit fd78d75

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎massive/rest/models/quotes.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ def from_dict(d):
5252
sequence_number=d.get("q", None),
5353
sip_timestamp=d.get("t", None),
5454
participant_timestamp=d.get("y", None),
55-
ask_price=d.get("P", None),
55+
# stocks send P/p; forex snapshot quotes send a/b
56+
ask_price=d.get("P", d.get("a")),
5657
ask_size=d.get("S", None),
5758
ask_exchange=d.get("X", None),
5859
conditions=d.get("c", None),
5960
indicators=d.get("i", None),
60-
bid_price=d.get("p", None),
61+
bid_price=d.get("p", d.get("b")),
6162
bid_size=d.get("s", None),
6263
bid_exchange=d.get("x", None),
6364
tape=d.get("z", None),

0 commit comments

Comments
 (0)