当前位置: 首页>>代码示例>>C#>>正文


C# ConstructGen.WriteToCSV方法代码示例

本文整理汇总了C#中ConstructGen.WriteToCSV方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructGen.WriteToCSV方法的具体用法?C# ConstructGen.WriteToCSV怎么用?C# ConstructGen.WriteToCSV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConstructGen的用法示例。


在下文中一共展示了ConstructGen.WriteToCSV方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Collate

    public static void Collate(BondMarket market_=BondMarket.US)
    {
      var allTenors = SI.ExtensionMethods.CreateArray(1, 30, x => x + 1);

      var con = new ConstructGen<double>(allTenors.Select(x => string.Format("cmt_{0}", x)).ToArray());

      for (int i = 0; i < allTenors.Length; ++i)
      {
        var cr = Get(market_, allTenors[i]);
        if (cr == null) continue;

        con.SetColumnValues(i, cr.Values.GetColumnValuesAsDDC((int) CMTCarry.ColPosition.Carry));
      }

      con.WriteToCSV(string.Format(@"e:\temp\CMTCarry_{0}.csv", market_));
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:16,代码来源:CMTCarryCache.cs

示例2: Go


//.........这里部分代码省略.........
        "8Y25Y",
        "8Y30Y",
        "9Y1Y",
        "9Y2Y",
        "9Y3Y",
        "9Y4Y",
        "9Y5Y",
        "9Y6Y",
        "9Y7Y",
        "9Y8Y",
        "9Y9Y",
        "9Y10Y",
        "9Y11Y",
        "9Y12Y",
        "9Y15Y",
        "9Y20Y",
        "9Y25Y",
        "9Y30Y",
        "10Y1Y",
        "10Y2Y",
        "10Y3Y",
        "10Y4Y",
        "10Y5Y",
        "10Y10Y",
        "10Y15Y",
        "10Y20Y",
        "10Y30Y",
        "11Y1Y",
        "11Y2Y",
        "11Y3Y",
        "11Y4Y",
        "11Y5Y",
        "11Y6Y",
        "11Y7Y",
        "11Y10Y",
        "11Y15Y",
        "11Y20Y",
        "11Y25Y",
        "11Y30Y",
        "12Y1Y",
        "12Y2Y",
        "12Y3Y",
        "12Y4Y",
        "12Y5Y",
        "12Y8Y",
        "12Y10Y",
        "12Y20Y",
        "12Y25Y",
        "15Y1Y",
        "15Y2Y",
        "15Y3Y",
        "15Y4Y",
        "15Y5Y",
        "15Y6Y",
        "15Y7Y",
        "15Y8Y",
        "15Y9Y",
        "15Y10Y",
        "15Y15Y",
        "20Y5Y",
        "20Y10Y",
        "25Y5Y",
        "30Y10Y",

      };

      ProductList.RegisterMongoClasses();

      foreach (var curve in new[] { CurveNames.USD3M, CurveNames.EUR6M} )
      {
        var con = new ConstructGen<double>(listOfTenors);

        for (int i = 0; i < listOfTenors.Length; ++i)
        {
          var split = listOfTenors[i].Trim('Y').Split('Y');

          int start=0, foward=0;

          if (split.Length == 1)
          {
            foward = int.Parse(split[0]);
          }
          else
          {
            start = int.Parse(split[0]);
            foward = int.Parse(split[1]);
          }

          var series = xYyY.Get(curve, start, foward);

          con.SetColumnValues(i, series.A_Prices);
        }

        if (con.NeedsToSortKeys())
          con.SortKeys();

        con.WriteToCSV(string.Format(@"e:\temp\Mark_Swaps_{0}.csv", curve));
      }
      
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:MarkEllisSwapData.cs

