Exemplo n.º 1
0
 public IsinAdderService(
     IIsinsRepository isinsRepository,
     IMarketDataRepository marketDataCsvFileRepository)
 {
     _isinsCsvFileRepository      = isinsRepository;
     _marketDataCsvFileRepository = marketDataCsvFileRepository;
 }
Exemplo n.º 2
0
        public SwapManager(
            IAccount account,
            ISwapClient swapClient,
            ICurrencyQuotesProvider quotesProvider,
            IMarketDataRepository marketDataRepository)
        {
            _account              = account ?? throw new ArgumentNullException(nameof(account));
            _swapClient           = swapClient ?? throw new ArgumentNullException(nameof(swapClient));
            _quotesProvider       = quotesProvider;
            _marketDataRepository = marketDataRepository ?? throw new ArgumentNullException(nameof(marketDataRepository));

            var currencySwaps = _account.Currencies
                                .Select(c =>
            {
                var currencySwap = CurrencySwapCreator.Create(
                    currency: c,
                    account: _account);

                currencySwap.InitiatorPaymentConfirmed += InitiatorPaymentConfirmed;
                currencySwap.AcceptorPaymentConfirmed  += AcceptorPaymentConfirmed;
                currencySwap.AcceptorPaymentSpent      += AcceptorPaymentSpent;
                currencySwap.SwapUpdated += SwapUpdatedHandler;

                return(currencySwap);
            });

            _currencySwaps = currencySwaps.ToDictionary(cs => cs.Currency);
        }
Exemplo n.º 3
0
 public MarketController(IMarketDataRepository marketDataRepository,
                         IAssetsRepository assetsRepository, IAssetPairBestPriceRepository marketProfileRepo)
 {
     _marketDataRepository = marketDataRepository;
     _assetsRepository     = assetsRepository;
     _marketProfileRepo    = marketProfileRepo;
 }
 public RegistryService(
     IMarketDataRepository marketDataRepository,
     IRegistryRepository registryRepository)
 {
     _marketDataRepository = marketDataRepository;
     _registryRepository   = registryRepository;
 }
