예제 #1
0
        private MT4Router CreateRouter(ISignalServiceRepository signalServiceRepository)
        {
            OperationResult <ServerConfiguration[]> serversData;

            while (true)
            {
                try
                {
                    serversData = accService.GetServerConfigurations();
                    if (!serversData.IsSuccess)
                    {
                        throw new Exception(serversData.Error);
                    }

                    break;
                }
                catch (EndpointNotFoundException)
                {
                    Thread.Sleep(1000);
                }
            }

            var res   = serversData.Result;
            var names = res.Select(x => x.Name).ToArray();
            var confs = res.Select(x => x.Ip).ToArray();
            var ports = res.Select(x => x.Port).ToArray();

            return(new MT4Router(names, confs, ports));
        }
예제 #2
0
        public ConsistencyController(ISignalServiceRepository repository, IServerController serverController, IAccountService accountService)
        {
            this.accountService   = accountService;
            this.repository       = repository;
            this.serverController = serverController;

            serverController.OrdersStatus += HandleOrderStatusResponse;
        }
예제 #3
0
        public TradeSignalProcessor(ISignalServiceRepository signalServiceRepository, IMT4Router serversController, IAccountService accountService)
        {
            this.signalServiceRepository = signalServiceRepository;
            this.accountService          = accountService;
            serversRouter = serversController;

            FillServersDictionary();
            FillAccountsDictionary();
        }
예제 #4
0
        private const int consistencyControlInterval = 60 * 5;         // Interval in seconds

        #endregion

        #region Constructor

        public SignalService(ISignalServiceRepository signalServiceRepository, IAccountService accService, IZeroMqServer server)
        {
            Logger.Info("Starting signal service...");
            Logger.Info("Starting wcf service...");

            this.signalServiceRepository = signalServiceRepository;
            this.accService = accService;
            this.server     = server;
        }