Jump to content

wki

Community Member
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

0 Neutral

About wki

  • Rank
    Occasional Contributor
  1. ok I think I have figured out how to extract the value from lightstreamer and then do something with it. I pass the streaming item through a function that extracts the appropriate value from the item, adds this value to a list, looks at the last item of that list and does something based on that value. Seems to work ok... lst = [] def add2list(item): val = float(item['values']['OFFER']) lst.append(val) if lst[-1] < 58000: return print('below',lst[-1]) else: return print('above',lst[-1]) session = IgStreamingSession(api_key, account_id
  2. Hi, I am trying to update the stops for an existing order using the streaming API. Working / fledgling code so far: import time from ig_streaming_client import IgStreamingSession from lightstreamer_client import LightstreamerSubscription api_key = ""; account_id = ''; rest_api_username = ""; rest_api_password = "" session = IgStreamingSession(api_key, account_id, rest_api_username, rest_api_password) subscription = LightstreamerSubscription('MERGE', ['MARKET:CS.D.BITCOIN.TODAY.IP'], [
  3. Thanks @jlz. Most of that is over my head but I will, as always, chip away.
  4. Ok great, so I can use the streaming api for this. Assuming I can do this over multiple forex pairs? I have the streaming api working in that I have been able to print to screen in Python but have hit a bit of a block going beyond that, wasn't sure if it was possible. Any resources you can recommend on how to do this? I'll look myself but if you have anything at your fingertips, that would be 👍 Thanks!
  5. sorry meant "update the stops when a level is reached'. Here is a link to my fleshed out question:
  6. That allows me to do a simple update of a position but not "update a position when a level is reached' ...?
  7. Through the rest api, the ability to add additional stops and/or limits to existing orders if a level is hit. For example, I have a current sell order in place with a stop at 10,050. If the price moves down to say 9,950, I would like to move the stop quite close to say 9,960. I could achieve this if I could create another instruction on the platform that specifies the level and the stop, linked to the same order id. Also the ability to edit this additional instruction via the rest api. The original stop of 10,050 would still be in place but would be redundant as the 9,960 stop will be hit f
  8. Hi. I have a trading strategy that I would like to execute but it involves moving the stop once when the price drops below a set threshold. Example: Current EURUSD price is at 10,000 (easy numbers) I put down a sell working order with the level set at 9,980 and a stop set at 9,990. The price drops to below 9,980 and the order is placed. As soon as the price drops further to 9,960 or below, the stop is moved close to the current price, i.e. it is moved from 9,990 to 9,965 Note this is a once-off move and a trailing stop won't (I don't think) give me what I n
  9. I have a complex trading strategy and I could use alerts if this was included in the rest api. Pretty please?
  10. 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.
  11. 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!
  12. 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
  13. 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=
  14. 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, direc
  15. 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.
×
×
  • Create New...