Ejemplo n.º 1
0
        /// <summary>
        /// Function: Create a Strategy and run startup procedures
        /// </summary>
        /// <param name="name">name</param>
        /// <param name="ccy">base currency</param>
        /// <param name="initialDate">starting date</param>
        /// <param name="initialValue">starting NAV</param>
        /// <param name="simulated">false if persistent</param>
        new public static ConstantStrategy CreateStrategy(string name, Currency ccy, BusinessDay initialDate, double initialValue, bool simulated)
        {
            Instrument       instrument = Instrument.CreateInstrument(name, InstrumentType.Strategy, name + "ConstantStrategy", ccy, FundingType.TotalReturn, simulated);
            ConstantStrategy strategy   = ConstantStrategy.CreateStrategy(instrument, initialDate, 1);

            strategy.SetConstantCarryCost(0.0 / (double)10000.0, 0.0 / (double)10000.0, DayCountConvention.Act360, 360);
            strategy.TimeSeriesRoll = TimeSeriesRollType.Last;
            strategy.Initialize();

            return(strategy);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Function: Create a Strategy and run startup procedures
        /// </summary>
        /// <param name="instrument">base instrument</param>
        /// <param name="initialDate">starting date</param>
        /// <param name="initialValue">starting NAV</param>
        public static ConstantStrategy CreateStrategy(Instrument instrument, BusinessDay initialDate, double initialValue)
        {
            if (instrument.InstrumentType == InstrumentType.Strategy)
            {
                ConstantStrategy Strategy = new ConstantStrategy(instrument);
                Strategy.Startup(initialDate, initialValue, null);

                return(Strategy);
            }
            else
            {
                throw new Exception("Instrument not an Strategy");
            }
        }