Jump to content


Community Member
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About wki

  • Rank
    Occasional Contributor
  1. That's great feedback, cheers. Will struggle to find the time to move over from Python to C# but will keep that in mind, especially if the wheels keep coming off with the Python libraries.
  2. I got it! It was a pesky little VERSION= 2 instead of VERSION = "2" under the """Updates an OTC working order""". I'll log a bug. Seems to be working now, thanks!
  3. I can see why you do that 😉. Thanks for your help. Here is the repo for the trading_ig api: https://github.com/ig-python/ig-markets-api-python-library/blob/master/trading_ig/rest.py
  4. Thanks again for your help @jlzbut still struggling. I reverted back to the basic create_open_position to test the connection, and start again from there, etc. So this works: response = ig_service.create_open_position( currency_code='GBP', direction='BUY', epic='CS.D.BITCOIN.TODAY.IP', expiry='DFB', force_open=True, guaranteed_stop=False, level=None, limit_distance='150', limit_level=None, order_type='MARKET', quote_id=None, size='1', stop_distance='150', stop_level=None, trailing_stop=False, trailing_stop_increment=None) But this does not (same InvalidHeader error as original post): response = ig_service.create_working_order( currency_code='GBP', direction='BUY', epic='CS.D.BITCOIN.TODAY.IP', expiry='DFB', force_open=True, time_in_force = 'GOOD_TILL_CANCELLED', good_till_date=None, guaranteed_stop=False, level='10800', limit_distance='150', limit_level=None, order_type='LIMIT', deal_reference=None, size='1', stop_distance='150', stop_level=None)
  5. Hi, trying to create a new working order with a trigger level going through the Python trading_ig API. currencyCode = 'GBP' direction = 'BUY' epic = 'CS.D.BITCOIN.TODAY.IP' expiry = 'DFB' forceOpen = True guaranteedStop = True level = str(11450) limitDistance = str(150) timeInForce='GOOD_TILL_CANCELLED' limitLevel = None orderType = 'LIMIT' quoteId = None size = str(1) stopDistance = str(150) stopLevel = None goodTillDate = str(datetime(year = 2020, month = 9, day = 3, hour = 18, minute = 0)) response = ig_service.create_working_order(currencyCode, direction, epic, expiry, guaranteedStop, level, size, timeInForce, orderType, limitDistance, limitLevel, stopDistance, stopLevel, goodTillDate, quoteId, forceOpen, None) However, getting a "InvalidHeader: Value for header {VERSION: 2} must be of type str or bytes, not <class 'int'>" error. Tried various permutations on the string values, have a feeling that the problem lies elsewhere (pebkac most likely 😉 ).
  6. Thank you so much! I would have been completely lost without your help. I was clearly on the wrong track, all sorted and working now.
  7. Hi, thanks again for your response and top tip. I am indeed getting the "LIMIT_ORDER_WRONG_SIDE_OF_MARKET" error. I have realised that I am looking to do a resting order as opposed to an immediate order as explained here: https://labs.ig.com/apiorders Can you get the API Companion working for a limit resting order with a level, the same as what is possible through the main UI dashboard (see attached)? Thanks again for your help!
  8. Hi, thanks @jlzfor your reply but I can't see anything in your C# code that indicates where I have gone wrong. As mentioned, I can't even get this working via the API Companion, let alone through Python. I'll contact IG directly. 👍
  9. Hi, I am trying to do a trade through the API (either Python or the API Companion). I can do a MARKET trade successfully but now I want to do a LIMIT trade, where the trade is executed when a specific price point is reached but I cannot get this to work. I can place the limit order with the level through the IG Trading Dashboard though. Through the API, the LEVEL seems to be completely ignored and so it bypasses the limit and goes straight to market. Here is my Python script for GBPUSD: epic = "CS.D.GBPUSD.TODAY.IP" direction = "BUY" stopDistance = 15 limitDistance = 15 size = 0.5 level = 13130 #(current price is 13125) expiry="DBF" orderType="LIMIT" guaranteedStop=False stopLevel=None trailingStopIncrement=None trailingStop=False forceOpen=True limitLevel=None quoteId=None currencyCode="GBP" response = ig_service.create_open_position(currencyCode, direction, epic, expiry, forceOpen, guaranteedStop, level, limitDistance, limitLevel, orderType, quoteId, size, stopDistance, stopLevel, trailingStop, trailingStopIncrement, None)
  10. Newbie here. I am looking to do a SB trade on Stellar but the "minimum points away" for the stop order is 10. Stellar is trading at 7.6 so this means the stop order goes to negative, which does not make sense....?