Exemplo n.º 5
0
        public Service()
        {
            try
            {
                _financialAnalysesCsvFileRepository = new AnalysesCsvFileRepository();
                _marketDataRepository = new MarketDataCsvFileRepository();
                _registryRepository   = new RegistryCsvFileRepository();

                var reader = new AppSettingsReader();

                _buyingPacketInEuro = (int)reader.GetValue("BuyingPacketInEuro", typeof(int));
                _fastMovingAverage  = (int)reader.GetValue("FastMovingAverage", typeof(int));
                _slowMovingAverage  = (int)reader.GetValue("SlowMovingAverage", typeof(int));

                _logger.Debug($"Buying Packet is {_buyingPacketInEuro} EUR from config file.");
                _logger.Debug($"Fast Moving Average subset size is {_fastMovingAverage} from config file.");
                _logger.Debug($"Slow Moving Average subset size is {_slowMovingAverage} from config file.");

                if (_fastMovingAverage >= _slowMovingAverage)
                {
                    throw new BusinessException("The timespan for the fast moving average must be lower than of the slow moving average.");
                }
                if (_buyingPacketInEuro <= 0 || _fastMovingAverage <= 0 || _slowMovingAverage <= 0)
                {
                    throw new BusinessException("Buying packet and moving average subset sizes must be positive numbers.");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                throw new BusinessException($"Error when initializing {GetType().Name}.", ex);
            }
        }
Exemplo n.º 6
0
 public QuoteCalculator(
     IMarketDataRepository marketDataRepository,
     IMarketCalculator marketCalculator)
 {
     this.marketDataRepository = marketDataRepository;
     this.marketCalculator     = marketCalculator;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Instantiates a <see cref="SubscriptionManager"/>
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="repository"></param>
        /// <param name="subscriptionFactory"></param>
        public SubscriptionManager(ILog logger, IMarketDataRepository repository, ISubscriptionFactory subscriptionFactory)
        {
            _logger = logger;
            _repository = repository;
            _subscriptionFactory = subscriptionFactory;

            // set up timer - wait five minutes, then update data every minute
            _dataUpdateTimer = new Timer(UpdateSubscriptionData);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Instantiates a <see cref="SubscriptionManager"/>
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="repository"></param>
        /// <param name="subscriptionFactory"></param>
        public SubscriptionManager(ILog logger, IMarketDataRepository repository, ISubscriptionFactory subscriptionFactory)
        {
            _logger              = logger;
            _repository          = repository;
            _subscriptionFactory = subscriptionFactory;

            // set up timer - wait five minutes, then update data every minute
            _dataUpdateTimer = new Timer(UpdateSubscriptionData);
        }
Exemplo n.º 9
0
 public MarketController(IMarketDataRepository marketDataRepository,
                         IAssetPairBestPriceRepository marketProfileRepo,
                         CachedDataDictionary <string, IAssetPair> assetPairsDictionary,
                         IMarketCapitalizationService marketCapitalizationService)
 {
     _marketDataRepository        = marketDataRepository;
     _marketProfileRepo           = marketProfileRepo;
     _assetPairsDictionary        = assetPairsDictionary;
     _marketCapitalizationService = marketCapitalizationService;
 }
Exemplo n.º 10
0
        // Constructor dependency injection
        public MarketFactory(IMarketDataRepository marketDataRepo, IMarketFactorySettings settings)
        {
            if (marketDataRepo == null)
                throw new ArgumentNullException("marketDataRepo");
            if (settings == null)
                throw new ArgumentNullException("settings");

            _marketDataRepo = marketDataRepo;
            _settings = settings;
        }
Exemplo n.º 11
0
 public WebService(
     IEnvironmentVariableReader environmentVariableReader,
     IHttpFacade httpFacade,
     IMarketDataRepository marketDataRepository)
 {
     _environmentVariableReader = environmentVariableReader
                                  ?? throw new ArgumentNullException(nameof(environmentVariableReader));
     _httpFacade = httpFacade
                   ?? throw new ArgumentNullException(nameof(httpFacade));
     _marketDataCsvFileRepository = marketDataRepository
                                    ?? throw new ArgumentNullException(nameof(marketDataRepository));
 }
 public TradeDataAggregationService(
     IMarketDataRepository marketDataRepository,
     IAssetsService assetsService,
     ITradeOperationsRepositoryClient tradeOperationsRepositoryClient,
     ILykkeMarketProfile marketProfileService,
     ILog log)
 {
     _marketDataRepository            = marketDataRepository;
     _assetsService                   = assetsService;
     _tradeOperationsRepositoryClient = tradeOperationsRepositoryClient;
     _marketProfileService            = marketProfileService;
     _log = log;
 }
Exemplo n.º 13
0
        public void SetUp()
        {
            var options = new DbContextOptionsBuilder <MarketContext>()
                          .UseInMemoryDatabase(databaseName: Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 8))
                          .Options;

            _inMemoryContext = new MarketContext(options);
            _repo            = new MarketDataRepository(_inMemoryContext);

            var mockCache = new Moq.Mock <ICacheRepository>();

            _service = new MarketDataService(_repo, mockCache.Object);
        }
Exemplo n.º 14
0
        public MarketFactory(IMarketDataRepository marketDataRepo, IMarketFactorySettings settings) // Constructor dependency injection
        {
            if (marketDataRepo == null)
            {
                throw new ArgumentNullException("marketDataRepo");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            _marketDataRepo = marketDataRepo;
            _settings       = settings;
        }
Exemplo n.º 15
0
        public Service(
            IAnalysesRepository analysesRepository,
            IMarketDataRepository marketDataRepository,
            IRegistryRepository registryRepository,
            IConfigReader config)
        {
            try
            {
                _financialAnalysesCsvFileRepository = analysesRepository;
                _marketDataRepository = marketDataRepository;
                _registryRepository   = registryRepository;
                _configReader         = config;

                _buyingPacketInEuro = _configReader.Settings.BuyingPacketInEuro;
                _fastMovingAverage  = _configReader.Settings.FastMovingAverage;
                _slowMovingAverage  = _configReader.Settings.SlowMovingAverage;

                _logger.Debug($"Buying Packet is {_buyingPacketInEuro} EUR from config file.");
                _logger.Debug($"Fast Moving Average subset size is {_fastMovingAverage} from config file.");
                _logger.Debug($"Slow Moving Average subset size is {_slowMovingAverage} from config file.");

                if (_fastMovingAverage >= _slowMovingAverage)
                {
                    throw new BusinessException("The timespan for the fast moving average must be lower than of the slow moving average.");
                }
                if (_buyingPacketInEuro <= 0 || _fastMovingAverage <= 0 || _slowMovingAverage <= 0)
                {
                    throw new BusinessException("Buying packet and moving average subset sizes must be positive numbers.");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                throw new BusinessException($"Error when initializing {GetType().Name}.", ex);
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Instantiates a <see cref="StaticStockListProvider"/>
 /// </summary>
 /// <param name="marketDataRepository"></param>
 public StaticStockListProvider(IMarketDataRepository marketDataRepository)
 {
     _marketDataRepository = marketDataRepository;
 }
Exemplo n.º 17
0
 public FixedMarketFactory(IMarketDataRepository marketDataRepo, IMarketFactorySettings settings)
     : base(marketDataRepo, settings)
 {
 }
 public RandomMarketFactory(IMarketDataRepository marketDataRepo, IMarketFactorySettings settings)
     : base(marketDataRepo, settings)
 {
 }
Exemplo n.º 19
0
 public WebService(IMarketDataRepository marketDataRepository)
 {
     _marketDataCsvFileRepository = marketDataRepository;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Instantiates a <see cref="OldService"/>
 /// </summary>
 /// <param name="marketDataRepository"></param>
 public OldService(IMarketDataRepository marketDataRepository)
 {
     _marketDataRepository = marketDataRepository;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Instantiates a <see cref="StaticStockListProvider"/>
 /// </summary>
 /// <param name="marketDataRepository"></param>
 public StaticStockListProvider(IMarketDataRepository marketDataRepository)
 {
     _marketDataRepository = marketDataRepository;
 }
Exemplo n.º 22
0
 /// <summary>
 /// Instantiates a <see cref="StockRetriever"/>
 /// </summary>
 /// <param name="marketDataRepository"></param>
 public StockRetriever(IMarketDataRepository marketDataRepository)
 {
     _marketDataRepository = marketDataRepository;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Instantiates a <see cref="StockRetriever"/>
 /// </summary>
 /// <param name="marketDataRepository"></param>
 public StockRetriever(IMarketDataRepository marketDataRepository)
 {
     _marketDataRepository = marketDataRepository;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Instantiates a <see cref="OldService"/>
 /// </summary>
 /// <param name="marketDataRepository"></param>
 public OldService(IMarketDataRepository marketDataRepository)
 {
     _marketDataRepository = marketDataRepository;
 }
Exemplo n.º 25
0
 public MarketDataService(IMarketDataRepository repository,
                          ICacheRepository cacheRepository)
 {
     _repository      = repository ?? throw new ArgumentNullException(nameof(repository));
     _cacheRepository = cacheRepository;
 }