예제 #1
0
 public ArbitrageSettings()
     : this(SerialIntegerFactory.Make(),
            new List <StrategyHeader>(),
            new List <StrategyHeader>(),
            new SpreadSettings())
 {
 }
예제 #2
0
 public Order(Signal signal, int timeToLiveSeconds)
     : this(SerialIntegerFactory.Make(), BrokerDateTime.Make(DateTime.Now), signal.Strategy.Portfolio, signal.Strategy.Symbol, signal.TradeAction, signal.OrderType, signal.Amount, signal.Limit, signal.Stop)
 {
     this.Signal         = signal;
     this.SignalId       = signal.Id;
     this.ExpirationDate = BrokerDateTime.Make(DateTime.Now).AddSeconds(timeToLiveSeconds);
 }
예제 #3
0
 public OrderCancellationRequest(Order order, string description)
 {
     this.Id          = SerialIntegerFactory.Make();
     this.OrderId     = order.Id;
     this.Order       = order;
     this.Description = description;
     this.DateTime    = BrokerDateTime.Make(DateTime.Now);
 }
예제 #4
0
 public OrderCancellationConfirmation(Order order, DateTime cancelDate, string description)
 {
     this.Id          = SerialIntegerFactory.Make();
     this.OrderId     = order.Id;
     this.Order       = order;
     this.Description = description;
     this.DateTime    = cancelDate;
 }
예제 #5
0
파일: SMASettings.cs 프로젝트: w1r2p1/TRx
 public SMASettings(StrategyHeader strategyHeader, int periodFast, int periodSlow)
 {
     this.Id         = SerialIntegerFactory.Make();
     this.Strategy   = strategyHeader;
     this.StrategyId = strategyHeader.Id;
     this.PeriodFast = periodFast;
     this.PeriodSlow = periodSlow;
 }
예제 #6
0
 public OrderRejection(Order order, DateTime rejectionDate, string description)
 {
     this.Id          = SerialIntegerFactory.Make();
     this.DateTime    = rejectionDate;
     this.OrderId     = order.Id;
     this.Order       = order;
     this.Description = description;
 }
 public OrderCancellationFailedNotification(Order order, DateTime failedDate, string description)
 {
     this.Id          = SerialIntegerFactory.Make();
     this.DateTime    = failedDate;
     this.Description = description;
     this.Order       = order;
     this.OrderId     = order.Id;
 }
예제 #8
0
        public void SerialInteger_Values_Are_Not_Equals()
        {
            int first  = SerialIntegerFactory.Make();
            int second = SerialIntegerFactory.Make();

            Assert.AreNotEqual(first, second);
            Assert.IsTrue(first + 1 == second);
        }
예제 #9
0
 /// <summary>
 /// NoTest
 /// </summary>
 /// <param name="strategyHeader">strategyHeader</param>
 /// <param name="symbol">symbol</param>
 /// <param name="interval">Длительность бара</param>
 /// <param name="period">Количество баров</param>
 /// <param name="barType">Тип бара</param>
 public BarSettings(StrategyHeader strategyHeader, string symbol, int interval, int period, DataModelType barType)
 {
     this.Id         = SerialIntegerFactory.Make();
     this.Symbol     = symbol;
     this.Interval   = interval;
     this.Period     = period;
     this.StrategyId = strategyHeader.Id;
     this.Strategy   = strategyHeader;
     this.BarType    = barType;
 }
예제 #10
0
 public MoveOrder(Order order, double price, DateTime date, string description)
 {
     this.Id           = SerialIntegerFactory.Make();
     this.DateTime     = date;
     this.Order        = order;
     this.OrderId      = order.Id;
     this.Price        = price;
     this.DeliveryDate = DateTime.MinValue;
     this.MoveDate     = DateTime.MinValue;
     this.Description  = description;
 }
예제 #11
0
 public OrderMoveRequest(Order order, double limitPrice, double stopPrice, string description)
 {
     this.Id               = SerialIntegerFactory.Make();
     this.Order            = order;
     this.OrderId          = order.Id;
     this.DateTime         = BrokerDateTime.Make(DateTime.Now);
     this.LimitPrice       = limitPrice;
     this.StopPrice        = stopPrice;
     this.Description      = description;
     this.DeliveryDate     = DateTime.MinValue;
     this.ExpirationDate   = this.DateTime.AddSeconds(60);
     this.FaultDate        = DateTime.MinValue;
     this.FaultDescription = string.Empty;
 }
