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.

No data being received for EURUSD, other pairs are fine
 Post subject: No data being received for EURUSD, other pairs are fine Post rating: 0   New post Posted: Wed 06 Feb, 2013, 20:43 

User rating: 0
Joined: Wed 06 Feb, 2013, 20:36
Posts: 3
Since this morning, no data being received via API for EURUSD.
Other pairs such as CHJPY seem to be working fine and data is received.
There are following messages:

Feb 06, 2013 7:40:02 PM com.dukascopy.api.impl.connect.AuthorizationClient getRetrievePropsFromResponse
INFO: Properties received
Feb 06, 2013 7:40:02 PM com.dukascopy.api.impl.connect.WLabelData <init>
WARNING: White Label Image is not received
Feb 06, 2013 7:40:02 PM singlejartest.Main$1 onConnect
INFO: Connected
Feb 06, 2013 7:40:03 PM singlejartest.Main main
INFO: Subscribing instruments...
Feb 06, 2013 7:40:03 PM singlejartest.Main main
INFO: Starting strategy
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [GBP/USD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"135.27","apa":"1.56675","a":"1.56662,1.5,0.0,1.56663,1.5,0.0,1.56665,2.63,0.0,1.56666,6.58,0.0,1.56667,2.83,0.0,1.56669,17.25,0.0,1.56670,12.2,0.0,1.56671,32.83,0.0,1.56672,3.75,0.0,1.56673,37.33,0.0","t":"1360179552548","apb":"1.5664","b":"1.56652,2.25,0.0,1.56651,4.5,0.0,1.56649,1.73,0.0,1.56648,4.7,0.0,1.56647,5.63,0.0,1.56646,3.68,0.0,1.56645,9.38,0.0,1.56644,19.13,0.0,1.56643,11.45,0.0,1.56642,35.05,0.0","pip":"0.0001","i":"GBP/USD","type":"marketState","tla":"157.35"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [AUD/CAD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"76.08","apa":"1.02817","a":"1.02799,1.5,0.0,1.02803,2.1,0.0,1.02804,1.5,0.0,1.02805,3.75,0.0,1.02807,6.2,0.0,1.02808,3.38,0.0,1.02810,2.83,0.0,1.02812,6.5,0.0,1.02814,3.75,0.0,1.02816,18.05,0.0","t":"1360179588503","apb":"1.02761","b":"1.02781,1.73,0.0,1.02776,2.84,0.0,1.02775,1.5,0.0,1.02773,3.38,0.0,1.02769,3.75,0.0,1.02766,4.9,0.0,1.02765,5.63,0.0,1.02763,9.03,0.0,1.02762,3.75,0.0,1.02760,24.7,0.0","pip":"0.0001","i":"AUD/CAD","type":"marketState","tla":"69.07"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [USD/CHF] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"150.26","apa":"0.90962","a":"0.90947,1.35,0.0,0.90948,1.5,0.0,0.90950,1.13,0.0,0.90951,11.53,0.0,0.90952,8.88,0.0,0.90954,26.45,0.0,0.90955,10.88,0.0,0.90956,16.88,0.0,0.90957,12.2,0.0,0.90958,39.73,0.0","t":"1360179587858","apb":"0.90921","b":"0.90934,3.0,0.0,0.90933,1.5,0.0,0.90932,1.5,0.0,0.90931,18.75,0.0,0.90930,12.75,0.0,0.90929,9.58,0.0,0.90928,6.75,0.0,0.90927,3.75,0.0,0.90926,3.75,0.0,0.90925,32.2,0.0","pip":"0.0001","i":"USD/CHF","type":"marketState","tla":"184.26"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [USD/JPY] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"126.33","apa":"93.415","a":"93.404,1.73,0.0,93.405,5.1,0.0,93.406,4.13,0.0,93.407,19.7,0.0,93.408,17.58,0.0,93.409,9.38,0.0,93.410,14.08,0.0,93.411,10.15,0.0,93.412,11.08,0.0,93.413,51.43,0.0","t":"1360179603894","apb":"93.385","b":"93.394,4.69,0.0,93.393,1.88,0.0,93.392,3.54,0.0,93.391,14.08,0.0,93.390,20.63,0.0,93.389,11.25,0.0,93.388,3.38,0.0,93.387,3.75,0.0,93.386,7.5,0.0,93.385,33.6,0.0","pip":"0.01","i":"USD/JPY","type":"marketState","tla":"197.07"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [EUR/GBP] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"175.51","apa":"0.86288","a":"0.86274,2.25,0.0,0.86275,4.5,0.0,0.86278,3.23,0.0,0.86279,3.75,0.0,0.86280,5.63,0.0,0.86281,7.13,0.0,0.86282,15.38,0.0,0.86283,7.5,0.0,0.86284,16.88,0.0,0.86285,34.58,0.0","t":"1360179599188","apb":"0.8625","b":"0.86265,1.5,0.0,0.86264,2.25,0.0,0.86262,2.85,0.0,0.86261,4.7,0.0,0.86260,2.83,0.0,0.86259,5.63,0.0,0.86258,15.95,0.0,0.86257,16.88,0.0,0.86256,8.63,0.0,0.86255,49.2,0.0","pip":"0.0001","i":"EUR/GBP","type":"marketState","tla":"153.05"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [XAG/USD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"0.97","apa":"31.865","a":"31.834,0.02,0.0,31.835,0.02,0.0,31.836,0.03,0.0,31.840,0.05,0.0,31.842,0.05,0.0,31.850,0.13,0.0,31.860,0.18,0.0,31.870,0.18,0.0,31.880,0.4,0.0","t":"1360179604028","apb":"31.774","b":"31.800,0.03,0.0,31.798,0.03,0.0,31.797,0.02,0.0,31.794,0.05,0.0,31.790,0.13,0.0,31.780,0.18,0.0,31.770,0.15,0.0,31.760,0.38,0.0","pip":"0.01","i":"XAG/USD","type":"marketState","tla":"1.06"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [CHF/JPY] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"121.52","apa":"102.728","a":"102.712,2.25,0.0,102.714,2.33,0.0,102.715,1.8,0.0,102.716,8.83,0.0,102.717,6.1,0.0,102.718,3.95,0.0,102.720,9.2,0.0,102.721,11.25,0.0,102.722,11.03,0.0,102.723,30.58,0.0","t":"1360179598877","apb":"102.674","b":"102.694,1.73,0.0,102.692,2.78,0.0,102.690,1.65,0.0,102.688,3.75,0.0,102.687,3.75,0.0,102.685,6.2,0.0,102.684,13.13,0.0,102.682,7.7,0.0,102.680,11.7,0.0,102.679,25.53,0.0","pip":"0.01","i":"CHF/JPY","type":"marketState","tla":"128.57"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [EUR/USD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"168.83","apa":"1.35162","a":"1.35145,1.5,0.0,1.35148,4.5,0.0,1.35149,1.35,0.0,1.35150,7.98,0.0,1.35151,4.7,0.0,1.35153,13.7,0.0,1.35154,22.5,0.0,1.35158,3.75,0.0,1.35159,16.28,0.0,1.35163,48.28,0.0","t":"1360179602336","apb":"1.3513","b":"1.35140,3.0,0.0,1.35139,1.5,0.0,1.35138,7.13,0.0,1.35137,4.33,0.0,1.35136,46.88,0.0,1.35135,8.45,0.0,1.35133,11.08,0.0,1.35131,19.7,0.0,1.35130,2.63,0.0,1.35128,46.7,0.0","pip":"0.0001","i":"EUR/USD","type":"marketState","tla":"152.32"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [XAU/USD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"0.0405","apa":"1678.026","a":"1677.970,5.0E-4,0.0,1677.973,4.0E-4,0.0,1677.990,8.0E-4,0.0,1677.997,5.0E-4,0.0,1678.000,0.005,0.0,1678.007,0.002,0.0,1678.010,0.005,0.0,1678.017,0.002,0.0,1678.020,0.003,0.0,1678.027,0.01,0.0","t":"1360179603698","apb":"1677.481","b":"1677.607,4.0E-4,0.0,1677.570,4.0E-4,0.0,1677.552,2.0E-4,0.0,1677.533,5.0E-4,0.0,1677.523,0.002,0.0,1677.513,0.002,0.0,1677.503,0.002,0.0,1677.500,0.002,0.0,1677.493,0.002,0.0,1677.490,0.02,0.0","pip":"0.01","i":"XAU/USD","type":"marketState","tla":"0.0359"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [AUD/USD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"115.63","apa":"1.03163","a":"1.03150,1.5,0.0,1.03152,3.0,0.0,1.03154,1.73,0.0,1.03155,6.58,0.0,1.03156,8.93,0.0,1.03157,31.88,0.0,1.03158,5.63,0.0,1.03160,2.83,0.0,1.03162,19.88,0.0,1.03165,37.25,0.0","t":"1360179589193","apb":"1.03127","b":"1.03138,1.73,0.0,1.03137,1.5,0.0,1.03135,4.13,0.0,1.03134,7.5,0.0,1.03133,15.0,0.0,1.03132,7.75,0.0,1.03131,9.38,0.0,1.03130,2.83,0.0,1.03129,5.08,0.0,1.03128,39.48,0.0","pip":"0.0001","i":"AUD/USD","type":"marketState","tla":"133.56"}]
Feb 06, 2013 7:40:04 PM com.dukascopy.api.impl.connect.JForexTaskManager onMarketState
WARNING: Got tick for instrument [USD/CAD] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"128.32","apa":"0.99671","a":"0.99659,2.25,0.0,0.99661,5.4,0.0,0.99663,5.18,0.0,0.99664,3.95,0.0,0.99665,8.45,0.0,0.99666,20.63,0.0,0.99667,5.63,0.0,0.99668,4.7,0.0,0.99669,5.63,0.0,0.99670,32.0,0.0","t":"1360179603808","apb":"0.99636","b":"0.99647,2.1,0.0,0.99646,1.13,0.0,0.99645,1.5,0.0,0.99644,5.25,0.0,0.99643,13.13,0.0,0.99642,5.63,0.0,0.99641,15.2,0.0,0.99640,3.18,0.0,0.99639,20.63,0.0,0.99637,35.95,0.0","pip":"0.0001","i":"USD/CAD","type":"marketState","tla":"117.87"}]
Strategy "DataCollect" Strategy ID: DD3408599C8E0B027A004CE534FA8807 is started at 2013-02-06 19:40:05.953 GMT on the local computer with parameters "Instrument"=[EUR/USD]
Feb 06, 2013 7:40:05 PM singlejartest.DataCollect onStart
INFO: Data Collection Started

then after all strategies are loaded after a minute or so I get the following:
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1016, other tasks - 275
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 879, other tasks - 231
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1016, other tasks - 275
Strategy thread queue overloaded with tasks. Ticks in queue - 2, bars - 890, other tasks - 231
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1027, other tasks - 275
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 890, other tasks - 242
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1027, other tasks - 286
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 901, other tasks - 242
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1038, other tasks - 286
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 901, other tasks - 242
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1038, other tasks - 286
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 912, other tasks - 242
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1049, other tasks - 286
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 912, other tasks - 242
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1049, other tasks - 286
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 934, other tasks - 242
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1071, other tasks - 286
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 934, other tasks - 253
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1071, other tasks - 297
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 945, other tasks - 253
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 1082, other tasks - 297


 
 Post subject: Re: No data being received for EURUSD, other pairs are fine Post rating: 0   New post Posted: Fri 08 Feb, 2013, 16:44 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide an example strategy which replicates the case. Also please provide a precise strategy launch scenario.


 
 Post subject: Re: No data being received for EURUSD, other pairs are fine Post rating: 0   New post Posted: Thu 21 Feb, 2013, 13:36 

User rating: 0
Joined: Wed 06 Feb, 2013, 20:36
Posts: 3
since yesterday the same problem with CHF/JPY although EUR/USD is being received fine now.

WARNING: Got tick for instrument [CHF/JPY] that was not processed by FeedDataProvider... Instrument subscription status [true] MarketState [{"tlb":"118.61","apa":"99.967","a":"99.949,1.43,0.0,99.950,1.5,0.0,99.951,2.48,0.0,99.953,6.95,0.0,99.954,7.5,0.0,99.955,5.45,0.0,99.956,5.63,0.0,99.957,7.8,0.0,99.960,7.5,0.0,99.961,30.43,0.0","t":"1361445294333","apb":"99.915","b":"99.933,1.43,0.0,99.931,2.18,0.0,99.930,2.18,0.0,99.929,3.75,0.0,99.928,5.63,0.0,99.926,6.0,0.0,99.924,5.63,0.0,99.923,7.33,0.0,99.921,8.83,0.0,99.920,27.75,0.0","pip":"0.01","i":"CHF/JPY","type":"marketState","tla":"132.87"}]
Strategy "DataCollect" Strategy ID: DD3408599C8E0B027A004CE534FA8807 is started at 2013-02-21 11:14:56.138 GMT on the local computer with parameters "Instrument"=[CHF/JPY], "DataTable"=[], "MySQLIP"=[], "DataBase"=[]
Feb 21, 2013 11:14:56 AM singlejartest.DataCollect onStart
INFO: Data Collection Started
Feb 21, 2013 11:15:22 AM singlejartest.DataCollect ReadHistData
INFO: Obtaining Hourly hist data for CHFJPY from 2013-02-21 09:00:00 to 2013-02-21 10:00:00 with last formed bar: 2013-02-21 10:00:00
Feb 21, 2013 11:15:22 AM singlejartest.DataCollect$2 dataLoaded
INFO: Downloading data into cache...
Feb 21, 2013 11:15:22 AM singlejartest.DataCollect$2 dataLoaded
INFO: Downloading data interval from 2013-02-01 00:00:00 to 2013-02-28 23:00:00...
Feb 21, 2013 11:15:41 AM singlejartest.DataCollect ReadHistData
INFO: Obtaining 1 Min hist data for CHFJPY from 2013-02-20 08:01:00 to 2013-02-21 11:14:00 with last formed bar: 2013-02-21 11:14:00
Feb 21, 2013 11:15:41 AM singlejartest.DataCollect$2 dataLoaded
INFO: Data loaded!
Feb 21, 2013 11:15:41 AM singlejartest.DataCollect$2 loadingFinished
INFO: All data loaded succesfully
Feb 21, 2013 11:15:41 AM singlejartest.DataCollect$2 dataLoaded
INFO: Downloading data into cache...
Feb 21, 2013 11:15:41 AM singlejartest.Main$1 onStart
INFO: Strategy started: 37
Feb 21, 2013 11:15:41 AM singlejartest.DataCollect$2 dataLoaded
INFO: Downloading data interval from 2013-02-21 00:00:00 to 2013-02-21 23:59:00...
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 390, other tasks - 108
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 391, other tasks - 111
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 394, other tasks - 111
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 394, other tasks - 111
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 397, other tasks - 111
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 397, other tasks - 111
Strategy thread queue overloaded with tasks. Ticks in queue - 3, bars - 398, other tasks - 111

Here is some code which is entirely based on API sample.

 //get the instance of the IClient interface
        final IClient client = ClientFactory.getDefaultInstance();
        //set the listener that will receive system events
        client.setSystemListener(new ISystemListener() {
            private int lightReconnects = 3;

           @Override
           public void onStart(long processId) {
                LOGGER.info("Strategy started: " + processId);
           }

         @Override
         public void onStop(long processId) {
                LOGGER.info("Strategy stopped: " + processId);
                if (client.getStartedStrategies().size() == 0) {
                    System.exit(0);
                }
         }

         @Override
         public void onConnect() {
                LOGGER.info("Connected");
                lightReconnects = 3;
         }

         @Override
         public void onDisconnect() {
                LOGGER.warn("Disconnected");
                if (lightReconnects > 0) {
                    client.reconnect();
                    --lightReconnects;
                } else {
                    try {
                        //sleep for 10 seconds before attempting to reconnect
                        Thread.sleep(10000);
                    } catch (InterruptedException e) {
                        //ignore
                    }
                    try {
                        client.connect(jnlpUrl, userName, password);
                    } catch (Exception e) {
                        LOGGER.error(e.getMessage(), e);
                        System.exit(1);
                    }
                }
         }
      });


//connect to the server using jnlp, user name and password
        client.connect(jnlpUrl, userName, password);

        //wait for it to connect
        int i = 10; //wait max ten seconds
        while (i > 0 && !client.isConnected()) {
            Thread.sleep(1000);
            i--;
        }
        if (!client.isConnected()) {
            LOGGER.error("Failed to connect Dukascopy servers");
            System.exit(1);
        }

        //subscribe to the instruments
        Set<Instrument> instruments = new HashSet<Instrument>();


instruments.add(Instrument.CHFJPY);
              client.setSubscribedInstruments(instruments);
              
              DataCollect strDC_CHFJPY = new DataCollect();
              strDC_CHFJPY.currentInstrument = Instrument.CHFJPY;
              client.startStrategy(strDC_CHFJPY);


public class DataCollect implements IStrategy {

   @Configurable("Instrument") public Instrument currentInstrument = Instrument.EURGBP;
   @Configurable("DataTable") public String tblTable = "";
   @Configurable("MySQLIP") public String strIP = "";
   @Configurable("DataBase") public String strDataBase = "";
   
    private IConsole console;
    private SimpleDateFormat sdf;
    private IHistory history;
    private static final Logger LOGGER = LoggerFactory.getLogger(DataCollect.class);
   
    private Connection dbhCM = null;
   private PreparedStatement pSM1 = null;
   private PreparedStatement pSM1dvalue = null;
   private PreparedStatement pSM1dateexists = null;
   private PreparedStatement pSH1 = null;
   private PreparedStatement pSD1 = null;
   private ResultSet resultSet = null;
   private long dLastUpdate = 0;
   private boolean first_check = true;
   private long dLastVerify = 0;
   
    public void onStart(IContext context) throws JFException {
        //engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        LOGGER.info("Data Collection Started");
       
        sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //sdf.setTimeZone(TimeZone.getTimeZone("GMT+3"));
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
       
        try {
           // This will load the MySQL driver, each DB has its own driver
         Class.forName("com.mysql.jdbc.Driver");
         
         // Setup the connection with the DB
         dbhCM = DriverManager.getConnection("jdbc:mysql://" + strIP + ":3306/" + strDataBase,"","");
         pSM1 = dbhCM.prepareStatement("REPLACE INTO " + tblTable + "M1 (date, open, high, low, close, volume, Verify, date_base) VALUES (?, ?, ?, ?, ?, ?, ?, ? )" );
         pSM1dvalue = dbhCM.prepareStatement("UPDATE " + tblTable + "M1 SET open=?, high=?, low=?, close=?, volume=? where date=?" );
         pSH1 = dbhCM.prepareStatement("REPLACE INTO " + tblTable + "H1 (date, open, high, low, close, volume, Verify, date_base) VALUES (?, ?, ?, ?, ?, ?, ?, ? )" );
         pSD1 = dbhCM.prepareStatement("REPLACE INTO " + tblTable + "D1 (date, open, high, low, close, volume, Verify, date_base) VALUES (?, ?, ?, ?, ?, ?, ?, ? )" );
         pSM1dateexists = dbhCM.prepareStatement("SELECT dvalue, dvalue_sign, dvalue_last FROM " + tblTable + "M1 where date=?");   
         
         //statement = dbhCM.prepareStatement("insert into tblNumbers (id) values (NULL)");
         //for (int i=0; i < 3000000; i++) statement.executeUpdate();
                  
         ReadHistData(currentInstrument, Period.DAILY, tblTable + "D1");
         ReadHistData(currentInstrument, Period.ONE_HOUR, tblTable + "H1");
         ReadHistData(currentInstrument, Period.ONE_MIN, tblTable + "M1");
         
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
         //closeResults();
      }
    }

    public void onStop() throws JFException {
       closeResults();
       LOGGER.info("Data Collection Stopped");
    }

    public void onTick(Instrument instrument, ITick tick) throws JFException {
       //if ( !instrument.equals(currentInstrument) ) return;
       
    }

public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) {
       if ( !instrument.equals(currentInstrument) || bidBar.getTime()-dLastUpdate < 30000 ) return;
       
        try {
          //obtain and update database with current bar which may not be complete yet
          IBar currBar = history.getBar(instrument, Period.ONE_MIN, OfferSide.BID, 0);
          //console.getOut().print(sdf.format(currBar.getTime()) + ", " + instrument.name() + ", " + currBar.getOpen() + ", " + currBar.getHigh() + ", " + currBar.getLow() + ", " + currBar.getClose() + ", " + currBar.getVolume() + "\n");
          updateTablePSM1(pSM1, sdf.format(currBar.getTime()), currBar.getOpen(), currBar.getHigh(), currBar.getLow(), currBar.getClose(), currBar.getVolume() );
          
          currBar = history.getBar(instrument, Period.ONE_MIN, OfferSide.BID, 1); //obtain and update database with complete previous bar
          //console.getOut().print(sdf.format(currBar.getTime()) + ", " + instrument.name() + ", " + currBar.getOpen() + ", " + currBar.getHigh() + ", " + currBar.getLow() + ", " + currBar.getClose() + ", " + currBar.getVolume() + "\n");
          updateTablePSM1(pSM1, sdf.format(currBar.getTime()), currBar.getOpen(), currBar.getHigh(), currBar.getLow(), currBar.getClose(), currBar.getVolume() );
          
          
          currBar = history.getBar(instrument, Period.ONE_HOUR, OfferSide.BID, 0);
          //console.getOut().print(sdf.format(currBar.getTime()) + ", " + instrument.name() + ", " + currBar.getOpen() + ", " + currBar.getHigh() + ", " + currBar.getLow() + ", " + currBar.getClose() + ", " + currBar.getVolume() + "\n");
          updateTablePS(pSH1, sdf.format(currBar.getTime()), currBar.getOpen(), currBar.getHigh(), currBar.getLow(), currBar.getClose(), currBar.getVolume() );
          
          currBar = history.getBar(instrument, Period.ONE_HOUR, OfferSide.BID, 1);
          //console.getOut().print(sdf.format(currBar.getTime()) + ", " + instrument.name() + ", " + currBar.getOpen() + ", " + currBar.getHigh() + ", " + currBar.getLow() + ", " + currBar.getClose() + ", " + currBar.getVolume() + "\n");
          updateTablePS(pSH1, sdf.format(currBar.getTime()), currBar.getOpen(), currBar.getHigh(), currBar.getLow(), currBar.getClose(), currBar.getVolume() );
          
          
          currBar = history.getBar(instrument, Period.DAILY, OfferSide.BID, 0);
          //console.getOut().print(sdf.format(currBar.getTime()) + ", " + instrument.name() + ", " + currBar.getOpen() + ", " + currBar.getHigh() + ", " + currBar.getLow() + ", " + currBar.getClose() + ", " + currBar.getVolume() + "\n");
          updateTablePS(pSD1, sdf.format(currBar.getTime()), currBar.getOpen(), currBar.getHigh(), currBar.getLow(), currBar.getClose(), currBar.getVolume() );
          
          currBar = history.getBar(instrument, Period.DAILY, OfferSide.BID, 1);
          //console.getOut().print(sdf.format(currBar.getTime()) + ", " + instrument.name() + ", " + currBar.getOpen() + ", " + currBar.getHigh() + ", " + currBar.getLow() + ", " + currBar.getClose() + ", " + currBar.getVolume() + "\n");
          updateTablePS(pSD1, sdf.format(currBar.getTime()), currBar.getOpen(), currBar.getHigh(), currBar.getLow(), currBar.getClose(), currBar.getVolume() );
          
          dLastUpdate = bidBar.getTime();
          
          if (bidBar.getTime()-dLastVerify>=6*3600*1000){
             LOGGER.info("VERIFY : "+instrument.toString());
             if (first_check){
                VerifyOldBars(instrument,Period.ONE_MIN,bidBar,1440*31);
                VerifyOldBars(instrument,Period.ONE_HOUR,bidBar,24*31);
                VerifyOldBars(instrument,Period.DAILY,bidBar,31);
                first_check = false;
             }else{
                VerifyOldBars(instrument,Period.ONE_MIN,bidBar,1440*7);
                VerifyOldBars(instrument,Period.ONE_HOUR,bidBar,24*7);
                VerifyOldBars(instrument,Period.DAILY,bidBar,7);
             }
             dLastVerify = bidBar.getTime();
          }
       } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          //closeResults();
         }
 
      
    }


private void ReadHistData(Instrument iInst, Period pBarSize, String tblCMTable) throws SQLException, JFException, ParseException {
       PreparedStatement sPS = null;
       String sInt = null;
       ResultSet rSet = null;
       
       Calendar cCal;
       cCal = Calendar.getInstance(new SimpleTimeZone(0, "GMT"));
       
       if (pBarSize.equals(Period.DAILY)) {
          sInt = "DAY";
       }else if (pBarSize.equals(Period.ONE_HOUR)) {
          sInt = "HOUR";
       }else if (pBarSize.equals(Period.ONE_MIN)) {
          sInt = "MINUTE";
       }else {
          LOGGER.error("Invalid Period in ReadHistData\n");
       }
       
       long tLastFormedBar = history.getBar(iInst, pBarSize, OfferSide.BID, 1).getTime();
       
       //SQL query to find all missing date/time records in tInput based on dates sequentially generated using auto-increment numbers in tblNumbers
       sPS = dbhCM.prepareStatement("SELECT tTemp.ts FROM (SELECT DATE_ADD(?, INTERVAL n.id-1 " + sInt + ") AS ts FROM tblNumbers n WHERE DATE_ADD(?, INTERVAL n.id-1 " + sInt + ") <= ?) tTemp LEFT JOIN " + tblCMTable + " tInput ON tInput.date=tTemp.ts WHERE tInput.date IS NULL");
       sPS.setString( 3, sdf.format(tLastFormedBar) ); //replace 3rd ? in the SQL with the time of last known formed bar
       cCal.add(Calendar.DATE, -30); cCal.set(Calendar.HOUR_OF_DAY, 0); cCal.set(Calendar.MINUTE,0); cCal.set(Calendar.SECOND,0); cCal.set(Calendar.MILLISECOND,0); //set calendar 30 day before current day at 00:00:00
       sPS.setString( 1, sdf.format(cCal.getTime()) );
      sPS.setString( 2, sdf.format(cCal.getTime()) );
      
      rSet = sPS.executeQuery();
      if ( !rSet.next() ) return;
      
      //writeResultSet(rSet);
      
      rSet.first();
      String sBarStart = rSet.getString(1);
      rSet.last();
      String sBarEnd = rSet.getString(1);
      
      LOGGER.info("Obtaining " + pBarSize.toString() + " hist data for " + iInst.name() + " from " + sBarStart + " to " + sBarEnd + " with last formed bar: " + sdf.format(tLastFormedBar) );
      
      history.readBars(iInst, pBarSize, OfferSide.BID,
                       history.getBarStart( pBarSize, sdf.parse(sBarStart).getTime()-pBarSize.getInterval() ),    //start
                       tLastFormedBar,       //end
         
                       new LoadingDataListener() {
                         public void newTick(Instrument instrument, long time, double ask, double bid, double askVol, double bidVol) {
                            //no ticks expected, because we are loading bars
                         }
                         public void newBar(Instrument instrument, Period period, OfferSide side, long time, double open, double close, double low, double high, double vol) {
                            //++numberOfBarsLoaded;
                            //console.getOut().println(sdf.format(time) + ", " + open + ", " + high + ", " + low + ", " + close + ", " + vol);
                            
                            try {
                               
                               if (period.equals(Period.DAILY)) {                            
                                 updateTablePS(pSD1, sdf.format(time), open, high, low, close, vol );   
                                 
                                }else if (period.equals(Period.ONE_HOUR)) {
                                   updateTablePS(pSH1, sdf.format(time), open, high, low, close, vol );
                                   
                                }else if (period.equals(Period.ONE_MIN)) {
                                   updateTablePSM1(pSM1, sdf.format(time), open, high, low, close, vol );
                                   
                                }else {
                                   LOGGER.error("Invalid Period in ReadHistData->newBar\n");
                                }
                            
                            } catch (SQLException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                           }
                         }
                     },
                     
                     new LoadingProgressListener() {
                        public void dataLoaded(long startTime, long endTime, long currentTime, String information) {
                           LOGGER.info(information);
                        }
                        public void loadingFinished(boolean allDataLoaded, long startTime, long endTime, long currentTime) {
                           if (allDataLoaded) {
                              LOGGER.info("All data loaded succesfully");
                              //context.stop();
                           } else {
                              LOGGER.info("For some reason loading failed or was canceled by the user");
                              //context.stop();
                           }
                        }
                        public boolean stopJob() {
                           return false;
                        }
                     }
      ); //end of readBars
      
    }
   


 
 Post subject: Re: No data being received for EURUSD, other pairs are fine Post rating: 0   New post Posted: Fri 22 Feb, 2013, 11:31 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Your strategy actions simply take prolonged time such that the incoming bars pile-up, consider using asynchronous bar reading methods:
https://www.dukascopy.com/wiki/#History_bars/Asynchronous_methods
Also if you need to schedule bar reading, you can also schedule the asynchronous reading, outside the onBar, see:
https://www.dukascopy.com/wiki/#Threading/Scheduled_asynchronous_execution


 

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