コード例 #1
0
        private void ParseLine(StreamReader sr)
        {
            string line = sr.ReadLine();

            if (CsvHeader != null && CsvHeader.Length == 0)
            {
                CsvHeader = line;
            }
            else
            {
                string[] arr = LineSplitter.SplitFilterCommasInQuotedStrings(line);

                decimal strike;
                int     openInterest;
                if (arr[0].EndsWith("P"))
                {
                    strike       = decimal.Parse(arr[0].Replace("P", string.Empty));
                    openInterest = int.Parse(arr[7]);
                    PutsDictionary.Add(strike, openInterest);
                }
                else
                {
                    if (arr[0].EndsWith("C"))
                    {
                        strike       = decimal.Parse(arr[0].Replace("C", string.Empty));
                        openInterest = int.Parse(arr[7]);
                        CallsDictionary.Add(strike, openInterest);
                    }
                    else
                    {
                        string message = line;
                    }
                }
            }
        }
コード例 #2
0
ファイル: DailyDownloader.cs プロジェクト: bizcad/MarketData
        /// <summary>
        /// Parses a line from the RowList into either the Puts Dictionary or the Calls Dictionary.
        /// Other lines (header and footer) are ingnored.
        /// </summary>
        /// <param name="line">The line from the list</param>
        private void AddRowToDictionary(string line)
        {
            string[] arr = LineSplitter.SplitFilterCommasInQuotedStrings(line);

            if (arr[0].EndsWith("P"))
            {
                AddRowToDictionary(ref PutsDictionary, "P", arr);
            }
            else
            {
                if (arr[0].EndsWith("C"))
                {
                    AddRowToDictionary(ref CallsDictionary, "C", arr);
                }
            }
        }