Пример #1
0
 public void VisitCT(CTBond ct, DateTime start)
 {
     if (ctCache != null)
         ctCache.Process(ct, start);
 }
Пример #2
0
        private Auction GetRelevantAuctions(CTBond ctcontract, DateTime startDate, int nth)
        {
            // find the relevant auctions for the term of the ct
            var auctions = Singleton<Auctions>.Instance.Where(a => TermBucket.IsTermWithinBucket(a.Term, ctcontract.Series));
            // find the most recent auction
            var sortedauctions = auctions.Where(x => x.AuctionDate < startDate).OrderByDescending(x => x.AuctionDate)
                                        .GroupBy(a => a.FIID).Select(g => g.First());

            var auction = sortedauctions.ElementAt(nth);
            return auction;
        }
Пример #3
0
    private static Bond findBond(IEnumerable<Bond> bonds_, MonthYear month_, int yearsMaturity_, DateTime currDate, int nthAuction)
    {
        Logger.InfoFormat(typeof(Generator), "searching CT bond for {0} series", yearsMaturity_);
      var overrIDE = _CT_overrides.FirstOrDefault(x => x.Item1 == yearsMaturity_ && x.Item2.Equals(month_));

      if (overrIDE != null)
        return bonds_.FirstOrDefault(x => String.Compare(x.SymmetryCode, overrIDE.Item3, StringComparison.OrdinalIgnoreCase) == 0);

      //var bonds = bonds_.Where(x => x.Maturity.Value.Month == month_.Month && x.Maturity.Value.Year == month_.Year + yearsMaturity_);

      //if (bonds.Count() > 1)
      //{
      //  Logger.Debug(string.Format("More than one bond found for {0} with {1} years to maturity", month_.ToString(), yearsMaturity_.ToString()), typeof(Generator));
      //  Array.ForEach(bonds.ToArray(),x=>Logger.Debug(string.Format("{0} - {1} - {2}",x.SymmetryCode,x.DisplayName,x.IssueDate),typeof(Generator)));
      //}
      //var  bond = bonds_.FirstOrDefault(x => x.Maturity.Value.Month == month_.Month && x.Maturity.Value.Year == month_.Year + yearsMaturity_);

      var ctcontract = new CTBond { Ric = "CT" + yearsMaturity_, Series = yearsMaturity_ };
      var ctlogic = new CTRollLogic(ctcontract);
      var bond = ctlogic.GetCTBond(currDate, nthAuction);
      if(bond != null)
        Logger.InfoFormat(typeof(Generator), "CT bond found {0}: ", bond.SymmetryCode);
      return bond;
    }
Пример #4
0
 private Bond GetRelevantCTBond(CTBond ctcontract, Auction auction)
 {
     // logic suitable for US only
     var allbondsForAuction = auction.Bonds.Where(x => x.SymmetryCode.StartsWith("US9128") && x.Term.HasValue  && x.IsFloater == false && x.IsInflationLinked == false);
                                                         //&& IsTermWithinAuctionBucket(x.Term, ctcontract.Series));
     // find the latest maturity
     var bond = allbondsForAuction.OrderByDescending(b => b.Maturity).First();
     return bond;
 }