コード例 #1
0
 public MtController(
     IMarginTradingAccountHistoryRepository accountsHistoryRepository,
     IMarginTradingOrdersHistoryRepository ordersHistoryRepository,
     IMicrographCacheService micrographCacheService,
     IAccountAssetsCacheService accountAssetsCacheService,
     IAssetPairsCache assetPairsCache,
     IMarketMakerMatchingEngine matchingEngine,
     ITradingEngine tradingEngine,
     IAccountsCacheService accountsCacheService,
     IMarginTradingOperationsLogService operationsLogService,
     IConsole consoleWriter,
     OrdersCache ordersCache,
     MarginSettings marginSettings,
     AccountManager accountManager,
     IAssetPairDayOffService assetDayOffService,
     IQuoteCacheService quoteCacheService,
     IIdentityGenerator identityGenerator)
 {
     _accountsHistoryRepository = accountsHistoryRepository;
     _ordersHistoryRepository   = ordersHistoryRepository;
     _micrographCacheService    = micrographCacheService;
     _accountAssetsCacheService = accountAssetsCacheService;
     _assetPairsCache           = assetPairsCache;
     _matchingEngine            = matchingEngine;
     _tradingEngine             = tradingEngine;
     _accountsCacheService      = accountsCacheService;
     _operationsLogService      = operationsLogService;
     _consoleWriter             = consoleWriter;
     _ordersCache        = ordersCache;
     _marginSettings     = marginSettings;
     _accountManager     = accountManager;
     _assetDayOffService = assetDayOffService;
     _quoteCacheService  = quoteCacheService;
     _identityGenerator  = identityGenerator;
 }
コード例 #2
0
        public RandomOrdersProcessedInParallelClassFixture()
        {
            // Arrange
            Orders             = GetRandomOrders();
            ActualOpenedOrders = new List <Order>();
            ActualClosedOrders = new List <Order>();

            var concurrentOrders = new ConcurrentQueue <Order>(Orders);

            Sut = new QueuedTradingEngine(new OrdersMatchingRule());

            Sut.OrderOpened += (sender, args) => { ActualOpenedOrders.Add(args.Order); };
            Sut.OrderClosed += (sender, args) => { ActualClosedOrders.Add(args.Order); };

            const int threadCount = 5;

            //Simulate multi-threading environment
            var tasks = new List <Task>();

            for (var i = 0; i < threadCount; i++)
            {
                tasks.Add(Task.Run(() => PlaceOrder(Sut, concurrentOrders)));
            }

            Task.WhenAll(tasks).Wait();
        }
コード例 #3
0
ファイル: AccountManager.cs プロジェクト: forkme7/MT
 public AccountManager(AccountsCacheService accountsCacheService,
                       IMarginTradingAccountsRepository repository,
                       IConsole console,
                       MarginSettings marginSettings,
                       IRabbitMqNotifyService rabbitMqNotifyService,
                       IAccountGroupCacheService accountGroupCacheService,
                       IClientNotifyService clientNotifyService,
                       IClientAccountClient clientAccountClient,
                       IMarginTradingAccountsRepository accountsRepository,
                       ITradingConditionsCacheService tradingConditionsCacheService,
                       ILog log,
                       OrdersCache ordersCache,
                       IEventChannel <AccountBalanceChangedEventArgs> acountBalanceChangedEventChannel,
                       ITradingEngine tradingEngine)
     : base(nameof(AccountManager), 60000, log)
 {
     _accountsCacheService = accountsCacheService;
     _clientAccountClient  = clientAccountClient;
     _repository           = repository;
     _console                       = console;
     _marginSettings                = marginSettings;
     _rabbitMqNotifyService         = rabbitMqNotifyService;
     _accountGroupCacheService      = accountGroupCacheService;
     _accountsRepository            = accountsRepository;
     _tradingConditionsCacheService = tradingConditionsCacheService;
     _log = log;
     _clientNotifyService = clientNotifyService;
     _ordersCache         = ordersCache;
     _acountBalanceChangedEventChannel = acountBalanceChangedEventChannel;
     _tradingEngine = tradingEngine;
 }
