countering for the trades and orders files
This commit is contained in:
1 parent
47628089ac
commit
8db81fa248
2 files changed
+4
-69
No files matched your search
@@ -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<SyntheticPrice> 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<BookSeries> leg_book_series,
|
||||
Action<SyntheticPrice> 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<SyntheticPrice> on_price){
|
||||
align_bookseries(
|
||||
(abooks) => {
|
||||
var sbe = _compute_synthetic_top_book(synth, abooks.ToArray());
|
||||
|
||||
@@ -177,14 +177,6 @@ namespace bts.history{
|
||||
return rv;
|
||||
}
|
||||
|
||||
// public static IEnumerable<string> generate_3_legged_circulars(
|
||||
// string symbol,
|
||||
// DateTime dt){
|
||||
// var p = get_book_path(symbol,dt);
|
||||
// IEnumerable<string> 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<string, int> mmap = new Dictionary<string, int>()
|
||||
{
|
||||
{"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<string, Tuple<DateTime,BookSeries>> _cache_map =
|
||||
// new Dictionary<string, Tuple<DateTime,BookSeries>>();
|
||||
// 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<DateTime,BookSeries> 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<string,BookSeries> 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);
|
||||
|
||||
Reference in new issue
Block a user