public void Initialize(string username, string[] servers, ILoggerFactory loggerFactory = null, string authToken = null)
        {
            _loggerFactory = loggerFactory ?? new DebugLoggerFactory();
            _log           = _loggerFactory.Create(typeof(ReactiveTrader));
            var concurrencyService = new ConcurrencyService();

            _serviceClientContainer = new WampServiceClientContainer(servers[0], username, concurrencyService, _loggerFactory);

            // TODO: Make the Async Connection better
            _serviceClientContainer.ConnectAsync().Wait();

            var referenceDataServiceClient = new ReferenceDataServiceClient(_serviceClientContainer.Reference, _loggerFactory);
            var executionServiceClient     = new ExecutionServiceClient(_serviceClientContainer.Execution);
            var blotterServiceClient       = new BlotterServiceClient(_serviceClientContainer.Blotter, _loggerFactory);
            var pricingServiceClient       = new PricingServiceClient(_serviceClientContainer.Pricing, _loggerFactory);

            PricingServiceClient = pricingServiceClient;
            PriceLatencyRecorder = new PriceLatencyRecorder();

            var tradeFactory              = new TradeFactory();
            var executionRepository       = new ExecutionRepository(executionServiceClient, tradeFactory, concurrencyService);
            var priceFactory              = new PriceFactory(executionRepository, PriceLatencyRecorder);
            var priceRepository           = new PriceRepository(pricingServiceClient, priceFactory, _loggerFactory);
            var currencyPairUpdateFactory = new CurrencyPairUpdateFactory(priceRepository);

            TradeRepository = new TradeRepository(blotterServiceClient, tradeFactory);
            ReferenceData   = new ReferenceDataRepository(referenceDataServiceClient, currencyPairUpdateFactory);
        }
        public void Initialize(string username, string[] servers, ILoggerFactory loggerFactory = null, string authToken = null)
        {
            _loggerFactory      = loggerFactory ?? new DebugLoggerFactory();
            _log                = _loggerFactory.Create(typeof(ReactiveTrader));
            _connectionProvider = new ConnectionProvider(username, servers, _loggerFactory);

            var referenceDataServiceClient = new ReferenceDataServiceClient(_connectionProvider, _loggerFactory);
            var executionServiceClient     = new ExecutionServiceClient(_connectionProvider);
            var blotterServiceClient       = new BlotterServiceClient(_connectionProvider, _loggerFactory);
            var pricingServiceClient       = new PricingServiceClient(_connectionProvider, _loggerFactory);

            if (authToken != null)
            {
                var controlServiceClient = new ControlServiceClient(new AuthTokenProvider(authToken), _connectionProvider, _loggerFactory);
                _controlRepository = new ControlRepository(controlServiceClient);
            }

            PriceLatencyRecorder = new PriceLatencyRecorder();
            var concurrencyService = new ConcurrencyService();

            var tradeFactory              = new TradeFactory();
            var executionRepository       = new ExecutionRepository(executionServiceClient, tradeFactory, concurrencyService);
            var priceFactory              = new PriceFactory(executionRepository, PriceLatencyRecorder);
            var priceRepository           = new PriceRepository(pricingServiceClient, priceFactory, _loggerFactory);
            var currencyPairUpdateFactory = new CurrencyPairUpdateFactory(priceRepository);

            TradeRepository = new TradeRepository(blotterServiceClient, tradeFactory);
            ReferenceData   = new ReferenceDataRepository(referenceDataServiceClient, currencyPairUpdateFactory);
        }
示例#3
0
        public void Setup()
        {
            var      executionRepository = new ExecutionRepository();
            IMailbox mailbox             = executionRepository;
            IReportCommandExecution reportCommandExecution = executionRepository;

            _dispatcher = new MyDispatcher(reportCommandExecution, mailbox);
        }
示例#4
0
 public HomeController(LoggingService myLoggingService, PreferenceRepository myPreferenceRepository, PlaneRepository myPlaneRepository,
                       ScriptRepository myScriptRepository, ExecutionRepository myExecutionRepository)
 {
     _LoggingService       = myLoggingService;
     _PreferenceRepository = myPreferenceRepository;
     _PlaneRepository      = myPlaneRepository;
     _ScriptRepository     = myScriptRepository;
     _ExecutionRepository  = myExecutionRepository;
 }
示例#5
0
 public void Init()
 {
     _LoggingService       = ServiceResolver.Resolve <LoggingService>();
     _PreferenceRepository = ServiceResolver.Resolve <PreferenceRepository>();
     _ExecutionRepository  = ServiceResolver.Resolve <ExecutionRepository>();
     _ActionRepository     = ServiceResolver.Resolve <ActionRepository>();
     _PlaneRepository      = ServiceResolver.Resolve <PlaneRepository>();
     _WcfService           = ServiceResolver.Resolve <WcfService>();
     _FileService          = ServiceResolver.Resolve <FileService>();
 }
示例#6
0
 public ExecutionController(LoggingService myLoggingService, PreferenceRepository myPreferenceRepository, ExecutionRepository myExecutionRepository,
                            WcfService myWcfService, ActionRepository myActionRepository, FileService myFileService, PlaneRepository myPlaneRepository)
 {
     _LoggingService       = myLoggingService;
     _PreferenceRepository = myPreferenceRepository;
     _ExecutionRepository  = myExecutionRepository;
     _ActionRepository     = myActionRepository;
     _PlaneRepository      = myPlaneRepository;
     _WcfService           = myWcfService;
     _FileService          = myFileService;
 }
示例#7
0
 public JsonResult GetExecutions()
 {
     try
     {
         var repo = new ExecutionRepository();
         var data = repo.Fetch();
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         this.LogError(String.Format("{0} List controller method failed with an error of {0}:{1}", "GetExecutions", e));
         return(Json(new { exception = e.Message }, JsonRequestBehavior.AllowGet));
     }
 }
示例#8
0
 public void Init()
 {
     myExecutionRepository = ServiceResolver.Resolve <ExecutionRepository>();
     myPlaneRepository     = ServiceResolver.Resolve <PlaneRepository>();
     myScriptRepository    = ServiceResolver.Resolve <ScriptRepository>();
 }
示例#9
0
 public ExecutionController()
 {
     this.executionRepository = new ExecutionRepository();
 }