示例3: Go

    public static void Go()
    {
      var yearOfFile = 2015;

      var ricList = new[] {"ED", "FEI", "FGBL", "FGBM", "FGBS", "TY", "FLG", "FSS", "FGB", "FBTP", "FOAT", "ES", "FDX"};

      var contractMonths = (MonthCode[])Enum.GetValues(typeof(MonthCode));

      var sourceDir = @"E:\futuresData\MarkFiles";
      var markDir = @"e:\futuresData\MarkEllis2";

      var dict = new SortedDictionary<string, DatedDataCollectionGen<double>>();
      var keys = new List<string>();

      foreach (var ricStart in ricList)
      {
        foreach (var contractYear in new[] { 2015, 2016, 2017 })
        {
          foreach (var contractMonth in contractMonths)
          {
            var dates = new List<DateTime>();
            var values = new List<double>();

            foreach (var monthOfFile in new[] { 6, 7, 8 })
            {
              var searchString = string.Format("*{0}-{1}-{2}{3}{4}.csv", yearOfFile, monthOfFile.ToString("00"), ricStart, contractMonth, contractYear - 2010);

              var files = Directory.GetFiles(sourceDir, searchString);

              if (files.Length == 0)
                continue;


              foreach (var item in CsvFile.Read<FuturesIntradaySaver.FuturesLineItem>(files[0]))
              {
                if (item.gmtDate.HasValue && (item.gmtDate.Value.Minute == 32 || item.gmtDate.Value.Minute == 2))
                {
                  item.Date = TimeZoneHelper.ConvertGmtTimeToLondon(item.gmtDate.Value);
                  item.Time = string.Empty;

                  if (item.Date.Hour < 8)
                    continue;

                  if (item.Date.Hour > 17)
                    continue;

                  dates.Add(item.Date);
                  values.Add((item.CloseAsk + item.CloseBid) / 2d);
                }
              }

              //list.ToCsv(string.Join("\\", markDir,
              //  string.Format("{0}-{1}-{2}{3}{4}", yearOfFile, monthOfFile.ToString("00"), UpdateStaticDataForFutures.MAPS[ricStart].Item1, contractMonth, contractYear - 2010)));
            }

            if(dates.Count>0)
            {
              try
              {
                var ticker = string.Format("{0}{1}{2}", UpdateStaticDataForFutures.MAPS[ricStart].Item1, contractMonth, contractYear - 2010);
                keys.Add(ticker);
                dict.Add(ticker, new DatedDataCollectionGen<double>(dates.ToArray(), values.ToArray()));
              }
              catch (Exception ex_)
              {
                Console.WriteLine(ex_.ToString());
              }
            }
          }
        }
      }

      var con = new ConstructGen<double>(keys.ToArray());
      for(int i=0;i<keys.Count;++i)
      {
        con.SetColumnValues(i,dict[keys[i]]);
      }

      if (con.NeedsToSortKeys())
        con.SortKeys();

      con.WriteToCSV(@"e:\futuresData\markDataTo1732.csv");
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:83,代码来源:MarkEllisData.cs

示例4: PublishHourlyVolumes

    public void PublishHourlyVolumes(RollSet set)
    {
      ReadFromCSV();

      var con = new ConstructGen<double>(new[] { MonthFrom, MonthTo, "Spread" });

      var priorVolume = new DatedDataCollectionGen<double>(Lines.Dates,
        Lines.Data.Select(x => x.PriorContractVolume).ToArray())
        .ToGenPeriod(
          periodDateFunction_: x => x,
          areSamePeriodFunction_: functionForSameVolumeBucketing(),
          collationFunction_: x => x.Sum());

      con.SetColumnValues(0, priorVolume);

      var newVolume = new DatedDataCollectionGen<double>(Lines.Dates,
        Lines.Data.Select(x => x.NewContractVolume).ToArray())
        .ToGenPeriod(
          periodDateFunction_: x=>x,
          areSamePeriodFunction_: functionForSameVolumeBucketing(),
          collationFunction_: x => x.Sum());

      con.SetColumnValues(1, newVolume);

      var spreadVolume = new DatedDataCollectionGen<double>(Lines.Dates,
        Lines.Data.Select(x => x.SpreadVolume).ToArray())
        .ToGenPeriod(
          periodDateFunction_: x => x,
          areSamePeriodFunction_: functionForSameVolumeBucketing(),
          collationFunction_: x => x.Sum());

      con.SetColumnValues(2, spreadVolume);

      con.WriteToCSV(string.Format(@"{4}\{0}_{1}_{2}_{3}_HourlyVolume.csv", Rolldate.ToString("yyyyMMdd"), set,
        MonthFrom, MonthTo,DIR));

    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:37,代码来源:RollDay.cs


注:本文中的ConstructGen.WriteToCSV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。