示例#1
0
        void PairBarsEnumeration()
        {
            var startTime = DateTime.Parse("3/3/2016 13:30:00", CultureInfo.InvariantCulture);
            var endTime   = DateTime.Parse("3/3/2016 14:00:00", CultureInfo.InvariantCulture);

            var bars = new PairBars(this.Feed, "EURUSD", BarPeriod.S1, startTime, endTime, 1024);

            var bidsVolume = 0D;
            var asksVolume = 0D;

            foreach (var element in bars)
            {
                if (element.Bid != null)
                {
                    bidsVolume += element.Bid.Volume;
                }

                if (element.Ask != null)
                {
                    asksVolume += element.Ask.Volume;
                }
            }

            Console.WriteLine("PairBarsEnumeration(): bids volume = {0}, asks volume = {1}", bidsVolume, asksVolume);
        }
示例#2
0
        void GetQuotes(DataFeed feed, string symbol)
        {
            this.CheckCancel();
            this.Log("Getting quotes for {0}", symbol);
            var bars = new PairBars(feed, symbol, BarPeriod.S1, timeStamp, -1);

            foreach (var element in bars)
            {
                if ((null != element.Bid) && (null != element.Ask))
                {
                    var entry = new FullSymbolEntry(symbol)
                    {
                        Bid = element.Bid.Close,
                        Ask = element.Ask.Close,
                    };
                    this.quotes.Add(entry);
                    this.Log("Quotes for symbol {0} have been got: {1}/{2}", symbol, entry.Bid, entry.Ask);
                }
                else
                {
                    this.Log("Quotes for symbol {0} are not available", symbol);
                }
                break;
            }
        }
示例#3
0
 public PairBar[] GetPairBars(string symbol, BarPeriod period, DateTime startTime, int barsNumber)
 {
     try
     {
         var bids   = this.GetBars(symbol, PriceType.Bid, period, startTime, barsNumber);
         var asks   = this.GetBars(symbol, PriceType.Ask, period, startTime, barsNumber);
         var bars   = new PairBars(bids, asks, barsNumber >= 0);
         var result = bars.ToArray();
         return(result);
     }
     catch (StorageHistoryNotFoundException ex)
     {
         throw new HistoryNotFoundException("GetPairBars", ex);
     }
 }
示例#4
0
        void PairBarsEnumeration()
        {
            var startTime = DateTime.Parse("2/1/2012 13:30:00", CultureInfo.InvariantCulture);
            var endTime = DateTime.Parse("2/1/2012 14:00:00", CultureInfo.InvariantCulture);

            var bars = new PairBars(this.Feed, "EURUSD", BarPeriod.S1, startTime, endTime, 1024);

            var bidsVolume = 0D;
            var asksVolume = 0D;

            foreach (var element in bars)
            {
                if (element.Bid != null)
                    bidsVolume += element.Bid.Volume;

                if (element.Ask != null)
                    asksVolume += element.Ask.Volume;
            }

            Console.WriteLine("PairBarsEnumeration(): bids volume = {0}, asks volume = {1}", bidsVolume, asksVolume);
        }
示例#5
0
文件: ServerDialog.cs 项目: ifzz/FDK
 void GetQuotes(DataFeed feed, string symbol)
 {
     this.CheckCancel();
     this.Log("Getting quotes for {0}", symbol);
     var bars = new PairBars(feed, symbol, BarPeriod.S1, timeStamp, -1);
     foreach (var element in bars)
     {
         if ((null != element.Bid) && (null != element.Ask))
         {
             var entry = new FullSymbolEntry(symbol)
             {
                 Bid = element.Bid.Close,
                 Ask = element.Ask.Close,
             };
             this.quotes.Add(entry);
             this.Log("Quotes for symbol {0} have been got: {1}/{2}", symbol, entry.Bid, entry.Ask);
         }
         else
         {
             this.Log("Quotes for symbol {0} are not available", symbol);
         }
         break;
     }
 }
示例#6
0
文件: SmartStorage.cs 项目: ifzz/FDK
 public PairBar[] GetPairBars(string symbol, BarPeriod period, DateTime startTime, int barsNumber)
 {
     try
     {
         var bids = this.GetBars(symbol, PriceType.Bid, period, startTime, barsNumber);
         var asks = this.GetBars(symbol, PriceType.Ask, period, startTime, barsNumber);
         var bars = new PairBars(bids, asks);
         var result = bars.ToArray();
         return result;
     }
     catch (StorageHistoryNotFoundException ex)
     {
         throw new HistoryNotFoundException("GetPairBars", ex);
     }
 }