|
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.
Order rejected due to validation failure... |
Marston
|
Post subject: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Mon 09 Sep, 2013, 12:37
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
Greetings, after several attempts to solve a problem, and not finding more information in your documentation I you hope to be able to understand how to intervene in this grave mistake. Using NetBeans IDE 7.1.1 I am trying to connect to your server to try to modify pending orders already accepted by your server, but I get the following error output: " Your order has been rejected due to validation failure. Invalid order StopDirection: null, order amount is empty or zero." Basically I wanted to understand if you have a solution or some line of code WHICH CAN give me a permanent solution and correct. I am attaching the code concerned. if(ord.getState() == IOrder.State.OPENED) { if(ord.getId()==frame.getPnlOrdersOrdIDModify()){//Find the Order to edit if(ord.getOpenPrice()!=frame.getPnlOrdersPriceModify()){//Compares OpenPrice if different modify OpenPrice try { ord.setOpenPrice(frame.getPnlOrdersPriceModify()); //Set OpenPrice existing order //ord.waitForUpdate(5000); } catch (JFException e) { e.printStackTrace(); } } } }
With this code I get the output: Your order has been rejected due to validation failure. Invalid order StopDirection: null, order amount is empty or zero.With a procedure, I WOULD LIKE TO modify the opening price of existing and pending order accepted by you. It is important to note that the code is part of a Desktop Application with the java language outside of the JForex. Best Regards N.B. I do not use Maven
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Mon 09 Sep, 2013, 13:07
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
- What JForex-API version do you use?
- The code snippet does not suffice to detect the reason of the validation failure. Please provide an example program which replicates the case.
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 08:00
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
1. I use JForex-API ver 2.6.72 2. The above code, are more than enough to understand, because only those manage modification of pending orders. getPnlOrdersOrdIDModify property () represents the ordId. getPnlOrdersPriceModify property () represents the new price. Both are called by an action through buttons. The above code is inside onBar(). The class that contains onBar() connected to the Main. The structure of the program is the same as here: https://www.dukascopy.com/wiki/#Use_in_NetBeansBut the question is, what does StopDirection: null and order amount is empty or zero? What is the correct procedure to modify an existing order?
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 08:10
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The version that you use is more than 1 year old. Please use the latest JForex-API version. Does the error repeat with the latest JForex-API version?
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 08:40
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
where can I find the latest version updated? the latest version is?
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 08:50
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 09:18
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
The repository do not work. These links they send me on your home page or 404 Error Page not found. I can't find the updated libraries. I would like to repeat that I do not use Maven. Here are the updated libraries? https://www.dukascopy.com/client/jforexl ... Forex-SDK/So, is it 2.27.1 the latest version? Please can you confirm?
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 09:26
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
We have updated the links. Marston wrote: I would like to repeat that I do not use Maven. That is the only configuration available. Please follow the given instructions in the first link of our previous post.
|
|
|
|
 |
tcsabina
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Tue 10 Sep, 2013, 09:33
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 09:35
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
I changed and updated libraries unfortunately I get the same error: "Your order has been rejected due to validation failure. Invalid order StopDirection: null, order amount is empty or zero"
Please I want to know what is "StopDirection" and "order amount". I think the problem is just that. Let me know...
Thanks
|
|
|
|
 |
tcsabina
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 09:58
|
|
User rating: 164
Joined: Mon 08 Oct, 2012, 10:35 Posts: 676 Location: NetherlandsNetherlands
|
Order amount: the unit that you have use (or going to be used when the order is filled) StopDirection: just guessing: SL level above/below open price Probably something wrong with the order you are trying to modify. I suggest to do some extra checks on the order, before you try to modify the openprice: ... if(ord.getOpenPrice()!=frame.getPnlOrdersPriceModify()){//Compares OpenPrice if different modify OpenPrice try { console.getOut().println("order amount: " + ord.getAmount()); console.getOut().println("order openprice before change: " + ord.getOpenPrice()); console.getOut().println("order SL: " + ord.getStopLossPrice()); console.getOut().println("order TP: " + ord.getTakeProfitPrice()); console.getOut().println("order is : " + (ord.isLong() ? "LONG" : "SHORT")); console.getOut().println("order openprice new: " + frame.getPnlOrdersPriceModify()); ord.setOpenPrice(frame.getPnlOrdersPriceModify()); //Set OpenPrice existing order //ord.waitForUpdate(5000); } catch (JFException e) { e.printStackTrace(); }
If this all brings out nothing, you might facing a bug, but for that to verify you have to provide the complete strategy that replicates the case. Because as Support pointed out, the piece of code snippet you provided isn't showing much...
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 11:09
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
Quote: Order amount: the unit that you have use (or going to be used when the order is filled) StopDirection: just guessing: SL level above/below open price I would like to get technical support. StopDirection is not about SL. Stop and lets technical support talk. Quote: Please provide a full example program which replicates this. The code I posted is more than enough This is not a strategy, but a Desktop application. Through 2 buttons, I enter the price I want to modify. I identify the order and wait For the server's answer. There is no need to post 1000 lines of code! I would like to know what is StopDirection and order amount.What do you want to change a pending order already accepted?
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 12:33
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Marston wrote: The code I posted is more than enough From the snippet alone we can't conclude what could be the reasons for the exception that you get, also because we have no information about the orders that you are trying to modify. Hence, your example program should create orders and then process them in such a way that the exception with the same message gets thrown.
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 13:03
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
In the next few days I'll create a program. In the meantime, can you tell me what is StopDirection and order amount (third time)?
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 13:31
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
StopDirection is an internal property for conditional orders. For order amount see the javadocs: https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IOrder.html#getAmount()We did additional investigation on the matter - could it be that you are trying to modify open price for market orders? In this case the validation would fail, because once the order has been submitted on server it is bound to immediate execution at the current market price and setting open price does not make any sense there. Use IOrder.getOrderCommand().isConditional() for checking if the order is conditional.
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 14:30
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
Quote: We did additional investigation on the matter - could it be that you are trying to modify open price for market orders? In this case the validation would fail, because once the order has been submitted on server it is bound to immediate execution at the current market price and setting open price does not make any sense there. Use IOrder.getOrderCommand().isConditional() for checking if the order is conditional. Of corse, I’m trying to modify an order already accepted (stop and limit). The orders I create with this programm will be just Stop or Limit According to your answer, it is not possible to modify orders Stop or Limit already entered and accepted by you, even if this latter has a price hardly reachable by the market (ex. EURUSD Price: 1.9000 Side:Sell Type: Limit)?? Please, confirm this. Then, the only choice would be to cancel the old order and create a new one with the new price: is it right? Please, confirm also this. It is really important
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 15:16
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Marston wrote: Of corse, I’m trying to modify an order already accepted (stop and limit).
The orders I create with this programm will be just Stop or Limit Consider adding an additional check that we suggested in our previous post to make sure that this is the case. Marston wrote: According to your answer, it is not possible to modify orders Stop or Limit already entered and accepted by you, even if this latter has a price hardly reachable by the market (ex. EURUSD Price: 1.9000 Side:Sell Type: Limit)?? Please, confirm this. This is not what we said and this is not the case. There is different logic for Market and Conditional orders, your strategy needs to handle this properly. And it is easy to check that this is not the case, consider the following strategy: private IOrder order;
@Override public void onStart(IContext context) throws JFException { engine = context.getEngine(); console = context.getConsole(); ITick tick = context.getHistory().getLastTick(Instrument.EURUSD); order = engine.submitOrder("MarketOrder"+System.currentTimeMillis(), Instrument.EURUSD, OrderCommand.BUY, 0.01); order.waitForUpdate(State.OPENED); try{ //this should raise the exception as one can't change an opened MARKET order order.setOpenPrice(tick.getBid() + Instrument.EURUSD.getPipValue() * 5); } catch (JFException e){ console.getErr().println(e); } order = engine.submitOrder("ConditionalOrder"+System.currentTimeMillis(), Instrument.EURUSD, OrderCommand.BUYSTOP, 0.01, Instrument.EURUSD.getPipValue() * 5); order.waitForUpdate(State.OPENED); try{ order.setOpenPrice(tick.getBid() + Instrument.EURUSD.getPipValue() * 10); } catch (JFException e){ console.getErr().println(e); } } Attachment: Marston wrote: Then, the only choice would be to cancel the old order and create a new one with the new price: is it right? Please, confirm also this. No this is not the case, you can modify any opened conditional order.
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Wed 11 Sep, 2013, 17:09
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
I made 2 files. JavaApplicationTest.rar is a NetBeans project. PlayStrategyForJforex is the same strategy that you can find in JavaApplicationTest.rar
Now, if PlayStrategyForJforex works inside JForex, PlayStrategyForJforex does not create problems. In fact, inserts 3 orders and change the OpenPrice immediately.
If you load the project in NetBeans, you have 3 pending orders but You cannot change the open price because it will raise the exception, "Your order has been rejected due to validation failure. Invalid order StopDirection: null, order amount is empty or zero"
I hope that you now understand the problem, solve it, or advise me.
Thanks
Attachments: |
PlayStrategyForJforex.java [1.48 KiB]
Downloaded 116 times
|
JavaApplicationTest.rar [17.96 KiB]
Downloaded 83 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Thu 12 Sep, 2013, 09:01
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
It works for us both from JForex-SDK and the JForex platform. Again, please make sure you use the latest JForex-SDK version - you can check it also the following way (simply add this program to your NetBeans project and launch it): package singlejartest;
import com.dukascopy.api.system.IClient; import com.dukascopy.dds2.greed.GreedClient;
public class VersionCheck {
public static void main(String[] args) { System.out.println( GreedClient.class.getProtectionDomain().getCodeSource().getLocation()+ "\n" + IClient.class.getProtectionDomain().getCodeSource().getLocation() ); }
}
|
|
|
|
 |
Marston
|
Post subject: Re: Order rejected due to validation failure... |
Post rating: 0
|
Posted: Thu 12 Sep, 2013, 13:44
|
|
User rating: 0
Joined: Wed 29 May, 2013, 04:14 Posts: 62
|
Thanks very much for the support. I fixed the problem. Now everything works correctly. The problem was the libraries!!!
Best Regards
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|