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.

IEngine.submitOrder method does not throw an exception
 Post subject: IEngine.submitOrder method does not throw an exception Post rating: 1   New post Posted: Thu 01 May, 2014, 06:51 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
IEngine.submitOrder method does not throw an exception if amount is less than minimum allowed as it is claimed in javadocs.
To prove this run the attached strategy.
package jforex;

import com.dukascopy.api.*;

public final class TestEngineException implements IStrategy {

    public void onStart(IContext context) throws JFException {
        try {
            // amount is less than minimum allowed
            context.getEngine().submitOrder("label", Instrument.EURUSD, IEngine.OrderCommand.BUY, 0.0);
            context.getConsole().getWarn().println("Exception has not been caught");
        } catch (JFException ex) {
            context.getConsole().getNotif().println("Exception is caught: " + ex);
        }
        context.stop();
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onStop() throws JFException {}
}


Attachments:
File comment: Run this strategy to see IEngine.submitOrder method bug.
TestEngineException.java [954 Bytes]
Downloaded 101 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.
 
 Post subject: Re: IEngine.submitOrder method does not throw an exception Post rating: 0   New post Posted: Wed 14 May, 2014, 06:17 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
IEngine.submitOrder method does not throw an exception even if it takes Double.NaN as amount parameter.


 
 Post subject: Re: IEngine.submitOrder method does not throw an exception Post rating: 0   New post Posted: Tue 10 Jun, 2014, 07:10 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
API 2.9.10
The issue still persists.


 
 Post subject: Re: IEngine.submitOrder method does not throw an exception Post rating: 0   New post Posted: Thu 07 Aug, 2014, 12:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The fix available with JForex-API 2.9.12.


 

Jump to:  

  © 1998-2024 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