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.

Custom dates interval from ITesterClient
 Post subject: Custom dates interval from ITesterClient Post rating: 0   New post Posted: Wed 05 Jun, 2013, 12:53 

User rating: 2
Joined: Wed 05 Jun, 2013, 12:27
Posts: 9
Hello support,

I'd like to run a strategy from a ITesterClient with custom dates interval.
My code is:
      
client = TesterFactory.getDefaultInstance();
       
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");         
Date dateFrom = dateFormat.parse("01/05/2006 00:00:00");
Date dateTo = dateFormat.parse("02/05/2006 00:00:00");
       
client.setDataInterval(ITesterClient.DataLoadingMethod.ALL_TICKS, dateFrom.getTime(), dateTo.getTime());

where client is a ITesterClient. The exception it causes is:

IllegalArgumentException: Desired from time is earlier than tick history start time '2006-04-30 22:00:00:000' > '2007-03-30 16:01:15:688'

I know there isn't any ticks data before 2007. I don't mind as I will filter by Period.ONE_MINUTE in the strategy. The only reason I have used ALL_TICKS is because I can't find any other way to retrieve data in a custom dates interval from a ITesterClient. It works when I ask for the interval 02/05/2013-02/05/2013.

I've also tried with:
client.setDataInterval(Period.ONE_MIN, OfferSide.ASK, ITesterClient.InterpolationMethod.FOUR_TICKS, dateFrom.getTime(), dateTo.getTime());

But then I recieve this other exception I don't understand at all because the dates should be ok as the previous example.
ERROR AbstractHTFlowDataCreator - from(2006-04-30 22:00:00:000) > to(292269055-12-02 16:47:04:192)
java.lang.IllegalArgumentException: from(2006-04-30 22:00:00:000) > to(292269055-12-02 16:47:04:192)


How can I solve the problem? Is any other way to do this?

Sorry in advance if the solution is obvious, I'm just starting with the API.


 
 Post subject: Re: Custom dates interval from ITesterClient Post rating: 0   New post Posted: Wed 05 Jun, 2013, 15:00 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
If there is no tick data before 2007, then why do you try to fetch before that?
Just set the start date (dateFrom) to 2008 or later...


 
 Post subject: Re: Custom dates interval from ITesterClient Post rating: 0   New post Posted: Wed 05 Jun, 2013, 15:07 

User rating: 2
Joined: Wed 05 Jun, 2013, 12:27
Posts: 9
Thank you for your answer, but actually, I'd prefer to fetch data from 2006 with Period.ONE_MINUTE, no ticks, but I don't know how to do that.


 

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