trading-ig icon indicating copy to clipboard operation
trading-ig copied to clipboard

Deprecation error on lightreamer.Subscription

Open alhennessey92 opened this issue 1 year ago • 2 comments

Getting a deprecation warning on my code that was previously working fine.

Error: /app/app.py:2127: DeprecationWarning: trading_ig.lightstreamer.Subscription is deprecated, and will be removed in a future version; use the official Lightstreamer Python client instead [server] subscription_prices = Subscription( [server] Traceback (most recent call last): [server] File "/app/app.py", line 2134, in <module> [server] sub_key_prices = ig_stream_service.ls_client.subscribe(subscription_prices) [server] File "/usr/local/lib/python3.9/site-packages/lightstreamer/client/ls_python_client_wrapper.py", line 1138, in subscribe [server] self.delegate.subscribe(subscription.delegate) [server] AttributeError: 'Subscription' object has no attribute 'delegate'

Code around them lines:

`main_stream = "CHART:CS.D.GBPUSD.TODAY.IP:{}".format(stream_scale_time)
    subscription_prices = Subscription(
        mode="MERGE",
        items=[main_stream],
        fields=["LTV", "UTM", "OFR_OPEN", "OFR_HIGH", "OFR_LOW", "OFR_CLOSE", "BID_OPEN", "BID_HIGH", "BID_LOW", "BID_CLOSE", "CONS_END", "CONS_TICK_COUNT"]
    )

    subscription_prices.addlistener(on_prices_update)
    sub_key_prices = ig_stream_service.ls_client.subscribe(subscription_prices)`

I have tried removing the line sub_key_prices = ig_stream_service.ls_client.subscribe(subscription_prices) However still getting the below error.

Error: /app/app.py:2127: DeprecationWarning: trading_ig.lightstreamer.Subscription is deprecated, and will be removed in a future version; use the official Lightstreamer Python client instead [server] subscription_prices = Subscription(

Everything was working fine before i restarted my Docker Desktop and it had to rebuild the container, so not sure if this is because the library has been updated.

Thanks for any help

alhennessey92 avatar Jan 14 '24 20:01 alhennessey92