예제 #12
0
 private BidAsk MakeBidAsk(UpdateBidAsk src)
 {
     return(new BidAsk {
         Symbol = src.Symbol,
         Row = src.Row,
         NRows = src.NRows,
         Bid = src.Bid,
         BidSize = src.BidSize,
         Ask = src.Ask,
         AskSize = src.AskSize,
         DateTime = BrokerDateTime.Make(DateTime.Now),
         Id = SerialIntegerFactory.Make()
     });
 }
예제 #13
0
파일: Signal.cs 프로젝트: w1r2p1/TRx
 //public Signal(StrategyHeader strategyHeader, DateTime date, TradeAction action, OrderType type, double price, double stop, double limit, long? barId = null, Bar bar = null)
 public Signal(StrategyHeader strategyHeader, DateTime date, TradeAction action, OrderType type, double price, double stop, double limit, long barDateId, Bar bar)
 {
     this.Id          = SerialIntegerFactory.Make();
     this.StrategyId  = strategyHeader.Id;
     this.Strategy    = strategyHeader;
     this.DateTime    = date;
     this.TradeAction = action;
     this.OrderType   = type;
     this.Amount      = strategyHeader.Amount;
     this.Price       = price;
     this.Stop        = stop;
     this.Limit       = limit;
     this.BarDateId   = barDateId;
     this.Bar         = bar;
 }
예제 #14
0
        public Trade(Order order, string portfolio, string symbol, double price, double amount, DateTime date)
        {
            this.Id        = SerialIntegerFactory.Make();
            this.Portfolio = portfolio;
            this.Symbol    = symbol;
            this.Price     = price;
            this.Amount    = amount;
            this.DateTime  = date;
            this.Order     = order;

            if (order != null)
            {
                this.OrderId = order.Id;
            }
        }
예제 #15
0
파일: OrderTests.cs 프로젝트: w1r2p1/TRx
        public void Order_IsClosePosition()
        {
            RawOrder order = new RawOrder
            {
                Portfolio = "PRTF",
                Symbol    = "SBER",
                Action    = SmartCOM3Lib.StOrder_Action.StOrder_Action_Sell,
                Type      = SmartCOM3Lib.StOrder_Type.StOrder_Type_Market,
                Validity  = SmartCOM3Lib.StOrder_Validity.StOrder_Validity_Day,
                Price     = 0,
                Amount    = 1,
                Stop      = 0,
                Cookie    = SerialIntegerFactory.Make()
            };

            Assert.IsFalse(order.RequestsOpenPosition());
            Assert.IsTrue(order.RequestsClosePosition());
        }
예제 #16
0
        public void UpdateQuotesOnBidAsk_handle_add_records_for_registered_symbol()
        {
            BidAsk bidAskOne = new BidAsk {
                Id = SerialIntegerFactory.Make(), Symbol = "RTS-9.13_FT", DateTime = BrokerDateTime.Make(DateTime.Now), Row = 0, NRows = 10, Ask = 150010, AskSize = 300, Bid = 150000, BidSize = 100
            };

            this.tradingData.Get <ObservableCollection <BidAsk> >().Add(bidAskOne);

            double resultBidPrice  = storage.GetBidPrice(bidAskOne.Symbol, 0);
            double resultBidVolume = storage.GetBidVolume(bidAskOne.Symbol, 0);

            double resultOfferPrice  = storage.GetOfferPrice(bidAskOne.Symbol, 0);
            double resultOfferVolume = storage.GetOfferVolume(bidAskOne.Symbol, 0);

            Assert.AreEqual(bidAskOne.Bid, resultBidPrice);
            Assert.AreEqual(bidAskOne.BidSize, resultBidVolume);

            Assert.AreEqual(bidAskOne.Ask, resultOfferPrice);
            Assert.AreEqual(bidAskOne.AskSize, resultOfferVolume);
        }
예제 #17
0
        public void SerialIntegerFactory_Makes_Value_Greater_Than_Zero()
        {
            int cookie = SerialIntegerFactory.Make();

            Assert.IsTrue(cookie > 0);
        }
예제 #18
0
파일: Position.cs 프로젝트: w1r2p1/TRx
 public Position(string portfolio, string symbol, double amount)
     : this(SerialIntegerFactory.Make(), portfolio, symbol, amount)
 {
 }
예제 #19
0
 public Order(Signal signal)
     : this(SerialIntegerFactory.Make(), BrokerDateTime.Make(DateTime.Now), signal.Strategy.Portfolio, signal.Strategy.Symbol, signal.TradeAction, signal.OrderType, signal.Amount, signal.Limit, signal.Stop)
 {
     this.Signal   = signal;
     this.SignalId = signal.Id;
 }
예제 #20
0
 public Order()
 {
     this.Id             = SerialIntegerFactory.Make();
     this.ExpirationDate = new FortsTradingSchedule().SessionEnd;
 }