diff --git a/src/client/spark_historical/StaticAnalysis/MarketQueries.cs b/src/client/spark_historical/StaticAnalysis/MarketQueries.cs index 008871c4e..144e9897a 100644 --- a/src/client/spark_historical/StaticAnalysis/MarketQueries.cs +++ b/src/client/spark_historical/StaticAnalysis/MarketQueries.cs @@ -19,33 +19,12 @@ namespace bts.history{ leg_book = leg_book_a; synthetic_book = synthetic_book_a; } - } - // public static void get_synthetic_prices( - // SpreaderOrderDefinition synth, - // DateTime date, - // Action on_price){ - // var sspr_name = synth.Security.Synthetic.Name; - // var price_map = - // synth.Security.Synthetic.Legs.ToDictionary( - // l => l.Security.Glbx.SecurityDesc, - // l => MarketQueriesHelper.get_book_series_fast( - // l.Security.Symbol, - // l.Security.Glbx.SecurityDesc, - // date)); - // get_synthetic_prices(synth,price_map,on_price); - // } + } public static void get_synthetic_prices( SpreaderOrderDefinition synth, IEnumerable leg_book_series, - Action on_price){ - // foreach (ContractLeg l in synth.Security.Synthetic.Legs){ - // BookSeries bser = null; - // Log.assert(price_map.TryGetValue(l.Security.Glbx.SecurityDesc, out bser), - // String.Format("Could not find book for {0}", - // l.Security.Glbx.SecurityDesc)); - // leg_book_series.Add(bser); - // } + Action on_price){ align_bookseries( (abooks) => { var sbe = _compute_synthetic_top_book(synth, abooks.ToArray()); diff --git a/src/client/spark_historical/StaticAnalysis/MarketQueriesHelper.cs b/src/client/spark_historical/StaticAnalysis/MarketQueriesHelper.cs index 1a8b09672..c7634807e 100644 --- a/src/client/spark_historical/StaticAnalysis/MarketQueriesHelper.cs +++ b/src/client/spark_historical/StaticAnalysis/MarketQueriesHelper.cs @@ -177,14 +177,6 @@ namespace bts.history{ return rv; } - // public static IEnumerable generate_3_legged_circulars( - // string symbol, - // DateTime dt){ - // var p = get_book_path(symbol,dt); - // IEnumerable sprs = System.IO.Directory.GetFiles(p); - // sprs = sprs.Select(f => System.IO.Path.GetFileName(f)); - // return generate_3_legged_circulars(symbol,sprs); - // } public static Dictionary mmap = new Dictionary() { {"F",1},{"G",2},{"H",3},{"J",4},{"K",5},{"M",6}, @@ -353,44 +345,6 @@ namespace bts.history{ public static bool reactable (BookEntry be){ return diff_ns(be.TimeRange.T2,be.TimeRange.T1) > 0; } - // public class BookSeriesCacher{ - // private readonly int _max_cache_size = 10; - // private IDictionary> _cache_map = - // new Dictionary>(); - // private string _get_latest(){ - // string rv = String.Empty; - // DateTime latest_dt = DateTime.MinValue; - // foreach (var kv in _cache_map){ - // if(kv.Value.Item1 > latest_dt){ - // rv = kv.Key; - // latest_dt = kv.Value.Item1; - // } - // } - // return rv; - // } - // public BookSeries get_book_series(string symbol, - // string sec_txt, - // DateTime date){ - // var key = String.Format("{0}_{1}_{2}",symbol,sec_txt, - // date.ToShortDateString()); - // Tuple rv; - // lock(this){ - // if(!_cache_map.TryGetValue(key,out rv)){ - // string fp = get_book_file(symbol,sec_txt,date); - // var bser = new BookSeries(symbol, fp); - // if(_cache_map.Count()==_max_cache_size){ - // // find latest one and evict the last one - // string latest_key = _get_latest(); - // _cache_map.Remove(latest_key); - // } - // rv = Tuple.Create(DateTime.Now,bser); - // _cache_map.Add(key,rv); - // } - // } - // return rv.Item2; - // } - - // } public static IDictionary get_all_books(string symbol, DateTime dt){ @@ -400,6 +354,8 @@ namespace bts.history{ var sprs = System.IO.Directory.GetFiles(p).Select(f=> Tuple.Create(System.IO.Path.GetFileName(f),f)); sprs = sprs.Where(s => !s.Item1.Contains(".")); + sprs = sprs.Where(s => !s.Item1.Contains("trades")); + sprs = sprs.Where(s => !s.Item1.Contains("orders")); Console.WriteLine("Spreads:{0}",sprs.Count()); Parallel.ForEach(sprs, s=>{ rv[s.Item1] = new BookSeries(symbol,s.Item1,dt);