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.

Exception by loding history data with custom period
 Post subject: Exception by loding history data with custom period Post rating: 0   New post Posted: Sat 02 Mar, 2013, 23:48 

User rating: 0
Joined: Mon 18 Feb, 2013, 14:51
Posts: 12
Location: GermanyGermany
Hello support,
i try to load history data with following code
Period period =Period.createCustomPeriod(Unit.Week, 2);
long lastBarTime = history.getPreviousBarStart(period, history.getStartTimeOfCurrentBar(getInstrument(), period));
List<IBar> list = history.getBars(getInstrument(), period, OfferSide.BID, Filter.WEEKENDS, 10, lastBarTime, 0);
and take
Exception by history loading - com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period
What is wrong ?


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Mon 04 Mar, 2013, 09:10 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Does the problem persist? If it does, please provide full example strategy which replicates the case.


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Mon 04 Mar, 2013, 09:55 

User rating: 0
Joined: Mon 18 Feb, 2013, 14:51
Posts: 12
Location: GermanyGermany
Complete strategy is to big. This is the sample to reproduce error.
Same error i take if use any custom period. Instrument is not null.

package test;

import java.util.List;

import com.dukascopy.api.Filter;
import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IHistory;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.OfferSide;
import com.dukascopy.api.Period;
import com.dukascopy.api.Unit;

public class SampleStrategy implements IStrategy {
   private IHistory history = null;
   private Instrument instrument  = null;

   @Override
   public void onStart(IContext context) throws JFException {
      history =context.getHistory();
      instrument = context.getLastActiveChart().getInstrument();
      List<IBar> historyBars  = doGetHistory();
                  //DO tms with list
      
   }
   
   private List<IBar> doGetHistory()  throws JFException{
      Period period =Period.createCustomPeriod(Unit.Week, 2);
      long lastBarTime = history.getPreviousBarStart(period, history.getStartTimeOfCurrentBar(getInstrument(), period));
      return history.getBars(getInstrument(), period, OfferSide.BID, Filter.WEEKENDS, 10, lastBarTime, 0);      
   }

   @Override
   public void onTick(Instrument instrument, ITick tick) throws JFException {
      // TODO Auto-generated method stub

   }

   @Override
   public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
      // TODO Auto-generated method stub

   }

   @Override
   public void onMessage(IMessage message) throws JFException {
      // TODO Auto-generated method stub

   }

   @Override
   public void onAccount(IAccount account) throws JFException {
      // TODO Auto-generated method stub

   }

   @Override
   public void onStop() throws JFException {
      // TODO Auto-generated method stub

   }

   public Instrument getInstrument() {
      return instrument;
   }

   public void setInstrument(Instrument instrument) {
      this.instrument = instrument;
   }

}


Another question - how to take custom period form chart? Is it possible ? I have tried and take - null.


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Mon 04 Mar, 2013, 16:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Zlatogorov wrote:
Complete strategy is to big. This is the sample to reproduce error.
Same error i take if use any custom period. Instrument is not null.
We could not reproduce this.
Zlatogorov wrote:
Another question - how to take custom period form chart? Is it possible ? I have tried and take - null.
Try:


Attachments:
GetCustomActiveChartPeriod.java [1.34 KiB]
Downloaded 307 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: Exception by loding history data with custom period Post rating: 0   New post Posted: Wed 06 Mar, 2013, 19:46 

User rating: 0
Joined: Mon 18 Feb, 2013, 14:51
Posts: 12
Location: GermanyGermany
Thanks,
i have try but result it the same
18:45:15 com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period @ jforex.StrategyTST.onStart(StrategyTST.java:31)
Instrument - AUDUSD , time frame - 3 Days, DEMO account.


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Mon 11 Mar, 2013, 11:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Do you get the same exception with GetCustomActiveChartPeriod.java? Does the problem persist after deleting your local cache?


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Tue 12 Mar, 2013, 08:47 

User rating: 0
Joined: Mon 18 Feb, 2013, 14:51
Posts: 12
Location: GermanyGermany
Yes. I take same error.


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Tue 12 Mar, 2013, 08:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
API Support wrote:
Does the problem persist after deleting your local cache?


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Tue 12 Mar, 2013, 10:18 

User rating: 0
Joined: Mon 18 Feb, 2013, 14:51
Posts: 12
Location: GermanyGermany
Local cache was cleared before.


 
 Post subject: Re: Exception by loding history data with custom period Post rating: 0   New post Posted: Wed 13 Mar, 2013, 08:33 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We can't replicate the case, the strategy for us works as expected.


 

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