Jump to content
  • 0

How does the relation between DealId and DealReference work in the different API endpoints


SZZ

Question

I'm trying to follow the documentation here: https://labs.ig.com/rest-trading-api-reference

My goal: I want to open an order via API, get frequent updates via lightstream and a final update when the order is closed, including P&L information.

I open the order by putting a request to /gateway/deal/positions/otc v2. This works and returns a deal id and a deal reference

Then I confirm the order by deal id using /gateway/deal/confirms/ v1. This also works.

I also get updates via the lightstream API on the trade type OPU with the status OPEN and DELETED when the order is closed. Again, the DealId and the Reference match. But the DELETED update does not contain a P&L information.

 

So on DELETE I access the activity transaction history by deal ID: /gateway/deal/history/activity v3. This also works, but also does not contain P&L, but therefore a description with a new Id, reading "Position opened: [some id]". This id consits of the last part of the DealId.

Afterwards, I access the transaction history on /gateway/deal/history/transactions v2. Here I finally have a P&L, but the reference field contains a new reference that never showed up before. There is just no way to link the transaction to the activity or to an order.

 

So the question: Is there any way to get P&L information on a closed position based on deal Id or deal reference? I really don't want to match opening date and epic name, that's just bad practice.

 

 

 

 

 

Link to comment

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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,984
    • Total Posts
      95,305
    • Total Members
      43,595
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    pb8080
    Joined 22/09/23 16:31
  • Posts

    • Basically, they've renamed the BitKeep wallet to BitgetWallet while megaswap to Bitgetswap😑...!   Most of the wallets have that inbuilt swap features but only a few reputable centralised exchanges have that feature!
    • Almost perfectly said! Especially, diversification & risk appetite factor worked great for me! Imagine, having -300% with 20x Lev😑. Still didn't close that trade after gaining+200%! Tho high lev isn't recommended,but I've just shared my personal experience as an example of risk appetite!  End of the day, experience & self confidence matters at crypto(For most of the people).
    • Hi @Ilikethestonk, Unfortunately, we only offer stocks listed on the following markets for share dealing: UK: FTSE 100, FTSE 250, and many other small-cap UK stocks US: S&P 500, NASDAQ 100, and many other small-cap US stocks Germany: DAX, HDAX, MDAX Ireland: ISEQ Netherlands: AEX Belgium: BEL 20 Austria: ATX, WBI Australia: ASX/S&P 300 Thanks, KoketsoIG
×
×
  • Create New...
us