SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Dec 12, 2017 7:35 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Import Level2 data
PostPosted: Tue Nov 21, 2017 5:25 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 209
How do you import level 2 data into data manager from CSV?


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 22, 2017 9:26 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 392
Hello.
Currently there is no importer for Level2 data from csv files using GUI.
You can import data programmatically.


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 22, 2017 11:23 am 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 209
Is there any example of this?


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 22, 2017 2:00 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 208
hi,
I can help you in about a week, till then I am on vacation.

What data do you have, full order book or only change of orderbook each interval?


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 22, 2017 7:46 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 209
Full order book (microsecond), plus tick data.


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Thu Nov 23, 2017 1:18 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 209
Hi,

I have created what i think is a correctly defined .quant file with Level2 data.

Code:
                DataFileManager.GetFile(symbol + "1.quant", FileMode.Create);
                DataSeries dataSeries = DataFileManager.GetSeries(symbol + "1.quant", symbol);


I record to dataseries eg:

Code:
                        Level2Snapshot level2 = new Level2Snapshot(datetime, ProviderId.Reuters, instrument.Id, bids, asks);
                        dataSeries.Add(level2);


and close:

Code:
                DataFileManager.Close(symbol + "1.quant");


How do I now access the .quant file and its associated series and stream out events in a strategy:

I have tried:

Code:
            strategy = new MyStrategy(framework, "Backtest");
         strategy.AddInstrument("****");
         Initialize();
         DataSeries series = DataFileManager.GetSeries("*****1.quant","****");
         DataSimulator.Series.Add(series);
                  
         DataSimulator.DateTime1 = new DateTime(2016, 1, 1);
         DataSimulator.DateTime2 = new DateTime(2016, 12 , 30);
         DataSimulator.SubscribeTrade = true;
         DataSimulator.SubscribeLevelII = true;
         DataSeriesEventLogger logger = new DataSeriesEventLogger(framework, series);

         logger.Enable(EventType.Level2);
         logger.Enable(EventType.Level2Snapshot);
         logger.Enable(EventType.Trade);

         EventManager.Logger = logger;

         StartStrategy()
;

However I get no data requests in backtestmode


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Tue Nov 28, 2017 10:46 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 392
Option to import Level2 data from CSV files will be added at next release.
ps export format of Level2 will be slightly changed.


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Tue Nov 28, 2017 10:57 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 208
Hope this helps for adding Level2 snapshots:

Code:
                                            var asks = new Ask[5]; var bids = new Bid[5];
                                            for (int c = 1; c < 6; c++)
                                            {
                                                asks[c - 1] = new Ask(DATE, pId, ins.Id,offerPrice, bidQty);
                                                bids[c - 1] = new Bid(DATE, pId, ins.Id, bidPrice, bidQty);
                                            }
                                            Level2Snapshot l2s = new Level2Snapshot(DATE, pId, ins.Id, bids, asks);
                                            DataManager.Save(ins, l2s);


and this for adding trades:
Code:
                                        Trade t = new Trade(DATE, pId, ins.Id, tradePrice, tradeQty, aggressorSide);
                                        DataManager.Save(ins, t);


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 29, 2017 10:09 am 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 209
I think get that part my issue is how do I request the data later from the xxx1.quant data file that you have built?

I cant stream the data back later.


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 29, 2017 11:12 am 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 208
why do you store it in that special data file and not in the normal datafile where all data is in, when you use Datamanager.Save(instrument,trade)?


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 29, 2017 1:50 pm 
Offline

Joined: Wed Aug 08, 2007 6:32 pm
Posts: 209
Ah I get you so I don't need to create a special datafile using datafilemanager


Top
 Profile  
 
 Post subject: Re: Import Level2 data
PostPosted: Wed Nov 29, 2017 2:15 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 208
I guess you can - depends on your needs, but I never tried.

So, I only went with the regular storage/datafile.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group