예제 #1
0
        private IEnumerableEx <ExecutionMessage> GetTrades()
        {
            if (IsBuildFromOrderLog.IsChecked == true)
            {
                var orderLog = StorageRegistry
                               .GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
                               .Load(From, To + TimeHelper.LessOneDay);

                if (IsNonSystem.IsChecked == false)
                {
                    orderLog = orderLog.Where(i => i.IsSystem != false).ToEx(orderLog.Count);
                }

                return(orderLog.ToTicks());
            }
            else
            {
                var trades = StorageRegistry
                             .GetExecutionStorage(SelectedSecurity, ExecutionTypes.Tick, Drive, StorageFormat)
                             .Load(From, To + TimeHelper.LessOneDay);

                if (IsNonSystem.IsChecked == false)
                {
                    trades = trades.Where(t => t.IsSystem != false).ToEx(trades.Count);
                }

                return(trades);
            }
        }
예제 #2
0
        private IEnumerableEx <ExecutionMessage> GetExecutions()
        {
            var executions = StorageRegistry
                             .GetExecutionStorage(SelectedSecurity, ExecutionTypes.Order, Drive, StorageFormat)
                             .Load(From, To + TimeHelper.LessOneDay);

            return(executions);
        }
예제 #3
0
        private IEnumerableEx <QuoteChangeMessage> GetDepths()
        {
            int maxDepth;

            if (!int.TryParse(Depth.Text, out maxDepth))
            {
                maxDepth = int.MaxValue;
            }

            if (maxDepth <= 0)
            {
                maxDepth = 1;
            }

            var interval = TimeSpan.FromMilliseconds(DepthGenerationInterval.Value ?? 0);

            switch (BuildFrom.SelectedIndex)
            {
            case 0:
            {
                var retVal = StorageRegistry
                             .GetQuoteMessageStorage(SelectedSecurity, Drive, StorageFormat)
                             .Load(From, To + TimeHelper.LessOneDay);

                return(retVal
                       .Select(md =>
                    {
                        md.Bids = md.Bids.Take(maxDepth).ToArray();
                        md.Asks = md.Asks.Take(maxDepth).ToArray();
                        return md;
                    })
                       .WhereWithPrevious((prev, curr) => (curr.ServerTime - prev.ServerTime) >= interval)
                       .ToEx(retVal.Count));
            }

            case 1:
            {
                return(StorageRegistry
                       .GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
                       .Load(From + new TimeSpan(18, 45, 0), To + TimeHelper.LessOneDay + new TimeSpan(18, 45, 0))
                       // TODO
                       .ToMarketDepths(OrderLogBuilders.Plaza2.CreateBuilder(SelectedSecurity.ToSecurityId()), interval, maxDepth));
            }

            case 2:
            {
                var level1 = StorageRegistry
                             .GetLevel1MessageStorage(SelectedSecurity, Drive, StorageFormat)
                             .Load(From, To + TimeHelper.LessOneDay);

                return(level1.ToOrderBooks());
            }

            default:
                throw new InvalidOperationException();
            }
        }
