Beispiel #1
0
 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
     });
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
        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();
 }
Beispiel #5
0
 public Task AddToAssetHistory(IBestBidAsk bidask)
 {
     AddToHistory(bidask);
     return(Task.FromResult(0));
 }
Beispiel #6
0
        public static string GetRowKey(IBestBidAsk src)
        {
            string key = src.ReceiveDate.Ticks.ToString();

            return(key);
        }
Beispiel #7
0
        public static string GetPartitionKey(IBestBidAsk src)
        {
            string key = string.Format("{0}_{1}", src.Asset, src.ReceiveDate.ToString("yyyyMMdd_HH"));

            return(key);
        }