Example #1
0
        public QuotesModule(IQuoteProvider quoteService, IZmqService publishingService)
            : base("/")
        {
            if (quoteService == null)
            {
                throw new ArgumentNullException(nameof(quoteService));
            }
            if (publishingService == null)
            {
                throw new ArgumentNullException(nameof(publishingService));
            }
            this.quoteService      = quoteService;
            this.publishingService = publishingService;

            Get["/quote/{id}"] = parameter =>
            {
                var securityIds = (string)parameter.id;
                var quotes      = quoteService.GetQuotes(securityIds);

                var responseModel = quotes.Count == 0 ? new Quote() : quotes[0];

                return(Response.AsJson(responseModel));
            };

            Get["/subscribe/{id}"] = parameter =>
            {
                var securityId = (string)parameter.id;

                publishingService.SubscribeTicker(securityId);

                return(Response.AsText($"{securityId} has been subscribed."));
            };
        }
Example #2
0
 public FleckService(IZmqService publishingService)
 {
     if (publishingService == null)
     {
         throw new ArgumentNullException(nameof(publishingService));
     }
     this.publishingService = publishingService;
 }
Example #3
0
        public MdsRepository(IQuoteProvider quoteProvider, IZmqService publishingService)
        {
            if (quoteProvider == null)
            {
                throw new ArgumentNullException(nameof(quoteProvider));
            }
            if (publishingService == null)
            {
                throw new ArgumentNullException(nameof(publishingService));
            }

            this.quoteProvider     = quoteProvider;
            this.publishingService = publishingService;
        }