Esempio n. 1
0
        public MtBackendResponse <bool> RemoveFromBestFxPriceCache(string assetPairId)
        {
            var result = _fxRateCacheService.RemoveQuote(assetPairId);

            return(result == RemoveQuoteErrorCode.None
                ? MtBackendResponse <bool> .Ok(true)
                : MtBackendResponse <bool> .Error(result.Message));
        }
Esempio n. 2
0
        public MtBackendResponse <bool> RemoveFromBestFxPriceCache(string assetPairId)
        {
            var positions = _ordersCache.Positions.GetPositionsByFxInstrument(assetPairId).ToList();

            if (positions.Any())
            {
                return(MtBackendResponse <bool> .Error(
                           $"Cannot delete [{assetPairId}] best FX price because there are {positions.Count} opened positions."));
            }

            var orders = _ordersCache.Active.GetOrdersByFxInstrument(assetPairId).ToList();

            if (orders.Any())
            {
                return(MtBackendResponse <bool> .Error(
                           $"Cannot delete [{assetPairId}] best FX price because there are {orders.Count} active orders."));
            }

            _fxRateCacheService.RemoveQuote(assetPairId);

            return(MtBackendResponse <bool> .Ok(true));
        }