Hi,
I see your points. My program is as follows:
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <OTClient.h>
#include “TTree.h”
#include “TFile.h”
#include “TBranch.h”
#include “OTHistData.h”
class MyClient : public OTClient
{
int i,i1;
public:
int id;
int id1;
int id2;
TTree *tree;
TFile f;
OTHistData h;
int counter;
MyClient ()
{
i = i1 = 0;
f = new TFile("/home/gma/c++program/test.root","RECREATE");
tree = new TTree("T","Test of tree");
h = new OTHistData();
tree->Branch("histdata","Transaction", &h,3200,99);
counter =0;
}
virtual ~MyClient ()
{
//tree->Write();
delete tree;
delete f;
delete h;
}
void onLogin ()
{
printf ("login ok\n");
//requestListExchanges ();
// id = requestTickStream (&OTDataEntity ("Q", "CSCO"));
struct tm begDate = { 0, 0, 9, 15, 11, 104 };
struct tm endDate = { 0, 0, 9, 25, 11, 104 };
requestHistData (&OTDataEntity ("Q", "MSFT"),
mktime(&begDate),
mktime(&endDate),
OT_HIST_RAW_TICKS,
1);
}
void onError (OTError * error)
{
printf ("-----> Error id=%d, code=%d, error=%s\n",
error->getRequestId(), error->getCode(), error->getDescription());
}
void onHistTrade (OTTrade *trade)
{
h->price = trade->getPrice();
h->volume = trade->getVolume();
h->timestamp = trade->getTimestamp();
tree->Fill();
tree->Write();
printf ("HistTrade: id = %d, timestamp = %d, price = %f, size = %d, volume = %lld ",
trade->getRequestId(), trade->getTimestamp(), trade->getPrice(), trade->getSize(), trade->getVolume()
);
printf ("sequenceNumber = %d, indicator = %c, tickIndicator = %c, isOpen = %d, isHigh = %d, isLow = %d, isClose = %d, isUpdateLast = %d \
isUpdateVolume = %d, isCancel = %d, isFromBook = %d \n", trade->getSequenceNumber(), trade->getIndicator(), trade->getTickIndicator(),
trade->isOpen(), trade->isHigh(), trade->isLow(), trade->isClose(),
trade->isUpdateLast(), trade->isUpdateVolume(), trade->isCancel(), trade->isFromBook()
);
}
};
int main()
{
MyClient *client = new MyClient();
client->addHost (“feed1.opentick.com”, 10010);
char login[255] = “”;
char passw[255] = “”;
printf (“Please, enter your login: “);
scanf (”%254s”, login);
printf (“Please, enter your password: “);
scanf (”%254s”, passw);
printf (“trying to log in…\n”);
getchar();
client->login (login, passw);
getchar();
delete client;
return 0;
}
[\code]
Attached please find the necessary header and library files which are needed to compile the problem. Thank you for your helps.
cheers,
gma[/code]
ot.zip (1.08 MB)