Marston:
I have some problems loading the feed price all currencies with jForex SDK 2.44.7. Please fix it.
com.dukascopy.api.JFException: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [AUD/CAD, 4 Hours, Bid]
API Support:
This happens because data loading took too long.
That can be solved by loading fewer instruments at once and restarting download with other instruments when the first ones have finished.
Marston:
Intraday is too long??
API Support:
Please run the JClient with open java console and post console output here.
Here is a descriptoin on how to enable the console:
https://www.java.com/en/download/help/javaconsole.xmlPlease note that if there are charts open, the platform will load all the data for those instruments.
Speed of data loading may also be limited due to the internet connection speeds.
fxbird:
I have the same problem with history.getBar(instrument, period, OfferSide.BID, 1);
com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [EUR/USD, 30 Mins, Bid]
at com.dukascopy.api.impl.History.getBarsSecured(History.java:596)
at com.dukascopy.api.impl.History$10.run(History.java:527)
at com.dukascopy.api.impl.History$10.run(History.java:524)
at java.security.AccessController.doPrivileged(Native Method)
at com.dukascopy.api.impl.History.getBars(History.java:524)
at com.dukascopy.api.impl.History.getHistoryBarBlocking(History.java:227)
at com.dukascopy.api.impl.History.getBar(History.java:196)
If I revert to 2.43.2, the same code works fine all the time in my unit tests! Is there a regression in 2.44.7?
My code is simple and I load only one instrument in my unit testing.
duka.instance.startStrategy(new GetContextForTesting());
IHistory history = GetContextForTesting.getHistory();
Instrument instrument = DukaTools.subscribeToInstrument(GetContextForTesting.getContext(), "EUR", "USD");
IBar prevBar = history.getBar(instrument, period, OfferSide.BID, 1);
I am going back to 2.43.2 for now...
PS: my connection speed is 250Mbit/s, and that would not explain why it works with 2.43.2
Marston:
2015-06-03 11:48:24.343 ERROR DCClientImpl$DefaultStrategyExceptionHandler - Exception thrown while running onTick method: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [EUR/USD, 1 Min, Bid]
com.dukascopy.api.JFException: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [EUR/USD, 1 Min, Bid]
at com.dukascopy.api.impl.History.getBar(History.java:198)
at OrdCommand.onTick(OrdCommand.java:475)
at com.dukascopy.api.impl.execution.TaskTick.postData(TaskTick.java:67)
at com.dukascopy.api.impl.execution.AbstractPostDataTask.call(AbstractPostDataTask.java:43)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.runTask(ScienceThreadPoolExecutor.java:904)
at com.dukascopy.api.impl.execution.ScienceThreadPoolExecutor$Worker.run(ScienceThreadPoolExecutor.java:926)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.dukascopy.charts.data.datacache.DataCacheException: Failed to load in-progress candle data in timeout period [EUR/USD, 1 Min, Bid]
at com.dukascopy.charts.data.datacache.IntraperiodCandlesGenerator.getInProgressCandleBlocking(IntraperiodCandlesGenerator.java:1255)
at com.dukascopy.charts.data.datacache.FeedDataProvider.getInProgressCandleBlocking(FeedDataProvider.java:1502)
at com.dukascopy.api.impl.History.getCurrentBar(History.java:204)
at com.dukascopy.api.impl.History.getBar(History.java:193)
... 7 more
Stopping "OrdCommand" strategy at 2015-06-03 09:48:27.082 GMT on the local computer
2015-06-03 11:48:24.353 INFO DCClientImpl - Strategy stopped: 80
Strategy "OrdCommand" is stopped at 2015-06-03 09:48:27.293 GMT on the local computer with no parameters. Reason: Stopped by Engine
fxbird:
I updated my POM today and I tested with 2.45.2. The same problem is still there and can be reproduced each time I run my unit test.
So the issue is there with 2.45.2 and 2.44.7, but it works fine with 2.43.2. I will stay on 2.43.2 until this problem is fixed.
API Support:
We were unable to reproduce this. Please provide full code example.
fxbird:
Ok. The following basic unit test works fine with 2.43.2, but not with 2.44.7 or 2.45.2:
package forex.tools;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IHistory;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.OfferSide;
import com.dukascopy.api.Period;
import com.dukascopy.api.system.ClientFactory;
import com.dukascopy.api.system.IClient;
import forex.strategy.GetContext;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.junit.Test;
import java.util.List;
import java.util.Set;
/**
* To reproduce dukascopy bug
* Created by Eric on 15/06/2015.
*/
@Slf4j
public class LoadingBarBug {
private static final String url = "https://www.dukascopy.com/client/demo/jclient/jforex.jnlp";
private static final String u = "";
private static final String pw = "";
@Test
public void mainTest() throws Throwable {
try {
Instrument instrument = Instrument.EURCAD;
Period period = Period.DAILY;
IClient instance = ClientFactory.getDefaultInstance();
instance.connect(url, u, pw);
int sec = 10;
while (sec > 0 && !instance.isConnected()) { //wait for it to connect
Thread.sleep(1000);
sec--;
}
instance.startStrategy(new GetContext());
IHistory history = GetContext.getHistory();
IContext context = GetContext.getContext();
Set<Instrument> subscribedInstruments = context.getSubscribedInstruments();
subscribedInstruments.add(instrument);
context.setSubscribedInstruments(subscribedInstruments, true);
// wait if instrument is not subscribed or we don't have any LastTick yet
int i = 200;
while ((!context.getSubscribedInstruments().contains(instrument)
|| context.getHistory().getLastTick(instrument) == null)
&& i >= 0) {
Thread.sleep(20);
i--;
}
DateTime time = new DateTime("2015-06-09T00:00:06.000Z");
long startTime = history.getBarStart(period, time.getMillis());
IBar prevBar = history.getBar(instrument, period, OfferSide.BID, 1);
List bars = history.getBars(instrument, period, OfferSide.BID, startTime, prevBar.getTime());
log.info(prevBar.toString());
log.info(bars.toString());
} catch (Exception e) {
log.error(e.toString(), e);
throw e
}
}
}
Here is the strategy for this test (only to get context and history, nothing else)
package forex.strategy;
import com.dukascopy.api.*;
import lombok.Getter;
/**
* Only to get history in testing.
* Created by Eric on 14/04/2015.
*/
public class GetContext implements IStrategy {
@Getter
private static IHistory history;
@Getter
private static IContext context;
@Getter
private static IIndicators indicators;
@Getter
private static IDataService dataService;
@Override
public void onStart(final IContext contextParam) throws JFException {
context = contextParam;
history = context.getHistory();
indicators = context.getIndicators();
dataService = contextParam.getDataService();
}
@Override
public void onTick(final Instrument instrument, final ITick tick) throws JFException {
}
@Override
public void onBar(final Instrument instrument, final Period period, final IBar askBar, final IBar bidBar) throws JFException {
}
@Override
public void onMessage(final IMessage message) throws JFException {
}
@Override
public void onAccount(final IAccount account) throws JFException {
}
@Override
public void onStop() throws JFException {
}
}