コード例 #4
0
 public SpecialLiquidationCommandsHandler(
     ITradingEngine tradingEngine,
     IDateService dateService,
     IOrderReader orderReader,
     IChaosKitty chaosKitty,
     IOperationExecutionInfoRepository operationExecutionInfoRepository,
     ILog log,
     MarginTradingSettings marginTradingSettings,
     IAssetPairsCache assetPairsCache,
     IAssetPairDayOffService assetPairDayOffService,
     IExchangeConnectorService exchangeConnectorService,
     IIdentityGenerator identityGenerator,
     IAccountsCacheService accountsCacheService)
 {
     _tradingEngine = tradingEngine;
     _dateService   = dateService;
     _orderReader   = orderReader;
     _chaosKitty    = chaosKitty;
     _operationExecutionInfoRepository = operationExecutionInfoRepository;
     _log = log;
     _marginTradingSettings    = marginTradingSettings;
     _assetPairsCache          = assetPairsCache;
     _assetPairDayOffService   = assetPairDayOffService;
     _exchangeConnectorService = exchangeConnectorService;
     _identityGenerator        = identityGenerator;
     _accountsCacheService     = accountsCacheService;
 }
コード例 #5
0
 private static void PlaceOrder(ITradingEngine engine, ConcurrentQueue <Order> orders)
 {
     while (orders.TryDequeue(out var order))
     {
         engine.PlaceAsync(order);
     }
 }
コード例 #6
0
 public LiquidationCommandsHandler(
     IAccountsCacheService accountsCache,
     IDateService dateService,
     IOperationExecutionInfoRepository operationExecutionInfoRepository,
     IChaosKitty chaosKitty,
     ITradingEngine tradingEngine,
     OrdersCache ordersCache,
     ILog log,
     IAccountUpdateService accountUpdateService,
     IEventChannel <LiquidationEndEventArgs> liquidationEndEventChannel,
     LiquidationHelper liquidationHelper,
     ILiquidationFailureExecutor failureExecutor)
 {
     _accountsCache = accountsCache;
     _dateService   = dateService;
     _operationExecutionInfoRepository = operationExecutionInfoRepository;
     _chaosKitty                 = chaosKitty;
     _tradingEngine              = tradingEngine;
     _ordersCache                = ordersCache;
     _log                        = log;
     _accountUpdateService       = accountUpdateService;
     _liquidationEndEventChannel = liquidationEndEventChannel;
     _liquidationHelper          = liquidationHelper;
     _failureExecutor            = failureExecutor;
 }
コード例 #7
0
 public LiquidationCommandsHandler(
     ITradingInstrumentsCacheService tradingInstrumentsCacheService,
     IAccountsCacheService accountsCache,
     IDateService dateService,
     IOperationExecutionInfoRepository operationExecutionInfoRepository,
     IChaosKitty chaosKitty,
     IMatchingEngineRouter matchingEngineRouter,
     ITradingEngine tradingEngine,
     OrdersCache ordersCache,
     ILog log,
     IAccountUpdateService accountUpdateService,
     IEventChannel <LiquidationEndEventArgs> liquidationEndEventChannel)
 {
     _tradingInstrumentsCacheService = tradingInstrumentsCacheService;
     _accountsCache = accountsCache;
     _dateService   = dateService;
     _operationExecutionInfoRepository = operationExecutionInfoRepository;
     _chaosKitty           = chaosKitty;
     _matchingEngineRouter = matchingEngineRouter;
     _tradingEngine        = tradingEngine;
     _ordersCache          = ordersCache;
     _log = log;
     _accountUpdateService       = accountUpdateService;
     _liquidationEndEventChannel = liquidationEndEventChannel;
 }
コード例 #8
0
ファイル: AccountManager.cs プロジェクト: LykkeBusiness/MT
 public AccountManager(
     AccountsCacheService accountsCacheService,
     MarginTradingSettings marginSettings,
     IRabbitMqNotifyService rabbitMqNotifyService,
     ILog log,
     OrdersCache ordersCache,
     ITradingEngine tradingEngine,
     IAccountsApi accountsApi,
     IAccountBalanceHistoryApi accountBalanceHistoryApi,
     IConvertService convertService,
     IDateService dateService,
     ISystemClock systemClock,
     IAccountMarginFreezingRepository accountMarginFreezingRepository,
     IAccountMarginUnconfirmedRepository accountMarginUnconfirmedRepository)
     : base(nameof(AccountManager), 60000, log)
 {
     _accountsCacheService  = accountsCacheService;
     _marginSettings        = marginSettings;
     _rabbitMqNotifyService = rabbitMqNotifyService;
     _log                                = log;
     _ordersCache                        = ordersCache;
     _tradingEngine                      = tradingEngine;
     _accountsApi                        = accountsApi;
     _accountBalanceHistoryApi           = accountBalanceHistoryApi;
     _convertService                     = convertService;
     _dateService                        = dateService;
     _systemClock                        = systemClock;
     _accountMarginFreezingRepository    = accountMarginFreezingRepository;
     _accountMarginUnconfirmedRepository = accountMarginUnconfirmedRepository;
 }
