Jump to content
  • 0

Stream API never response with these epics (HS50 CFD)


madeinquant

Question

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-----------
 
Link to comment

4 answers to this question

Recommended Posts

  • 0
3 hours ago, madeinquant said:
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-----------
 

Hi @madeinquant

Thanks for reaching out. You can also share this with webapisupport@ig.com for more assistance. This team is created to assist with Web API issues. All the best, OfentseIG

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • General Statistics

    • Total Topics
      22,096
    • Total Posts
      92,952
    • Total Members
      42,474
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    scobes2
    Joined 17/05/23 10:51
  • Posts

    • Look ahead to 2/6/23: US jobs; Baker Hughes rig count After the stronger than expected private payrolls number from ADP, risks would seem to be on the upside for the US non-farm jobs number on Friday. ¬†Jeremy Naylor¬†|¬†Analyst,¬†London¬†| Publication date:¬†Thursday 01 June 2023¬† IGTV‚Äôs Jeremy Naylor looks at USD/JPY as a potential trade. Outside of this watch Brent around the Baker Hughes rig count. ¬† ¬† ¬† ¬† ¬† ¬†
    • What's the next move following the bank run that led to a rally in US stocks? The markets have been giving us hints on its coming trend, which markets are they? Deploying market psychology not only helps us to connect the dots in today‚Äôs complexity, it also gives us the simplicity to chart into the future. In this session, we have invited market veteran, Wong Kon How, to help you improve your trading literacy and successfully navigate the financial markets. Kon How will demonstrate how he understands today‚Äôs market complexity and seizes the coming opportunity with behavioral science. ¬†
    • Charting the Markets: 1 June Dow and CAC40 stabilise while Nasdaq 100 edges down. EUR/USD, EUR/GBP and USD/CAD stabilise as US debt ceiling bill goes to Senate. And Brent, orange juice stabilise while copper advances as US debt ceiling bill gets signed. Shaun Murison¬†|¬†Senior Market Analyst,¬†Johannesburg¬†| Publication date:¬†Thursday 01 June 2023 ¬† ¬† ¬† ¬† ¬† ¬† ¬† This is here for you to¬†catch up¬†but if you have any ideas on markets or events you want us to relay to the TV¬†team we‚Äôre more than happy to.
×
×
  • Create New...