Пример #1
0
 public MarketMakerJob(ILogger <MarketMakerJob> logger, IMarketMaker[] marketMakers, IMarketMakerSettingsAccessor settingsAccessor)
 {
     _marketMakers     = marketMakers;
     _settingsAccessor = settingsAccessor;
     _timer            = new MyTaskTimer(typeof(MarketMakerJob),
                                         TimeSpan.FromMilliseconds(settingsAccessor.GetMarketMakerSettings().MarketMakerRefreshIntervalMSec),
                                         logger, DoTime);
 }
 public QuotePublisher(IPublisher <BidAsk> publisher, IPublisher <IBidAsk> candlePublisher, IMyNoSqlServerDataWriter <BidAskNoSql> writer, ILogger <QuotePublisher> logger)
 {
     _publisher       = publisher;
     _candlePublisher = candlePublisher;
     _writer          = writer;
     _logger          = logger;
     _timer           = new MyTaskTimer(nameof(QuotePublisher), TimeSpan.FromMilliseconds(WriterDelayMs), logger, DoProcess);
 }
 public DepositsProcessingJob(ILogger <DepositsProcessingJob> logger,
                              DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder,
                              ISpotChangeBalanceService changeBalanceService,
                              IServiceBusPublisher <Deposit> depositPublisher)
 {
     _logger = logger;
     _dbContextOptionsBuilder = dbContextOptionsBuilder;
     _changeBalanceService    = changeBalanceService;
     _depositPublisher        = depositPublisher;
     _timer = new MyTaskTimer(typeof(DepositsProcessingJob),
                              TimeSpan.FromSeconds(Program.ReloadedSettings(e => e.DepositsProcessingIntervalSec).Invoke()),
                              logger, DoTime);
 }
Пример #4
0
        public ExchangeBalanceHistoryWriter(
            ISubscriber <IReadOnlyList <ExBalanceUpdateMessage> > subscriber,
            ILogger <ExchangeBalanceHistoryWriter> logger,
            DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder,
            MyLocker locker)
        {
            _logger = logger;
            _dbContextOptionsBuilder = dbContextOptionsBuilder;
            _locker    = locker;
            _mmWallets = Program.Settings.MmWallets.Split(';').ToList();
            subscriber.Subscribe(HandleEvents);

            _timer = new MyTaskTimer(nameof(ExchangeBalanceHistoryWriter), TimeSpan.FromSeconds(60), logger, DoTimer);
            _timer.Start();
        }
        public InternalTradeReaderJob(
            ILogger <InternalTradeReaderJob> logger,
            ISubscriber <IReadOnlyList <WalletTradeMessage> > subscriber,
            IPortfolioManager manager,
            IHedgeService hedgeService,
            ILpWalletManager walletManager,
            IHedgeSettingsManager hedgeSettings)
        {
            _manager       = manager;
            _hedgeService  = hedgeService;
            _walletManager = walletManager;
            _hedgeSettings = hedgeSettings;
            subscriber.Subscribe(HandleTrades);

            _hedgeTimer = new MyTaskTimer(nameof(InternalTradeReaderJob), TimeSpan.FromMilliseconds(5000), logger, DoHedge).DisableTelemetry();
        }
