Dukascopy
 
 
Wiki JStore Search Login

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

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

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

getOpenPrice() and getOrderLabel() error
 Post subject: getOpenPrice() and getOrderLabel() error Post rating: 0   New post Posted: Tue 02 Dec, 2014, 14:03 
User avatar

User rating: 0
Joined: Sat 02 Aug, 2014, 10:12
Posts: 23
Location: China, Shijiazhuang
1.When I use getOpenPrice(),it return 0 many times;
2.When I first selecte orders in history,and call the label of some order, it may return null anytime.

So, May the support team fix the bugs?
I hoped this is my mistake and the two methods were OK, but it seems not. How could we trust the methods getOpenPrice() and getLabel() and a lots others which are frequently used?


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 0   New post Posted: Wed 03 Dec, 2014, 08:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi!
Please provide the strategy that replicates the case.


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 0   New post Posted: Mon 08 Dec, 2014, 15:44 
User avatar

User rating: 0
Joined: Sat 02 Aug, 2014, 10:12
Posts: 23
Location: China, Shijiazhuang
Hi,thanks for your reply!
Codes such like these:
1.
IOrder myOrder=engine.submitOrder(OrderLabel, instrument, IEngine.OrderCommand.BUY, 0.01);
myOrder.waitForUpdate(2000, OPENED, FILLED);
double openprice = myOrder.getOpenPrice();
openprice is 0;
Is it because that the order's state is OPENED and the .getOpenPrice() return 0?

2.
List<IOrder> his = history.getOrdersHistory(instrument, time0, time1);
for (IOrder o : his) {
console.getOut().println(o.getLabel());
}
Some times o.getLabel() would be null,particularly when the time0 is very early - such like a month ago.

--------------
Now I have some measures to fix these problems - to check the results returned correct or not.But the problem 2 - "history order's label sometimes would be null" - is very intractability.

Any help?


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 1   New post Posted: Tue 09 Dec, 2014, 17:04 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
1. It's not a bug. State OPENED means that order was sent for execution, but wasn't executed yet. For market order there is no open price before execution. You can wait until order gets executed and then check the price like that:
myOrder.waitForUpdate(2000, FILLED);
myOrder.getOpenPrice();

2. We could not replicate the issue. Does this problem persist? If yes, then please send us exceptions from java console.


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 0   New post Posted: Wed 10 Dec, 2014, 04:22 
User avatar

User rating: 0
Joined: Sat 02 Aug, 2014, 10:12
Posts: 23
Location: China, Shijiazhuang
Thank you for your attention and the replies.
1.yes, the first one is my fault,and it isn't a bug.
2.The second one did happen, I will capture it again and send it to you.

Otherwise, a new problem should be mention that : Sometime there will appear two positions with same order-label. I would like to capture it and send it to you.


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 0   New post Posted: Wed 10 Dec, 2014, 09:09 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Historical orders with the same label is normal situation. You can open one order with some label, then close it, then open new order with the same label, then close second order. It's absolutely legal situation, both orders will be returned by IHistory.getOrdersHistory and they will have equal label.


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 0   New post Posted: Wed 10 Dec, 2014, 09:20 
User avatar

User rating: 0
Joined: Sat 02 Aug, 2014, 10:12
Posts: 23
Location: China, Shijiazhuang
yes,I know that,but not history orders. In actual fact there are two orders with same order-label in filled-state.
It mostly happen when send the two orders almost at the same time.


 
 Post subject: Re: getOpenPrice() and getOrderLabel() error Post rating: 1   New post Posted: Fri 12 Dec, 2014, 09:43 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We were unable to reproduce this issue. Please provide sample strategy that would:
  • Open orders with equal labels
  • Code that you used to print out the details of these orders


 

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