Пример #1
0
        private async Task <Dictionary <string, Order> > PlaceOrderAndTryExecute(Order order)
        {
            string key = CacheKeyGenerator.ToStoreKey(ref order);

            order.DeletionReferenceKey = key;

            await _orderCacheService.Cache(key, order);

            return(await TryExecute(order));
        }
Пример #2
0
        private async Task <Dictionary <string, Order> > Execute(Order order, Order oppositeOrder)
        {
            string orderKey         = CacheKeyGenerator.ToStoreKey(ref order);
            string oppositeOrderKey = CacheKeyGenerator.ToStoreKey(ref oppositeOrder);

            Dictionary <string, Order> ordersInvolved = new Dictionary <string, Order>
            {
                { orderKey, order },
                { oppositeOrderKey, oppositeOrder }
            };

            await _orderCacheService.Decache(ordersInvolved);

            decimal execPrice = GetExecutionPrice(order, oppositeOrder);

            OrderExecutionDueDiligence(execPrice, ordersInvolved);

            return(ordersInvolved);
        }