Пример #6
0
 public WithdrawalProcessingJob(ILogger <WithdrawalProcessingJob> logger,
                                DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder,
                                CryptoWithdrawalService cryptoWithdrawalService,
                                ISubscriber <WithdrawalVerifiedMessage> verificationSubscriber,
                                IWithdrawalVerificationService verificationService,
                                IServiceBusPublisher <Withdrawal> withdrawalPublisher,
                                IIndexPricesClient indexPricesClient)
 {
     _indexPrices = indexPricesClient;
     verificationSubscriber.Subscribe(HandleVerifiedWithdrawals);
     _logger = logger;
     _dbContextOptionsBuilder = dbContextOptionsBuilder;
     _cryptoWithdrawalService = cryptoWithdrawalService;
     _verificationService     = verificationService;
     _withdrawalPublisher     = withdrawalPublisher;
     _timer = new MyTaskTimer(typeof(WithdrawalProcessingJob),
                              TimeSpan.FromSeconds(Program.ReloadedSettings(e => e.WithdrawalsProcessingIntervalSec).Invoke()),
                              logger, DoTime);
 }
        public BitGoDepositAddressesGenerationJob(
            ILogger <BitGoDepositAddressesGenerationJob> logger,
            IBitGoAssetMapSettingsService bitGoAssetMapSettingsService,
            IMyNoSqlServerDataWriter <GeneratedDepositAddressEntity> dataWriter,
            DepositAddressGeneratorService depositAddressGeneratorService,
            IAssetsDictionaryClient assetsDictionaryClient,
            IAssetPaymentSettingsClient assetPaymentSettingsClient)
        {
            _logger = logger;
            _bitGoAssetMapSettingsService = bitGoAssetMapSettingsService;
            _dataWriter = dataWriter;
            _depositAddressGeneratorService = depositAddressGeneratorService;
            _assetsDictionaryClient         = assetsDictionaryClient;
            _assetPaymentSettingsClient     = assetPaymentSettingsClient;

            _timer = new MyTaskTimer(typeof(BitGoDepositAddressesGenerationJob),
                                     TimeSpan.FromSeconds(Program.ReloadedSettings(e => e.GenerateAddressesIntervalSec).Invoke()),
                                     logger, DoTime);
        }
        public OperationHistoryWriter(
            ILogger <OperationHistoryWriter> logger,
            DbContextOptionsBuilder <DatabaseContext> dbContextOptionsBuilder,
            IMyNoSqlServerDataWriter <OperationHistoryNoSqlEntity> writer,
            ISubscriber <IReadOnlyList <Withdrawal> > withdrawalSubscriber,
            ISubscriber <IReadOnlyList <Deposit> > depositSubscriber,
            ISubscriber <IReadOnlyList <SwapMessage> > swapSubscriber,
            ISubscriber <IReadOnlyList <Transfer> > transferSubscriber,
            ISubscriber <IReadOnlyList <ManualChangeBalanceMessage> > manualChangeSubscriber,
            ISubscriber <IReadOnlyList <PaidInterestRateMessage> > interestRateSubscriber,
            ISubscriber <IReadOnlyList <FeePaymentEntity> > feePaymentSubscriber,
            ISubscriber <IReadOnlyList <RewardPaymentMessage> > rewardSubscriber,
            ISubscriber <IReadOnlyList <SimplexIntention> > simplexSubscriber,
            ISubscriber <IReadOnlyList <InvestOrder> > investSubscriber,
            ISubscriber <IReadOnlyList <InitialFuturePayment> > futurePaymentSubscriber,
            ISubscriber <IReadOnlyList <ClientOfferAction> > clientOfferActionSubscriber,
            MyLocker locker, IConvertIndexPricesClient pricesClient)
        {
            _logger = logger;
            _dbContextOptionsBuilder = dbContextOptionsBuilder;
            _writer       = writer;
            _locker       = locker;
            _pricesClient = pricesClient;
            Program.Settings.MmWallets.Split(';').ToList();

            //subscriber.Subscribe(HandleEvents);
            withdrawalSubscriber.Subscribe(HandleWithdrawalUpdates);
            depositSubscriber.Subscribe(HandleDepositUpdates);
            swapSubscriber.Subscribe(HandleSwapUpdates);
            transferSubscriber.Subscribe(HandleTransferUpdates);
            manualChangeSubscriber.Subscribe(HandleManualChangeUpdates);
            interestRateSubscriber.Subscribe(HandleInterestRateUpdates);
            feePaymentSubscriber.Subscribe(HandleFeePaymentUpdates);
            rewardSubscriber.Subscribe(HandleRewardPaymentUpdates);
            simplexSubscriber.Subscribe(HandleNewSimplexUpdates);
            investSubscriber.Subscribe(HandleInvestOrdersUpdates);
            futurePaymentSubscriber.Subscribe(HandleFuturePayments);
            clientOfferActionSubscriber.Subscribe(HandleEarnClientOfferActionUpdates);

            _timer = new MyTaskTimer(nameof(OperationHistoryWriter), TimeSpan.FromSeconds(60), logger, DoTimer);
            _timer.Start();
        }