public static BestBidAskEntity CreateEntity(IBestBidAsk src) { return(new BestBidAskEntity { PartitionKey = GetPartitionKey(src), RowKey = GetRowKey(src), Asset = src.Asset, BestAsk = src.BestAsk, BestBid = src.BestBid, BidDate = src.Timestamp, Source = src.Source, ReceiveDate = src.ReceiveDate }); }
Task IAssetDatabase.AddToAssetHistory(IBestBidAsk quote) { AssetQueue.Enqueue(quote); try { if (AssetQueue.Count >= 512) { IBestBidAsk[] buffer = AssetQueue.ToArray(); AssetQueue.Clear(); AddToAssetFile(buffer); } return(Task.FromResult(0)); } catch { throw; } }
private void AddToHistory(IBestBidAsk bidask) { if (!assetCache.ContainsKey(bidask.Asset)) { assetCache.Add(bidask.Asset, new Queue <IBestBidAsk>()); } assetCache[bidask.Asset].Enqueue(bidask); if (assetCache[bidask.Asset].Count >= queueMaxSize) { List <IBestBidAsk> buffer = assetCache[bidask.Asset].ToList(); assetCache[bidask.Asset].Clear(); InsertInAzure(buffer); } }
Task IAssetDatabase.AddToAssetHistory(IBestBidAsk bestBidAsk) { throw new NotImplementedException(); }
public Task AddToAssetHistory(IBestBidAsk bidask) { AddToHistory(bidask); return(Task.FromResult(0)); }
public static string GetRowKey(IBestBidAsk src) { string key = src.ReceiveDate.Ticks.ToString(); return(key); }
public static string GetPartitionKey(IBestBidAsk src) { string key = string.Format("{0}_{1}", src.Asset, src.ReceiveDate.ToString("yyyyMMdd_HH")); return(key); }