Jump to content

jlz

Community Member
  • Posts

    421
  • Joined

  • Last visited

  • Days Won

    26

Posts posted by jlz

  1. On 12/02/2022 at 11:39, AshleyN said:

    I would like to (if possible) use the API to pull all my transaction/trade history (ie every buy and sell I have ever made) for my Share Dealing and ISA accounts so I can then further analyse all my historical trade data and plot charts of total proffit loss across the years etc (rather than just the running p/l value IG gives you on your account) as well as create other analytics. I am not interested or needing to actually open/close positions.

    Is there any support for this? 

    Using IG API Companion and switching to my ISA account for example and trying to GET positions resulted in error.public-api.failure.stockbroking-not-supported

    I know I could use the CSV transaction export file but it would be a lot cleaner and fluid to use an API

     

    The API is only available for Spreadbet and CFD accounts. That's why you get that error message. 

     

  2. 4 hours ago, igungho said:

    It is normal to make losses in trading, just make sure the losses are not too big.

    That's the sentence. You don't really care about where the market is going, you are fine as long as you can handle your exits. 

    If you focus on 'when to enter' your system will be wrong most of the time, but if you focus on how to handle drawdowns you might get it right.

    That's why TA books are only useful as door stoppers or monitor lifters. 

    • Like 1
  3. 17 hours ago, MichaelDE said:

    Hi,

    I placed a CFD Market-Order via https://demo-api.ig.com/gateway/deal/positions/otc (POST) as follows:

    {
    "currencyCode": "EUR",
    "dealReference": "TESTxy",
    "direction": "BUY",
    "epic": "IX.D.DAX.IFMM.IP",
    "expiry": "-",
    "forceOpen": "False",
    "guaranteedStop": "False",
    "orderType": "MARKET",
    "size": 0.5
    }
    I obtained the deal confirmation via https://demo-api.ig.com/gateway/deal/confirms/TESTxy (GET) as follows:
    {
    "date": "2021-11-24T10:16:31.629",
    "status": null,
    "reason": "MINIMUM_ORDER_SIZE_ERROR",
    "dealStatus": "REJECTED",
    "epic": "IX.D.DAX.IFMM.IP",
    "expiry": null,
    "dealReference": "TESTxy",
    "dealId": ...and so forth...
     
    My question is: What is the MINIMUM_ORDER_SIZE?
    Size 1.0 worked - is this the minimum?
     
    Thanks
     

    In case that you want to automate the minimum size per market there is an endpoint for it.

    https://labs.ig.com/rest-trading-api-reference/service-detail?id=594

    The endpoint is /market/{epic}. It will give you the dealing rules for that market

    • Sad 1
  4. Have they shut down your other post about the virus @Caseynotes?

    You have been insulting people for months and now they act on it. Interesting. You have been way ruder before, you and your minion, the clown.

    All the hard work that you have put into posting nonsense and memes from Twitter....They don't appreciate your purpose here.

    Finally there is some moderation on this forum and you get what you deserve.

    Frankieburgo is an unsung hero.

    • Like 3
    • Sad 1
  5. There are a lot of commented code that does not do anything. I removed anything that does not trigger any action, so it is easier to read.

    I pasted the code here with some highlighting, https://pastebin.com/zkaJMCwa
    The link is password protected. In order to see the file use the password: DHAjBkgbjH

    I can see in line 48 where the TradeInstrument function starts, and in line 243 where the position gets closed. But I can't see a "reopen" routine anywhere. In order to look for places where the position is being opened look for the word "createPosition".  There is only one place in the code that opens a position. Bear in mind that lines that start with '   '  are meant to be comments and do not do anything.

    I was expecting a call to create a new position after the stop is hit but I can't see it. Either you have some extra code that has not been posted or it is not implemented.

    • Like 1
    • Sad 1
  6. 3 minutes ago, Speedbird168l said:

    Wow. That's a generous and quick response. Thank you. I'm able to create a basket with a bulk of trades (initially inserting them manually) for pairing. They should auto re-open after closing when hitting the limit or loss. It's basically a trending tool which can invert the direction. It works sometimes and then it just hangs. I presume that might be because of the API call limit?  I can mail you the sheet for your comments if you are willing to look at it?

    I am not a Windows user, so I won't be able to open the Excel file. If you want to share anything send the VBA code in plain text. There are VBA developers in the forum , maybe they can help.
     

    • Sad 1
  7. 2 minutes ago, Speedbird168l said:

    Thanks @jlz. I've had someone help me configure the excel VBA sample sheet to auto-reopen baskets of trades after closing them once a prescribed limit of loss has been reached. I am using the ig.com rest API endpoint in excel VBA with "/positions/otc" Post method (creating an OTC position). However, when using this API in loop, it creates trades a few positions and then just stops. The loop then is then stuck and excel hangs due to not responding. Happy to share the file with you if you wish?

    Sure share the file, it will be easier to look at the code.

    • Sad 1
  8. 5 hours ago, Speedbird168l said:

    Hello. I am trying to implement custom functionality into the excel VBA sample sheet where open trades close after reaching a limit or loss, and the auto-reopen (trade) again. I am using the ig.com rest API endpoint in excel VBA with "/positions/otc" Post method for trade (Creates an OTC position). When I am using this API in loop, it creates a few positions (trade) and stops giving the response. The loop then is stuck and excel hangs due to not responding.

    Any suggestions? Is there any advanced version of "/positions/otc" POST API that creates positions in bulk which I can use in the loop that responds immediately?

     

    You can't create positions in bulk, you are supposed to call the endpoint each time on every position.

    A loop should be fine as long as you can handle all responses. Bear in mind that you are only allowed to call the endpoint a number of times per minute, if you pass that limit your positions will not be created. (the exact number was somewhere but I don't have it hand :D)


    If you are able to create positions, your call to the endpoint is already working. In order to see where the problem is we would need to see the VBA code that you have written. I would bet on the way that code handles the response, bear in mind that the response is different when you have an error coming from the server.

    If you have a successful response where the position has been created you get a json like:

    {

       "dealReference": [positionReferenceId]

    }

    But if you have any error your response will be:

    {

       "errorCode": error code from the list [https://labs.ig.com/rest-trading-api-reference/service-detail?id=608]

    }

    If you are expecting the attribute dealReference and you get an error instead it will raise an exception and will hang Excel.

     

    • Sad 1
  9. On 16/10/2021 at 12:23, andysinclair said:

    Hi,

    Does anybody know if it is possible to plot my historical trades on a chart? I don't believe it is possible on the IG platform, however is there some other software that I could easily use to achieve this (linked to my IG account so the trades are plotted automatically).

    I would like to do this so I can review my weeks trading, see where I made profit/loss and basically help me improve.

    If nothing exists then as I am a software developer may look into building this for myself!

    Thanks!

    I use lightcharts from Trading View

    If you need an example I put something together at:

    https://github.com/AnAlgoTrader/AlgoReplay/tree/master/Monitor

    The static.html file renders everything.

    The realtime.html file renders candle by candle 

     

    • Sad 3
×
×
  • Create New...
us