public void Reset()
 {
     Way = WayEnum.NotSet;
     Quantity = 0;
     Symbol = string.Empty;
     ClientId = 0;
 }
 public void Update(MarketOrderDto other)
 {
     Symbol = other.Symbol;
     Quantity = other.Quantity;
     Way = other.Way;
     ClientId = other.ClientId;
 }
Пример #3
0
 public MarketOrder(string symbol, int quantity, WayEnum way, int clientId)
     : base(symbol, quantity, 0, way, clientId)
 {
     if (way == WayEnum.Buy)
         Price = double.MaxValue;
     else if (way == WayEnum.Sell)
         Price = double.MinValue;
 }
 public void Reeset()
 {
     Symbol = String.Empty;
     Quantity = 0;
     Price = 0;
     Way = WayEnum.NotSet;
     ExchangeOrderId = 0;
     ClientId = 0;
 }
Пример #5
0
 private void SetFields(StopLimitOrderDto stopLimitOrder)
 {
     symbol          = stopLimitOrder.Symbol;
     quantity        = stopLimitOrder.Quantity;
     limitPrice      = stopLimitOrder.LimitPrice;
     triggerPrice    = stopLimitOrder.TriggerPrice;
     way             = stopLimitOrder.Way;
     exchangeOrderId = stopLimitOrder.ExchangeOrderId;
 }
Пример #6
0
 public void Reset()
 {
     ExchangeOrderId = 0;
     Quantity        = 0;
     Symbol          = string.Empty;
     Price           = 0;
     ExecutionTime   = DateTimeOffset.MinValue;
     Way             = WayEnum.NotSet;
 }
Пример #7
0
 public void Update(ExecutionDto other)
 {
     ExchangeOrderId = other.ExchangeOrderId;
     Quantity        = other.Quantity;
     Symbol          = other.Symbol;
     Price           = other.Price;
     ExecutionTime   = other.ExecutionTime;
     Way             = other.Way;
 }
 public void Update(LimitOrderDto other)
 {
     Symbol = other.Symbol;
     Quantity = other.Quantity;
     Price = other.Price;
     Way = other.Way;
     ExchangeOrderId = other.ExchangeOrderId;
     ClientId = other.ClientId;
 }
        public NewLimitOrderViewModel(IClient exchangeApi)
        {
            this.exchangeApi = exchangeApi;
            LimitOrderTypes = new List<string> {"Limit order", "Stop limit order"};
            Ways = new List<WayEnum> { WayEnum.Buy, WayEnum.Sell };
            selectedLimitOrderType = LimitOrderTypes[0];
            selectedWay = WayEnum.Buy;

            SetupCommandsAndBehaviour();
        }
 public void Update(StopLimitOrderDto other)
 {
     Symbol = other.Symbol;
     Quantity = other.Quantity;
     LimitPrice = other.LimitPrice;
     TriggerPrice = other.TriggerPrice;
     Way = other.Way;
     ExchangeOrderId = other.ExchangeOrderId;
     ClientId = other.ClientId;
 }
 public StopLimitOrder(string symbol, int quantity, double limitPrice, double triggerPrice, WayEnum way, int clientId, IBestPriceTrigger trigger)
 {
     this.way = way;
     this.symbol = symbol;
     this.exchangeOrderId = 0;
     this.clientId = clientId;
     this.triggerPrice = triggerPrice;
     this.limitPrice = limitPrice;
     this.quantity = quantity;
     Trigger = trigger;
 }
Пример #12
0
 public MarketOrder(string symbol, int quantity, WayEnum way, int clientId) : base(symbol, quantity, 0, way, clientId)
 {
     if (way == WayEnum.Buy)
     {
         Price = double.MaxValue;
     }
     else if (way == WayEnum.Sell)
     {
         Price = double.MinValue;
     }
 }
Пример #13
0
 public StopLimitOrder(string symbol, int quantity, double limitPrice, double triggerPrice, WayEnum way, int clientId, IBestPriceTrigger trigger)
 {
     this.way             = way;
     this.symbol          = symbol;
     this.exchangeOrderId = 0;
     this.clientId        = clientId;
     this.triggerPrice    = triggerPrice;
     this.limitPrice      = limitPrice;
     this.quantity        = quantity;
     Trigger = trigger;
 }
Пример #14
0
 public LimitOrder(string symbol, int quantity, double price, WayEnum way, int clientId)
 {
     this.symbol          = symbol;
     this.quantity        = quantity;
     this.price           = price;
     this.way             = way;
     this.clientId        = clientId;
     this.exchangeOrderId = 0;
     ModifiedHandlers     = new List <Action <ILimitOrder, int, double> >();
     DeletedHandlers      = new List <Action <ILimitOrder> >();
     FilledHandlers       = new List <Action <ILimitOrder> >();
 }
