コード例 #1
0
        public void Connect()
        {
            // do smthng
            var basec = new Entities.Instrument(1, "UXU2", "FUTUX", Entities.InstrumentType.Futures, "UX-9.13");

            basec.MaturityDate = new DateTime(2013, 6, 15);
            TimeSpan diff = basec.MaturityDate - DateTime.Now;

            basec.DaysToMate = (int)diff.TotalDays;
            this._instrumentslist.Add(basec);
            var opt1 = new Entities.Instrument(2, "UX000850BU3", "OPTUX", Entities.InstrumentType.Option, "UX 850 Put", Entities.OptionType.Put, 850, basec.Id);

            opt1.DaysToMate = 15;
            var opt2 = new Entities.Instrument(3, "UX000900BI3", "OPTUX", Entities.InstrumentType.Option, "UX 900 Call", Entities.OptionType.Call, 900, basec.Id);

            opt2.DaysToMate = 15;
            var opt3 = new Entities.Instrument(4, "UX000950BI3", "OPTUX", Entities.InstrumentType.Option, "UX 950 Call", Entities.OptionType.Call, 950, basec.Id);

            opt3.DaysToMate = 15;
            this._instrumentslist.Add(opt1);
            this._instrumentslist.Add(opt2);
            this._instrumentslist.Add(opt3);

            this._positionslist.Add(new Entities.Position(basec, -25, 0, 0));
            this._positionslist.Add(new Entities.Position(_instrumentslist.FirstOrDefault(i => i.Id == 2), 10, 2, 4));
            this._positionslist.Add(new Entities.Position(_instrumentslist.FirstOrDefault(i => i.Id == 3), -5, 2, 4));
            this._positionslist.Add(new Entities.Position(_instrumentslist.FirstOrDefault(i => i.Id == 4), 2, 2, 4));

            var acc = new Entities.Account("my_acc", 2);

            this._portfolioslist.Add(new Entities.Portfolio(basec.Id, acc, this._positionslist));
            this._portfolioslist.ElementAt(0).Name = "Test portfolio";
        }
コード例 #2
0
ファイル: TestData.cs プロジェクト: KuzinAU/OptionsCalc
        public void Connect()
        {
            // do smthng
            var basec=new Entities.Instrument(1,"UXU2","FUTUX",Entities.InstrumentType.Futures,"UX-9.13");
            basec.MaturityDate = new DateTime(2013,6,15);
            TimeSpan diff = basec.MaturityDate - DateTime.Now;
            basec.DaysToMate = (int)diff.TotalDays;
            this._instrumentslist.Add(basec);
            var opt1 = new Entities.Instrument(2, "UX000850BU3", "OPTUX", Entities.InstrumentType.Option, "UX 850 Put", Entities.OptionType.Put, 850, basec.Id);
            opt1.DaysToMate = 15;
            var opt2 = new Entities.Instrument(3, "UX000900BI3", "OPTUX", Entities.InstrumentType.Option, "UX 900 Call", Entities.OptionType.Call, 900, basec.Id);
            opt2.DaysToMate = 15;
            var opt3 = new Entities.Instrument(4, "UX000950BI3", "OPTUX", Entities.InstrumentType.Option, "UX 950 Call", Entities.OptionType.Call, 950, basec.Id);
            opt3.DaysToMate = 15;
            this._instrumentslist.Add(opt1);
            this._instrumentslist.Add(opt2);
            this._instrumentslist.Add(opt3);

            this._positionslist.Add(new Entities.Position(basec,-25,0,0));
            this._positionslist.Add(new Entities.Position(_instrumentslist.FirstOrDefault(i=>i.Id==2),10,2,4));
            this._positionslist.Add(new Entities.Position(_instrumentslist.FirstOrDefault(i=>i.Id==3),-5,2,4));
            this._positionslist.Add(new Entities.Position(_instrumentslist.FirstOrDefault(i=>i.Id==4),2,2,4));

            var acc=new Entities.Account("my_acc",2);
            this._portfolioslist.Add(new Entities.Portfolio(basec.Id,acc,this._positionslist));
            this._portfolioslist.ElementAt(0).Name = "Test portfolio";
        }