Wait for a last price tick before delivering quote
parent
af0503956a
commit
24596022f9
|
@ -26,6 +26,7 @@ from dataclasses import asdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import itertools
|
import itertools
|
||||||
|
from math import isnan
|
||||||
from typing import (
|
from typing import (
|
||||||
Any, Optional,
|
Any, Optional,
|
||||||
AsyncIterator, Awaitable,
|
AsyncIterator, Awaitable,
|
||||||
|
@ -502,7 +503,11 @@ class Client:
|
||||||
contract,
|
contract,
|
||||||
snapshot=True,
|
snapshot=True,
|
||||||
)
|
)
|
||||||
ticker = await ticker.updateEvent
|
|
||||||
|
# ensure a last price gets filled in before we deliver quote
|
||||||
|
while isnan(ticker.last):
|
||||||
|
ticker = await ticker.updateEvent
|
||||||
|
|
||||||
details = (await details_fute)[0]
|
details = (await details_fute)[0]
|
||||||
return contract, ticker, details
|
return contract, ticker, details
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue