Jump to content
  • 1

IG API Open Position Margin


SuperCode

Question

Hi there, i recently started using the IG Trading  API with a custom Python client of mine, everything seems to be working except that when i open a deal, it spends $5000 but i want to spend exactly 1000 is there anyway I can configure this in the API ?

 

 

Link to comment

2 answers to this question

Recommended Posts

  • 1

In my Python app I submit a /markets GET request for the Epic code. This returns the bid and offer prices, along with lot_size and margin requirement.

I am assuming by "spend exactly 1000" you mean commit that much margin (I am mainly familiar with spread betting and CFDs).

I calculate my order size by:

    cash / price / margin / lot_size

So, if I have £1,000 available for margin on a CFD, the price is 7,500, the margin 5% and the lot size £2 per point, that means I need to open a position for £1.33 per point.

Of course, the price may have changed marginally in the fraction of a second between fetching the price, doing the calculation and opening the position, but it's close enough for me.

Julian

  • Like 1
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
×
×
  • Create New...