/// <summary> /// Creates a <see cref="MarginCore"/> for a given <see cref="IWpfTextView"/>. /// </summary> /// <param name="textView">The <see cref="IWpfTextView"/> to attach the margin to.</param> /// <param name="textDocumentFactoryService">Service that creates, loads, and disposes text documents.</param> /// <param name="vsServiceProvider">Visual Studio service provider.</param> /// <param name="formatMapService">Service that provides the <see cref="IEditorFormatMap"/>.</param> /// <param name="scrollMapFactoryService">Factory that creates or reuses an <see cref="IScrollMap"/> for an <see cref="ITextView"/>.</param> public MarginCore(IWpfTextView textView, ITextDocumentFactoryService textDocumentFactoryService, SVsServiceProvider vsServiceProvider, IEditorFormatMapService formatMapService, IScrollMapFactoryService scrollMapFactoryService) { Debug.WriteLine("Entering constructor.", Properties.Resources.ProductName); _textView = textView; if (!textDocumentFactoryService.TryGetTextDocument(_textView.TextDataModel.DocumentBuffer, out _textDoc)) { Debug.WriteLine("Can not retrieve TextDocument. Margin is disabled.", Properties.Resources.ProductName); _isEnabled = false; return; } _formatMap = formatMapService.GetEditorFormatMap(textView); _marginSettings = new MarginSettings(_formatMap); _scrollMap = scrollMapFactoryService.Create(textView); var dte = (DTE2)vsServiceProvider.GetService(typeof(DTE)); _tfExt = (TeamFoundationServerExt)dte.GetObject(typeof(TeamFoundationServerExt).FullName); Debug.Assert(_tfExt != null, "_tfExt is null."); _tfExt.ProjectContextChanged += OnTfExtProjectContextChanged; UpdateMargin(); }
public Application( IRabbitMqNotifyService rabbitMqNotifyService, IConsole consoleWriter, MarketMakerService marketMakerService, ILog logger, MarginSettings marginSettings, IMaintenanceModeService maintenanceModeService, IRabbitMqService rabbitMqService, MatchingEngineRoutesManager matchingEngineRoutesManager, IMigrationService migrationService, IConvertService convertService, ExternalOrderBooksList externalOrderBooksList) { _rabbitMqNotifyService = rabbitMqNotifyService; _consoleWriter = consoleWriter; _marketMakerService = marketMakerService; _logger = logger; _marginSettings = marginSettings; _maintenanceModeService = maintenanceModeService; _rabbitMqService = rabbitMqService; _matchingEngineRoutesManager = matchingEngineRoutesManager; _migrationService = migrationService; _convertService = convertService; _externalOrderBooksList = externalOrderBooksList; }
public BackendServicesModule(MtBackendSettings mtSettings, MarginSettings settings, IHostingEnvironment environment, ILog log) { _mtSettings = mtSettings; _settings = settings; _environment = environment; _log = log; }
public EquivalentPricesService( ICfdCalculatorService cfdCalculatorService, MarginSettings marginSettings) { _cfdCalculatorService = cfdCalculatorService; _marginSettings = marginSettings; }
public OvernightSwapService( IOvernightSwapCache overnightSwapCache, IAccountAssetsCacheService accountAssetsCacheService, IAccountsCacheService accountsCacheService, ICommissionService commissionService, IOvernightSwapStateRepository overnightSwapStateRepository, IOvernightSwapHistoryRepository overnightSwapHistoryRepository, IOrderReader orderReader, IThreadSwitcher threadSwitcher, IDateService dateService, AccountManager accountManager, MarginSettings marginSettings, ILog log) { _overnightSwapCache = overnightSwapCache; _accountAssetsCacheService = accountAssetsCacheService; _accountsCacheService = accountsCacheService; _commissionService = commissionService; _overnightSwapStateRepository = overnightSwapStateRepository; _overnightSwapHistoryRepository = overnightSwapHistoryRepository; _orderReader = orderReader; _threadSwitcher = threadSwitcher; _dateService = dateService; _accountManager = accountManager; _marginSettings = marginSettings; _log = log; }
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; }
public void SetUp() { _clientAccountsService = Mock.Of <IClientAccountClient>(r => r.GetMarginEnabledAsync("id of client") == Task.FromResult(new MarginEnabledSettingsModel())); var publisher = Mock.Of <IMessageProducer <MarginTradingEnabledChangedMessage> >(); Mock.Get(publisher) .Setup(s => s.ProduceAsync(It.IsNotNull <MarginTradingEnabledChangedMessage>())) .Returns(Task.CompletedTask).Callback <MarginTradingEnabledChangedMessage>(m => _sentMessage = m); var expectedRabbitMqSettings = new RabbitMqSettings { ConnectionString = "conn str", ExchangeName = "exchange name" }; var rabbitMqService = Mock.Of <IRabbitMqService>(s => s.GetProducer(expectedRabbitMqSettings.Equivalent(), true, s.GetJsonSerializer <MarginTradingEnabledChangedMessage>()) == publisher); _marginSettings = new MarginSettings { MtRabbitMqConnString = "conn str", RabbitMqQueues = new RabbitMqQueues { MarginTradingEnabledChanged = new RabbitMqQueueInfo { ExchangeName = "exchange name" } } }; _marginTradingSettingsCacheService = Mock.Of <IMarginTradingSettingsCacheService>(); _sut = new MarginTradingEnablingService(_clientAccountsService, rabbitMqService, _marginSettings, _marginTradingSettingsCacheService); _sut.Start(); }
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; }
public UpdatedAccountsStatsConsumer(IAccountsCacheService accountsCacheService, MarginSettings marginSettings, IRabbitMqNotifyService rabbitMqNotifyService) { _accountsCacheService = accountsCacheService; _marginSettings = marginSettings; _rabbitMqNotifyService = rabbitMqNotifyService; }
public MarginTradingEnablingService(IClientAccountClient clientAccountClient, IRabbitMqService rabbitMqService, MarginSettings settings, IMarginTradingSettingsCacheService marginTradingSettingsCacheService) { _marginSettings = settings; _rabbitMqService = rabbitMqService; _clientAccountClient = clientAccountClient; _marginTradingSettingsCacheService = marginTradingSettingsCacheService; }
/// <summary> /// Base setup required for building pdf. No defaults are set, so inputs are required. /// </summary> /// <param name="colorMode"></param> /// <param name="pageMargins"></param> /// <param name="orientation"></param> /// <param name="paperSize"></param> public BasePdfPageSpecification(ColorMode colorMode, MarginSettings pageMargins, Orientation orientation, PaperKind paperSize) { this.PageColorMode = colorMode; this.PageMargins = pageMargins ?? new MarginSettings { Top = 20, Bottom = 20 }; this.PageOrientation = orientation; this.PaperSize = paperSize; }
public RabbitMqNotifyService( MarginSettings settings, IIndex <string, IMessageProducer <string> > publishers, ILog log) { _settings = settings; _publishers = publishers; _log = log; }
public RisksController(IAssetPairsCache instrumentsCache, IAccountsCacheService accountsCacheService, MarginSettings marginSettings, IMarginTradingAccountHistoryRepository accountHistoryRepository) { _instrumentsCache = instrumentsCache; _accountsCacheService = accountsCacheService; _marginSettings = marginSettings; _accountHistoryRepository = accountHistoryRepository; }
public MarginSettingsInstance(ObjectInstance prototype, MarginSettings marginSettings) : this(prototype) { if (marginSettings == null) { throw new ArgumentNullException("marginSettings"); } m_marginSettings = marginSettings; }
public AccountGroupManager( AccountGroupCacheService accountGroupCacheService, IAccountGroupRepository accountGroupRepository, MarginSettings settings, IClientNotifyService clientNotifyService) { _accountGroupCacheService = accountGroupCacheService; _repository = accountGroupRepository; _settings = settings; _clientNotifyService = clientNotifyService; }
public Stream GenerateReport(string htmlContent) { var doc = new HtmlToPdfDocument { GlobalSettings = { Margins = new MarginSettings { Top = 10 }, PageOffset = 0 },
public IsAliveController( IMarketMakerMatchingEngine matchingEngine, ITradingEngine tradingEngine, MarginSettings settings, IDateService dateService) { _matchingEngine = matchingEngine; _tradingEngine = tradingEngine; _settings = settings; _dateService = dateService; }
public EquivalentPricesService( IAccountsCacheService accountsCacheService, ICfdCalculatorService cfdCalculatorService, MarginSettings marginSettings, ILog log) { _accountsCacheService = accountsCacheService; _cfdCalculatorService = cfdCalculatorService; _marginSettings = marginSettings; _log = log; }
public MarginTradingEnabledFilter( MarginSettings marginSettings, IMarginTradingSettingsCacheService marginTradingSettingsCacheService, ICacheProvider cacheProvider, ILog log) { _marginSettings = marginSettings; _marginTradingSettingsCacheService = marginTradingSettingsCacheService; _cacheProvider = cacheProvider; _log = log; }
public async Task CreateSummary(List <TourItem> mockList = null) { var employeeList = new List <TourItem>(); if (mockList == null) { var jsonData = System.IO.File.ReadAllText(userPath + @"TourPlaner_DL\TourJson\TourData.json"); employeeList = JsonConvert.DeserializeObject <List <TourItem> >(jsonData) ?? new List <TourItem>(); } else { employeeList = mockList; } float totalDistance = 0; string summaryText = ""; TimeSpan total = new(); var totalDisplay = ""; foreach (var item in employeeList) { totalDistance += item.TourInfo.Distance; if (mockList == null) { var split = item.TourInfo.TotalTime.Split(':'); total = total.Add(new TimeSpan(int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]))); totalDisplay = total.ToString(@"dd\:hh\:mm\:ss"); } summaryText += @$ "Tourname: {item.Name} || Start: {item.TourInfo.Start} -> Destination: {item.TourInfo.Goal} || Time: {item.TourInfo.TotalTime} || Distance: {item.TourInfo.Distance}km <br>"; } var converter = new BasicConverter(new PdfTools()); if (!Directory.Exists(userPath + $@"TourPlaner_DL\TourPDFs\")) { Directory.CreateDirectory(userPath + @"TourPlaner_DL\TourPDFs\"); } var doc = new HtmlToPdfDocument() { GlobalSettings = { ColorMode = ColorMode.Color, Orientation = Orientation.Landscape, PaperSize = PaperKind.A4Plus, Margins = new MarginSettings { Top = 10 }, Out = userPath + @"TourPlaner_DL\TourPDFs\SummaryLog.pdf", },
public AccountsBalanceController( MarginSettings marginSettings, IMarginTradingOperationsLogService operationsLogService, ILog log, IAccountsCacheService accountsCacheService, AccountManager accountManager) { _marginSettings = marginSettings; _operationsLogService = operationsLogService; _log = log; _accountsCacheService = accountsCacheService; _accountManager = accountManager; }
public AccountAssetsManager( AccountAssetsCacheService accountAssetsCacheService, IAccountAssetPairsRepository accountAssetPairsRepository, MarginSettings settings, IClientNotifyService clientNotifyService, IOrderReader orderReader) { _accountAssetsCacheService = accountAssetsCacheService; _pairsRepository = accountAssetPairsRepository; _settings = settings; _clientNotifyService = clientNotifyService; _orderReader = orderReader; }
public AccountProfileController( IMarginTradingAccountHistoryRepository accountsHistoryRepository, IMarginTradingOrdersHistoryRepository ordersHistoryRepository, IAccountsCacheService accountsCacheService, OrdersCache ordersCache, MarginSettings settings) { _accountsHistoryRepository = accountsHistoryRepository; _ordersHistoryRepository = ordersHistoryRepository; _accountsCacheService = accountsCacheService; _ordersCache = ordersCache; _settings = settings; }
public ClientNotifyService( IRabbitMqNotifyService rabbitMqNotifyService, IMarginTradingOperationsLogService operationsLogService, MarginSettings marginSettings, IConsole consoleWriter, IAccountsCacheService accountsCacheService) { _rabbitMqNotifyService = rabbitMqNotifyService; _operationsLogService = operationsLogService; _marginSettings = marginSettings; _consoleWriter = consoleWriter; _accountsCacheService = accountsCacheService; }
/// <summary> /// Base setup required for building pdf. No defaults are set, so inputs are required. /// </summary> /// <param name="colorMode"></param> /// <param name="pageMargins"></param> /// <param name="orientation"></param> /// <param name="paperSize"></param> public BasePdfPageSpecification(ColorMode colorMode, MarginSettings pageMargins, Orientation orientation, PaperKind paperSize) { this.PageColorMode = colorMode; this.PageMargins = pageMargins ?? new MarginSettings { Top = 20, Bottom = 20 }; this.PageOrientation = orientation; this.PaperSize = paperSize; DefaultEncoding = "utf-8"; FontName = "Arial"; PageSpacing = 10; UserStyleSheet = string.Empty; }
public void ShouldHaveDefaultValuesAfterInvokingEmptyConstructor() { // Act var sut = new MarginSettings(); // Assert using (new AssertionScope()) { sut.Unit.Should().Be(Unit.Millimeters); sut.Top.Should().BeNull(); sut.Right.Should().BeNull(); sut.Bottom.Should().BeNull(); sut.Left.Should().BeNull(); } }
public EquivalentPricesService( IAccountsCacheService accountsCacheService, ICfdCalculatorService cfdCalculatorService, IQuoteCacheService quoteCacheService, IAssetPairsCache assetPairsCache, MarginSettings marginSettings, ILog log) { _accountsCacheService = accountsCacheService; _cfdCalculatorService = cfdCalculatorService; _quoteCacheService = quoteCacheService; _assetPairsCache = assetPairsCache; _marginSettings = marginSettings; _log = log; }
public TradingSyncContext(string contextType, string contextSource, ITelemetryPublisher telemetryPublisher, MarginSettings marginTradingSettings) { _contextType = contextType; _contextSource = contextSource; _telemetryPublisher = telemetryPublisher; _marginTradingSettings = marginTradingSettings; _sw.Start(); Monitor.Enter(MarginTradingHelpers.TradingMatchingSync); _waitingForLockTime = _sw.ElapsedMilliseconds; _sw.Restart(); _contextNestingDepth++; }
public void ShouldReturnProperStringWhenInvokingGetMarginValue( Unit unit, double?value, string?expected) { // Arrange var sut = new MarginSettings { Unit = unit, }; // Act var result = sut.GetMarginValue(value); // Assert result.Should().Be(expected); }
public QuotesMonitor(ILog log, IMtSlackNotificationsSender slackNotificationsSender, MarginSettings marginSettings, IQuoteCacheService quoteCacheService, IDateService dateService, IAssetPairDayOffService dayOffService, IAlertSeverityLevelService alertSeverityLevelService) : base("QuotesMonitor", 60000, log) { _log = log; _slackNotificationsSender = slackNotificationsSender; _marginSettings = marginSettings; _quoteCacheService = quoteCacheService; _dateService = dateService; _dayOffService = dayOffService; _alertSeverityLevelService = alertSeverityLevelService; _outdatedQuotes = new Dictionary <string, OutdatedQuoteInfo>(); }