Jump to content
  • 0

API and Spread Betting


david_blumkey

Question

Hello,

I have two questions about interacting with the API in conjunction with a spread betting account. There are two things that I don't understand:

- After POSTing to `/session`, I have two accounts that are returned in the response (CFD and Spread Bet), however I don't understand how I can select that account to be used when (for example) creating and viewing trades. In the response object I can see my preferred account is selected as the CFD account, but I'm not sure how I can update this "preferred account" or even programmatically select the Spread Bet account for further use. How can I ensure the spread bet account is used for subsequent API interactions?

- When querying for market epics via `/markets`. How can I tell if a market is a spread betting market or a CFD (or other) market? There doesn't appear to be a clear way of knowing.

Thanks in advance for you time! Please let me know if I can provide any further information.

Link to comment

5 answers to this question

Recommended Posts

  • 0
21 hours ago, david_blumkey said:

Hello,

I have two questions about interacting with the API in conjunction with a spread betting account. There are two things that I don't understand:

- After POSTing to `/session`, I have two accounts that are returned in the response (CFD and Spread Bet), however I don't understand how I can select that account to be used when (for example) creating and viewing trades. In the response object I can see my preferred account is selected as the CFD account, but I'm not sure how I can update this "preferred account" or even programmatically select the Spread Bet account for further use. How can I ensure the spread bet account is used for subsequent API interactions?

- When querying for market epics via `/markets`. How can I tell if a market is a spread betting market or a CFD (or other) market? There doesn't appear to be a clear way of knowing.

Thanks in advance for you time! Please let me know if I can provide any further information.

Hi @david_blumkey,

Welcome to the IG community and thank you for your post. Please see the below answers to your questions:

1. The API will always use the account that has been set as the 'default' account as the preferred account, once logged in to the API there is a 'Switch account' function that can be used to switch between Spread Bet and CFD accounts but preferred account will always be the default account on login.

2. Most Spread Bet market EPICs will have 'Daily' or 'Cash' and CFD market EPICs will normally have 'Today' in the EPIC. The best option is to get the EPIC from the market for the specific account (Spread Bet/CFD) to ensure the right EPIC is used for the correct account and for the correct market EPIC.

All the best,

KoketsoIG
 

- KoketsoIG

Link to comment
  • 0
On 13/11/2023 at 09:17, KoketsoIG said:

Hi @david_blumkey,

Welcome to the IG community and thank you for your post. Please see the below answers to your questions:

1. The API will always use the account that has been set as the 'default' account as the preferred account, once logged in to the API there is a 'Switch account' function that can be used to switch between Spread Bet and CFD accounts but preferred account will always be the default account on login.

2. Most Spread Bet market EPICs will have 'Daily' or 'Cash' and CFD market EPICs will normally have 'Today' in the EPIC. The best option is to get the EPIC from the market for the specific account (Spread Bet/CFD) to ensure the right EPIC is used for the correct account and for the correct market EPIC.

All the best,

KoketsoIG
 

Thank you for getting back to me, and thank you for the information. Would you have a link to the endpoint that you were referring to in regards to the switching accounts function?

I thought it might the PUT /accounts/preferences endpoint, but accoring to the documentation that only allows you to enable / disable trailing stop losses:
https://labs.ig.com/rest-trading-api-reference/service-detail?id=654

Would it be possible to set in the UI? I can't seem to find the setting if so. I tried changing the "Default View", but that doesn't appear to set affect the API account

Screenshot2023-11-25at11_36_05.thumb.png.96160e6261191e73c083a34750e36ef7.png

Link to comment
  • 0
On 25/11/2023 at 13:37, david_blumkey said:

Thank you for getting back to me, and thank you for the information. Would you have a link to the endpoint that you were referring to in regards to the switching accounts function?

I thought it might the PUT /accounts/preferences endpoint, but accoring to the documentation that only allows you to enable / disable trailing stop losses:
https://labs.ig.com/rest-trading-api-reference/service-detail?id=654

Would it be possible to set in the UI? I can't seem to find the setting if so. I tried changing the "Default View", but that doesn't appear to set affect the API account

Screenshot2023-11-25at11_36_05.thumb.png.96160e6261191e73c083a34750e36ef7.png

Hi @david_blumkey,

Thank you for your post.

Please note that you can find the details in the following: /session | IG Labs it's under Login and Session

This can be done in the UI, changing 'Default view' in the web platform only changes the default account for Live accounts. You might have changed the default account for live and logged in with your demo API which is why you might have not noticed a change.

Changing the default account for the demo can only be done on the IG mobile app (Account > Manage accounts).

image.png

- KoketsoIG

Link to comment
  • 0

