diff --git a/tastytrade/__init__.py b/tastytrade/__init__.py index 37b55f4..b0bd042 100644 --- a/tastytrade/__init__.py +++ b/tastytrade/__init__.py @@ -4,7 +4,9 @@ BACKTEST_URL = "https://backtester.vast.tastyworks.com" CERT_URL = "https://api.cert.tastyworks.com" VAST_URL = "https://vast.tastyworks.com" -VERSION = "9.8" +VERSION = "9.9" + +__version__ = VERSION logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) diff --git a/tastytrade/streamer.py b/tastytrade/streamer.py index d7c55f4..3e3b7c5 100644 --- a/tastytrade/streamer.py +++ b/tastytrade/streamer.py @@ -387,6 +387,7 @@ class DXLinkStreamer: def __init__( self, session: Session, + refresh_interval: float = 0.1, reconnect_args: tuple[Any, ...] = (), reconnect_fn: Optional[Callable[..., Coroutine[Any, Any, None]]] = None, ssl_context: SSLContext = create_default_context(), @@ -404,6 +405,9 @@ def __init__( "Underlying": 17, } self._subscription_state: dict[str, str] = defaultdict(lambda: "CHANNEL_CLOSED") + #: Time in seconds between fetching new events from dxfeed. You can try a higher + #: value if processing quote updates quickly is not a high priority. + self.refresh_interval = refresh_interval #: An async function to be called upon reconnection. The first argument must be #: of type `DXLinkStreamer` and will be a reference to the streamer object. self.reconnect_fn = reconnect_fn @@ -647,7 +651,7 @@ async def _channel_setup(self, event_type: str) -> None: message = { "type": "FEED_SETUP", "channel": self._channels[event_type], - "acceptAggregationPeriod": 10, + "acceptAggregationPeriod": self.refresh_interval, "acceptDataFormat": "COMPACT", }