public TradeGenerator(TradeGeneratorConfiguration configuration, IEventStoreRepository <Guid> repository, IEventStoreCache <Guid, Trade> cache)
        {
            _configuration = configuration;

            _cache      = cache;
            _repository = repository;
            _jwthandler = new JwtSecurityTokenHandler();
            _cleanup    = new CompositeDisposable();

            var settings = AppCore.Instance.Get <JsonSerializerSettings>();

            var refitSettings = new RefitSettings()
            {
                ContentSerializer         = new JsonContentSerializer(settings),
                HttpMessageHandlerFactory = () => new HttpRetryForeverMessageHandler(5000)
            };

            var accessTokenRetrieverFactory = new AccessTokenRetrieverFactory();

            _tradeService = ApiServiceBuilder <ITradeService>
                            .Build(configuration.Gateway)
                            .AddAuthorizationHeader(accessTokenRetrieverFactory.GetToken(
                                                        "bob.woodworth",
                                                        "bob",
                                                        _configuration.Identity,
                                                        AzurePlaygroundConstants.Auth.ClientReferenceToken,
                                                        AzurePlaygroundConstants.Api.Trade,
                                                        _configuration.Key

                                                        ))
                            .Create(refitSettings: refitSettings);
        }
Пример #2
0
        public MarketService(IEventStoreRepository <Guid> repository, MarketServiceConfiguration configuration, IEventStoreCache <Guid, Trade> cache)
        {
            _cache         = cache;
            _repository    = repository;
            _configuration = configuration;

            var settings = AppCore.Instance.Get <JsonSerializerSettings>();

            var refitSettings = new RefitSettings()
            {
                ContentSerializer         = new JsonContentSerializer(settings),
                HttpMessageHandlerFactory = () => new HttpRetryForeverMessageHandler(5000)
            };

            _priceService = ApiServiceBuilder <IPriceService>
                            .Build(configuration.Gateway)
                            .Create(refitSettings: refitSettings);
        }
        public TradeEventListener(TradeEventServiceConfiguration configuration, IEventStoreCache <Guid, Trade> cache)
        {
            _cache = cache;

            var accessTokenRetrieverFactory = new AccessTokenRetrieverFactory();

            var tokenRetriever = accessTokenRetrieverFactory.GetToken(
                "internal",
                "idkfa",
                configuration.Identity,
                AzurePlaygroundConstants.Auth.ClientReferenceToken,
                AzurePlaygroundConstants.Api.Trade,
                configuration.Key
                );

            _tradeEventHubService = SignalRServiceBuilder <Trade, TradeEventRequest>
                                    .Create()
                                    .Build(new TradeEventRequest((p) => true), (opts) =>
            {
                opts.AccessTokenProvider = () => Task.FromResult(tokenRetriever());
            });

            _tradeEventHubService.Connect(Scheduler.Default, 2000);
        }
Пример #4
0
 public ComplianceService(IEventStoreRepository <Guid> repository, ComplianceServiceConfiguration configuration, IEventStoreCache <Guid, Trade> cache)
 {
     _cache         = cache;
     _repository    = repository;
     _configuration = configuration;
 }