Example #1
0
        /// <summary>
        /// Get quote packed
        /// </summary>
        /// <param name="symbol">Symbol to get quotes on</param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="levelDbl"></param>
        /// <returns></returns>
        public static string GetQuotePacked(string symbol, DateTime startTime, DateTime endTime, double levelDbl = 2)
        {
            try
            {
                var level = (int)levelDbl;

                Log.InfoFormat("FdkLevel2.GetQuotePacked( symbol: {0}, startTime: {1}, endTime: {2}, level: {3} {4})",
                               symbol, startTime, endTime, levelDbl, startTime.Kind.ToString());


                Quote[] quotesData      = FdkQuotes.CalculateHistoryForSymbolArray(symbol, startTime, endTime, level);
                var     quoteLevel2Data = BuildQuoteMultiLevelData(quotesData, level);

                var quoteHistory = FdkVars.RegisterVariable(quoteLevel2Data, "quotesL2");
                return(quoteHistory);
            }
            catch (OutOfMemoryException ex)
            {
                Log.Error("Too large amount of data. Adjust the query");
                throw;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
            finally
            {
                GC.Collect();
            }
        }
Example #2
0
        /// <summary>
        /// Get quote packed
        /// </summary>
        /// <param name="symbol">Symbol to get quotes on</param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="levelDbl"></param>
        /// <returns></returns>
        public static string GetQuotePacked(string symbol, DateTime startTime, DateTime endTime, double levelDbl = 2)
        {
            try
            {
                var level = (int)levelDbl;

                Log.InfoFormat("FdkLevel2.GetQuotePacked( symbol: {0}, startTime: {1}, endTime: {2}, level: {3})",
                               symbol, startTime, endTime, levelDbl);

                Quote[] quotesData      = FdkQuotes.CalculateHistoryForSymbolArray(symbol, startTime, endTime, level);
                var     quoteLevel2Data = BuildQuoteMultiLevelData(quotesData, level);

                var quoteHistory = FdkVars.RegisterVariable(quoteLevel2Data, "quotesL2");
                return(quoteHistory);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }