Exemplo n.º 1
0
        public Task RemoveCurrencyPair(CurrencyPairDto ccyPair)
        {
            var update = new CurrencyPairUpdateDto
            {
                CurrencyPair = ccyPair,
                UpdateType   = UpdateTypeDto.Removed
            };

            return(Publish(update));
        }
Exemplo n.º 2
0
        public ICurrencyPairUpdate Create(CurrencyPairUpdateDto currencyPairUpdate)
        {
            var cp = new CurrencyPair(
                currencyPairUpdate.CurrencyPair.Symbol,
                currencyPairUpdate.CurrencyPair.RatePrecision,
                currencyPairUpdate.CurrencyPair.PipsPosition,
                _priceRepository);

            var update =
                new CurrencyPairUpdate(
                    currencyPairUpdate.UpdateType == UpdateTypeDto.Added ? UpdateType.Add : UpdateType.Remove, cp);

            return(update);
        }
Exemplo n.º 3
0
        private async Task Publish(CurrencyPairUpdateDto update)
        {
            IHubCallerConnectionContext context = _contextHolder.ReferenceDataHubClients;

            if (context == null)
            {
                return;
            }

            const string groupName = ReferenceDataHub.CurrencyPairUpdateGroupName;

            try
            {
                await context.Group(groupName).OnCurrencyPairUpdate(update);

                Log.InfoFormat("Published currency pair update to group {0}: {1}", groupName, update);
            }
            catch (Exception e)
            {
                Log.Error(
                    string.Format("An error occurred while publishing currency pair update to group {0}: {1}", groupName,
                                  update), e);
            }
        }