Example #1
0
 public void TestTranslate(MsBaseStructs.RecDay day, string ticker)
 {
     if (mp.UseHeaders)
     {
         Add(header(mp.UseQuotes));
     }
     this.ticker = ticker;
     addLine(day);
 }
Example #2
0
        private string insertLine(MsBaseStructs.RecDay day, int startLine)
        {
            string line = "";

            foreach (ColumnInfo colInfo in (List <ColumnInfo>)mp.ColInfoList)
            {
                addField(day, colInfo, ref line);
            }
            if (mp.FieldDelim.Length > 0)
            {
                line = NgUtils.RemoveTrailingChar(line, mp.FieldDelim[0]);
            }
            Insert(startLine, line);
            return(line);
        }
Example #3
0
        private void addField(MsBaseStructs.RecDay day, ColumnInfo ci, ref string line)
        {
            string str1 = "";

            mp.NFI.NumberDecimalDigits = ci.DP;
            switch (ci.Name.ToLower())
            {
            case "close":
                str1 = formatPrice((double)day.c);
                break;

            case "date":
                str1 = DateTime.FromOADate((double)day.d).ToString(mp.DateFormat);
                break;

            case "dummy time":
                str1 = mp.DummyTime;
                break;

            case "high":
                str1 = formatPrice((double)day.h);
                break;

            case "low":
                str1 = formatPrice((double)day.l);
                break;

            case "open":
                str1 = formatPrice((double)day.o);
                break;

            case "open interest":
                str1 = formatPrice((double)day.i);
                break;

            case "openint":
                str1 = formatPrice((double)day.i);
                break;

            case "openinterest":
                str1 = formatPrice((double)day.i);
                break;

            case "ticker":
                str1 = ticker;
                break;

            case "vol":
                str1 = formatPrice((double)day.v);
                break;

            case "volume":
                str1 = formatPrice((double)day.v);
                break;
            }

            if (str1.Length <= 0)
            {
                return;
            }
            int totalWidth = mp.FieldWidth;

            if (mp.UseQuotes)
            {
                totalWidth -= 2;
            }
            if (totalWidth < 0)
            {
                totalWidth = 0;
            }
            string str2 = str1.PadLeft(totalWidth);

            if (mp.UseQuotes)
            {
                str2 = "\"" + str2 + "\"";
            }
            line = line + str2 + mp.FieldDelim;
        }
Example #4
0
 private string insertLine(MsBaseStructs.RecDay day)
 {
     return(insertLine(day, 0));
 }