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.

Historical data in standalone Application
 Post subject: Historical data in standalone Application Post rating: 0   New post Posted: Mon 05 Jun, 2017, 20:15 
User avatar

User rating: 2
Joined: Tue 16 Aug, 2011, 19:01
Posts: 70
Location: ItalyItaly
Hi,
I can retrieve historical data in a strategy with following code
  prevBarTime = history.getPreviousBarStart(mMyPeriodDataChart, history.getLastTick(Instrument.AUDUSD).getTime()); 
  startTime =  history.getTimeForNBarsBack(mMyPeriodDataChart, prevBarTime, mNumData);
  java.util.List  listBarsAudusd = history.getBars(Instrument.AUDUSD, mMyPeriodDataChart, OfferSide.BID, startTime, prevBarTime);


I'd like to obtain the same result in a standalone java application using JForex-SDK without using a jforex strategy.

Best regards,
Frank


 
 Post subject: Re: Historical data in standalone Application Post rating: 0   New post Posted: Tue 06 Jun, 2017, 08:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It is possible to call JForex interfaces outside of strategy thread using IContext.executeTask(Callable<T> callable). It is described here:
https://www.dukascopy.com/wiki/en/devel ... /threading


 
 Post subject: Re: Historical data in standalone Application Post rating: 0   New post Posted: Tue 06 Jun, 2017, 12:11 
User avatar

User rating: 2
Joined: Tue 16 Aug, 2011, 19:01
Posts: 70
Location: ItalyItaly
Hi,
I'd like understanding how to obtain IHistory and IContext objects in a standalone application (like the TesterMain in JForex SDK).

In the page that you linked, there is an example that uses a Jforex strategy (it extends an IStrategy objects) and another snippet class BuyTask that uses an IHistory object but is not clear how it obtains this object.

Thanks for reply,
Frank


 
 Post subject: Re: Historical data in standalone Application Post rating: 0   New post Posted: Thu 08 Jun, 2017, 09:23 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
IContext can only be obtained from IStategy. That means that the application needs to start a strategy first.


 

Jump to:  

  © 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