示例#1
0
 void OnReceiveRealConditions(object sender, _DKHOpenAPIEvents_OnReceiveRealConditionEvent e)
 {
     if (e.strType.Equals("I") && Pick.Contains(e.sTrCode) && Ban.Contains(e.sTrCode) == false && Strategics.Any(o => o.Code.Equals(e.sTrCode)) == false &&
         Connect.HoldingStock.ContainsKey(e.sTrCode) == false && int.TryParse(axAPI.GetMasterLastPrice(e.sTrCode), out int price))
     {
         new Task(() =>
         {
             var sc = new SatisfyConditionsAccordingToTrends
             {
                 Code  = e.sTrCode,
                 Short = AccordingToTrends.Short,
                 Long  = AccordingToTrends.Long,
                 Trend = AccordingToTrends.Trend,
                 ReservationSellUnit     = AccordingToTrends.ReservationSellUnit,
                 ReservationSellQuantity = AccordingToTrends.ReservationSellQuantity,
                 ReservationSellRate     = AccordingToTrends.ReservationSellRate,
                 ReservationBuyUnit      = AccordingToTrends.ReservationBuyUnit,
                 ReservationBuyQuantity  = AccordingToTrends.ReservationBuyQuantity,
                 ReservationBuyRate      = AccordingToTrends.ReservationBuyRate,
                 TradingSellInterval     = price / AccordingToTrends.TradingSellInterval,
                 TradingSellQuantity     = AccordingToTrends.TradingSellQuantity,
                 TradingSellRate         = AccordingToTrends.TradingSellRate,
                 TradingBuyInterval      = price / AccordingToTrends.TradingBuyInterval,
                 TradingBuyQuantity      = AccordingToTrends.TradingBuyQuantity,
                 TradingBuyRate          = AccordingToTrends.TradingBuyRate
             };
             if (Strategics.Add(sc) && Ban.Add(e.sTrCode))
             {
                 var count = SetStrategics(sc);
                 SendMessage(string.Concat(e.strConditionName, '_', count), e.sTrCode);
                 SendConditions?.Invoke(this, new SendSecuritiesAPI(SetSatisfyConditions(sc), sc));
             }
         }).Start();
     }
 }