public DynamicPropSimulation(String key, double lossCutEach, double leverageEach, double maxInvestmentEach, 
            String ticker, String currency, DateTime from, DateTime until, int startGapMonth, int durationMonth, IEachSimPolicy policy)
        {
            this.Key = key;
            this._lossCutEach = lossCutEach;
            this._leverageEach = leverageEach;
            this._maxInvestmentEach = maxInvestmentEach;

            this._ticker = ticker;
            this._currency = currency;
            this._from = from;
            this._until = until;
            this._startGapMonth = startGapMonth;
            this._durationMonth = durationMonth;
            this.EachSims = new List<EachDynamicPropSim>();
            this._policy = policy;

            Trace.Assert(this._lossCutEach < 0);
        }
示例#2
0
        public EachDynamicPropSim(String parentKey, String ticker, Tuple<DateTime, DateTime> fromUntil, 
            SortedList<DateTime, double> marketData, double lossCut, double leverage, double maxInvestment, IEachSimPolicy policy)
        {
            this.Key = String.Format("{0}_{1}_{2}", parentKey, fromUntil.Item1.ToString("yyyy"), fromUntil.Item2.ToString("yyyy"));
            this.Ticker = ticker;
            this.From = fromUntil.Item1;
            this.Until = fromUntil.Item2;
            this.MarketData = marketData;
            this.LossCut = lossCut;
            this.Leverage = leverage;
            this.MaxInvestment = maxInvestment;
            this._policy = policy;

            SortedList<DateTime, double> zooMarketData = ZooUtil.FillWithPrev(marketData, From.AddDays(-100), Until, 0);
            this.Incs = ConvertUtil.ToIncrement(zooMarketData);
            this.Pnls = new SortedList<DateTime, double>();
            this.CumPnls = new SortedList<DateTime, double>();
            this.Investments = new SortedList<DateTime, double>();

            Trace.Assert(this.LossCut < 0);
        }