Exemple #1
0
 public ArbitrageSettings()
     : this(SerialIntegerFactory.Make(),
            new List <StrategyHeader>(),
            new List <StrategyHeader>(),
            new SpreadSettings())
 {
 }
Exemple #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);
 }
 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);
 }
Exemple #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;
 }
Exemple #5
0
 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;
 }
Exemple #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;
 }
        public void SerialInteger_Values_Are_Not_Equals()
        {
            int first  = SerialIntegerFactory.Make();
            int second = SerialIntegerFactory.Make();

            Assert.AreNotEqual(first, second);
            Assert.IsTrue(first + 1 == second);
        }
Exemple #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;
 }
Exemple #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;
 }
Exemple #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;
 }
Exemple #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()
     });
 }
Exemple #13
0
 //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;
 }
Exemple #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;
            }
        }
Exemple #15
0
        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());
        }
Exemple #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);
        }
        public void SerialIntegerFactory_Makes_Value_Greater_Than_Zero()
        {
            int cookie = SerialIntegerFactory.Make();

            Assert.IsTrue(cookie > 0);
        }
Exemple #18
0
 public Position(string portfolio, string symbol, double amount)
     : this(SerialIntegerFactory.Make(), portfolio, symbol, amount)
 {
 }
Exemple #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;
 }
Exemple #20
0
 public Order()
 {
     this.Id             = SerialIntegerFactory.Make();
     this.ExpirationDate = new FortsTradingSchedule().SessionEnd;
 }