コード例 #1
0
        public List <IOrder> GetConsistentOrderList(double capital, IPortfolio portfolio, OrderType orderType)
        {
            var ol = new List <IOrder>();
            var wl = portfolio.GetWeightList();

            if (wl == null || wl.Count == 0)
            {
                return(ol);
            }
            foreach (var kv in wl)
            {
                var p = portfolio.PositionList.FirstOrDefault(v => v.InstrumentTicker == kv.Key);
                var o = portfolio.GenerateOrderByCapital(kv.Key, p.CurrentPrice, capital, orderType);
                if (o != null)
                {
                    ol.Add(o);
                }
            }
            return(ol);
        }