A couple questions

Hi,

I was hoping you could help with the following:

  1. when I use

con.get_open_positions().T

the grossPL won’t update when I rerun the function, as far as i understand grossPL is the current profit and loss of the position, not sure why this is not updating?

  1. the “time” part when I run con.get_open_positions().T is giving me a large number. I thought it was unix time and tried to convert it.

eg:

import datetime as dt

time = 11092018192639
dt.datetime.fromtimestamp(time)

when I run it will give

OSError: [Errno 22] Invalid argument

I’m getting this error as the number is too large. I would like to get the exact date and time for when the position was opened

how to update a stoploss for a pricelevel? not just the amount of pips.

I would want to be able to create orders for the market open at night. is there any functionality for this?

thanks

1 Like

Hi @Jens,

  1. Yes it should update in real time unless trading for that particular instrument is closed. Can you give me more details such as the instrument(s) you were trading and you observed this consistently or just once?
  2. The time identifier is showing MM/DD/YYYY HH:MM:SS without any spaces. So 11092018192639 = 11/09/2018 19:26:39. I’m checking with the team to see if there’s a way to convert it to an easier to read format and will revert back to you.
  3. You would use is_in_pips = False. So to change an open order’s stop, use
    con.change_trade_stop_limit(tradeId, is_in_pips=False,
    is_stop=True, rate=1.1400)
  4. Are you wanting to create an entry order to open a trade at a specific time, or are you wanting to restrict your system from placing trades during certain times?

thanks for the swift response.

I was testing it on USDJPY and EURUSD

in regards to 4:

I have some manual trading strategies which take trades at the close (or opening of the next day). As I don’t want to be or can always be at my computer at that time, I’d like to create a function where I can enter the entry/sl/target for the trade to be taken at the open / close

Hi @Jens, in regards to #1, the developers are aware of this issue and working on a fix. I will update the thread once it has been released.
For #4, fxcmpy does not have a function for this but we did find an Event Scheduler Python class which we believe would work for you: https://docs.python.org/3/library/sched.html#sched.scheduler

1 Like

Hi @QN_Liza , do we have any update on the gross PL issue? Would you please give alternative way as I will use it for my exit trigger. Basically I want my algo to close all position if certain gross PL is achieved.

Thanking you in advance

1 Like

@adrian and @Jens, the issue with gross P/L not updating has now been resolved on both demo and live. Please try again and let me know if you’re still experiencing the issue.

2 Likes

thanks Liza,

I’ve got another question. Let me know if I should post this in a new thread.

df = con.get_candles('GBP/USD', period='m15',start= dt.datetime(2018, 1, 1),end = 
dt.datetime(2018, 10, 10))

for some reason the lower time periods seem to give me an error as I’m getting this:

ServerError: FXCM Server reports an error: Invalid from/to parameneters..

I’ve consulted the API documentation and it should be written as a string, ‘m15’ so that looks fine to me.

thanks

@Jens the reason you are getting the error is because you are trying to pull more than 10,000 candles. The max you can pull is 10,000. I tried your code and was able to pull from 13 March without an error.

The 10,000 candle limit is not in the Python wrapper documentation (but should be, thanks for bringing this up). It is in the REST API documentation, page 33.

Thanks @QN_Liza, I tested it in demo account using while loop and .get_accounts().T and it works like a charm.

1 Like

Hi Liza, have you also got any updates in regards to 2. ? thanks!

thanks for that too. Will this change in the future the 10 000 candle limit or is there a way around it?

Hi @Jens, we do not have plans to change it at the moment but I have sent this feedback to our team for new improvements.

Also, in regards to #2,

Please try this:

from datetime import datetime as dt
time = con.get_open_positions().iloc[0]['time']
dt.strptime(time,'%m%d%Y%H%M%S')
It returns:
datetime.datetime(2018, 11, 20, 14, 37, 2)

Hi,

thanks. that’s indeed an option but it would be useful in the future to have it build in so when you call open positions you have the right format straight away instead of having to separately modify it. Not a major problem though!