예제 #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
     });
 }
예제 #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;
     }
 }
예제 #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);
            }
        }
예제 #4
0
 Task IAssetDatabase.AddToAssetHistory(IBestBidAsk bestBidAsk)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public Task AddToAssetHistory(IBestBidAsk bidask)
 {
     AddToHistory(bidask);
     return(Task.FromResult(0));
 }
예제 #6
0
        public static string GetRowKey(IBestBidAsk src)
        {
            string key = src.ReceiveDate.Ticks.ToString();

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

            return(key);
        }