Esempio n. 1
0
        public void ProcessOrderCommands(MarketMakerOrderCommandsBatchMessage batch)
        {
            batch.AssetPairId.RequiredNotNullOrWhiteSpace(nameof(batch.AssetPairId));
            batch.Commands.RequiredNotNull(nameof(batch.Commands));

            if (_maintenanceModeService.CheckIsEnabled())
            {
                return;
            }

            if (_assetPairDayOffService.IsAssetTradingDisabled(batch.AssetPairId))
            {
                return;
            }

            var model = new SetOrderModel {
                MarketMakerId = batch.MarketMakerId
            };

            ConvertCommandsToOrders(batch, model);
            if (model.OrdersToAdd?.Count > 0 || model.DeleteByInstrumentsBuy?.Count > 0 ||
                model.DeleteByInstrumentsSell?.Count > 0)
            {
                _matchingEngine.SetOrders(model);
            }
        }
Esempio n. 2
0
        public void SetUp()
        {
            var ordersSet = new[]
            {
                new LimitOrder {
                    CreateDate = DateTime.UtcNow, Id = "1", Instrument = "EURUSD", MarketMakerId = _marketMakerId1, Price = 1.04M, Volume = 4
                },
                new LimitOrder {
                    CreateDate = DateTime.UtcNow, Id = "2", Instrument = "EURUSD", MarketMakerId = _marketMakerId1, Price = 1.05M, Volume = 7
                },
                new LimitOrder {
                    CreateDate = DateTime.UtcNow, Id = "3", Instrument = "EURUSD", MarketMakerId = _marketMakerId1, Price = 1.1M, Volume = -6
                },
                new LimitOrder {
                    CreateDate = DateTime.UtcNow, Id = "4", Instrument = "EURUSD", MarketMakerId = _marketMakerId1, Price = 1.15M, Volume = -8
                }
            };

            _matchingEngine.SetOrders(_marketMakerId1, ordersSet);
        }
Esempio n. 3
0
        public static void SetOrders(this IMarketMakerMatchingEngine matchingEngine, string marketMakerId, LimitOrder[] ordersToAdd = null, string[] orderIdsToDelete = null, bool deleteAll = false)
        {
            var model = new SetOrderModel
            {
                MarketMakerId    = marketMakerId,
                OrdersToAdd      = ordersToAdd,
                OrderIdsToDelete = orderIdsToDelete
            };

            if (deleteAll)
            {
                model.DeleteAllBuy  = true;
                model.DeleteAllSell = true;
            }
            matchingEngine.SetOrders(model);
        }
Esempio n. 4
0
 public void TeadDown()
 {
     _matchingEngine.SetOrders("marketMaker1", null, null, true);
 }