コード例 #1
0
ファイル: Guild.cs プロジェクト: Mr-Dm1try/Merchant_sGuild
        public String NewDeal(Merchant merch1, Merchant merch2)
        {
            Deals.Add(new Deal(merch1, merch2, merch1.Strategy(merch2), merch2.Strategy(merch1)));
            String result = Deals.Last().MakeDeal();

            return(merch1.Name + ": +" + result[0] + "\t" + merch2.Name + ": +" + result[1]);
        }
コード例 #2
0
 private void SetCumulativePnL(Deal deal)
 {
     if (Deals.Count > 0)
     {
         deal.CumulativePnL = deal.PnL + Deals.Last().CumulativePnL;
         if (deal.IsProfit == Deals.Last().IsProfit)
         {
             deal.InSeries    = Deals.Last().InSeries + 1;
             deal.InSeriesMax = deal.InSeries;
             Deals.Last().InSeriesMax = 0;
         }
         else
         {
             deal.InSeries    = 1;
             deal.InSeriesMax = 1;
         }
     }
     else
     {
         deal.CumulativePnL = deal.PnL;
         deal.InSeries      = 1;
         deal.InSeriesMax   = 1;
     }
 }