Stream API never response with these epics (HS50 CFD), Please feel free to comment.
Thank you
1. IX.D.HANGSENG.IFM.IP",
2. IX.D.HANGSENG.IFD.IP",
3. IX.D.HANGSENG.FWM3.IP",
4. IX.D.HANGSENG.IFU.IP",
There is a source code in python (trading_ig) for your reference.
No response of stream data
# A simple function acting as a Subscription listener
def on_prices_update(item_update😞
# print("price: %s " % item_update)
print("{stock_name:<19}: Time {UPDATE_TIME:<8} - "
"Bid {BID:>5} - Ask {OFFER:>5}".format(
stock_name=item_update["name"], **item_update["values"]))
ig_service = IGService(config.username,
config.password,
config.api_key,
config.acc_type,
acc_number=config.acc_number)
ig_stream_service = IGStreamService(ig_service)
ig_stream_service.create_session()
subscription_prices = Subscription(
mode="MERGE",
items=[
"IX.D.HANGSENG.IFM.IP",
"IX.D.HANGSENG.IFD.IP",
"IX.D.HANGSENG.FWM3.IP",
"IX.D.HANGSENG.IFU.IP",
], # sample spreadbet epics
fields=["UPDATE_TIME", "BID", "OFFER", "CHANGE", "MARKET_STATE"],
)
# Adding the "on_price_update" function to Subscription
subscription_prices.addlistener(on_prices_update)
# Registering the Subscription
sub_key_prices = ig_stream_service.ls_client.subscribe(subscription_prices)
INFO:root:Creating new v2 session for user 'IGCFDEMO' at 'https://demo-api.ig.com/gateway/deal'
INFO:root:POST '/session', resp 200
INFO:trading_ig.stream:Starting connection with https://demo-apd.marketdatasystems.com
balance: {'pos': 1, 'name': 'ACCOUNT:Z528CN', 'values': {'AVAILABLE_CASH': '19901.90'}}
----------HIT CR TO UNSUBSCRIBE AND DISCONNECT FROM LIGHTSTREAMER-----------