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 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