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

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

            return(key);
        }