Dukascopy
 
 
Wiki JStore Search Login

JFOREX-3668 getOrdersHistory thows an exception in History Tester
 Post subject: JFOREX-3668 getOrdersHistory thows an exception in History Tester Post rating: 0   New post Posted: Fri 30 Mar, 2012, 11:36 
User avatar

User rating: 21
Joined: Thu 19 May, 2011, 20:50
Posts: 413
Location: Germany, Munich
Please check this bug in Historical Tester.

/*     
 * This is a test programm only, do not use for trading!
 * It checks getOrdersHistory(Instrument, long, long) of Interface IHistory
 * At current JForex DEMO version 2.15 this throws an exception in History Tester
 *
 * (c) Stash GmbH Muenchen / Germany     
 *     www.stash.de
 *     Author: Bernhard Schicht
 *     Email: [email protected]
 */


package jforex;

import java.util.*;

import com.dukascopy.api.*;

public class HistoryBug implements IStrategy {
    private boolean firstRun = true;
    private long startTime = 0;
    private int counter = 0;
    public void onTick(Instrument instrument, ITick tick) throws JFException {       
        if (firstRun){
            startTime = tick.getTime();
            firstRun = false;
        }
        counter++;
        if (counter == 100){
            print("calling getOrdersHistory function, startTime = "+startTime+", currentTickTime = "+tick.getTime());
            try{
                    history.getOrdersHistory(instrument , startTime,  tick.getTime());
            }
            catch (Exception e){
                e.printStackTrace(console.getErr());
            }
        }
    }
    public void print(String text){
        console.getOut().println(text);
    }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { }
    public void onAccount(IAccount account) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onStop() throws JFException { }

    public void onStart(IContext context) throws JFException {
        this.engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;
        this.indicators = context.getIndicators();
        this.userInterface = context.getUserInterface();
    }
    private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;

}



If you run this strategy in Historical Tester it will throw

2012-03-30 10:35:37 at java.lang.Thread.run(Unknown Source)
2012-03-30 10:35:37 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2012-03-30 10:35:37 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.actions.StrategyTesterAction.yk(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.actions.StrategyTesterAction.yK(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.t.run(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
2012-03-30 10:35:37 at jforex.HistoryBug.onTick(HistoryBug.java:35)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.al.getOrdersHistory(Unknown Source)
2012-03-30 10:35:37 java.lang.NullPointerException



Bug approved with JForex DEMO version
Dukascopy ver. 2.15
JForex API ver. 2.6.63


 
 Post subject: Re: JFOREX-3668 getOrdersHistory thows an exception in History Tester Post rating: 0   New post Posted: Fri 30 Mar, 2012, 14:51 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Available In a next version.


 

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