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
 

Please rate us on Trustpilot: IG Trustpilot 

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

Please rate us on Trustpilot: IG Trustpilot 

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

    • Recently, U.S. Senator Bill Hagerty from Tennessee spoke at the Bitcoin conference, stating his efforts to push for Bitcoin-supportive legislation to promote freedom and opportunity. This year, cryptocurrency has become a key battleground in the election campaigns. It remains to be seen whether future policies on cryptocurrency will improve.
    • The digital landscape is undergoing a profound transformation as attention, once a freely given commodity, is increasingly recognized as a valuable asset. Layer3 is at the forefront of this revolution, pioneering a new economy where attention can be owned, traded, and monetized   This innovative approach empowers individuals to monetize their engagement, providing unprecedented control over personal data. Simultaneously, advertisers benefit from transparent metrics that optimize campaign performance. Content creators are presented with diverse revenue avenues beyond traditional advertising, while the overall ecosystem experiences a more equitable distribution of value.   The implications of Layer3 extend across various sectors. Social media platforms, for instance, can leverage this technology to revolutionize user engagement and monetization strategies. Tokenomics play a crucial role in driving Layer3's economy, incentivizing participation and rewarding value creation. While challenges such as data privacy and market volatility exist, the potential benefits of Layer3 are immense   Anticipation is building as its native token $L3 is on Bitget Pre-market as users await its listing on the exchange. This milestone is expected to significantly increase the token's visibility and accessibility, potentially driving substantial growth and attracting new investors. As the countdown begins, the crypto community watches with keen interest, eager to see how Layer3 will perform in this new chapter.
    • I've been exploring the world of play-to-earn gaming recently, looking for something that's not just about endless grinding but actually offers a fun and rewarding experience. OGC really stood out to me because it combines gaming with a sense of community in a unique way. OGC isn't just a game; it's a platform where you can play, earn, and even help shape its future. You're not just a player; you're part of a community with a voice. The idea of earning crypto while playing games is exciting, but what makes OGC special is its focus on community involvement. Your feedback can directly influence the development of the game, which is a big deal. I've also heard that the OGC token is available for pre-market trading on Bitget. While I'm still getting to know the platform and its features, it's definitely something to keep an eye on. Has anyone else tried OGC? What has your experience been like? I'd love to hear your thoughts and any tips you might have.
×
×
  • Create New...
us