コード例 #9
0
 public PendingOrdersCleaningService(ILog log, IOrderReader orderReader, ITradingEngine tradingEngine,
                                     IAssetPairDayOffService assetDayOffService)
     : base(nameof(PendingOrdersCleaningService), 60000, log)
 {
     _log                = log;
     _orderReader        = orderReader;
     _tradingEngine      = tradingEngine;
     _assetDayOffService = assetDayOffService;
 }
コード例 #10
0
ファイル: Program.cs プロジェクト: KirillSelyukov/crypto
        private static void PlaceOrder(ITradingEngine engine, ConcurrentQueue <Order> orders)
        {
            Order order;

            while (orders.TryDequeue(out order))
            {
                Console.WriteLine("Place: " + order);
                engine.Place(order);
            }
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: arzion/azurefabrictest
        private static void PlaceOrder(ITradingEngine engine, ConcurrentQueue <Order> orders)
        {
            Order order;

            while (orders.TryDequeue(out order))
            {
                Console.WriteLine("PlaceAsync: " + order + " Thread: " + Thread.CurrentThread.ManagedThreadId);
                engine.PlaceAsync(order).GetAwaiter().GetResult();
            }
        }
コード例 #12
0
 public IsAliveController(
     IMarketMakerMatchingEngine matchingEngine,
     ITradingEngine tradingEngine,
     MarginSettings settings,
     IDateService dateService)
 {
     _matchingEngine = matchingEngine;
     _tradingEngine  = tradingEngine;
     _settings       = settings;
     _dateService    = dateService;
 }
コード例 #13
0
 public AssetPairProjection(
     ITradingEngine tradingEngine,
     IAssetPairsCache assetPairsCache,
     IOrderReader orderReader,
     IScheduleSettingsCacheService scheduleSettingsCacheService,
     ILog log)
 {
     _tradingEngine   = tradingEngine;
     _assetPairsCache = assetPairsCache;
     _orderReader     = orderReader;
     _scheduleSettingsCacheService = scheduleSettingsCacheService;
     _log = log;
 }
コード例 #14
0
 public DeleteAccountsCommandsHandler(
     IOrderReader orderReader,
     IDateService dateService,
     IAccountsCacheService accountsCacheService,
     ITradingEngine tradingEngine,
     IChaosKitty chaosKitty,
     IOperationExecutionInfoRepository operationExecutionInfoRepository,
     ILog log)
 {
     _orderReader                      = orderReader;
     _dateService                      = dateService;
     _accountsCacheService             = accountsCacheService;
     _tradingEngine                    = tradingEngine;
     _chaosKitty                       = chaosKitty;
     _operationExecutionInfoRepository = operationExecutionInfoRepository;
     _log = log;
 }
コード例 #15
0
ファイル: PositionsController.cs プロジェクト: alpo-8/MT
 public PositionsController(
     ITradingEngine tradingEngine,
     IOperationsLogService operationsLogService,
     ILog log,
     OrdersCache ordersCache,
     IAssetPairDayOffService assetDayOffService,
     IIdentityGenerator identityGenerator,
     ICqrsSender cqrsSender,
     IDateService dateService)
 {
     _tradingEngine        = tradingEngine;
     _operationsLogService = operationsLogService;
     _log                = log;
     _ordersCache        = ordersCache;
     _assetDayOffService = assetDayOffService;
     _identityGenerator  = identityGenerator;
     _cqrsSender         = cqrsSender;
     _dateService        = dateService;
 }
コード例 #16
0
 public OrdersController(
     ITradingEngine tradingEngine,
     IOperationsLogService operationsLogService,
     ILog log,
     OrdersCache ordersCache,
     IDateService dateService,
     IValidateOrderService validateOrderService,
     IIdentityGenerator identityGenerator,
     ICqrsSender cqrsSender)
 {
     _tradingEngine        = tradingEngine;
     _operationsLogService = operationsLogService;
     _log                  = log;
     _ordersCache          = ordersCache;
     _dateService          = dateService;
     _validateOrderService = validateOrderService;
     _identityGenerator    = identityGenerator;
     _cqrsSender           = cqrsSender;
 }
コード例 #17
0
ファイル: OvernightMarginService.cs プロジェクト: alpo-8/MT
 public OvernightMarginService(
     IDateService dateService,
     ITradingEngine tradingEngine,
     IAccountsCacheService accountsCacheService,
     IAccountUpdateService accountUpdateService,
     IScheduleSettingsCacheService scheduleSettingsCacheService,
     IOvernightMarginParameterContainer overnightMarginParameterContainer,
     ILog log,
     IEventChannel <MarginCallEventArgs> marginCallEventChannel,
     OvernightMarginSettings overnightMarginSettings)
 {
     _dateService                       = dateService;
     _tradingEngine                     = tradingEngine;
     _accountsCacheService              = accountsCacheService;
     _accountUpdateService              = accountUpdateService;
     _scheduleSettingsCacheService      = scheduleSettingsCacheService;
     _overnightMarginParameterContainer = overnightMarginParameterContainer;
     _log = log;
     _marginCallEventChannel  = marginCallEventChannel;
     _overnightMarginSettings = overnightMarginSettings;
 }
コード例 #18
0
 public ProductChangedProjection(
     ITradingEngine tradingEngine,
     IAssetPairsCache assetPairsCache,
     IOrderReader orderReader,
     IScheduleSettingsCacheService scheduleSettingsCacheService,
     ITradingInstrumentsManager tradingInstrumentsManager,
     IRfqService rfqService,
     IRfqPauseService rfqPauseService,
     MarginTradingSettings mtSettings,
     ILog log,
     IQuoteCacheService quoteCache)
 {
     _tradingEngine   = tradingEngine;
     _assetPairsCache = assetPairsCache;
     _orderReader     = orderReader;
     _scheduleSettingsCacheService = scheduleSettingsCacheService;
     _tradingInstrumentsManager    = tradingInstrumentsManager;
     _rfqService      = rfqService;
     _rfqPauseService = rfqPauseService;
     _mtSettings      = mtSettings;
     _log             = log;
     _quoteCache      = quoteCache;
 }
コード例 #19
0
 public PositionsController(
     ITradingEngine tradingEngine,
     IOperationsLogService operationsLogService,
     ILog log,
     OrdersCache ordersCache,
     IAssetPairDayOffService assetDayOffService,
     IIdentityGenerator identityGenerator,
     ICqrsSender cqrsSender,
     IDateService dateService,
     IAccountHistoryRepository accountHistoryRepository,
     IMarginTradingBlobRepository blobRepository)
 {
     _tradingEngine        = tradingEngine;
     _operationsLogService = operationsLogService;
     _log                      = log;
     _ordersCache              = ordersCache;
     _assetDayOffService       = assetDayOffService;
     _identityGenerator        = identityGenerator;
     _cqrsSender               = cqrsSender;
     _dateService              = dateService;
     _accountHistoryRepository = accountHistoryRepository;
     _blobRepository           = blobRepository;
 }
コード例 #20
0
ファイル: OrdersController.cs プロジェクト: alpo-8/MT
 public OrdersController(IAssetPairsCache assetPairsCache,
                         ITradingEngine tradingEngine,
                         IAccountsCacheService accountsCacheService,
                         IOperationsLogService operationsLogService,
                         ILog log,
                         OrdersCache ordersCache,
                         IAssetPairDayOffService assetDayOffService,
                         IDateService dateService,
                         IValidateOrderService validateOrderService,
                         IIdentityGenerator identityGenerator,
                         ICqrsSender cqrsSender)
 {
     _assetPairsCache      = assetPairsCache;
     _tradingEngine        = tradingEngine;
     _accountsCacheService = accountsCacheService;
     _operationsLogService = operationsLogService;
     _log                  = log;
     _ordersCache          = ordersCache;
     _assetDayOffService   = assetDayOffService;
     _dateService          = dateService;
     _validateOrderService = validateOrderService;
     _identityGenerator    = identityGenerator;
     _cqrsSender           = cqrsSender;
 }