Ejemplo n.º 1
0
        public void Execute(IContext context, ISecurity[] securities)
        {
            var timeStart = DateTime.Now;
            var logger    = new LoggerSystem(context);

            var system = new MainSystem();

            system.Initialize(securities, context);
            system.Run();

            system.Paint(context, securities.First());
            var timeStop = DateTime.Now;
            var time     = timeStop - timeStart;

            logger.Log(time.ToString());
        }
Ejemplo n.º 2
0
        public void Initialize(ISecurity[] securities, IContext ctx)
        {
            var logger        = new LoggerSystem(ctx);
            var securityFirst = securities.First();

            if (IsLaboratory(securityFirst))
            {
                account = new AccountLab(securityFirst);
            }
            else
            {
                account = new AccountReal(securityFirst);
            }

            var securityList = new List <Security>();

            this.securityFirst = new SecurityTSlab(securityFirst);
            securityList.Add(this.securityFirst);

            var globalMoneyManager = new GlobalMoneyManagerReal(account, riskValuePrcnt: 1.00);

            globalMoneyManager.Logger = logger;
            var localMoneyManagerRuble = new LocalMoneyManager(globalMoneyManager, account, Currency.Ruble);

            //tradingSystems = new List<TradingSystemPivotPointsTwoTimeFrames>();
            tradingSystems = new List <TradingSystemPivotPointsEMA>();

            double                      comission;
            AbsolutCommission           comis;
            TradingSystemPivotPointsEMA ts;

            //tradingSystems.Add(new TradingSystemPivotPointsTwoTimeFrames(localMoneyManagerRuble, account, this.securityFirst));
            ts        = new TradingSystemPivotPointsEMA(localMoneyManagerRuble, account, this.securityFirst);//si-5min
            ts.Logger = logger;
            tradingSystems.Add(ts);
            comission = 1.15 * 2;
            //comission = 1 * 2;
            comis = new AbsolutCommission()
            {
                Commission = comission
            };
            comis.Execute(securities[0]);

            ////tradingSystems.Add(new TradingSystemPivotPointsTwoTimeFrames(localMoneyManagerRuble, account, new Se)curityTSlab(securities[1])));
            //ts = new TradingSystemPivotPointsEMA(localMoneyManagerRuble, account, new SecurityTSlab(securities[1]));//sbrf-5min
            //tradingSystems.Add(ts);
            //ts.Logger = logger;
            //tradingSystems.Add(ts);
            //comission = 2.02 * 2;
            ////comission = 2 * 2;
            //comis = new AbsolutCommission() { Commission = comission };
            //comis.Execute(securities[1]);

            //ts = new TradingSystemPivotPointsEMA(localMoneyManagerRuble, account, new SecurityTSlab(securities[2]));//gazr-5min
            //tradingSystems.Add(ts);
            //ts.Logger = logger;
            //tradingSystems.Add(ts);
            //comission = 2.02 * 2;
            ////comission = 2 * 2;
            //comis = new AbsolutCommission() { Commission = comission };
            //comis.Execute(securities[1]);

            //ts = new TradingSystemPivotPointsEMA(localMoneyManagerRuble, account, new SecurityTSlab(securities[3]));//lkoh-5min
            //tradingSystems.Add(ts);
            //ts.Logger = logger;
            //tradingSystems.Add(ts);
            //comission = 2.02 * 2;
            ////comission = 2 * 2;
            //comis = new AbsolutCommission() { Commission = comission };
            //comis.Execute(securities[1]);

            //ts = new TradingSystemPivotPointsEMA(localMoneyManagerRuble, account, new SecurityTSlab(securities[4]));//mxi-5min
            //tradingSystems.Add(ts);
            //ts.Logger = logger;
            //tradingSystems.Add(ts);
            //comission = 2.02 * 2;
            ////comission = 2 * 2;
            //comis = new AbsolutCommission() { Commission = comission };
            //comis.Execute(securities[1]);

            //ts = new TradingSystemPivotPointsEMA(localMoneyManagerRuble, account, new SecurityTSlab(securities[5]));//silv-5min
            //tradingSystems.Add(ts);
            //ts.Logger = logger;
            //tradingSystems.Add(ts);
            //comission = 2.02 * 2;
            ////comission = 2 * 2;
            //comis = new AbsolutCommission() { Commission = comission };
            //comis.Execute(securities[1]);



            //tradingSystem.Logger = logger;
            account.Logger = logger;
            this.ctx       = ctx;
            context        = new ContextTSLab(ctx);
            var acc = account as AccountLab;

            acc.Initialize(securityList);
        }