Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Rollover daily message?
 Post subject: Rollover daily message? Post rating: 0   New post Posted: Sat 24 Aug, 2013, 13:20 

User rating: 0
Joined: Sat 08 Jun, 2013, 12:05
Posts: 71
Location: FranceFrance
Is there a daily message for this, that you can detect with the api? (between 9pm and 10pm)

If not what is the workaround to show the daily profit and loss of an order since the lastest rollover?
for the moment I have set 9:00pm, and map the order with the instrument price at this time

thanks

edit: may I suggest to provide the last rollover time in IClientInfo and IAccount interfaces (just rollover close)


 
 Post subject: Re: Rollover daily message? Post rating: 0   New post Posted: Tue 27 Aug, 2013, 12:45 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
On rollover the position open price (i.e., IOrder.getOpenPrice) gets adjusted to resemble the rollover amount that has been applied to the position. On such open price change an IMessage.Type.ORDER_CHANGED_OK message arrives in IStrategy.onMessage. Thus to get the rollover amounts you have to store the previous open price, get the difference with the current open price and then multiply it with the position amount. Position's daily profit and loss you can simply fetch shortly after the settlement by calling IOrder.getProfitLossInAccountCurrency.


 
 Post subject: Re: Rollover daily message? Post rating: 0   New post Posted: Thu 29 Aug, 2013, 18:22 

User rating: 0
Joined: Sat 08 Jun, 2013, 12:05
Posts: 71
Location: FranceFrance
Thanks
API Support wrote:
Position's daily profit and loss you can simply fetch shortly after the settlement by calling IOrder.getProfitLossInAccountCurrency.

Just to be sure getProfitLossInAccountCurrency returns the daily pnl in account currency? or the pnl since order fill time?

edit: after checking, it's probably pnl since creation time

How precisely is the rollover notified with ORDER_CHANGED, since there is normally 1 close, followed by an open order I guess?
there are 2 events or just one?


 
 Post subject: Re: Rollover daily message? Post rating: 0   New post Posted: Fri 30 Aug, 2013, 13:36 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
lil wrote:
Just to be sure getProfitLossInAccountCurrency returns the daily pnl in account currency? or the pnl since order fill time?

edit: after checking, it's probably pnl since creation time
The fill time.
lil wrote:
there are 2 events or just one?
Just one message per position, you can make sure of this by leaving overnight a strategy which prints order-related messages.


 

Jump to:  

cron
  © 1998-2026 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com