Exemple #1
0
        //TODO: implement routes logic, to consider account LE and take only ME with same LE as account, find ME with correct mode that owns the same Entity as asset pair
        public IMatchingEngineBase GetMatchingEngineForExecution(Order order)
        {
            var route = _routesManager.FindRoute(null, order.TradingConditionId, order.AssetPairId,
                                                 order.Direction);

            if (route != null)
            {
                return(_matchingEngineRepository.GetMatchingEngineById(route.MatchingEngineId));
            }

            var assetPair = _assetPairsCache.GetAssetPairByIdOrDefault(order.AssetPairId);

            return(_matchingEngineRepository.GetMatchingEngineById(
                       (assetPair?.MatchingEngineMode ?? MatchingEngineMode.MarketMaker) == MatchingEngineMode.MarketMaker
                    ? MatchingEngineConstants.DefaultMm
                    : MatchingEngineConstants.DefaultStp));
        }
Exemple #2
0
        public IMatchingEngineBase GetMatchingEngineForOpen(IOrder order)
        {
            var route = _routesManager.FindRoute(order.ClientId, order.TradingConditionId, order.Instrument,
                                                 order.GetOrderType());

            if (route != null)
            {
                //TODO: to consider account LE and take only ME with same LE as account

                return(_matchingEngineRepository.GetMatchingEngineById(route.MatchingEngineId));
            }

            var assetPair = _assetPairsCache.GetAssetPairByIdOrDefault(order.Instrument);

            //TODO: find ME with correct mode that ownes the same Entity as asset pair
            return(_matchingEngineRepository.GetMatchingEngineById(
                       (assetPair?.MatchingEngineMode ?? MatchingEngineMode.MarketMaker) == MatchingEngineMode.MarketMaker
                    ? MatchingEngineConstants.LykkeVuMm
                    : MatchingEngineConstants.LykkeCyStp));
        }