Jump to content

nickcamel

Community Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by nickcamel

  1. I think I managed to figure it out and resolve this issue.

    Previously (for years) I used to always send a body along with the request

    Quote

     body={}
    ...
    requests.request(method, url, headers=headers, json=body)

    Even if the body was empty.

    This doesn’t seem to be a stable solution any longer for unknown reasons, (first detected 2022-07-04).

    That’s also, I believe, why the ‘position/otc’ – POST would work, because it would send a non-empty body (as required).

  2. This week the API has been very shaky for me.

    The REST-API

    • login,
    • handshake for retrieving CST and X-SECURITY-TOKEN tokens

    and the STREAMING API

    • subscribing

    all work pretty decent.

    However, other REST-API calls, e.g. 'positions', 'prices', 'watchlists', most of the time return a connection error:

    Quote

    Connection broken: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)

    Concurrent calls, say 1 in 50, returns an OK response. Concurrent = call, get connection broken response, wait, same call again, i.e. without any new logout / login routines.

    I've tried with both live and demo account. Same behavior.

    Funny enough, 'positions/otc' seem to work most of the time.

    Anyone know what's up?

  3. On 26/07/2020 at 20:34, jlz said:

    @panja I added a method to retrieve prices within the IgClient class at

    https://github.com/oneangrytrader/brokerapiclients/blob/master/IG.Python.Api.Client/client/IgClient.py

    Input parameters are: Epic, Resolution, DateFrom and DateTo. 

    Resolution is an enum also part of the repository., check the possible values there.

    An example url retrieving prices for the FTSE100 from the 20th to the 21st of July with a daily resolution would retrieve two candles, one per day.

    Producing the result of:

    result:[
        {
            "closePrice": {
                "ask": 6269.3,
                "bid": 6265.3,
                "lastTraded": null
            },
            "highPrice": {
                "ask": 6314.3,
                "bid": 6310.3,
                "lastTraded": null
            },
            "lastTradedVolume": 75212,
            "lowPrice": {
                "ask": 6220.1,
                "bid": 6219.1,
                "lastTraded": null
            },
            "openPrice": {
                "ask": 6308.8,
                "bid": 6304.8,
                "lastTraded": null
            },
            "snapshotTime": "2020/07/20 00:00:00",
            "snapshotTimeUTC": "2020-07-19T23:00:00"
        },
        {
            "closePrice": {
                "ask": 6264.5,
                "bid": 6260.5,
                "lastTraded": null
            },
            "highPrice": {
                "ask": 6317.0,
                "bid": 6316.0,
                "lastTraded": null
            },
            "lastTradedVolume": 74772,
            "lowPrice": {
                "ask": 6237.9,
                "bid": 6235.9,
                "lastTraded": null
            },
            "openPrice": {
                "ask": 6268.9,
                "bid": 6264.9,
                "lastTraded": null
            },
            "snapshotTime": "2020/07/21 00:00:00",
            "snapshotTimeUTC": "2020-07-20T23:00:00"
        }
    ]
     

     

    Repo seems gone!?

    I've also started a python project on Ig Api, when I saw your post I was def hoping on gaining some more knowledge or collaboration.

    Here's my repo. https://github.com/nickcamel/IgApi

×
×
  • Create New...
us