예제 #4
0
        private IEnumerableEx <CandleMessage> GetCandles()
        {
            var from = From.Value;
            var to   = To.Value.EndOfDay();

            switch (BuildFrom.SelectedIndex)
            {
            case 0:
                return(StorageRegistry
                       .GetCandleMessageStorage(CandleSeries.CandleType.ToCandleMessageType(), CandleSeries.Security, CandleSeries.Arg, Drive, StorageFormat)
                       .Load(from, to));

            case 1:
                return(StorageRegistry
                       .GetExecutionStorage(SelectedSecurity, ExecutionTypes.Tick, Drive, StorageFormat)
                       .Load(from, to)
                       .ToCandles(CandleSeries));

            case 2:
                return(StorageRegistry
                       .GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
                       .Load(from, to)
                       .ToTicks()
                       .ToCandles(CandleSeries));

            case 3:
                return(StorageRegistry
                       .GetQuoteMessageStorage(SelectedSecurity, Drive, StorageFormat)
                       .Load(from, to)
                       .ToCandles(CandleSeries));

            case 4:
                return(StorageRegistry
                       .GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
                       .Load(from, to)
                       .ToMarketDepths(OrderLogBuilders.Plaza2.CreateBuilder(SelectedSecurity.ToSecurityId()))
                       .ToCandles(CandleSeries));

            case 5:
                return(StorageRegistry
                       .GetCandleMessageStorage(typeof(TimeFrameCandleMessage), SelectedSecurity, TimeSpan.FromMinutes(1), Drive, StorageFormat)
                       .Load(from, to)
                       .ToTrades(SelectedSecurity.VolumeStep ?? 1m)
                       .ToCandles(CandleSeries));

            case 6:
                return(StorageRegistry
                       .GetLevel1MessageStorage(SelectedSecurity, Drive, StorageFormat)
                       .Load(from, to)
                       .ToTicks()
                       .ToCandles(CandleSeries));

            default:
                throw new InvalidOperationException(LocalizedStrings.Str2874Params.Put(BuildFrom.SelectedIndex));
            }
        }
예제 #5
0
		private IEnumerableEx<ExecutionMessage> GetOrderLog()
		{
			var orderLog = StorageRegistry
				.GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
				.Load(From, To + TimeHelper.LessOneDay);

			if (IsNonSystem.IsChecked == false)
				orderLog = orderLog.Where(o => o.IsSystem != false).ToEx(orderLog.Count);

			return orderLog;
		}
예제 #6
0
        private IEnumerableEx <ExecutionMessage> GetTrades()
        {
            switch (BuildFrom.SelectedIndex)
            {
            case 0:
            {
                var trades = StorageRegistry
                             .GetExecutionStorage(SelectedSecurity, ExecutionTypes.Tick, Drive, StorageFormat)
                             .Load(From, To + TimeHelper.LessOneDay);

                if (IsNonSystem.IsChecked == false)
                {
                    trades = trades.Where(t => t.IsSystem != false).ToEx(trades.Count);
                }

                return(trades);
            }

            case 1:
            {
                var orderLog = StorageRegistry
                               .GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
                               .Load(From, To + TimeHelper.LessOneDay);

                if (IsNonSystem.IsChecked == false)
                {
                    orderLog = orderLog.Where(i => i.IsSystem != false).ToEx(orderLog.Count);
                }

                return(orderLog.ToTicks());
            }

            case 2:
            {
                var level1 = StorageRegistry
                             .GetLevel1MessageStorage(SelectedSecurity, Drive, StorageFormat)
                             .Load(From, To + TimeHelper.LessOneDay);

                return(level1.ToTicks());
            }

            default:
                throw new InvalidOperationException();
            }
        }
예제 #7
0
        private IEnumerableEx <QuoteChangeMessage> GetDepths()
        {
            int maxDepth;

            if (!int.TryParse(Depth.Text, out maxDepth))
            {
                maxDepth = int.MaxValue;
            }

            if (maxDepth <= 0)
            {
                maxDepth = 1;
            }

            var interval = TimeSpan.FromMilliseconds(DepthGenerationInterval.Value ?? 0);

            if (IsBuildFromOrderLog.IsChecked == true)
            {
                return(StorageRegistry
                       .GetExecutionStorage(SelectedSecurity, ExecutionTypes.OrderLog, Drive, StorageFormat)
                       .Load(From + new TimeSpan(18, 45, 0), To + TimeHelper.LessOneDay + new TimeSpan(18, 45, 0))
                       .ToMarketDepths(interval, maxDepth));
            }

            var retVal = StorageRegistry
                         .GetQuoteMessageStorage(SelectedSecurity, Drive, StorageFormat)
                         .Load(From, To + TimeHelper.LessOneDay);

            return(retVal
                   .Select(md =>
            {
                md.Bids = md.Bids.Take(maxDepth).ToArray();
                md.Asks = md.Asks.Take(maxDepth).ToArray();
                return md;
            })
                   .WhereWithPrevious((prev, curr) => (curr.ServerTime - prev.ServerTime) >= interval)
                   .ToEx(retVal.Count));
        }