Wait for a last price tick before delivering quote

vlm_plotz_backup
Tyler Goodlet 2021-10-27 11:54:32 -04:00
parent af0503956a
commit 24596022f9
1 changed files with 6 additions and 1 deletions

View File

@ -26,6 +26,7 @@ from dataclasses import asdict
from datetime import datetime
from functools import partial
import itertools
from math import isnan
from typing import (
Any, Optional,
AsyncIterator, Awaitable,
@ -502,7 +503,11 @@ class Client:
contract,
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]
return contract, ticker, details