Пример #15
0
 public LimitOrder(string symbol, int quantity, double price, WayEnum way, int clientId)
 {
     this.symbol = symbol;
     this.quantity = quantity;
     this.price = price;
     this.way = way;
     this.clientId = clientId;
     this.exchangeOrderId = 0;
     ModifiedHandlers = new List<Action<ILimitOrder, int, double>>();
     DeletedHandlers = new List<Action<ILimitOrder>>();
     FilledHandlers = new List<Action<ILimitOrder>>();
 }
Пример #16
0
        public NewLimitOrderViewModel(IClient exchangeApi)
        {
            this.exchangeApi = exchangeApi;
            LimitOrderTypes  = new List <string> {
                "Limit order", "Stop limit order"
            };
            Ways = new List <WayEnum> {
                WayEnum.Buy, WayEnum.Sell
            };
            selectedLimitOrderType = LimitOrderTypes[0];
            selectedWay            = WayEnum.Buy;

            SetupCommandsAndBehaviour();
        }
        public ILimitOrder NewLimitOrder(string symbol, int clientId, double price, int quantity, WayEnum way)
        {
            if (!ClientOrders.ContainsKey(clientId))
                ClientOrders.Add(clientId, new EditableList<ILimitOrder>());

            ILimitOrder toReturn = new LimitOrder(symbol, quantity, price, way, clientId);
            toReturn.SetExchangeOrderId(globalItemCounter);

            LimitOrders.Add(toReturn.ExchangeOrderId, toReturn);
            ClientOrders[clientId].Add(toReturn);
            toReturn.RegisterDeleteNotificationHandler(HandleDeletedLimitOrder);
            toReturn.RegisterFilledNotification(HandleDeletedLimitOrder);

            globalItemCounter++;
            return toReturn;
        }
Пример #18
0
        public void SubmitMarketOrder(string symbol, int quantity, WayEnum way)
        {
            if (!isStarted)
            {
                return;
            }

            messageConnection.SendMessage(new ClientToServerMessage
            {
                ClientId    = clientId,
                MarketOrder = new MarketOrderDto
                {
                    Quantity = quantity,
                    Symbol   = symbol,
                    Way      = way
                },
                MessageType = ClientToServerMessageTypeEnum.PlaceMarketOrder
            });
        }
Пример #19
0
        public void SubmitLimitOrder(string symbol, double price, int quantity, WayEnum way)
        {
            if (!isStarted)
            {
                return;
            }

            messageConnection.SendMessage(new ClientToServerMessage
            {
                ClientId   = clientId,
                LimitOrder = new LimitOrderDto
                {
                    ClientId = clientId,
                    Price    = price,
                    Quantity = quantity,
                    Symbol   = symbol,
                    Way      = way
                },
                MessageType = ClientToServerMessageTypeEnum.PlaceLimitOrder
            });
        }
Пример #20
0
        public void SubmitLimitOrder(string symbol, double price, int quantity, WayEnum way)
        {
            if (!isStarted)
                return;

            messageConnection.SendMessage(new ClientToServerMessage
            {
                ClientId = clientId,
                LimitOrder = new LimitOrderDto
                {
                    ClientId = clientId,
                    Price = price,
                    Quantity = quantity,
                    Symbol = symbol,
                    Way = way
                },
                MessageType = ClientToServerMessageTypeEnum.PlaceLimitOrder
            });
        }
 private void SetFields(LimitOrderDto limitOrder)
 {
     Symbol = limitOrder.Symbol;
     Quantity = limitOrder.Quantity;
     Price = limitOrder.Price;
     Way = limitOrder.Way;
     OrderType = "Limit order";
     OrderId = limitOrder.ExchangeOrderId;
 }
Пример #22
0
        public void SubmitStopLimitOrder(string symbol, double triggerPrice, double limitPrice, int quantity, WayEnum way)
        {
            if (!isStarted)
            {
                return;
            }

            messageConnection.SendMessage(new ClientToServerMessage
            {
                ClientId       = clientId,
                StopLimitOrder = new StopLimitOrderDto
                {
                    Symbol       = symbol,
                    Quantity     = quantity,
                    Way          = way,
                    TriggerPrice = triggerPrice,
                    LimitPrice   = limitPrice,
                    ClientId     = clientId
                },
                MessageType = ClientToServerMessageTypeEnum.PlaceStopLimitOrder
            });
        }
        public IStopLimitOrder NewStopLimitOrder(string symbol, int clientId, double triggerPrice, double limitPrice, int quantity, WayEnum way)
        {
            if (!ClientStopLimitOrders.ContainsKey(clientId))
                ClientStopLimitOrders.Add(clientId, new EditableList<IStopLimitOrder>());

            var trigger = new BestPriceTrigger(symbol, triggerPrice, way);
            var toReturn = new StopLimitOrder(symbol, quantity, limitPrice, triggerPrice, way, clientId, trigger );

            toReturn.SetExchangeOrderId(globalItemCounter);
            StopLimitOrders.Add(globalItemCounter, toReturn);
            ClientStopLimitOrders[clientId].Add(toReturn);
            toReturn.RegisterOrderRepositoryDeleteHandler(HandleDeletedStopLimitOrder);

            globalItemCounter++;
            return toReturn;
        }
        public IMarketOrder NewMarketOrder(string symbol, int clientId, int quantity, WayEnum way)
        {
            IMarketOrder toReturn = new MarketOrder(symbol, quantity, way, clientId);
            toReturn.SetExchangeOrderId(globalItemCounter);

            globalItemCounter++;
            return toReturn;
        }
