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.

API for Portfolio Statement
 Post subject: API for Portfolio Statement Post rating: 0   New post Posted: Thu 13 Dec, 2012, 11:46 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hi Dukascopy Team,

Can you please provide API for Portfolio Statement on Trade Detail level.

Currently it is not possible to determine thru API how a trade really went. Don't have information about partial fills, even if I store info about partial fills in database I still don't have information about settlement price which influeces final Profit and Loss.

Current solution with IHistory of IOrders is imperfect. Provides only general data and results are not accurate.

Thanks and best regards,
kurak


 
 Post subject: Re: Generating position report Post rating: 0   New post Posted: Thu 13 Dec, 2012, 13:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
kurak777 wrote:
Currently it is not possible to determine thru API how a trade really went. Don't have information about partial fills, even if I store info about partial fills in database I still don't have information about settlement price which influeces final Profit and Loss.
You can fetch the information about partial fills from onMessage, according to the order workflow, see the IOrder.State.FILLED rectangle in:
https://www.dukascopy.com/wiki/#Order_state/Market_order_states_diagram
The settlement price can be retrieved by IOrder.getOpenPrice, since it gets updated on every settlement.
kurak777 wrote:
Current solution with IHistory of IOrders is imperfect. Provides only general data and results are not accurate.
Please be more specific, such that we can either advise how to retrieve the values or improve the API if there is some discrepancy.


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Thu 13 Dec, 2012, 14:13 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Quote:
You can fetch the information about partial fills from onMessage, according to the order workflow, see the IOrder.State.FILLED rectangle in:
https://www.dukascopy.com/wiki/#Order_st ... es_diagram
The settlement price can be retrieved by IOrder.getOpenPrice, since it gets updated on every settlement.


I do fetch partial closes now, it works well. Though it would be much easier to have access to Portfolio Statement directly thru API. Current solution is data redundancy. I have to store the same data which is already available on your web server.

I can't confirm that getOpenPrice() return settlement price or maybe we are talking about different things. Anyway I mean column "Settl.Price" in attached screenshots.

Quote:
Please be more specific, such that we can either advise how to retrieve the values or improve the API if there is some discrepancy.


Let me provide two examples. I already reported one of them in bug section.

Please consider one trade, no partial closes - results given in Portfolio Statement are different than those retrived by methods of IOrder (attachment ex1.png):
Attachment:
ex1.png [33.62 KiB]
Downloaded 490 times


Please conider merged order - results given in Portfolio Statement are completly different than those retrived by methods of IOrder (attachment ex2.png)
Attachment:
ex2.png [36.76 KiB]
Downloaded 494 times


best regards,
kurak


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Fri 14 Dec, 2012, 13:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
kurak777 wrote:
I do fetch partial closes now, it works well. Though it would be much easier to have access to Portfolio Statement directly thru API. Current solution is data redundancy. I have to store the same data which is already available on your web server.
The feature request for this has been registered.

kurak777 wrote:
Please consider one trade, no partial closes - results given in Portfolio Statement are different than those retrived by methods of IOrder (attachment ex1.png):
What formula did you use? We obtained the following result:
(closePrice-openPrice)*amount/closePrice = (1,29514 - 1,29313) * 395251/ 1,29514 = 613,41 EUR

kurak777 wrote:
Please conider merged order - results given in Portfolio Statement are completly different than those retrived by methods of IOrder (attachment ex2.png)
This has been registered.


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Fri 14 Dec, 2012, 15:33 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hi,

Thanks for resposne and registration of the issues.

Quote:
What formula did you use? We obtained the following result:
(closePrice-openPrice)*amount/closePrice = (1,29514 - 1,29313) * 395251/ 1,29514 = 613,41 EUR


Your results still differ comparing to Position Statment.

I did not use a formula to retrive Profit, the value was retrieved by IOrders's method - getProfitInAccountCurrency().

best regards,
kurak


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Thu 31 Jan, 2013, 16:16 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
For open positions:
The Profit/Loss value depends on the last tick bid/ask prices. It can be changed several time per second.
Therefore it is impossible to see the similar P/L values via Platform->Positions table (P/L columns is updated synchronously on new tick received)
and Portfolio Statement reports which is updated manually by click "Reload" button.
For closed positions:
P/L depends on the last market prices of the order's instrument on the moment of receiving order data.


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Thu 14 Feb, 2013, 13:51 
User avatar

User rating: 7
Joined: Fri 13 Jan, 2012, 20:49
Posts: 94
Location: Poland, Warsaw
Hi DS Team,

Regarding Open Position I understand and I fully agree.

But regarding Closed Position data which is used among others for trade history analysis it is very important to have consistent results. And current behaviour does not gurantee this.

For example for trades made 1 year ago on USD/JPY profit given by getProfitLossInAccountCurrency() method would result in around 15% difference comparing to result from year before. Such inaccurate data is not very useful. That is why I would like to ask you to think about implementing API for Portfolio Statement (and by Portfolio Statement I mean consistent data for closed trades and position) so that getProfitLossInAccountCurrency() method for closed orders returns the same value every time it is called.

best regards,
kurak


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Tue 29 Apr, 2014, 19:26 
User avatar

User rating: 0
Joined: Wed 07 Mar, 2012, 06:02
Posts: 58
Location: SwitzerlandSwitzerland
Any update on the "Portfolio Statement" correction?

Also, please add the Profit/loss in "PIPS" to the Statement - thank you!


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Fri 02 May, 2014, 13:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please post your Portfolio Statement change requests in the Trading Platforms section.


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Sat 03 May, 2014, 16:21 
User avatar

User rating: 0
Joined: Wed 07 Mar, 2012, 06:02
Posts: 58
Location: SwitzerlandSwitzerland
Do you have a link to an existing thread or do i need to create a new topic there?


 
 Post subject: Re: API for Portfolio Statement Post rating: 0   New post Posted: Tue 06 May, 2014, 09:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please post a new topic.


 

Jump to:  

cron
  © 1998-2025 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