Understanding how to select the desired account for your API requests is crucial for seamless integration. If the response object indicates your preferred account as the CFD account, you might need to explore the API documentation further to find methods for updating this preference or programmatically selecting the Spread Bet account.

Link to comment
  • 0
On 21/03/2024 at 17:11, capitulinagarage said:

Understanding how to select the desired account for your API requests is crucial for seamless integration. If the response object indicates your preferred account as the CFD account, you might need to explore the API documentation further to find methods for updating this preference or programmatically selecting the Spread Bet account.

Remember, troubleshooting API integrations can be complex, but with patience and persistence, you'll likely find a solution that works for you. And if you're interested in expanding your knowledge of spread betting or exploring related topics, you might discover valuable insights and resources at https://www.nettcasino.com/omtaler/. Keep up the great work, and don't hesitate to reach out if you have further questions or need assistance along the way!

Edited by capitulinagarage
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
  • image.png

  • Posts

    • The cryptocurrency market has seen some adjustments recently, with BTC experiencing a sudden dip from $60k to $57k, leading to numerous liquidations. While shorting traders may be benefiting, those in long positions are facing challenges. It’s uncertain whether the market will recover or experience further declines. Considering BTC’s historical post-halving behavior and the circumstances that precede the 2024 pre-halving, especially the approval of BTC spot ETF, the market narrative has become unpredictable, prompting many traders to experience FOMO. Amidst this uncertainty, engaging in opportunities like BTC & ETH trade mining could be advantageous. Traders can earn profits regardless of liquidations, with each trader eligible to receive up to 500 BGB daily. Furthermore, this event isn’t exclusive to high-volume traders; it offers opportunities for low-volume traders as well, with rewards tied to daily trading volume. With only 20 days left in the event, seizing this opportunity can significantly increase one’s crypto holdings with minimal risk. If interested, you can join via this link https://www.bitget.com/events/trade-mining
    • MAJOR XAU/USD (GOLD VS US DOLLAR) UPDATE! We are 6 days away from May 7th, which is the ECM target and April has just concluded with a close ABOVE the monthly BREAKOUT LINE! This indicates that gold is READY for its commodity boom!  #BUY BUY BUY Indicator (EA included): Breakout Lines MT5: https://www.mql5.com/en/market/product/97201 Breakout Lines MT4: https://www.mql5.com/en/market/product/80143
    • Coffee Elliott Wave Analysis  Function - Counter-trend  Mode - Corrective  Structure - Possible Zigzag for B  Position - Wave B of (Y) Direction - Wave B of  (Y) is still in progress Details - Wave B is still in progress. It looks to be in the last leg for a zigzag structure. The decline could continue to 207-to-199 before returning upside for wave C. Coffee prices have embarked on a nuanced journey post the robust impulse breakout witnessed since March 19, signifying a potential completion of a significant phase. Preceding this surge, the commodity had languished within a confined sideways range for a span of three months. The ongoing descent appears poised to persist within the framework of a zigzag structure, setting the stage for an eventual upward trajectory in alignment with the broader resurgence.   Delving into the daily chart reveals the unfolding of a bullish double zigzag pattern originating from 141.85 in January 2023. This intricate pattern likely constitutes the second leg of a larger corrective wave initiated back in February 2022. For analytical simplicity, our focus remains on the double zigzag structure stemming from 141.85, as depicted on the daily chart. Presently, this double zigzag is navigating through its final wave – denoted as primary degree blue wave W. Blue wave W, in turn, unfolds as a double zigzag at the intermediate degree, delineated as waves (W)-(X)-(Y). The preceding three-month consolidation period culminated in the formation of a triangle pattern, notably identified as wave (X), at the 179.35 mark. The ongoing wave Y also appears to be materializing into a double zigzag, with the current downturn representing its second leg, preceding an anticipated upward surge to finalize wave (Y) of blue Y.   Zooming in on the H4 chart accentuates the present retracement, identified as wave B of (Y). This corrective wave is conceivably in the process of completing a zigzag pattern and may discover support within the Fibonacci zone spanning from 207.9 to 199.40. Consequently, a subsequent wave C is anticipated to manifest, propelling prices higher, potentially surpassing the April 18th high. However, a decisive breach beneath this support zone, coupled with a violation of the 161.8% extension level at 194.3, could herald the emergence of an impulse wave. Such a scenario could entail a more profound corrective pullback, challenging the integrity of the 179.35 low, or even signaling the culmination of wave (Y) at the April 18th peak, paving the way for a broader downturn encompassing primary degree wave Y (blue).   Technical Analyst : Sanmi Adeagbo Source : Tradinglounge.com get trial here!        
×
×
  • Create New...
us