Пример #25
0
 public BestPriceTrigger(string symbol, double triggerPrice, WayEnum way)
 {
     Symbol       = symbol;
     TriggerPrice = triggerPrice;
     Way          = way;
 }
Пример #26
0
        public IMarketOrder NewMarketOrder(string symbol, int clientId, int quantity, WayEnum way)
        {
            IMarketOrder toReturn = new MarketOrder(symbol, quantity, way, clientId);

            toReturn.SetExchangeOrderId(globalItemCounter);

            globalItemCounter++;
            return(toReturn);
        }
Пример #27
0
        public IStopLimitOrder NewStopLimitOrder(string symbol, int clientId, double triggerPrice, double limitPrice, int quantity, WayEnum way)
        {
            if (!ClientStopLimitOrders.ContainsKey(clientId))
            {
                ClientStopLimitOrders.Add(clientId, new EditableList <IStopLimitOrder>());
            }

            var trigger  = new BestPriceTrigger(symbol, triggerPrice, way);
            var toReturn = new StopLimitOrder(symbol, quantity, limitPrice, triggerPrice, way, clientId, trigger);

            toReturn.SetExchangeOrderId(globalItemCounter);
            StopLimitOrders.Add(globalItemCounter, toReturn);
            ClientStopLimitOrders[clientId].Add(toReturn);
            toReturn.RegisterOrderRepositoryDeleteHandler(HandleDeletedStopLimitOrder);

            globalItemCounter++;
            return(toReturn);
        }
Пример #28
0
        public ILimitOrder NewLimitOrder(string symbol, int clientId, double price, int quantity, WayEnum way)
        {
            if (!ClientOrders.ContainsKey(clientId))
            {
                ClientOrders.Add(clientId, new EditableList <ILimitOrder>());
            }

            ILimitOrder toReturn = new LimitOrder(symbol, quantity, price, way, clientId);

            toReturn.SetExchangeOrderId(globalItemCounter);

            LimitOrders.Add(toReturn.ExchangeOrderId, toReturn);
            ClientOrders[clientId].Add(toReturn);
            toReturn.RegisterDeleteNotificationHandler(HandleDeletedLimitOrder);
            toReturn.RegisterFilledNotification(HandleDeletedLimitOrder);

            globalItemCounter++;
            return(toReturn);
        }
 private void SetFields()
 {
     Symbol = limitOrder.Symbol;
     Quantity = limitOrder.Quantity;
     Price = limitOrder.Price;
     Way = limitOrder.Way;
 }
 public BestPriceTrigger(string symbol, double triggerPrice, WayEnum way)
 {
     Symbol = symbol;
     TriggerPrice = triggerPrice;
     Way = way;
 }
 private void SetFields(StopLimitOrderDto stopLimitOrder)
 {
     symbol = stopLimitOrder.Symbol;
     quantity = stopLimitOrder.Quantity;
     limitPrice = stopLimitOrder.LimitPrice;
     triggerPrice = stopLimitOrder.TriggerPrice;
     way = stopLimitOrder.Way;
     exchangeOrderId = stopLimitOrder.ExchangeOrderId;
 }
Пример #32
0
        public void SubmitMarketOrder(string symbol, int quantity, WayEnum way)
        {
            if (!isStarted)
                return;

            messageConnection.SendMessage(new ClientToServerMessage
            {
                ClientId = clientId,
                MarketOrder = new MarketOrderDto
                {
                    Quantity = quantity,
                    Symbol = symbol,
                    Way = way
                },
                MessageType = ClientToServerMessageTypeEnum.PlaceMarketOrder
            });
        }
Пример #33
0
        public void SubmitStopLimitOrder(string symbol, double triggerPrice, double limitPrice, int quantity, WayEnum way)
        {
            if (!isStarted)
                return;

            messageConnection.SendMessage(new ClientToServerMessage
            {
                ClientId = clientId,
                StopLimitOrder = new StopLimitOrderDto
                {
                    Symbol = symbol,
                    Quantity = quantity,
                    Way = way,
                    TriggerPrice = triggerPrice,
                    LimitPrice = limitPrice,
                    ClientId = clientId

                },
                MessageType = ClientToServerMessageTypeEnum.PlaceStopLimitOrder
            });
        }
 private void SetFields(StopLimitOrderDto stopLimitOrder)
 {
     Symbol = stopLimitOrder.Symbol;
     Quantity = stopLimitOrder.Quantity;
     TriggerPrice = stopLimitOrder.TriggerPrice;
     LimitPrice = stopLimitOrder.LimitPrice;
     OrderId = stopLimitOrder.ExchangeOrderId;
     Way = stopLimitOrder.Way;
 }