Exemple #1
0
 /// <summary>
 /// Check profits for a history dict and update if profit has been higher for required ticks or if it is lower
 /// </summary>
 private void UpdateProfits(Dictionary <AlgorithmType, AlgorithmHistory> history, int ticks, StringBuilder sb)
 {
     foreach (var algo in history.Keys)
     {
         if (NHSmaData.TryGetPaying(algo, out var paying))
         {
             history[algo].Add(paying);
             if (paying > _lastLegitPaying[algo])
             {
                 var i = history[algo].CountOverProfit(_lastLegitPaying[algo]);
                 if (i >= ticks)
                 {
                     _lastLegitPaying[algo] = paying;
                     sb.AppendLine($"\tTAKEN: new profit {paying:e5} after {i} ticks for {algo}");
                 }
                 else
                 {
                     sb.AppendLine(
                         $"\tPOSTPONED: new profit {paying:e5} (previously {_lastLegitPaying[algo]:e5})," +
                         $" higher for {i}/{ticks} ticks for {algo}"
                         );
                 }
             }
             else
             {
                 // Profit has gone down
                 _lastLegitPaying[algo] = paying;
             }
         }
     }
 }