Historical Data

Moderator: Moderator

Historical Data

Postby imzombie13 » Mon Feb 19, 2018 1:32 pm

Hello, I am trying to fetch historical data, I am using this code to send request

Code: Select all
     O2GRequestFactory factory = session.getRequestFactory();
            if (factory != null)
            {
                O2GTimeframe tf = factory.Timeframes[timeframeName];
                O2GRequest request = factory.createMarketDataSnapshotRequestInstrument("EUR/USD", tf, 300);

                DateTime dtFrom = new DateTime(2017,10,10);
                DateTime dtTo = new DateTime(2018,10,10);
                dtFrom = string.IsNullOrEmpty(sFrom) ? factory.ZERODATE : DateTime.Parse(sFrom);
                dtTo = string.IsNullOrEmpty(sTo) ? factory.ZERODATE : DateTime.Parse(sTo);
                factory.fillMarketDataSnapshotRequestTime(request, dtFrom, dtTo, false);

                session.sendRequest(request);
                responseListener.ResponseHandle.WaitOne(30000); //30 seconds timeout
            }



I suppose to get response type as MarketDataSnapshot , but i am always getting response of type CommandResponse, Can you please mention what is wrong in this method ?
imzombie13
 
Posts: 1
Joined: Mon Feb 19, 2018 12:57 pm

Re: Historical Data

Postby Apprentice » Wed Feb 21, 2018 9:59 am

Forwarded to the development team.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36258
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Historical Data

Postby PetroIV » Tue Feb 27, 2018 2:52 am

Hello imzombie13,
Your code is correct. A similar logic is used in the sample NonTableManagerSamples/GetHistPrices. The output of the GetHistPrices sample is historical data. Could you please confirm the following points:
1. Are you able to run the GetHistPrices sample with filled parameters in App.config?
2. Do you get prices in the output?
PetroIV
 
Posts: 24
Joined: Tue Aug 15, 2017 9:45 am


Return to Price History API

Who is online

Users browsing this forum: No registered users and 1 guest