From c06ac5f1d51768b5c16ef70408e542d3c446b763 Mon Sep 17 00:00:00 2001 From: Dmitry Samodov Date: Fri, 6 Nov 2020 13:09:38 +0300 Subject: [PATCH 01/60] SIR-1726: added sirius deposit event processing --- .../Lykke.Job.History.csproj | 1 + src/Lykke.Job.History/Modules/CqrsModule.cs | 7 ++++++ .../Projections/TransactionHashProjection.cs | 22 +++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/Lykke.Job.History/Lykke.Job.History.csproj b/src/Lykke.Job.History/Lykke.Job.History.csproj index b82d6df..59495c9 100644 --- a/src/Lykke.Job.History/Lykke.Job.History.csproj +++ b/src/Lykke.Job.History/Lykke.Job.History.csproj @@ -29,6 +29,7 @@ + diff --git a/src/Lykke.Job.History/Modules/CqrsModule.cs b/src/Lykke.Job.History/Modules/CqrsModule.cs index cae7e4b..c69728e 100644 --- a/src/Lykke.Job.History/Modules/CqrsModule.cs +++ b/src/Lykke.Job.History/Modules/CqrsModule.cs @@ -12,6 +12,7 @@ using Lykke.Job.History.Workflow.ExecutionProcessing; using Lykke.Job.History.Workflow.Handlers; using Lykke.Job.History.Workflow.Projections; +using Lykke.Job.SiriusDepositsDetector.Contract; using Lykke.Messaging; using Lykke.Messaging.Contract; using Lykke.Messaging.RabbitMq; @@ -154,6 +155,12 @@ private CqrsEngine CreateEngine( .WithEndpointResolver(sagasMessagePackEndpointResolver) .WithProjection(typeof(TransactionHashProjection), BlockchainCashinDetectorBoundedContext.Name) + .ListeningEvents(typeof(Job.SiriusDepositsDetector.Contract.Events.CashinCompletedEvent)) + .From(SiriusDepositsDetectorBoundedContext.Name) + .On(defaultRoute) + .WithEndpointResolver(sagasMessagePackEndpointResolver) + .WithProjection(typeof(TransactionHashProjection), SiriusDepositsDetectorBoundedContext.Name) + .ListeningEvents( typeof(Job.BlockchainCashoutProcessor.Contract.Events.CashoutCompletedEvent), typeof(Job.BlockchainCashoutProcessor.Contract.Events.CrossClientCashoutCompletedEvent), diff --git a/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs b/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs index 24656f2..83b8d3b 100644 --- a/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs +++ b/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs @@ -84,6 +84,28 @@ public async Task Handle( return CommandHandlingResult.Ok(); } + /// + /// Sirius cashin event + /// + /// + /// + public async Task Handle( + Job.SiriusDepositsDetector.Contract.Events.CashinCompletedEvent @event) + { + if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, @event.TransactionHash)) + { + _logger.Warning($"Transaction hash was not set", context: new + { + id = @event.OperationId, + hash = @event.TransactionHash + }); + + return CommandHandlingResult.Fail(TimeSpan.FromMinutes(1)); + } + + return CommandHandlingResult.Ok(); + } + /// /// BIL cashout event /// From 0257d8b02f64c6c35260cd8969a21c3e77492c2f Mon Sep 17 00:00:00 2001 From: Dmitry Samodov Date: Tue, 22 Dec 2020 14:26:25 +0300 Subject: [PATCH 02/60] SIR-1904: process sirius cashout completed event --- .../Lykke.Job.History.csproj | 1 + src/Lykke.Job.History/Modules/CqrsModule.cs | 7 ++++++ .../Projections/TransactionHashProjection.cs | 22 +++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/Lykke.Job.History/Lykke.Job.History.csproj b/src/Lykke.Job.History/Lykke.Job.History.csproj index 59495c9..4896b83 100644 --- a/src/Lykke.Job.History/Lykke.Job.History.csproj +++ b/src/Lykke.Job.History/Lykke.Job.History.csproj @@ -29,6 +29,7 @@ + diff --git a/src/Lykke.Job.History/Modules/CqrsModule.cs b/src/Lykke.Job.History/Modules/CqrsModule.cs index c69728e..eb9736d 100644 --- a/src/Lykke.Job.History/Modules/CqrsModule.cs +++ b/src/Lykke.Job.History/Modules/CqrsModule.cs @@ -12,6 +12,7 @@ using Lykke.Job.History.Workflow.ExecutionProcessing; using Lykke.Job.History.Workflow.Handlers; using Lykke.Job.History.Workflow.Projections; +using Lykke.Job.SiriusCashoutProcessor.Contract; using Lykke.Job.SiriusDepositsDetector.Contract; using Lykke.Messaging; using Lykke.Messaging.Contract; @@ -161,6 +162,12 @@ private CqrsEngine CreateEngine( .WithEndpointResolver(sagasMessagePackEndpointResolver) .WithProjection(typeof(TransactionHashProjection), SiriusDepositsDetectorBoundedContext.Name) + .ListeningEvents(typeof(Job.SiriusCashoutProcessor.Contract.Events.CashoutCompletedEvent)) + .From(SiriusCashoutProcessorBoundedContext.Name) + .On(defaultRoute) + .WithEndpointResolver(sagasMessagePackEndpointResolver) + .WithProjection(typeof(TransactionHashProjection), SiriusCashoutProcessorBoundedContext.Name) + .ListeningEvents( typeof(Job.BlockchainCashoutProcessor.Contract.Events.CashoutCompletedEvent), typeof(Job.BlockchainCashoutProcessor.Contract.Events.CrossClientCashoutCompletedEvent), diff --git a/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs b/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs index 83b8d3b..51507dc 100644 --- a/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs +++ b/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs @@ -128,6 +128,28 @@ public async Task Handle( return CommandHandlingResult.Ok(); } + /// + /// Sirius cashout event + /// + /// + /// + public async Task Handle( + Job.SiriusCashoutProcessor.Contract.Events.CashoutCompletedEvent @event) + { + if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, @event.TransactionHash)) + { + _logger.Warning($"Transaction hash was not set", context: new + { + id = @event.OperationId, + hash = @event.TransactionHash + }); + + return CommandHandlingResult.Fail(TimeSpan.FromMinutes(1)); + } + + return CommandHandlingResult.Ok(); + } + /// /// BIL batched cashout event /// From a4f8276f39c0ddf5fe9db6c72bd9a7b59c728f97 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Mon, 11 Jan 2021 16:20:37 +0400 Subject: [PATCH 03/60] Migrated to antares --- ...History.sln => Antares.Service.History.sln | 44 ++-- .../Antares.Service.History.Client.csproj} | 8 +- .../AutofacExtension.cs | 6 +- .../HistoryClient.cs | 2 +- .../HistoryJsonConverter.cs | 9 +- .../HistoryServiceClientSettings.cs | 2 +- .../IHistoryApi.cs | 7 +- .../IHistoryClient.cs | 2 +- .../IOrdersApi.cs | 7 +- .../ITradesApi.cs | 8 +- .../Antares.Service.History.Contracts.csproj} | 2 +- .../Commands/CreateForwardCashinCommand.cs | 4 +- .../Commands/DeleteForwardCashinCommand.cs | 4 +- .../Cqrs/Events/ForwardCashinCreatedEvent.cs | 4 +- .../Cqrs/Events/ForwardCashinDeletedEvent.cs | 4 +- .../Cqrs/HistoryBoundedContext.cs | 6 +- .../Enums/HistoryState.cs | 6 +- .../Enums/HistoryType.cs | 6 +- .../Enums/OrderSide.cs | 2 +- .../Enums/OrderStatus.cs | 2 +- .../Enums/OrderType.cs | 2 +- .../Enums/TradeRole.cs | 2 +- .../Enums/TradeType.cs | 2 +- .../History/BaseHistoryModel.cs | 4 +- .../History/CashinModel.cs | 4 +- .../History/CashoutModel.cs | 4 +- .../History/OrderEventModel.cs | 6 +- .../History/TradeModel.cs | 6 +- .../Orders/OrderModel.cs | 4 +- .../Lykke.Service.History.Client.xml | 206 ------------------ .../Antares.Job.History.csproj} | 12 +- .../AutoMapper/CashTransferConverter.cs | 8 +- .../AutoMapper/ExecutionConverter.cs | 4 +- .../AutoMapper/ServiceProfile.cs | 16 +- .../Dockerfile | 2 +- .../Modules/CqrsModule.cs | 26 +-- .../Modules/DbModule.cs | 14 +- .../Program.cs | 4 +- .../Properties/launchSettings.json | 0 .../ShutdownManager.cs | 6 +- .../Startup.cs | 10 +- .../StartupManager.cs | 6 +- .../BaseBatchQueueReader.cs | 2 +- .../ExecutionProcessing/CustomQueueItem.cs | 2 +- .../ExecutionQueueReader.cs | 6 +- .../OrderEventQueueReader.cs | 4 +- .../Handlers/EthereumCommandHandler.cs | 6 +- .../ForwardWithdrawalCommandHandler.cs | 8 +- .../Workflow/Projections/CashInProjection.cs | 4 +- .../Workflow/Projections/CashOutProjection.cs | 4 +- .../Projections/CashTransferProjection.cs | 4 +- .../Projections/TransactionHashProjection.cs | 12 +- .../Antares.Service.History.Core.csproj} | 8 +- .../Domain/Enums/HistoryState.cs | 2 +- .../Domain/Enums/HistoryType.cs | 2 +- .../Domain/Enums/OrderSide.cs | 2 +- .../Domain/Enums/OrderStatus.cs | 2 +- .../Domain/Enums/OrderType.cs | 2 +- .../Domain/Enums/TradeRole.cs | 2 +- .../Domain/History/BaseHistoryRecord.cs | 4 +- .../Domain/History/Cashin.cs | 4 +- .../Domain/History/Cashout.cs | 4 +- .../History/IHistoryRecordsRepository.cs | 4 +- .../Domain/History/OrderEvent.cs | 4 +- .../Domain/History/Trade.cs | 4 +- .../Domain/Orders/IOrdersRepository.cs | 6 +- .../Domain/Orders/Order.cs | 6 +- .../Settings/AppSettings.cs | 6 +- .../Settings/CqrsSettings.cs | 2 +- .../Settings/DbSettings.cs | 2 +- .../Settings/HistorySettings.cs | 2 +- .../Utils.cs | 4 +- ...rvice.History.PostgresRepositories.csproj} | 8 +- .../ConnectionFactory.cs | 2 +- .../Constants.cs | 2 +- .../DataContext.cs | 6 +- .../Entities/HistoryEntity.cs | 4 +- .../Entities/HistoryEntityContext.cs | 4 +- .../Entities/OrderEntity.cs | 4 +- .../CustomSqlMethodCallTranslator.cs | 2 +- .../JsonbQuery/JsonbExtensions.cs | 2 +- .../JsonbQuery/JsonbFindTranslator.cs | 2 +- .../JsonbQuery/NpgsqlFragmentExpression.cs | 2 +- .../Mappings/HistoryEntityBulkMapping.cs | 4 +- .../Mappings/HistoryTypeMapper.cs | 8 +- .../Mappings/OrderEntityBulkMapping.cs | 4 +- .../Mappings/RepositoryProfile.cs | 12 +- .../Repositories/HistoryRecordsRepository.cs | 12 +- .../Repositories/OrdersRepository.cs | 14 +- .../Antares.Service.History.Services.csproj} | 4 +- .../Antares.Service.History.csproj} | 14 +- .../AutoMapper/ServiceProfile.cs | 10 +- .../Controllers/HistoryController.cs | 8 +- .../Controllers/OrdersController.cs | 8 +- .../Controllers/TradesController.cs | 10 +- .../Dockerfile | 2 +- .../Modules/DbModule.cs | 14 +- .../Program.cs | 4 +- .../Properties/launchSettings.json | 0 .../Startup.cs | 10 +- .../Antares.Service.History.Tests.csproj | 21 ++ .../CashinTests.cs | 6 +- .../CashoutTests.cs | 6 +- .../ForwardWithdrawalTests.cs | 10 +- .../Init/InMemoryHistoryRepository.cs | 6 +- .../Init/InMemoryOrdersRepository.cs | 8 +- .../Init/TestInitialization.cs | 25 +-- .../PostgresTests.cs | 12 +- .../TransferTests.cs | 6 +- .../UtilsTests.cs | 7 +- .../Lykke.Service.History.Tests.csproj | 21 -- 111 files changed, 334 insertions(+), 577 deletions(-) rename Lykke.Service.History.sln => Antares.Service.History.sln (61%) rename client/{Lykke.Service.History.Client/Lykke.Service.History.Client.csproj => Antares.Service.History.Client/Antares.Service.History.Client.csproj} (90%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/AutofacExtension.cs (91%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/HistoryClient.cs (95%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/HistoryJsonConverter.cs (88%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/HistoryServiceClientSettings.cs (88%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/IHistoryApi.cs (89%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/IHistoryClient.cs (93%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/IOrdersApi.cs (90%) rename client/{Lykke.Service.History.Client => Antares.Service.History.Client}/ITradesApi.cs (90%) rename client/{Lykke.Service.History.Contracts/Lykke.Service.History.Contracts.csproj => Antares.Service.History.Contracts/Antares.Service.History.Contracts.csproj} (79%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Cqrs/Commands/CreateForwardCashinCommand.cs (81%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Cqrs/Commands/DeleteForwardCashinCommand.cs (69%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Cqrs/Events/ForwardCashinCreatedEvent.cs (81%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Cqrs/Events/ForwardCashinDeletedEvent.cs (70%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Cqrs/HistoryBoundedContext.cs (69%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/HistoryState.cs (62%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/HistoryType.cs (58%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/OrderSide.cs (72%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/OrderStatus.cs (82%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/OrderType.cs (75%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/TradeRole.cs (73%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Enums/TradeType.cs (56%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/History/BaseHistoryModel.cs (72%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/History/CashinModel.cs (78%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/History/CashoutModel.cs (78%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/History/OrderEventModel.cs (72%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/History/TradeModel.cs (81%) rename client/{Lykke.Service.History.Contracts => Antares.Service.History.Contracts}/Orders/OrderModel.cs (91%) delete mode 100644 client/Lykke.Service.History.Client/Lykke.Service.History.Client.xml rename src/{Lykke.Job.History/Lykke.Job.History.csproj => Antares.Job.History/Antares.Job.History.csproj} (82%) rename src/{Lykke.Job.History => Antares.Job.History}/AutoMapper/CashTransferConverter.cs (82%) rename src/{Lykke.Job.History => Antares.Job.History}/AutoMapper/ExecutionConverter.cs (88%) rename src/{Lykke.Job.History => Antares.Job.History}/AutoMapper/ServiceProfile.cs (86%) rename src/{Lykke.Job.History => Antares.Job.History}/Dockerfile (55%) rename src/{Lykke.Job.History => Antares.Job.History}/Modules/CqrsModule.cs (89%) rename src/{Lykke.Service.History => Antares.Job.History}/Modules/DbModule.cs (68%) rename src/{Lykke.Service.History => Antares.Job.History}/Program.cs (85%) rename src/{Lykke.Job.History => Antares.Job.History}/Properties/launchSettings.json (100%) rename src/{Lykke.Job.History => Antares.Job.History}/ShutdownManager.cs (86%) rename src/{Lykke.Job.History => Antares.Job.History}/Startup.cs (94%) rename src/{Lykke.Job.History => Antares.Job.History}/StartupManager.cs (88%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs (99%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/ExecutionProcessing/CustomQueueItem.cs (91%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/ExecutionProcessing/ExecutionQueueReader.cs (96%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/ExecutionProcessing/OrderEventQueueReader.cs (97%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/Handlers/EthereumCommandHandler.cs (96%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs (91%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/Projections/CashInProjection.cs (90%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/Projections/CashOutProjection.cs (91%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/Projections/CashTransferProjection.cs (92%) rename src/{Lykke.Job.History => Antares.Job.History}/Workflow/Projections/TransactionHashProjection.cs (92%) rename src/{Lykke.Service.History.Core/Lykke.Service.History.Core.csproj => Antares.Service.History.Core/Antares.Service.History.Core.csproj} (52%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Enums/HistoryState.cs (70%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Enums/HistoryType.cs (76%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Enums/OrderSide.cs (60%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Enums/OrderStatus.cs (77%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Enums/OrderType.cs (66%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Enums/TradeRole.cs (61%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/History/BaseHistoryRecord.cs (71%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/History/Cashin.cs (77%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/History/Cashout.cs (77%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/History/IHistoryRecordsRepository.cs (92%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/History/OrderEvent.cs (78%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/History/Trade.cs (86%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Orders/IOrdersRepository.cs (83%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Domain/Orders/Order.cs (88%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Settings/AppSettings.cs (62%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Settings/CqrsSettings.cs (77%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Settings/DbSettings.cs (82%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Settings/HistorySettings.cs (92%) rename src/{Lykke.Service.History.Core => Antares.Service.History.Core}/Utils.cs (93%) rename src/{Lykke.Service.History.PostgresRepositories/Lykke.Service.History.PostgresRepositories.csproj => Antares.Service.History.PostgresRepositories/Antares.Service.History.PostgresRepositories.csproj} (62%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/ConnectionFactory.cs (91%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Constants.cs (83%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/DataContext.cs (80%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Entities/HistoryEntity.cs (91%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Entities/HistoryEntityContext.cs (93%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Entities/OrderEntity.cs (94%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/JsonbQuery/CustomSqlMethodCallTranslator.cs (90%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/JsonbQuery/JsonbExtensions.cs (80%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/JsonbQuery/JsonbFindTranslator.cs (94%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/JsonbQuery/NpgsqlFragmentExpression.cs (93%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Mappings/HistoryEntityBulkMapping.cs (84%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Mappings/HistoryTypeMapper.cs (86%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Mappings/OrderEntityBulkMapping.cs (92%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Mappings/RepositoryProfile.cs (93%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Repositories/HistoryRecordsRepository.cs (95%) rename src/{Lykke.Service.History.PostgresRepositories => Antares.Service.History.PostgresRepositories}/Repositories/OrdersRepository.cs (94%) rename src/{Lykke.Service.History.Services/Lykke.Service.History.Services.csproj => Antares.Service.History.Services/Antares.Service.History.Services.csproj} (60%) rename src/{Lykke.Service.History/Lykke.Service.History.csproj => Antares.Service.History/Antares.Service.History.csproj} (78%) rename src/{Lykke.Service.History => Antares.Service.History}/AutoMapper/ServiceProfile.cs (81%) rename src/{Lykke.Service.History => Antares.Service.History}/Controllers/HistoryController.cs (92%) rename src/{Lykke.Service.History => Antares.Service.History}/Controllers/OrdersController.cs (95%) rename src/{Lykke.Service.History => Antares.Service.History}/Controllers/TradesController.cs (94%) rename src/{Lykke.Service.History => Antares.Service.History}/Dockerfile (54%) rename src/{Lykke.Job.History => Antares.Service.History}/Modules/DbModule.cs (67%) rename src/{Lykke.Job.History => Antares.Service.History}/Program.cs (84%) rename src/{Lykke.Service.History => Antares.Service.History}/Properties/launchSettings.json (100%) rename src/{Lykke.Service.History => Antares.Service.History}/Startup.cs (93%) create mode 100644 tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/CashinTests.cs (92%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/CashoutTests.cs (92%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/ForwardWithdrawalTests.cs (90%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/Init/InMemoryHistoryRepository.cs (96%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/Init/InMemoryOrdersRepository.cs (93%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/Init/TestInitialization.cs (89%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/PostgresTests.cs (95%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/TransferTests.cs (94%) rename tests/{Lykke.Service.History.Tests => Antares.Service.History.Tests}/UtilsTests.cs (90%) delete mode 100644 tests/Lykke.Service.History.Tests/Lykke.Service.History.Tests.csproj diff --git a/Lykke.Service.History.sln b/Antares.Service.History.sln similarity index 61% rename from Lykke.Service.History.sln rename to Antares.Service.History.sln index 37cb4c7..a29b1fc 100644 --- a/Lykke.Service.History.sln +++ b/Antares.Service.History.sln @@ -1,19 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30804.86 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History", "src\Lykke.Service.History\Lykke.Service.History.csproj", "{E414FDB9-FEEA-4CD0-9BBA-D1541601DF29}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History", "src\Antares.Service.History\Antares.Service.History.csproj", "{E414FDB9-FEEA-4CD0-9BBA-D1541601DF29}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1. Instrastructure", "1. Instrastructure", "{CC2067D7-1971-47BB-B491-5649EA3C18B2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History.Core", "src\Lykke.Service.History.Core\Lykke.Service.History.Core.csproj", "{F5B2F6B8-A8CC-4612-8F1D-C063EB8C8955}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Core", "src\Antares.Service.History.Core\Antares.Service.History.Core.csproj", "{F5B2F6B8-A8CC-4612-8F1D-C063EB8C8955}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2. Repositories", "2. Repositories", "{BF745453-B940-470E-81BC-43FB67703D4E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History.PostgresRepositories", "src\Lykke.Service.History.PostgresRepositories\Lykke.Service.History.PostgresRepositories.csproj", "{4BE49E02-AAAD-460B-8D00-57F412A3D181}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.PostgresRepositories", "src\Antares.Service.History.PostgresRepositories\Antares.Service.History.PostgresRepositories.csproj", "{4BE49E02-AAAD-460B-8D00-57F412A3D181}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History.Services", "src\Lykke.Service.History.Services\Lykke.Service.History.Services.csproj", "{2D5F52EC-2A27-4045-81ED-72355E2A6325}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Services", "src\Antares.Service.History.Services\Antares.Service.History.Services.csproj", "{2D5F52EC-2A27-4045-81ED-72355E2A6325}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution items", "{6CA74DE0-A357-4934-9D8B-FEA3F0A2D690}" ProjectSection(SolutionItems) = preProject @@ -22,17 +22,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution settings.yaml = settings.yaml EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3. Client", "3. Client", "{C9A2CFDE-EA32-4946-B679-7CE6EFA816B8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Tests", "tests\Antares.Service.History.Tests\Antares.Service.History.Tests.csproj", "{A61FFDEE-5725-4650-A788-6E55EE5EFD5B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History.Client", "client\Lykke.Service.History.Client\Lykke.Service.History.Client.csproj", "{3C300C31-97D3-41E8-A627-C53491BDA28B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4. Tests", "4. Tests", "{8F9036B1-5106-4C69-B2D2-B78EE52687A0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History.Tests", "tests\Lykke.Service.History.Tests\Lykke.Service.History.Tests.csproj", "{A61FFDEE-5725-4650-A788-6E55EE5EFD5B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Job.History", "src\Antares.Job.History\Antares.Job.History.csproj", "{20110F5A-E5BA-4147-BF4E-7258CB54FE93}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4. Tests", "4. Tests", "{8F9036B1-5106-4C69-B2D2-B78EE52687A0}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3. Client", "3. Client", "{CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lykke.Service.History.Contracts", "client\Lykke.Service.History.Contracts\Lykke.Service.History.Contracts.csproj", "{2064A769-4F07-4E1C-A946-7CFF768704F2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Client", "client\Antares.Service.History.Client\Antares.Service.History.Client.csproj", "{831EC068-8A52-4209-BCCA-6EB5A1FF363B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lykke.Job.History", "src\Lykke.Job.History\Lykke.Job.History.csproj", "{20110F5A-E5BA-4147-BF4E-7258CB54FE93}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Contracts", "client\Antares.Service.History.Contracts\Antares.Service.History.Contracts.csproj", "{E4199193-31F4-401B-8464-96783A6195D2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -56,22 +56,22 @@ Global {2D5F52EC-2A27-4045-81ED-72355E2A6325}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D5F52EC-2A27-4045-81ED-72355E2A6325}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D5F52EC-2A27-4045-81ED-72355E2A6325}.Release|Any CPU.Build.0 = Release|Any CPU - {3C300C31-97D3-41E8-A627-C53491BDA28B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3C300C31-97D3-41E8-A627-C53491BDA28B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3C300C31-97D3-41E8-A627-C53491BDA28B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3C300C31-97D3-41E8-A627-C53491BDA28B}.Release|Any CPU.Build.0 = Release|Any CPU {A61FFDEE-5725-4650-A788-6E55EE5EFD5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A61FFDEE-5725-4650-A788-6E55EE5EFD5B}.Debug|Any CPU.Build.0 = Debug|Any CPU {A61FFDEE-5725-4650-A788-6E55EE5EFD5B}.Release|Any CPU.ActiveCfg = Release|Any CPU {A61FFDEE-5725-4650-A788-6E55EE5EFD5B}.Release|Any CPU.Build.0 = Release|Any CPU - {2064A769-4F07-4E1C-A946-7CFF768704F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2064A769-4F07-4E1C-A946-7CFF768704F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2064A769-4F07-4E1C-A946-7CFF768704F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2064A769-4F07-4E1C-A946-7CFF768704F2}.Release|Any CPU.Build.0 = Release|Any CPU {20110F5A-E5BA-4147-BF4E-7258CB54FE93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20110F5A-E5BA-4147-BF4E-7258CB54FE93}.Debug|Any CPU.Build.0 = Debug|Any CPU {20110F5A-E5BA-4147-BF4E-7258CB54FE93}.Release|Any CPU.ActiveCfg = Release|Any CPU {20110F5A-E5BA-4147-BF4E-7258CB54FE93}.Release|Any CPU.Build.0 = Release|Any CPU + {831EC068-8A52-4209-BCCA-6EB5A1FF363B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {831EC068-8A52-4209-BCCA-6EB5A1FF363B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {831EC068-8A52-4209-BCCA-6EB5A1FF363B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {831EC068-8A52-4209-BCCA-6EB5A1FF363B}.Release|Any CPU.Build.0 = Release|Any CPU + {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -80,9 +80,9 @@ Global {F5B2F6B8-A8CC-4612-8F1D-C063EB8C8955} = {CC2067D7-1971-47BB-B491-5649EA3C18B2} {4BE49E02-AAAD-460B-8D00-57F412A3D181} = {BF745453-B940-470E-81BC-43FB67703D4E} {2D5F52EC-2A27-4045-81ED-72355E2A6325} = {CC2067D7-1971-47BB-B491-5649EA3C18B2} - {3C300C31-97D3-41E8-A627-C53491BDA28B} = {C9A2CFDE-EA32-4946-B679-7CE6EFA816B8} {A61FFDEE-5725-4650-A788-6E55EE5EFD5B} = {8F9036B1-5106-4C69-B2D2-B78EE52687A0} - {2064A769-4F07-4E1C-A946-7CFF768704F2} = {C9A2CFDE-EA32-4946-B679-7CE6EFA816B8} + {831EC068-8A52-4209-BCCA-6EB5A1FF363B} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} + {E4199193-31F4-401B-8464-96783A6195D2} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EB6C0EF4-AA6A-444D-8603-3669F73A58BC} diff --git a/client/Lykke.Service.History.Client/Lykke.Service.History.Client.csproj b/client/Antares.Service.History.Client/Antares.Service.History.Client.csproj similarity index 90% rename from client/Lykke.Service.History.Client/Lykke.Service.History.Client.csproj rename to client/Antares.Service.History.Client/Antares.Service.History.Client.csproj index 23e3558..028773a 100644 --- a/client/Lykke.Service.History.Client/Lykke.Service.History.Client.csproj +++ b/client/Antares.Service.History.Client/Antares.Service.History.Client.csproj @@ -1,6 +1,6 @@  - netstandard2.0 + netstandard2.1 1.0.1 Lykke Lykke @@ -27,13 +27,13 @@ - - - true lib/netstandard2.0 + + + \ No newline at end of file diff --git a/client/Lykke.Service.History.Client/AutofacExtension.cs b/client/Antares.Service.History.Client/AutofacExtension.cs similarity index 91% rename from client/Lykke.Service.History.Client/AutofacExtension.cs rename to client/Antares.Service.History.Client/AutofacExtension.cs index bff3149..5eb000b 100644 --- a/client/Lykke.Service.History.Client/AutofacExtension.cs +++ b/client/Antares.Service.History.Client/AutofacExtension.cs @@ -5,10 +5,8 @@ using Lykke.HttpClientGenerator; using Lykke.HttpClientGenerator.Infrastructure; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Refit; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// History service autofac registration extension @@ -35,7 +33,7 @@ public static void RegisterHistoryClient( throw new ArgumentException("Value cannot be null or whitespace.", nameof(HistoryServiceClientSettings.ServiceUrl)); - var clientBuilder = HttpClientGenerator.HttpClientGenerator.BuildForUrl(settings.ServiceUrl) + var clientBuilder = Lykke.HttpClientGenerator.HttpClientGenerator.BuildForUrl(settings.ServiceUrl) .WithAdditionalCallsWrapper(new ExceptionHandlerCallsWrapper()); clientBuilder = builderConfigure?.Invoke(clientBuilder) ?? clientBuilder.WithoutRetries(); diff --git a/client/Lykke.Service.History.Client/HistoryClient.cs b/client/Antares.Service.History.Client/HistoryClient.cs similarity index 95% rename from client/Lykke.Service.History.Client/HistoryClient.cs rename to client/Antares.Service.History.Client/HistoryClient.cs index 0552bad..1f1d084 100644 --- a/client/Lykke.Service.History.Client/HistoryClient.cs +++ b/client/Antares.Service.History.Client/HistoryClient.cs @@ -1,6 +1,6 @@ using Lykke.HttpClientGenerator; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// diff --git a/client/Lykke.Service.History.Client/HistoryJsonConverter.cs b/client/Antares.Service.History.Client/HistoryJsonConverter.cs similarity index 88% rename from client/Lykke.Service.History.Client/HistoryJsonConverter.cs rename to client/Antares.Service.History.Client/HistoryJsonConverter.cs index b6beb81..4829ce5 100644 --- a/client/Lykke.Service.History.Client/HistoryJsonConverter.cs +++ b/client/Antares.Service.History.Client/HistoryJsonConverter.cs @@ -1,13 +1,10 @@ using System; -using System.Collections.Generic; -using System.Text; -using Lykke.Service.History.Contracts; -using Lykke.Service.History.Contracts.Enums; -using Lykke.Service.History.Contracts.History; +using Antares.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.History; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// public class HistoryJsonConverter : JsonConverter diff --git a/client/Lykke.Service.History.Client/HistoryServiceClientSettings.cs b/client/Antares.Service.History.Client/HistoryServiceClientSettings.cs similarity index 88% rename from client/Lykke.Service.History.Client/HistoryServiceClientSettings.cs rename to client/Antares.Service.History.Client/HistoryServiceClientSettings.cs index 1e9b1d0..e401246 100644 --- a/client/Lykke.Service.History.Client/HistoryServiceClientSettings.cs +++ b/client/Antares.Service.History.Client/HistoryServiceClientSettings.cs @@ -1,6 +1,6 @@ using Lykke.SettingsReader.Attributes; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// History client settings. diff --git a/client/Lykke.Service.History.Client/IHistoryApi.cs b/client/Antares.Service.History.Client/IHistoryApi.cs similarity index 89% rename from client/Lykke.Service.History.Client/IHistoryApi.cs rename to client/Antares.Service.History.Client/IHistoryApi.cs index 7a0d40a..b61c696 100644 --- a/client/Lykke.Service.History.Client/IHistoryApi.cs +++ b/client/Antares.Service.History.Client/IHistoryApi.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.History; using JetBrains.Annotations; -using Lykke.Service.History.Contracts.Enums; -using Lykke.Service.History.Contracts.History; -using Microsoft.AspNetCore.Mvc; using Refit; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// History client API interface. diff --git a/client/Lykke.Service.History.Client/IHistoryClient.cs b/client/Antares.Service.History.Client/IHistoryClient.cs similarity index 93% rename from client/Lykke.Service.History.Client/IHistoryClient.cs rename to client/Antares.Service.History.Client/IHistoryClient.cs index 6a5f2d6..7dca88c 100644 --- a/client/Lykke.Service.History.Client/IHistoryClient.cs +++ b/client/Antares.Service.History.Client/IHistoryClient.cs @@ -1,6 +1,6 @@ using JetBrains.Annotations; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// History client interface. diff --git a/client/Lykke.Service.History.Client/IOrdersApi.cs b/client/Antares.Service.History.Client/IOrdersApi.cs similarity index 90% rename from client/Lykke.Service.History.Client/IOrdersApi.cs rename to client/Antares.Service.History.Client/IOrdersApi.cs index 43146fb..8fca8fb 100644 --- a/client/Lykke.Service.History.Client/IOrdersApi.cs +++ b/client/Antares.Service.History.Client/IOrdersApi.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Orders; using JetBrains.Annotations; -using Lykke.Service.History.Contracts.Enums; -using Lykke.Service.History.Contracts.History; -using Lykke.Service.History.Contracts.Orders; using Refit; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// Orders client API interface. diff --git a/client/Lykke.Service.History.Client/ITradesApi.cs b/client/Antares.Service.History.Client/ITradesApi.cs similarity index 90% rename from client/Lykke.Service.History.Client/ITradesApi.cs rename to client/Antares.Service.History.Client/ITradesApi.cs index 388d9c5..735edb5 100644 --- a/client/Lykke.Service.History.Client/ITradesApi.cs +++ b/client/Antares.Service.History.Client/ITradesApi.cs @@ -1,12 +1,12 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.History; using JetBrains.Annotations; -using Lykke.Service.History.Contracts.Enums; -using Lykke.Service.History.Contracts.History; using Refit; -namespace Lykke.Service.History.Client +namespace Antares.Service.History.Client { /// /// Orders client API interface. diff --git a/client/Lykke.Service.History.Contracts/Lykke.Service.History.Contracts.csproj b/client/Antares.Service.History.Contracts/Antares.Service.History.Contracts.csproj similarity index 79% rename from client/Lykke.Service.History.Contracts/Lykke.Service.History.Contracts.csproj rename to client/Antares.Service.History.Contracts/Antares.Service.History.Contracts.csproj index 9b1a5b5..0e5ac07 100644 --- a/client/Lykke.Service.History.Contracts/Lykke.Service.History.Contracts.csproj +++ b/client/Antares.Service.History.Contracts/Antares.Service.History.Contracts.csproj @@ -2,7 +2,7 @@ 1.0.0 - netstandard2.0 + netstandard2.1 diff --git a/client/Lykke.Service.History.Contracts/Cqrs/Commands/CreateForwardCashinCommand.cs b/client/Antares.Service.History.Contracts/Cqrs/Commands/CreateForwardCashinCommand.cs similarity index 81% rename from client/Lykke.Service.History.Contracts/Cqrs/Commands/CreateForwardCashinCommand.cs rename to client/Antares.Service.History.Contracts/Cqrs/Commands/CreateForwardCashinCommand.cs index 05073da..527f3dc 100644 --- a/client/Lykke.Service.History.Contracts/Cqrs/Commands/CreateForwardCashinCommand.cs +++ b/client/Antares.Service.History.Contracts/Cqrs/Commands/CreateForwardCashinCommand.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; using ProtoBuf; -namespace Lykke.Service.History.Contracts.Cqrs.Commands +namespace Antares.Service.History.Contracts.Cqrs.Commands { [ProtoContract] public class CreateForwardCashinCommand diff --git a/client/Lykke.Service.History.Contracts/Cqrs/Commands/DeleteForwardCashinCommand.cs b/client/Antares.Service.History.Contracts/Cqrs/Commands/DeleteForwardCashinCommand.cs similarity index 69% rename from client/Lykke.Service.History.Contracts/Cqrs/Commands/DeleteForwardCashinCommand.cs rename to client/Antares.Service.History.Contracts/Cqrs/Commands/DeleteForwardCashinCommand.cs index b0bd2be..a96486c 100644 --- a/client/Lykke.Service.History.Contracts/Cqrs/Commands/DeleteForwardCashinCommand.cs +++ b/client/Antares.Service.History.Contracts/Cqrs/Commands/DeleteForwardCashinCommand.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; using ProtoBuf; -namespace Lykke.Service.History.Contracts.Cqrs.Commands +namespace Antares.Service.History.Contracts.Cqrs.Commands { [ProtoContract] public class DeleteForwardCashinCommand diff --git a/client/Lykke.Service.History.Contracts/Cqrs/Events/ForwardCashinCreatedEvent.cs b/client/Antares.Service.History.Contracts/Cqrs/Events/ForwardCashinCreatedEvent.cs similarity index 81% rename from client/Lykke.Service.History.Contracts/Cqrs/Events/ForwardCashinCreatedEvent.cs rename to client/Antares.Service.History.Contracts/Cqrs/Events/ForwardCashinCreatedEvent.cs index a3d7b81..7ef0fff 100644 --- a/client/Lykke.Service.History.Contracts/Cqrs/Events/ForwardCashinCreatedEvent.cs +++ b/client/Antares.Service.History.Contracts/Cqrs/Events/ForwardCashinCreatedEvent.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; using ProtoBuf; -namespace Lykke.Service.History.Contracts.Cqrs.Events +namespace Antares.Service.History.Contracts.Cqrs.Events { [ProtoContract] public class ForwardCashinCreatedEvent diff --git a/client/Lykke.Service.History.Contracts/Cqrs/Events/ForwardCashinDeletedEvent.cs b/client/Antares.Service.History.Contracts/Cqrs/Events/ForwardCashinDeletedEvent.cs similarity index 70% rename from client/Lykke.Service.History.Contracts/Cqrs/Events/ForwardCashinDeletedEvent.cs rename to client/Antares.Service.History.Contracts/Cqrs/Events/ForwardCashinDeletedEvent.cs index a2fc240..40bb00f 100644 --- a/client/Lykke.Service.History.Contracts/Cqrs/Events/ForwardCashinDeletedEvent.cs +++ b/client/Antares.Service.History.Contracts/Cqrs/Events/ForwardCashinDeletedEvent.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; using ProtoBuf; -namespace Lykke.Service.History.Contracts.Cqrs.Events +namespace Antares.Service.History.Contracts.Cqrs.Events { [ProtoContract] public class ForwardCashinDeletedEvent diff --git a/client/Lykke.Service.History.Contracts/Cqrs/HistoryBoundedContext.cs b/client/Antares.Service.History.Contracts/Cqrs/HistoryBoundedContext.cs similarity index 69% rename from client/Lykke.Service.History.Contracts/Cqrs/HistoryBoundedContext.cs rename to client/Antares.Service.History.Contracts/Cqrs/HistoryBoundedContext.cs index 5bfab1b..dbef386 100644 --- a/client/Lykke.Service.History.Contracts/Cqrs/HistoryBoundedContext.cs +++ b/client/Antares.Service.History.Contracts/Cqrs/HistoryBoundedContext.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Lykke.Service.History.Contracts.Cqrs +namespace Antares.Service.History.Contracts.Cqrs { /// /// History service bounded context diff --git a/client/Lykke.Service.History.Contracts/Enums/HistoryState.cs b/client/Antares.Service.History.Contracts/Enums/HistoryState.cs similarity index 62% rename from client/Lykke.Service.History.Contracts/Enums/HistoryState.cs rename to client/Antares.Service.History.Contracts/Enums/HistoryState.cs index dcac352..1541d4e 100644 --- a/client/Lykke.Service.History.Contracts/Enums/HistoryState.cs +++ b/client/Antares.Service.History.Contracts/Enums/HistoryState.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { /// /// History record state diff --git a/client/Lykke.Service.History.Contracts/Enums/HistoryType.cs b/client/Antares.Service.History.Contracts/Enums/HistoryType.cs similarity index 58% rename from client/Lykke.Service.History.Contracts/Enums/HistoryType.cs rename to client/Antares.Service.History.Contracts/Enums/HistoryType.cs index eb6178b..2cbe61b 100644 --- a/client/Lykke.Service.History.Contracts/Enums/HistoryType.cs +++ b/client/Antares.Service.History.Contracts/Enums/HistoryType.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { /// /// History type diff --git a/client/Lykke.Service.History.Contracts/Enums/OrderSide.cs b/client/Antares.Service.History.Contracts/Enums/OrderSide.cs similarity index 72% rename from client/Lykke.Service.History.Contracts/Enums/OrderSide.cs rename to client/Antares.Service.History.Contracts/Enums/OrderSide.cs index 6917232..91679a3 100644 --- a/client/Lykke.Service.History.Contracts/Enums/OrderSide.cs +++ b/client/Antares.Service.History.Contracts/Enums/OrderSide.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { /// /// Order side diff --git a/client/Lykke.Service.History.Contracts/Enums/OrderStatus.cs b/client/Antares.Service.History.Contracts/Enums/OrderStatus.cs similarity index 82% rename from client/Lykke.Service.History.Contracts/Enums/OrderStatus.cs rename to client/Antares.Service.History.Contracts/Enums/OrderStatus.cs index 094168e..b6c3561 100644 --- a/client/Lykke.Service.History.Contracts/Enums/OrderStatus.cs +++ b/client/Antares.Service.History.Contracts/Enums/OrderStatus.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { /// /// Order status diff --git a/client/Lykke.Service.History.Contracts/Enums/OrderType.cs b/client/Antares.Service.History.Contracts/Enums/OrderType.cs similarity index 75% rename from client/Lykke.Service.History.Contracts/Enums/OrderType.cs rename to client/Antares.Service.History.Contracts/Enums/OrderType.cs index 7555787..fde9399 100644 --- a/client/Lykke.Service.History.Contracts/Enums/OrderType.cs +++ b/client/Antares.Service.History.Contracts/Enums/OrderType.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { /// /// Order type diff --git a/client/Lykke.Service.History.Contracts/Enums/TradeRole.cs b/client/Antares.Service.History.Contracts/Enums/TradeRole.cs similarity index 73% rename from client/Lykke.Service.History.Contracts/Enums/TradeRole.cs rename to client/Antares.Service.History.Contracts/Enums/TradeRole.cs index d55df3c..9e71d56 100644 --- a/client/Lykke.Service.History.Contracts/Enums/TradeRole.cs +++ b/client/Antares.Service.History.Contracts/Enums/TradeRole.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { /// /// Trade role diff --git a/client/Lykke.Service.History.Contracts/Enums/TradeType.cs b/client/Antares.Service.History.Contracts/Enums/TradeType.cs similarity index 56% rename from client/Lykke.Service.History.Contracts/Enums/TradeType.cs rename to client/Antares.Service.History.Contracts/Enums/TradeType.cs index 44006d8..b06af0c 100644 --- a/client/Lykke.Service.History.Contracts/Enums/TradeType.cs +++ b/client/Antares.Service.History.Contracts/Enums/TradeType.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Contracts.Enums +namespace Antares.Service.History.Contracts.Enums { public enum TradeType { diff --git a/client/Lykke.Service.History.Contracts/History/BaseHistoryModel.cs b/client/Antares.Service.History.Contracts/History/BaseHistoryModel.cs similarity index 72% rename from client/Lykke.Service.History.Contracts/History/BaseHistoryModel.cs rename to client/Antares.Service.History.Contracts/History/BaseHistoryModel.cs index 47fbae2..d21b33b 100644 --- a/client/Lykke.Service.History.Contracts/History/BaseHistoryModel.cs +++ b/client/Antares.Service.History.Contracts/History/BaseHistoryModel.cs @@ -1,7 +1,7 @@ using System; -using Lykke.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Enums; -namespace Lykke.Service.History.Contracts.History +namespace Antares.Service.History.Contracts.History { public abstract class BaseHistoryModel { diff --git a/client/Lykke.Service.History.Contracts/History/CashinModel.cs b/client/Antares.Service.History.Contracts/History/CashinModel.cs similarity index 78% rename from client/Lykke.Service.History.Contracts/History/CashinModel.cs rename to client/Antares.Service.History.Contracts/History/CashinModel.cs index 6fab33d..e3f2d6a 100644 --- a/client/Lykke.Service.History.Contracts/History/CashinModel.cs +++ b/client/Antares.Service.History.Contracts/History/CashinModel.cs @@ -1,6 +1,6 @@ -using Lykke.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Enums; -namespace Lykke.Service.History.Contracts.History +namespace Antares.Service.History.Contracts.History { public class CashinModel : BaseHistoryModel { diff --git a/client/Lykke.Service.History.Contracts/History/CashoutModel.cs b/client/Antares.Service.History.Contracts/History/CashoutModel.cs similarity index 78% rename from client/Lykke.Service.History.Contracts/History/CashoutModel.cs rename to client/Antares.Service.History.Contracts/History/CashoutModel.cs index 17a8bbc..e436f05 100644 --- a/client/Lykke.Service.History.Contracts/History/CashoutModel.cs +++ b/client/Antares.Service.History.Contracts/History/CashoutModel.cs @@ -1,6 +1,6 @@ -using Lykke.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Enums; -namespace Lykke.Service.History.Contracts.History +namespace Antares.Service.History.Contracts.History { public class CashoutModel : BaseHistoryModel { diff --git a/client/Lykke.Service.History.Contracts/History/OrderEventModel.cs b/client/Antares.Service.History.Contracts/History/OrderEventModel.cs similarity index 72% rename from client/Lykke.Service.History.Contracts/History/OrderEventModel.cs rename to client/Antares.Service.History.Contracts/History/OrderEventModel.cs index 8bc04b6..c231c5a 100644 --- a/client/Lykke.Service.History.Contracts/History/OrderEventModel.cs +++ b/client/Antares.Service.History.Contracts/History/OrderEventModel.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; -using Lykke.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Enums; -namespace Lykke.Service.History.Contracts.History +namespace Antares.Service.History.Contracts.History { public class OrderEventModel : BaseHistoryModel { diff --git a/client/Lykke.Service.History.Contracts/History/TradeModel.cs b/client/Antares.Service.History.Contracts/History/TradeModel.cs similarity index 81% rename from client/Lykke.Service.History.Contracts/History/TradeModel.cs rename to client/Antares.Service.History.Contracts/History/TradeModel.cs index b4f2b03..93ad703 100644 --- a/client/Lykke.Service.History.Contracts/History/TradeModel.cs +++ b/client/Antares.Service.History.Contracts/History/TradeModel.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; -using Lykke.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Enums; -namespace Lykke.Service.History.Contracts.History +namespace Antares.Service.History.Contracts.History { public class TradeModel : BaseHistoryModel { diff --git a/client/Lykke.Service.History.Contracts/Orders/OrderModel.cs b/client/Antares.Service.History.Contracts/Orders/OrderModel.cs similarity index 91% rename from client/Lykke.Service.History.Contracts/Orders/OrderModel.cs rename to client/Antares.Service.History.Contracts/Orders/OrderModel.cs index 316a12c..f82fc5b 100644 --- a/client/Lykke.Service.History.Contracts/Orders/OrderModel.cs +++ b/client/Antares.Service.History.Contracts/Orders/OrderModel.cs @@ -1,7 +1,7 @@ using System; -using Lykke.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.Enums; -namespace Lykke.Service.History.Contracts.Orders +namespace Antares.Service.History.Contracts.Orders { public class OrderModel { diff --git a/client/Lykke.Service.History.Client/Lykke.Service.History.Client.xml b/client/Lykke.Service.History.Client/Lykke.Service.History.Client.xml deleted file mode 100644 index 38d0e89..0000000 --- a/client/Lykke.Service.History.Client/Lykke.Service.History.Client.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - Lykke.Service.History.Client - - - - - History service autofac registration extension - - - - - Registers in Autofac container using . - - Autofac container builder. - History client settings. - Optional configure handler. - - - - - History API aggregating interface. - - - - C-tor - - - - - - - - - - - - - - - - - - - - - - - - - History client settings. - - - - Service url. - - - - History client API interface. - - - - - Get history by wallet id - - - - - - - - - - - - - - Get history item by id - - - - - - - - History client interface. - - - - - History api interface (trade \ cashin \ cashout \ transfer \ order event) - - - - - Orders api interface - - - - - Trades api interface - - - - - Orders client API interface. - - - - - Get order by id - - - - - - - Get order list by wallet id - - - - - - - - - - - - Get active orders by wallet id - - - - - - - - - - Orders client API interface. - - - - - Get trades by wallet id - - - - - - - - - - - - - - Get order trades - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Lykke.Job.History/Lykke.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj similarity index 82% rename from src/Lykke.Job.History/Lykke.Job.History.csproj rename to src/Antares.Job.History/Antares.Job.History.csproj index b82d6df..2d31df4 100644 --- a/src/Lykke.Job.History/Lykke.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -1,6 +1,6 @@  - netcoreapp2.2 + net5.0 Exe 1.0.1 @@ -23,6 +23,7 @@ + @@ -32,18 +33,17 @@ - - - - + - + + + diff --git a/src/Lykke.Job.History/AutoMapper/CashTransferConverter.cs b/src/Antares.Job.History/AutoMapper/CashTransferConverter.cs similarity index 82% rename from src/Lykke.Job.History/AutoMapper/CashTransferConverter.cs rename to src/Antares.Job.History/AutoMapper/CashTransferConverter.cs index f007101..0a25330 100644 --- a/src/Lykke.Job.History/AutoMapper/CashTransferConverter.cs +++ b/src/Antares.Job.History/AutoMapper/CashTransferConverter.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; +using Antares.Service.History.Core.Domain.History; using AutoMapper; -using Lykke.Service.History.Core.Domain.History; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -namespace Lykke.Job.History.AutoMapper +namespace Antares.Job.History.AutoMapper { public class CashTransferConverter : ITypeConverter> { @@ -19,7 +19,7 @@ public IEnumerable Convert(CashTransferProcessedEvent source, Timestamp = source.Timestamp, AssetId = source.AssetId, FeeSize = source.FromWalletId == source.FeeSourceWalletId ? source.FeeSize : null, - State = Service.History.Core.Domain.Enums.HistoryState.Finished + State = Antares.Service.History.Core.Domain.Enums.HistoryState.Finished }; yield return new Cashin @@ -30,7 +30,7 @@ public IEnumerable Convert(CashTransferProcessedEvent source, Timestamp = source.Timestamp, AssetId = source.AssetId, FeeSize = source.ToWalletId == source.FeeSourceWalletId ? source.FeeSize : null, - State = Service.History.Core.Domain.Enums.HistoryState.Finished + State = Antares.Service.History.Core.Domain.Enums.HistoryState.Finished }; } } diff --git a/src/Lykke.Job.History/AutoMapper/ExecutionConverter.cs b/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs similarity index 88% rename from src/Lykke.Job.History/AutoMapper/ExecutionConverter.cs rename to src/Antares.Job.History/AutoMapper/ExecutionConverter.cs index 9559e6f..05ffd0a 100644 --- a/src/Lykke.Job.History/AutoMapper/ExecutionConverter.cs +++ b/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; +using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.History.Core.Domain.Orders; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -namespace Lykke.Job.History.AutoMapper +namespace Antares.Job.History.AutoMapper { public class ExecutionConverter : ITypeConverter> { diff --git a/src/Lykke.Job.History/AutoMapper/ServiceProfile.cs b/src/Antares.Job.History/AutoMapper/ServiceProfile.cs similarity index 86% rename from src/Lykke.Job.History/AutoMapper/ServiceProfile.cs rename to src/Antares.Job.History/AutoMapper/ServiceProfile.cs index 0b4de79..ab27084 100644 --- a/src/Lykke.Job.History/AutoMapper/ServiceProfile.cs +++ b/src/Antares.Job.History/AutoMapper/ServiceProfile.cs @@ -1,17 +1,17 @@ using System; using System.Collections.Generic; +using Antares.Service.History.Contracts.Cqrs.Commands; +using Antares.Service.History.Contracts.History; +using Antares.Service.History.Core; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.History.Contracts.Cqrs.Commands; -using Lykke.Service.History.Contracts.History; -using Lykke.Service.History.Core; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; using TradeModel = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.TradeModel; -namespace Lykke.Job.History.AutoMapper +namespace Antares.Job.History.AutoMapper { public class ServiceProfile : Profile { @@ -55,7 +55,7 @@ public ServiceProfile() .IncludeBase(); CreateMap() .IncludeBase(); - CreateMap() + CreateMap() .IncludeBase(); CreateMap() .IncludeBase(); diff --git a/src/Lykke.Job.History/Dockerfile b/src/Antares.Job.History/Dockerfile similarity index 55% rename from src/Lykke.Job.History/Dockerfile rename to src/Antares.Job.History/Dockerfile index 6b5a759..97050b6 100644 --- a/src/Lykke.Job.History/Dockerfile +++ b/src/Antares.Job.History/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:2.2-aspnetcore-runtime +FROM mcr.microsoft.com/dotnet/aspnet:5.0.1-buster-slim WORKDIR /app COPY . . ENTRYPOINT ["dotnet", "Lykke.Job.History.dll"] diff --git a/src/Lykke.Job.History/Modules/CqrsModule.cs b/src/Antares.Job.History/Modules/CqrsModule.cs similarity index 89% rename from src/Lykke.Job.History/Modules/CqrsModule.cs rename to src/Antares.Job.History/Modules/CqrsModule.cs index cae7e4b..452ec42 100644 --- a/src/Lykke.Job.History/Modules/CqrsModule.cs +++ b/src/Antares.Job.History/Modules/CqrsModule.cs @@ -1,5 +1,13 @@ using System; using System.Collections.Generic; +using Antares.Job.History.Workflow.ExecutionProcessing; +using Antares.Job.History.Workflow.Handlers; +using Antares.Job.History.Workflow.Projections; +using Antares.Sdk.Services; +using Antares.Service.History.Contracts.Cqrs; +using Antares.Service.History.Contracts.Cqrs.Commands; +using Antares.Service.History.Contracts.Cqrs.Events; +using Antares.Service.History.Core.Settings; using Autofac; using Lykke.Bitcoin.Contracts; using Lykke.Bitcoin.Contracts.Events; @@ -9,24 +17,16 @@ using Lykke.Cqrs.Middleware.Logging; using Lykke.Job.BlockchainCashinDetector.Contract; using Lykke.Job.BlockchainCashoutProcessor.Contract; -using Lykke.Job.History.Workflow.ExecutionProcessing; -using Lykke.Job.History.Workflow.Handlers; -using Lykke.Job.History.Workflow.Projections; using Lykke.Messaging; using Lykke.Messaging.Contract; using Lykke.Messaging.RabbitMq; using Lykke.Messaging.Serialization; -using Lykke.Sdk; -using Lykke.Service.History.Contracts.Cqrs; -using Lykke.Service.History.Contracts.Cqrs.Commands; -using Lykke.Service.History.Contracts.Cqrs.Events; -using Lykke.Service.History.Core.Settings; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Lykke.SettingsReader; using RabbitMQ.Client; -namespace Lykke.Job.History.Modules +namespace Antares.Job.History.Modules { public class CqrsModule : Module { @@ -148,16 +148,16 @@ private CqrsEngine CreateEngine( .WithEndpointResolver(sagasMessagePackEndpointResolver) .WithProjection(typeof(TransactionHashProjection), BitcoinBoundedContext.Name) - .ListeningEvents(typeof(Job.BlockchainCashinDetector.Contract.Events.CashinCompletedEvent)) + .ListeningEvents(typeof(Lykke.Job.BlockchainCashinDetector.Contract.Events.CashinCompletedEvent)) .From(BlockchainCashinDetectorBoundedContext.Name) .On(defaultRoute) .WithEndpointResolver(sagasMessagePackEndpointResolver) .WithProjection(typeof(TransactionHashProjection), BlockchainCashinDetectorBoundedContext.Name) .ListeningEvents( - typeof(Job.BlockchainCashoutProcessor.Contract.Events.CashoutCompletedEvent), - typeof(Job.BlockchainCashoutProcessor.Contract.Events.CrossClientCashoutCompletedEvent), - typeof(Job.BlockchainCashoutProcessor.Contract.Events.CashoutsBatchCompletedEvent)) + typeof(Lykke.Job.BlockchainCashoutProcessor.Contract.Events.CashoutCompletedEvent), + typeof(Lykke.Job.BlockchainCashoutProcessor.Contract.Events.CrossClientCashoutCompletedEvent), + typeof(Lykke.Job.BlockchainCashoutProcessor.Contract.Events.CashoutsBatchCompletedEvent)) .From(BlockchainCashoutProcessorBoundedContext.Name) .On(defaultRoute) .WithEndpointResolver(sagasMessagePackEndpointResolver) diff --git a/src/Lykke.Service.History/Modules/DbModule.cs b/src/Antares.Job.History/Modules/DbModule.cs similarity index 68% rename from src/Lykke.Service.History/Modules/DbModule.cs rename to src/Antares.Job.History/Modules/DbModule.cs index 6261312..a5bd7d5 100644 --- a/src/Lykke.Service.History/Modules/DbModule.cs +++ b/src/Antares.Job.History/Modules/DbModule.cs @@ -1,12 +1,12 @@ -using Autofac; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; -using Lykke.Service.History.Core.Settings; -using Lykke.Service.History.PostgresRepositories; -using Lykke.Service.History.PostgresRepositories.Repositories; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.Core.Settings; +using Antares.Service.History.PostgresRepositories; +using Antares.Service.History.PostgresRepositories.Repositories; +using Autofac; using Lykke.SettingsReader; -namespace Lykke.Service.History.Modules +namespace Antares.Job.History.Modules { public class DbModule : Module { diff --git a/src/Lykke.Service.History/Program.cs b/src/Antares.Job.History/Program.cs similarity index 85% rename from src/Lykke.Service.History/Program.cs rename to src/Antares.Job.History/Program.cs index 38dd8f9..0af251e 100644 --- a/src/Lykke.Service.History/Program.cs +++ b/src/Antares.Job.History/Program.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; -using Lykke.Sdk; +using Antares.Sdk; -namespace Lykke.Service.History +namespace Antares.Job.History { internal sealed class Program { diff --git a/src/Lykke.Job.History/Properties/launchSettings.json b/src/Antares.Job.History/Properties/launchSettings.json similarity index 100% rename from src/Lykke.Job.History/Properties/launchSettings.json rename to src/Antares.Job.History/Properties/launchSettings.json diff --git a/src/Lykke.Job.History/ShutdownManager.cs b/src/Antares.Job.History/ShutdownManager.cs similarity index 86% rename from src/Lykke.Job.History/ShutdownManager.cs rename to src/Antares.Job.History/ShutdownManager.cs index 8c9e4db..662108a 100644 --- a/src/Lykke.Job.History/ShutdownManager.cs +++ b/src/Antares.Job.History/ShutdownManager.cs @@ -1,8 +1,8 @@ using System.Threading.Tasks; -using Lykke.Job.History.Workflow.ExecutionProcessing; -using Lykke.Sdk; +using Antares.Job.History.Workflow.ExecutionProcessing; +using Antares.Sdk.Services; -namespace Lykke.Job.History +namespace Antares.Job.History { public class ShutdownManager : IShutdownManager { diff --git a/src/Lykke.Job.History/Startup.cs b/src/Antares.Job.History/Startup.cs similarity index 94% rename from src/Lykke.Job.History/Startup.cs rename to src/Antares.Job.History/Startup.cs index eb70689..836519b 100644 --- a/src/Lykke.Job.History/Startup.cs +++ b/src/Antares.Job.History/Startup.cs @@ -1,14 +1,14 @@ using System; +using Antares.Job.History.AutoMapper; +using Antares.Sdk; +using Antares.Service.History.Core.Settings; +using Antares.Service.History.PostgresRepositories.Mappings; using AutoMapper; using JetBrains.Annotations; -using Lykke.Job.History.AutoMapper; -using Lykke.Sdk; -using Lykke.Service.History.Core.Settings; -using Lykke.Service.History.PostgresRepositories.Mappings; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; -namespace Lykke.Job.History +namespace Antares.Job.History { [UsedImplicitly] public class Startup diff --git a/src/Lykke.Job.History/StartupManager.cs b/src/Antares.Job.History/StartupManager.cs similarity index 88% rename from src/Lykke.Job.History/StartupManager.cs rename to src/Antares.Job.History/StartupManager.cs index 61fd349..f6761ba 100644 --- a/src/Lykke.Job.History/StartupManager.cs +++ b/src/Antares.Job.History/StartupManager.cs @@ -1,9 +1,9 @@ using System.Threading.Tasks; +using Antares.Job.History.Workflow.ExecutionProcessing; +using Antares.Sdk.Services; using Lykke.Cqrs; -using Lykke.Job.History.Workflow.ExecutionProcessing; -using Lykke.Sdk; -namespace Lykke.Job.History +namespace Antares.Job.History { public class StartupManager : IStartupManager { diff --git a/src/Lykke.Job.History/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs similarity index 99% rename from src/Lykke.Job.History/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs rename to src/Antares.Job.History/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs index cdd7a8f..f45fe95 100644 --- a/src/Lykke.Job.History/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/BaseBatchQueueReader.cs @@ -8,7 +8,7 @@ using RabbitMQ.Client; using RabbitMQ.Client.Events; -namespace Lykke.Job.History.Workflow.ExecutionProcessing +namespace Antares.Job.History.Workflow.ExecutionProcessing { public abstract class BaseBatchQueueReader { diff --git a/src/Lykke.Job.History/Workflow/ExecutionProcessing/CustomQueueItem.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/CustomQueueItem.cs similarity index 91% rename from src/Lykke.Job.History/Workflow/ExecutionProcessing/CustomQueueItem.cs rename to src/Antares.Job.History/Workflow/ExecutionProcessing/CustomQueueItem.cs index 77588e4..398ff91 100644 --- a/src/Lykke.Job.History/Workflow/ExecutionProcessing/CustomQueueItem.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/CustomQueueItem.cs @@ -1,6 +1,6 @@ using RabbitMQ.Client; -namespace Lykke.Job.History.Workflow.ExecutionProcessing +namespace Antares.Job.History.Workflow.ExecutionProcessing { public class CustomQueueItem { diff --git a/src/Lykke.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs similarity index 96% rename from src/Lykke.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs rename to src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs index e97508e..0203983 100644 --- a/src/Lykke.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs @@ -2,19 +2,19 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; using AutoMapper; using Common; using Lykke.Common.Log; using Lykke.RabbitMqBroker.Subscriber; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using MoreLinq; using RabbitMQ.Client; using RabbitMQ.Client.Events; -namespace Lykke.Job.History.Workflow.ExecutionProcessing +namespace Antares.Job.History.Workflow.ExecutionProcessing { public class ExecutionQueueReader : BaseBatchQueueReader> { diff --git a/src/Lykke.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs similarity index 97% rename from src/Lykke.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs rename to src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs index 394be91..a9a10a3 100644 --- a/src/Lykke.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs @@ -2,17 +2,17 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; using AutoMapper; using Common; using Lykke.Common.Log; using Lykke.RabbitMqBroker.Subscriber; -using Lykke.Service.History.Core.Domain.History; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using RabbitMQ.Client; using RabbitMQ.Client.Events; -namespace Lykke.Job.History.Workflow.ExecutionProcessing +namespace Antares.Job.History.Workflow.ExecutionProcessing { public class OrderEventQueueReader : BaseBatchQueueReader { diff --git a/src/Lykke.Job.History/Workflow/Handlers/EthereumCommandHandler.cs b/src/Antares.Job.History/Workflow/Handlers/EthereumCommandHandler.cs similarity index 96% rename from src/Lykke.Job.History/Workflow/Handlers/EthereumCommandHandler.cs rename to src/Antares.Job.History/Workflow/Handlers/EthereumCommandHandler.cs index 0fe33fa..ec2d9ac 100644 --- a/src/Lykke.Job.History/Workflow/Handlers/EthereumCommandHandler.cs +++ b/src/Antares.Job.History/Workflow/Handlers/EthereumCommandHandler.cs @@ -1,14 +1,14 @@ using System; using System.Threading.Tasks; +using Antares.Service.History.Core; +using Antares.Service.History.Core.Domain.History; using Common.Log; using Lykke.Common.Log; using Lykke.Cqrs; using Lykke.Job.EthereumCore.Contracts.Enums; -using Lykke.Service.History.Core; -using Lykke.Service.History.Core.Domain.History; using MessagePack; -namespace Lykke.Job.History.Workflow.Handlers +namespace Antares.Job.History.Workflow.Handlers { public class EthereumCommandHandler { diff --git a/src/Lykke.Job.History/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs b/src/Antares.Job.History/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs similarity index 91% rename from src/Lykke.Job.History/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs rename to src/Antares.Job.History/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs index 715f413..b899689 100644 --- a/src/Lykke.Job.History/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs +++ b/src/Antares.Job.History/Workflow/Handlers/ForwardWithdrawalCommandHandler.cs @@ -1,13 +1,13 @@ using System.Threading.Tasks; +using Antares.Service.History.Contracts.Cqrs.Commands; +using Antares.Service.History.Contracts.Cqrs.Events; +using Antares.Service.History.Core.Domain.History; using AutoMapper; using Common.Log; using Lykke.Common.Log; using Lykke.Cqrs; -using Lykke.Service.History.Contracts.Cqrs.Commands; -using Lykke.Service.History.Contracts.Cqrs.Events; -using Lykke.Service.History.Core.Domain.History; -namespace Lykke.Job.History.Workflow.Handlers +namespace Antares.Job.History.Workflow.Handlers { public class ForwardWithdrawalCommandHandler { diff --git a/src/Lykke.Job.History/Workflow/Projections/CashInProjection.cs b/src/Antares.Job.History/Workflow/Projections/CashInProjection.cs similarity index 90% rename from src/Lykke.Job.History/Workflow/Projections/CashInProjection.cs rename to src/Antares.Job.History/Workflow/Projections/CashInProjection.cs index e84a53b..019eedc 100644 --- a/src/Lykke.Job.History/Workflow/Projections/CashInProjection.cs +++ b/src/Antares.Job.History/Workflow/Projections/CashInProjection.cs @@ -1,12 +1,12 @@ using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; using AutoMapper; using Common.Log; using Lykke.Common.Log; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -namespace Lykke.Job.History.Workflow.Projections +namespace Antares.Job.History.Workflow.Projections { public class CashInProjection { diff --git a/src/Lykke.Job.History/Workflow/Projections/CashOutProjection.cs b/src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs similarity index 91% rename from src/Lykke.Job.History/Workflow/Projections/CashOutProjection.cs rename to src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs index de9d27a..7dbf539 100644 --- a/src/Lykke.Job.History/Workflow/Projections/CashOutProjection.cs +++ b/src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs @@ -1,12 +1,12 @@ using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; using AutoMapper; using Common.Log; using Lykke.Common.Log; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -namespace Lykke.Job.History.Workflow.Projections +namespace Antares.Job.History.Workflow.Projections { public class CashOutProjection { diff --git a/src/Lykke.Job.History/Workflow/Projections/CashTransferProjection.cs b/src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs similarity index 92% rename from src/Lykke.Job.History/Workflow/Projections/CashTransferProjection.cs rename to src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs index 627b436..83a5dc3 100644 --- a/src/Lykke.Job.History/Workflow/Projections/CashTransferProjection.cs +++ b/src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; using AutoMapper; using Common.Log; using Lykke.Common.Log; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -namespace Lykke.Job.History.Workflow.Projections +namespace Antares.Job.History.Workflow.Projections { public class CashTransferProjection { diff --git a/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs b/src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs similarity index 92% rename from src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs rename to src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs index 24656f2..aa6485f 100644 --- a/src/Lykke.Job.History/Workflow/Projections/TransactionHashProjection.cs +++ b/src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs @@ -1,12 +1,12 @@ using System; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; using Common.Log; using Lykke.Bitcoin.Contracts.Events; using Lykke.Common.Log; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; -namespace Lykke.Job.History.Workflow.Projections +namespace Antares.Job.History.Workflow.Projections { public class TransactionHashProjection { @@ -68,7 +68,7 @@ public async Task Handle(CashoutCompletedEvent @event) /// /// public async Task Handle( - Job.BlockchainCashinDetector.Contract.Events.CashinCompletedEvent @event) + Lykke.Job.BlockchainCashinDetector.Contract.Events.CashinCompletedEvent @event) { if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, @event.TransactionHash)) { @@ -90,7 +90,7 @@ public async Task Handle( /// /// public async Task Handle( - Job.BlockchainCashoutProcessor.Contract.Events.CashoutCompletedEvent @event) + Lykke.Job.BlockchainCashoutProcessor.Contract.Events.CashoutCompletedEvent @event) { if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, @event.TransactionHash)) { @@ -112,7 +112,7 @@ public async Task Handle( /// /// public async Task Handle( - Job.BlockchainCashoutProcessor.Contract.Events.CashoutsBatchCompletedEvent @event) + Lykke.Job.BlockchainCashoutProcessor.Contract.Events.CashoutsBatchCompletedEvent @event) { if (@event.Cashouts == null || @event.Cashouts.Length == 0) { @@ -145,7 +145,7 @@ public async Task Handle( /// /// public async Task Handle( - Job.BlockchainCashoutProcessor.Contract.Events.CrossClientCashoutCompletedEvent @event) + Lykke.Job.BlockchainCashoutProcessor.Contract.Events.CrossClientCashoutCompletedEvent @event) { if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, _crossClientTransactionHashSubstituition)) diff --git a/src/Lykke.Service.History.Core/Lykke.Service.History.Core.csproj b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj similarity index 52% rename from src/Lykke.Service.History.Core/Lykke.Service.History.Core.csproj rename to src/Antares.Service.History.Core/Antares.Service.History.Core.csproj index f978c44..a5efe62 100644 --- a/src/Lykke.Service.History.Core/Lykke.Service.History.Core.csproj +++ b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj @@ -1,13 +1,13 @@  - netcoreapp2.2 - Lykke.Service.History.Core - Lykke.Service.History.Core + net5.0 + Antares.Service.History.Core + Antares.Service.History.Core 1.0.0 + - diff --git a/src/Lykke.Service.History.Core/Domain/Enums/HistoryState.cs b/src/Antares.Service.History.Core/Domain/Enums/HistoryState.cs similarity index 70% rename from src/Lykke.Service.History.Core/Domain/Enums/HistoryState.cs rename to src/Antares.Service.History.Core/Domain/Enums/HistoryState.cs index fcce463..b87cff2 100644 --- a/src/Lykke.Service.History.Core/Domain/Enums/HistoryState.cs +++ b/src/Antares.Service.History.Core/Domain/Enums/HistoryState.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Core.Domain.Enums +namespace Antares.Service.History.Core.Domain.Enums { public enum HistoryState { diff --git a/src/Lykke.Service.History.Core/Domain/Enums/HistoryType.cs b/src/Antares.Service.History.Core/Domain/Enums/HistoryType.cs similarity index 76% rename from src/Lykke.Service.History.Core/Domain/Enums/HistoryType.cs rename to src/Antares.Service.History.Core/Domain/Enums/HistoryType.cs index b4b5c96..6dc2c5d 100644 --- a/src/Lykke.Service.History.Core/Domain/Enums/HistoryType.cs +++ b/src/Antares.Service.History.Core/Domain/Enums/HistoryType.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Core.Domain.Enums +namespace Antares.Service.History.Core.Domain.Enums { public enum HistoryType { diff --git a/src/Lykke.Service.History.Core/Domain/Enums/OrderSide.cs b/src/Antares.Service.History.Core/Domain/Enums/OrderSide.cs similarity index 60% rename from src/Lykke.Service.History.Core/Domain/Enums/OrderSide.cs rename to src/Antares.Service.History.Core/Domain/Enums/OrderSide.cs index 2c6ca2b..fce6076 100644 --- a/src/Lykke.Service.History.Core/Domain/Enums/OrderSide.cs +++ b/src/Antares.Service.History.Core/Domain/Enums/OrderSide.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Core.Domain.Enums +namespace Antares.Service.History.Core.Domain.Enums { public enum OrderSide { diff --git a/src/Lykke.Service.History.Core/Domain/Enums/OrderStatus.cs b/src/Antares.Service.History.Core/Domain/Enums/OrderStatus.cs similarity index 77% rename from src/Lykke.Service.History.Core/Domain/Enums/OrderStatus.cs rename to src/Antares.Service.History.Core/Domain/Enums/OrderStatus.cs index f32f56d..605d28a 100644 --- a/src/Lykke.Service.History.Core/Domain/Enums/OrderStatus.cs +++ b/src/Antares.Service.History.Core/Domain/Enums/OrderStatus.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Core.Domain.Enums +namespace Antares.Service.History.Core.Domain.Enums { public enum OrderStatus { diff --git a/src/Lykke.Service.History.Core/Domain/Enums/OrderType.cs b/src/Antares.Service.History.Core/Domain/Enums/OrderType.cs similarity index 66% rename from src/Lykke.Service.History.Core/Domain/Enums/OrderType.cs rename to src/Antares.Service.History.Core/Domain/Enums/OrderType.cs index 0674f7f..288f60a 100644 --- a/src/Lykke.Service.History.Core/Domain/Enums/OrderType.cs +++ b/src/Antares.Service.History.Core/Domain/Enums/OrderType.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Core.Domain.Enums +namespace Antares.Service.History.Core.Domain.Enums { public enum OrderType { diff --git a/src/Lykke.Service.History.Core/Domain/Enums/TradeRole.cs b/src/Antares.Service.History.Core/Domain/Enums/TradeRole.cs similarity index 61% rename from src/Lykke.Service.History.Core/Domain/Enums/TradeRole.cs rename to src/Antares.Service.History.Core/Domain/Enums/TradeRole.cs index a46633d..9199514 100644 --- a/src/Lykke.Service.History.Core/Domain/Enums/TradeRole.cs +++ b/src/Antares.Service.History.Core/Domain/Enums/TradeRole.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.Core.Domain.Enums +namespace Antares.Service.History.Core.Domain.Enums { public enum TradeRole { diff --git a/src/Lykke.Service.History.Core/Domain/History/BaseHistoryRecord.cs b/src/Antares.Service.History.Core/Domain/History/BaseHistoryRecord.cs similarity index 71% rename from src/Lykke.Service.History.Core/Domain/History/BaseHistoryRecord.cs rename to src/Antares.Service.History.Core/Domain/History/BaseHistoryRecord.cs index d9c386c..2aaa238 100644 --- a/src/Lykke.Service.History.Core/Domain/History/BaseHistoryRecord.cs +++ b/src/Antares.Service.History.Core/Domain/History/BaseHistoryRecord.cs @@ -1,7 +1,7 @@ using System; -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.Core.Domain.History +namespace Antares.Service.History.Core.Domain.History { public abstract class BaseHistoryRecord { diff --git a/src/Lykke.Service.History.Core/Domain/History/Cashin.cs b/src/Antares.Service.History.Core/Domain/History/Cashin.cs similarity index 77% rename from src/Lykke.Service.History.Core/Domain/History/Cashin.cs rename to src/Antares.Service.History.Core/Domain/History/Cashin.cs index 0891737..47f8376 100644 --- a/src/Lykke.Service.History.Core/Domain/History/Cashin.cs +++ b/src/Antares.Service.History.Core/Domain/History/Cashin.cs @@ -1,6 +1,6 @@ -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.Core.Domain.History +namespace Antares.Service.History.Core.Domain.History { public class Cashin : BaseHistoryRecord { diff --git a/src/Lykke.Service.History.Core/Domain/History/Cashout.cs b/src/Antares.Service.History.Core/Domain/History/Cashout.cs similarity index 77% rename from src/Lykke.Service.History.Core/Domain/History/Cashout.cs rename to src/Antares.Service.History.Core/Domain/History/Cashout.cs index bcbb9a4..c552c5c 100644 --- a/src/Lykke.Service.History.Core/Domain/History/Cashout.cs +++ b/src/Antares.Service.History.Core/Domain/History/Cashout.cs @@ -1,6 +1,6 @@ -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.Core.Domain.History +namespace Antares.Service.History.Core.Domain.History { public class Cashout : BaseHistoryRecord { diff --git a/src/Lykke.Service.History.Core/Domain/History/IHistoryRecordsRepository.cs b/src/Antares.Service.History.Core/Domain/History/IHistoryRecordsRepository.cs similarity index 92% rename from src/Lykke.Service.History.Core/Domain/History/IHistoryRecordsRepository.cs rename to src/Antares.Service.History.Core/Domain/History/IHistoryRecordsRepository.cs index 43389d7..be3b5f7 100644 --- a/src/Lykke.Service.History.Core/Domain/History/IHistoryRecordsRepository.cs +++ b/src/Antares.Service.History.Core/Domain/History/IHistoryRecordsRepository.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.Core.Domain.History +namespace Antares.Service.History.Core.Domain.History { public interface IHistoryRecordsRepository { diff --git a/src/Lykke.Service.History.Core/Domain/History/OrderEvent.cs b/src/Antares.Service.History.Core/Domain/History/OrderEvent.cs similarity index 78% rename from src/Lykke.Service.History.Core/Domain/History/OrderEvent.cs rename to src/Antares.Service.History.Core/Domain/History/OrderEvent.cs index 738a038..7af7b0b 100644 --- a/src/Lykke.Service.History.Core/Domain/History/OrderEvent.cs +++ b/src/Antares.Service.History.Core/Domain/History/OrderEvent.cs @@ -1,7 +1,7 @@ using System; -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.Core.Domain.History +namespace Antares.Service.History.Core.Domain.History { public class OrderEvent : BaseHistoryRecord { diff --git a/src/Lykke.Service.History.Core/Domain/History/Trade.cs b/src/Antares.Service.History.Core/Domain/History/Trade.cs similarity index 86% rename from src/Lykke.Service.History.Core/Domain/History/Trade.cs rename to src/Antares.Service.History.Core/Domain/History/Trade.cs index 8fb7d61..a112d0a 100644 --- a/src/Lykke.Service.History.Core/Domain/History/Trade.cs +++ b/src/Antares.Service.History.Core/Domain/History/Trade.cs @@ -1,7 +1,7 @@ using System; -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.Core.Domain.History +namespace Antares.Service.History.Core.Domain.History { public class Trade : BaseHistoryRecord { diff --git a/src/Lykke.Service.History.Core/Domain/Orders/IOrdersRepository.cs b/src/Antares.Service.History.Core/Domain/Orders/IOrdersRepository.cs similarity index 83% rename from src/Lykke.Service.History.Core/Domain/Orders/IOrdersRepository.cs rename to src/Antares.Service.History.Core/Domain/Orders/IOrdersRepository.cs index c089f6a..cdcb682 100644 --- a/src/Lykke.Service.History.Core/Domain/Orders/IOrdersRepository.cs +++ b/src/Antares.Service.History.Core/Domain/Orders/IOrdersRepository.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; -namespace Lykke.Service.History.Core.Domain.Orders +namespace Antares.Service.History.Core.Domain.Orders { public interface IOrdersRepository { diff --git a/src/Lykke.Service.History.Core/Domain/Orders/Order.cs b/src/Antares.Service.History.Core/Domain/Orders/Order.cs similarity index 88% rename from src/Lykke.Service.History.Core/Domain/Orders/Order.cs rename to src/Antares.Service.History.Core/Domain/Orders/Order.cs index 2f01cbe..70662cc 100644 --- a/src/Lykke.Service.History.Core/Domain/Orders/Order.cs +++ b/src/Antares.Service.History.Core/Domain/Orders/Order.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; -namespace Lykke.Service.History.Core.Domain.Orders +namespace Antares.Service.History.Core.Domain.Orders { public class Order { diff --git a/src/Lykke.Service.History.Core/Settings/AppSettings.cs b/src/Antares.Service.History.Core/Settings/AppSettings.cs similarity index 62% rename from src/Lykke.Service.History.Core/Settings/AppSettings.cs rename to src/Antares.Service.History.Core/Settings/AppSettings.cs index 4f98b01..f7845e5 100644 --- a/src/Lykke.Service.History.Core/Settings/AppSettings.cs +++ b/src/Antares.Service.History.Core/Settings/AppSettings.cs @@ -1,7 +1,7 @@ -using JetBrains.Annotations; -using Lykke.Sdk.Settings; +using Antares.Sdk.Settings; +using JetBrains.Annotations; -namespace Lykke.Service.History.Core.Settings +namespace Antares.Service.History.Core.Settings { [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public class AppSettings : BaseAppSettings diff --git a/src/Lykke.Service.History.Core/Settings/CqrsSettings.cs b/src/Antares.Service.History.Core/Settings/CqrsSettings.cs similarity index 77% rename from src/Lykke.Service.History.Core/Settings/CqrsSettings.cs rename to src/Antares.Service.History.Core/Settings/CqrsSettings.cs index 2bb2b9a..39ef47a 100644 --- a/src/Lykke.Service.History.Core/Settings/CqrsSettings.cs +++ b/src/Antares.Service.History.Core/Settings/CqrsSettings.cs @@ -1,6 +1,6 @@ using Lykke.SettingsReader.Attributes; -namespace Lykke.Service.History.Core.Settings +namespace Antares.Service.History.Core.Settings { public class CqrsSettings { diff --git a/src/Lykke.Service.History.Core/Settings/DbSettings.cs b/src/Antares.Service.History.Core/Settings/DbSettings.cs similarity index 82% rename from src/Lykke.Service.History.Core/Settings/DbSettings.cs rename to src/Antares.Service.History.Core/Settings/DbSettings.cs index 652c773..0fc6fc3 100644 --- a/src/Lykke.Service.History.Core/Settings/DbSettings.cs +++ b/src/Antares.Service.History.Core/Settings/DbSettings.cs @@ -1,6 +1,6 @@ using Lykke.SettingsReader.Attributes; -namespace Lykke.Service.History.Core.Settings +namespace Antares.Service.History.Core.Settings { public class DbSettings { diff --git a/src/Lykke.Service.History.Core/Settings/HistorySettings.cs b/src/Antares.Service.History.Core/Settings/HistorySettings.cs similarity index 92% rename from src/Lykke.Service.History.Core/Settings/HistorySettings.cs rename to src/Antares.Service.History.Core/Settings/HistorySettings.cs index c5b93e1..cbe9396 100644 --- a/src/Lykke.Service.History.Core/Settings/HistorySettings.cs +++ b/src/Antares.Service.History.Core/Settings/HistorySettings.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using Lykke.SettingsReader.Attributes; -namespace Lykke.Service.History.Core.Settings +namespace Antares.Service.History.Core.Settings { [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public class HistorySettings diff --git a/src/Lykke.Service.History.Core/Utils.cs b/src/Antares.Service.History.Core/Utils.cs similarity index 93% rename from src/Lykke.Service.History.Core/Utils.cs rename to src/Antares.Service.History.Core/Utils.cs index 0fadaa6..5cb8e80 100644 --- a/src/Lykke.Service.History.Core/Utils.cs +++ b/src/Antares.Service.History.Core/Utils.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; -using System.Text; using System.Text.RegularExpressions; -namespace Lykke.Service.History.Core +namespace Antares.Service.History.Core { public class Utils { diff --git a/src/Lykke.Service.History.PostgresRepositories/Lykke.Service.History.PostgresRepositories.csproj b/src/Antares.Service.History.PostgresRepositories/Antares.Service.History.PostgresRepositories.csproj similarity index 62% rename from src/Lykke.Service.History.PostgresRepositories/Lykke.Service.History.PostgresRepositories.csproj rename to src/Antares.Service.History.PostgresRepositories/Antares.Service.History.PostgresRepositories.csproj index 098af54..95208d8 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Lykke.Service.History.PostgresRepositories.csproj +++ b/src/Antares.Service.History.PostgresRepositories/Antares.Service.History.PostgresRepositories.csproj @@ -1,8 +1,8 @@  - netcoreapp2.2 - Lykke.Service.History.PostgresRepositories - Lykke.Service.History.PostgresRepositories + net5.0 + Antares.Service.History.PostgresRepositories + Antares.Service.History.PostgresRepositories 1.0.0 @@ -13,6 +13,6 @@ - + diff --git a/src/Lykke.Service.History.PostgresRepositories/ConnectionFactory.cs b/src/Antares.Service.History.PostgresRepositories/ConnectionFactory.cs similarity index 91% rename from src/Lykke.Service.History.PostgresRepositories/ConnectionFactory.cs rename to src/Antares.Service.History.PostgresRepositories/ConnectionFactory.cs index 25e0fbd..7aa8526 100644 --- a/src/Lykke.Service.History.PostgresRepositories/ConnectionFactory.cs +++ b/src/Antares.Service.History.PostgresRepositories/ConnectionFactory.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Npgsql; -namespace Lykke.Service.History.PostgresRepositories +namespace Antares.Service.History.PostgresRepositories { public class ConnectionFactory { diff --git a/src/Lykke.Service.History.PostgresRepositories/Constants.cs b/src/Antares.Service.History.PostgresRepositories/Constants.cs similarity index 83% rename from src/Lykke.Service.History.PostgresRepositories/Constants.cs rename to src/Antares.Service.History.PostgresRepositories/Constants.cs index 0f9effc..c45c122 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Constants.cs +++ b/src/Antares.Service.History.PostgresRepositories/Constants.cs @@ -1,4 +1,4 @@ -namespace Lykke.Service.History.PostgresRepositories +namespace Antares.Service.History.PostgresRepositories { internal class Constants { diff --git a/src/Lykke.Service.History.PostgresRepositories/DataContext.cs b/src/Antares.Service.History.PostgresRepositories/DataContext.cs similarity index 80% rename from src/Lykke.Service.History.PostgresRepositories/DataContext.cs rename to src/Antares.Service.History.PostgresRepositories/DataContext.cs index 6d8ef80..5d1f08d 100644 --- a/src/Lykke.Service.History.PostgresRepositories/DataContext.cs +++ b/src/Antares.Service.History.PostgresRepositories/DataContext.cs @@ -1,9 +1,9 @@ -using Lykke.Service.History.PostgresRepositories.Entities; -using Lykke.Service.History.PostgresRepositories.JsonbQuery; +using Antares.Service.History.PostgresRepositories.Entities; +using Antares.Service.History.PostgresRepositories.JsonbQuery; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators; -namespace Lykke.Service.History.PostgresRepositories +namespace Antares.Service.History.PostgresRepositories { public class DataContext : DbContext { diff --git a/src/Lykke.Service.History.PostgresRepositories/Entities/HistoryEntity.cs b/src/Antares.Service.History.PostgresRepositories/Entities/HistoryEntity.cs similarity index 91% rename from src/Lykke.Service.History.PostgresRepositories/Entities/HistoryEntity.cs rename to src/Antares.Service.History.PostgresRepositories/Entities/HistoryEntity.cs index e4e5dce..f71a7bc 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Entities/HistoryEntity.cs +++ b/src/Antares.Service.History.PostgresRepositories/Entities/HistoryEntity.cs @@ -1,10 +1,10 @@ using System; using System.ComponentModel.DataAnnotations.Schema; +using Antares.Service.History.Core.Domain.Enums; using Common; -using Lykke.Service.History.Core.Domain.Enums; using Newtonsoft.Json; -namespace Lykke.Service.History.PostgresRepositories.Entities +namespace Antares.Service.History.PostgresRepositories.Entities { [Table(Constants.HistoryTableName)] internal class HistoryEntity diff --git a/src/Lykke.Service.History.PostgresRepositories/Entities/HistoryEntityContext.cs b/src/Antares.Service.History.PostgresRepositories/Entities/HistoryEntityContext.cs similarity index 93% rename from src/Lykke.Service.History.PostgresRepositories/Entities/HistoryEntityContext.cs rename to src/Antares.Service.History.PostgresRepositories/Entities/HistoryEntityContext.cs index 7dc8396..260508e 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Entities/HistoryEntityContext.cs +++ b/src/Antares.Service.History.PostgresRepositories/Entities/HistoryEntityContext.cs @@ -1,6 +1,6 @@ -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.PostgresRepositories.Entities +namespace Antares.Service.History.PostgresRepositories.Entities { internal class HistoryEntityContext { diff --git a/src/Lykke.Service.History.PostgresRepositories/Entities/OrderEntity.cs b/src/Antares.Service.History.PostgresRepositories/Entities/OrderEntity.cs similarity index 94% rename from src/Lykke.Service.History.PostgresRepositories/Entities/OrderEntity.cs rename to src/Antares.Service.History.PostgresRepositories/Entities/OrderEntity.cs index aa487c2..70612fd 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Entities/OrderEntity.cs +++ b/src/Antares.Service.History.PostgresRepositories/Entities/OrderEntity.cs @@ -1,8 +1,8 @@ using System; using System.ComponentModel.DataAnnotations.Schema; -using Lykke.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Enums; -namespace Lykke.Service.History.PostgresRepositories.Entities +namespace Antares.Service.History.PostgresRepositories.Entities { [Table(Constants.OrdersTableName)] internal class OrderEntity diff --git a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/CustomSqlMethodCallTranslator.cs b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/CustomSqlMethodCallTranslator.cs similarity index 90% rename from src/Lykke.Service.History.PostgresRepositories/JsonbQuery/CustomSqlMethodCallTranslator.cs rename to src/Antares.Service.History.PostgresRepositories/JsonbQuery/CustomSqlMethodCallTranslator.cs index eeceff6..6beec78 100644 --- a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/CustomSqlMethodCallTranslator.cs +++ b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/CustomSqlMethodCallTranslator.cs @@ -2,7 +2,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal; using Npgsql.EntityFrameworkCore.PostgreSQL.Query.ExpressionTranslators.Internal; -namespace Lykke.Service.History.PostgresRepositories.JsonbQuery +namespace Antares.Service.History.PostgresRepositories.JsonbQuery { internal class CustomSqlMethodCallTranslator : NpgsqlCompositeMethodCallTranslator { diff --git a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/JsonbExtensions.cs b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/JsonbExtensions.cs similarity index 80% rename from src/Lykke.Service.History.PostgresRepositories/JsonbQuery/JsonbExtensions.cs rename to src/Antares.Service.History.PostgresRepositories/JsonbQuery/JsonbExtensions.cs index c9c7fbc..9cf6cad 100644 --- a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/JsonbExtensions.cs +++ b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/JsonbExtensions.cs @@ -1,6 +1,6 @@ using System; -namespace Lykke.Service.History.PostgresRepositories.JsonbQuery +namespace Antares.Service.History.PostgresRepositories.JsonbQuery { internal static class JsonbExtensions { diff --git a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/JsonbFindTranslator.cs b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/JsonbFindTranslator.cs similarity index 94% rename from src/Lykke.Service.History.PostgresRepositories/JsonbQuery/JsonbFindTranslator.cs rename to src/Antares.Service.History.PostgresRepositories/JsonbQuery/JsonbFindTranslator.cs index 2aa98fb..922a6f5 100644 --- a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/JsonbFindTranslator.cs +++ b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/JsonbFindTranslator.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Query.Expressions; using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators; -namespace Lykke.Service.History.PostgresRepositories.JsonbQuery +namespace Antares.Service.History.PostgresRepositories.JsonbQuery { internal class JsonbFindTranslator : IMethodCallTranslator { diff --git a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/NpgsqlFragmentExpression.cs b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/NpgsqlFragmentExpression.cs similarity index 93% rename from src/Lykke.Service.History.PostgresRepositories/JsonbQuery/NpgsqlFragmentExpression.cs rename to src/Antares.Service.History.PostgresRepositories/JsonbQuery/NpgsqlFragmentExpression.cs index 6fe229e..6bffbf2 100644 --- a/src/Lykke.Service.History.PostgresRepositories/JsonbQuery/NpgsqlFragmentExpression.cs +++ b/src/Antares.Service.History.PostgresRepositories/JsonbQuery/NpgsqlFragmentExpression.cs @@ -2,7 +2,7 @@ using JetBrains.Annotations; using Microsoft.EntityFrameworkCore.Query.Expressions; -namespace Lykke.Service.History.PostgresRepositories.JsonbQuery +namespace Antares.Service.History.PostgresRepositories.JsonbQuery { internal class NpgsqlFragmentExpression : SqlFragmentExpression { diff --git a/src/Lykke.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs b/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs similarity index 84% rename from src/Lykke.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs rename to src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs index 11bbafa..b206f36 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs +++ b/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs @@ -1,7 +1,7 @@ -using Lykke.Service.History.PostgresRepositories.Entities; +using Antares.Service.History.PostgresRepositories.Entities; using PostgreSQLCopyHelper; -namespace Lykke.Service.History.PostgresRepositories.Mappings +namespace Antares.Service.History.PostgresRepositories.Mappings { internal class HistoryEntityBulkMapping { diff --git a/src/Lykke.Service.History.PostgresRepositories/Mappings/HistoryTypeMapper.cs b/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryTypeMapper.cs similarity index 86% rename from src/Lykke.Service.History.PostgresRepositories/Mappings/HistoryTypeMapper.cs rename to src/Antares.Service.History.PostgresRepositories/Mappings/HistoryTypeMapper.cs index 45aa032..58734a3 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Mappings/HistoryTypeMapper.cs +++ b/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryTypeMapper.cs @@ -1,10 +1,10 @@ using System; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.PostgresRepositories.Entities; using AutoMapper; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.PostgresRepositories.Entities; -namespace Lykke.Service.History.PostgresRepositories.Mappings +namespace Antares.Service.History.PostgresRepositories.Mappings { internal class HistoryTypeMapper { diff --git a/src/Lykke.Service.History.PostgresRepositories/Mappings/OrderEntityBulkMapping.cs b/src/Antares.Service.History.PostgresRepositories/Mappings/OrderEntityBulkMapping.cs similarity index 92% rename from src/Lykke.Service.History.PostgresRepositories/Mappings/OrderEntityBulkMapping.cs rename to src/Antares.Service.History.PostgresRepositories/Mappings/OrderEntityBulkMapping.cs index 12067cf..114489c 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Mappings/OrderEntityBulkMapping.cs +++ b/src/Antares.Service.History.PostgresRepositories/Mappings/OrderEntityBulkMapping.cs @@ -1,8 +1,8 @@ -using Lykke.Service.History.PostgresRepositories.Entities; +using Antares.Service.History.PostgresRepositories.Entities; using NpgsqlTypes; using PostgreSQLCopyHelper; -namespace Lykke.Service.History.PostgresRepositories.Mappings +namespace Antares.Service.History.PostgresRepositories.Mappings { internal class OrderEntityBulkMapping { diff --git a/src/Lykke.Service.History.PostgresRepositories/Mappings/RepositoryProfile.cs b/src/Antares.Service.History.PostgresRepositories/Mappings/RepositoryProfile.cs similarity index 93% rename from src/Lykke.Service.History.PostgresRepositories/Mappings/RepositoryProfile.cs rename to src/Antares.Service.History.PostgresRepositories/Mappings/RepositoryProfile.cs index a9098bf..854ad81 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Mappings/RepositoryProfile.cs +++ b/src/Antares.Service.History.PostgresRepositories/Mappings/RepositoryProfile.cs @@ -1,10 +1,10 @@ -using AutoMapper; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; -using Lykke.Service.History.PostgresRepositories.Entities; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.PostgresRepositories.Entities; +using AutoMapper; -namespace Lykke.Service.History.PostgresRepositories.Mappings +namespace Antares.Service.History.PostgresRepositories.Mappings { public class RepositoryProfile : Profile { diff --git a/src/Lykke.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs b/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs similarity index 95% rename from src/Lykke.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs rename to src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs index 18c2fcb..69ed46b 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs +++ b/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs @@ -3,18 +3,18 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.PostgresRepositories.Entities; +using Antares.Service.History.PostgresRepositories.JsonbQuery; +using Antares.Service.History.PostgresRepositories.Mappings; using AutoMapper; using Dapper; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.PostgresRepositories.Entities; -using Lykke.Service.History.PostgresRepositories.JsonbQuery; -using Lykke.Service.History.PostgresRepositories.Mappings; using Microsoft.EntityFrameworkCore; using Npgsql; using PostgreSQLCopyHelper; -namespace Lykke.Service.History.PostgresRepositories.Repositories +namespace Antares.Service.History.PostgresRepositories.Repositories { public class HistoryRecordsRepository : IHistoryRecordsRepository { diff --git a/src/Lykke.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs b/src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs similarity index 94% rename from src/Lykke.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs rename to src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs index e4f7494..2237004 100644 --- a/src/Lykke.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs +++ b/src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs @@ -3,18 +3,18 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.PostgresRepositories.Entities; +using Antares.Service.History.PostgresRepositories.JsonbQuery; +using Antares.Service.History.PostgresRepositories.Mappings; using AutoMapper; using Dapper; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; -using Lykke.Service.History.PostgresRepositories.Entities; -using Lykke.Service.History.PostgresRepositories.JsonbQuery; -using Lykke.Service.History.PostgresRepositories.Mappings; using Microsoft.EntityFrameworkCore; using PostgreSQLCopyHelper; -namespace Lykke.Service.History.PostgresRepositories.Repositories +namespace Antares.Service.History.PostgresRepositories.Repositories { public class OrdersRepository : IOrdersRepository { diff --git a/src/Lykke.Service.History.Services/Lykke.Service.History.Services.csproj b/src/Antares.Service.History.Services/Antares.Service.History.Services.csproj similarity index 60% rename from src/Lykke.Service.History.Services/Lykke.Service.History.Services.csproj rename to src/Antares.Service.History.Services/Antares.Service.History.Services.csproj index 23f9ec6..aaac335 100644 --- a/src/Lykke.Service.History.Services/Lykke.Service.History.Services.csproj +++ b/src/Antares.Service.History.Services/Antares.Service.History.Services.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 - Lykke.Service.History.Services + net5.0 + Antares.Service.History.Services Lykke.Service.History.Services 1.0.0 diff --git a/src/Lykke.Service.History/Lykke.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj similarity index 78% rename from src/Lykke.Service.History/Lykke.Service.History.csproj rename to src/Antares.Service.History/Antares.Service.History.csproj index 7049abb..42fcc04 100644 --- a/src/Lykke.Service.History/Lykke.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -1,10 +1,10 @@  - netcoreapp2.2 + net5.0 Exe 1.0.1 - Lykke.Service.History - Lykke.Service.History + Antares.Service.History + Antares.Service.History bin\Release\netcoreapp2.0\Lykke.Service.History.xml @@ -22,6 +22,7 @@ + @@ -31,15 +32,14 @@ - - - - + + + diff --git a/src/Lykke.Service.History/AutoMapper/ServiceProfile.cs b/src/Antares.Service.History/AutoMapper/ServiceProfile.cs similarity index 81% rename from src/Lykke.Service.History/AutoMapper/ServiceProfile.cs rename to src/Antares.Service.History/AutoMapper/ServiceProfile.cs index 5decb63..3d8695d 100644 --- a/src/Lykke.Service.History/AutoMapper/ServiceProfile.cs +++ b/src/Antares.Service.History/AutoMapper/ServiceProfile.cs @@ -1,11 +1,11 @@ -using AutoMapper; -using Lykke.Service.History.Contracts.History; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; +using Antares.Service.History.Contracts.History; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using AutoMapper; using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; using TradeModel = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.TradeModel; -namespace Lykke.Service.History.AutoMapper +namespace Antares.Service.History.AutoMapper { public class ServiceProfile : Profile { diff --git a/src/Lykke.Service.History/Controllers/HistoryController.cs b/src/Antares.Service.History/Controllers/HistoryController.cs similarity index 92% rename from src/Lykke.Service.History/Controllers/HistoryController.cs rename to src/Antares.Service.History/Controllers/HistoryController.cs index 53aea76..5b6c6b8 100644 --- a/src/Lykke.Service.History/Controllers/HistoryController.cs +++ b/src/Antares.Service.History/Controllers/HistoryController.cs @@ -3,14 +3,14 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.History; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; using AutoMapper; -using Lykke.Service.History.Contracts.History; -using Lykke.Service.History.Core.Domain.History; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; -using HistoryType = Lykke.Service.History.Core.Domain.Enums.HistoryType; -namespace Lykke.Service.History.Controllers +namespace Antares.Service.History.Controllers { [Route("api/history")] [ApiController] diff --git a/src/Lykke.Service.History/Controllers/OrdersController.cs b/src/Antares.Service.History/Controllers/OrdersController.cs similarity index 95% rename from src/Lykke.Service.History/Controllers/OrdersController.cs rename to src/Antares.Service.History/Controllers/OrdersController.cs index 9a3c924..5565cdf 100644 --- a/src/Lykke.Service.History/Controllers/OrdersController.cs +++ b/src/Antares.Service.History/Controllers/OrdersController.cs @@ -3,14 +3,14 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Orders; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.History.Contracts.Orders; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.Orders; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; -namespace Lykke.Service.History.Controllers +namespace Antares.Service.History.Controllers { [Route("api/orders")] [ApiController] diff --git a/src/Lykke.Service.History/Controllers/TradesController.cs b/src/Antares.Service.History/Controllers/TradesController.cs similarity index 94% rename from src/Lykke.Service.History/Controllers/TradesController.cs rename to src/Antares.Service.History/Controllers/TradesController.cs index 006aba1..712e85f 100644 --- a/src/Lykke.Service.History/Controllers/TradesController.cs +++ b/src/Antares.Service.History/Controllers/TradesController.cs @@ -2,15 +2,15 @@ using System.Collections.Generic; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.History.Contracts.Enums; -using Lykke.Service.History.Contracts.History; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; +using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; -namespace Lykke.Service.History.Controllers +namespace Antares.Service.History.Controllers { [Route("api/trades")] [ApiController] diff --git a/src/Lykke.Service.History/Dockerfile b/src/Antares.Service.History/Dockerfile similarity index 54% rename from src/Lykke.Service.History/Dockerfile rename to src/Antares.Service.History/Dockerfile index a8efdd2..3314010 100644 --- a/src/Lykke.Service.History/Dockerfile +++ b/src/Antares.Service.History/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:2.2-aspnetcore-runtime +FROM FROM mcr.microsoft.com/dotnet/aspnet:5.0.1-buster-slim WORKDIR /app COPY . . ENTRYPOINT ["dotnet", "Lykke.Service.History.dll"] diff --git a/src/Lykke.Job.History/Modules/DbModule.cs b/src/Antares.Service.History/Modules/DbModule.cs similarity index 67% rename from src/Lykke.Job.History/Modules/DbModule.cs rename to src/Antares.Service.History/Modules/DbModule.cs index b6b26a7..580c579 100644 --- a/src/Lykke.Job.History/Modules/DbModule.cs +++ b/src/Antares.Service.History/Modules/DbModule.cs @@ -1,12 +1,12 @@ -using Autofac; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; -using Lykke.Service.History.Core.Settings; -using Lykke.Service.History.PostgresRepositories; -using Lykke.Service.History.PostgresRepositories.Repositories; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.Core.Settings; +using Antares.Service.History.PostgresRepositories; +using Antares.Service.History.PostgresRepositories.Repositories; +using Autofac; using Lykke.SettingsReader; -namespace Lykke.Job.History.Modules +namespace Antares.Service.History.Modules { public class DbModule : Module { diff --git a/src/Lykke.Job.History/Program.cs b/src/Antares.Service.History/Program.cs similarity index 84% rename from src/Lykke.Job.History/Program.cs rename to src/Antares.Service.History/Program.cs index 4710329..aca1884 100644 --- a/src/Lykke.Job.History/Program.cs +++ b/src/Antares.Service.History/Program.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; -using Lykke.Sdk; +using Antares.Sdk; -namespace Lykke.Job.History +namespace Antares.Service.History { internal sealed class Program { diff --git a/src/Lykke.Service.History/Properties/launchSettings.json b/src/Antares.Service.History/Properties/launchSettings.json similarity index 100% rename from src/Lykke.Service.History/Properties/launchSettings.json rename to src/Antares.Service.History/Properties/launchSettings.json diff --git a/src/Lykke.Service.History/Startup.cs b/src/Antares.Service.History/Startup.cs similarity index 93% rename from src/Lykke.Service.History/Startup.cs rename to src/Antares.Service.History/Startup.cs index 0852f75..85a905b 100644 --- a/src/Lykke.Service.History/Startup.cs +++ b/src/Antares.Service.History/Startup.cs @@ -1,14 +1,14 @@ using System; +using Antares.Sdk; +using Antares.Service.History.AutoMapper; +using Antares.Service.History.Core.Settings; +using Antares.Service.History.PostgresRepositories.Mappings; using AutoMapper; using JetBrains.Annotations; -using Lykke.Sdk; -using Lykke.Service.History.AutoMapper; -using Lykke.Service.History.Core.Settings; -using Lykke.Service.History.PostgresRepositories.Mappings; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; -namespace Lykke.Service.History +namespace Antares.Service.History { [UsedImplicitly] public class Startup diff --git a/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj b/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj new file mode 100644 index 0000000..1a164b5 --- /dev/null +++ b/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj @@ -0,0 +1,21 @@ + + + net5.0 + 1.0.0 + + + + + + + + + + + + + + + + + diff --git a/tests/Lykke.Service.History.Tests/CashinTests.cs b/tests/Antares.Service.History.Tests/CashinTests.cs similarity index 92% rename from tests/Lykke.Service.History.Tests/CashinTests.cs rename to tests/Antares.Service.History.Tests/CashinTests.cs index 53e6a70..b9306a5 100644 --- a/tests/Lykke.Service.History.Tests/CashinTests.cs +++ b/tests/Antares.Service.History.Tests/CashinTests.cs @@ -1,14 +1,14 @@ using System; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Tests.Init; using Autofac; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Tests.Init; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Xunit; -namespace Lykke.Service.History.Tests +namespace Antares.Service.History.Tests { [Collection("history-tests")] public class CashinTests diff --git a/tests/Lykke.Service.History.Tests/CashoutTests.cs b/tests/Antares.Service.History.Tests/CashoutTests.cs similarity index 92% rename from tests/Lykke.Service.History.Tests/CashoutTests.cs rename to tests/Antares.Service.History.Tests/CashoutTests.cs index ff8a421..2ec554e 100644 --- a/tests/Lykke.Service.History.Tests/CashoutTests.cs +++ b/tests/Antares.Service.History.Tests/CashoutTests.cs @@ -1,14 +1,14 @@ using System; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Tests.Init; using Autofac; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Tests.Init; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Xunit; -namespace Lykke.Service.History.Tests +namespace Antares.Service.History.Tests { [Collection("history-tests")] public class CashoutTests diff --git a/tests/Lykke.Service.History.Tests/ForwardWithdrawalTests.cs b/tests/Antares.Service.History.Tests/ForwardWithdrawalTests.cs similarity index 90% rename from tests/Lykke.Service.History.Tests/ForwardWithdrawalTests.cs rename to tests/Antares.Service.History.Tests/ForwardWithdrawalTests.cs index d23997a..292623b 100644 --- a/tests/Lykke.Service.History.Tests/ForwardWithdrawalTests.cs +++ b/tests/Antares.Service.History.Tests/ForwardWithdrawalTests.cs @@ -1,14 +1,14 @@ using System; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Cqrs; +using Antares.Service.History.Contracts.Cqrs.Commands; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Tests.Init; using Autofac; using Lykke.Cqrs; -using Lykke.Service.History.Contracts.Cqrs; -using Lykke.Service.History.Contracts.Cqrs.Commands; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Tests.Init; using Xunit; -namespace Lykke.Service.History.Tests +namespace Antares.Service.History.Tests { [Collection("history-tests")] public class ForwardWithdrawalTests diff --git a/tests/Lykke.Service.History.Tests/Init/InMemoryHistoryRepository.cs b/tests/Antares.Service.History.Tests/Init/InMemoryHistoryRepository.cs similarity index 96% rename from tests/Lykke.Service.History.Tests/Init/InMemoryHistoryRepository.cs rename to tests/Antares.Service.History.Tests/Init/InMemoryHistoryRepository.cs index bc47ed5..6d4cb22 100644 --- a/tests/Lykke.Service.History.Tests/Init/InMemoryHistoryRepository.cs +++ b/tests/Antares.Service.History.Tests/Init/InMemoryHistoryRepository.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; using AutoMapper; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -namespace Lykke.Service.History.Tests.Init +namespace Antares.Service.History.Tests.Init { public class InMemoryHistoryRepository : IHistoryRecordsRepository { diff --git a/tests/Lykke.Service.History.Tests/Init/InMemoryOrdersRepository.cs b/tests/Antares.Service.History.Tests/Init/InMemoryOrdersRepository.cs similarity index 93% rename from tests/Lykke.Service.History.Tests/Init/InMemoryOrdersRepository.cs rename to tests/Antares.Service.History.Tests/Init/InMemoryOrdersRepository.cs index 0d55a18..1486b55 100644 --- a/tests/Lykke.Service.History.Tests/Init/InMemoryOrdersRepository.cs +++ b/tests/Antares.Service.History.Tests/Init/InMemoryOrdersRepository.cs @@ -2,13 +2,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; using Common; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; using Newtonsoft.Json; -namespace Lykke.Service.History.Tests.Init +namespace Antares.Service.History.Tests.Init { public class InMemoryOrdersRepository : IOrdersRepository { diff --git a/tests/Lykke.Service.History.Tests/Init/TestInitialization.cs b/tests/Antares.Service.History.Tests/Init/TestInitialization.cs similarity index 89% rename from tests/Lykke.Service.History.Tests/Init/TestInitialization.cs rename to tests/Antares.Service.History.Tests/Init/TestInitialization.cs index d82762a..4c22e81 100644 --- a/tests/Lykke.Service.History.Tests/Init/TestInitialization.cs +++ b/tests/Antares.Service.History.Tests/Init/TestInitialization.cs @@ -1,31 +1,30 @@ using System; using System.Collections.Generic; +using Antares.Job.History.Workflow.Handlers; +using Antares.Job.History.Workflow.Projections; +using Antares.Service.History.Contracts.Cqrs; +using Antares.Service.History.Contracts.Cqrs.Commands; +using Antares.Service.History.Contracts.Cqrs.Events; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.Core.Settings; +using Antares.Service.History.Modules; +using Antares.Service.History.PostgresRepositories.Mappings; using Autofac; using AutoMapper; using Lykke.Common.Log; using Lykke.Cqrs; using Lykke.Cqrs.Configuration; -using Lykke.Job.History.Workflow.Handlers; -using Lykke.Job.History.Workflow.Projections; using Lykke.Logs; using Lykke.Logs.Loggers.LykkeConsole; using Lykke.Messaging; using Lykke.Messaging.Contract; -using Lykke.Service.History.AutoMapper; -using Lykke.Service.History.Contracts.Cqrs; -using Lykke.Service.History.Contracts.Cqrs.Commands; -using Lykke.Service.History.Contracts.Cqrs.Events; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; -using Lykke.Service.History.Core.Settings; -using Lykke.Service.History.Modules; -using Lykke.Service.History.PostgresRepositories.Mappings; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Lykke.SettingsReader.ReloadingManager; using Xunit; -namespace Lykke.Service.History.Tests.Init +namespace Antares.Service.History.Tests.Init { [CollectionDefinition("history-tests")] public class TestInitializationCollection : ICollectionFixture @@ -38,7 +37,7 @@ static TestInitialization() { Mapper.Initialize(cfg => { - cfg.AddProfiles(typeof(Lykke.Job.History.AutoMapper.ServiceProfile)); + cfg.AddProfiles(typeof(Antares.Job.History.AutoMapper.ServiceProfile)); cfg.AddProfiles(typeof(RepositoryProfile)); }); } diff --git a/tests/Lykke.Service.History.Tests/PostgresTests.cs b/tests/Antares.Service.History.Tests/PostgresTests.cs similarity index 95% rename from tests/Lykke.Service.History.Tests/PostgresTests.cs rename to tests/Antares.Service.History.Tests/PostgresTests.cs index 5e45e84..8d668bb 100644 --- a/tests/Lykke.Service.History.Tests/PostgresTests.cs +++ b/tests/Antares.Service.History.Tests/PostgresTests.cs @@ -2,15 +2,15 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.Tests.Init; using Autofac; -using Lykke.Service.History.Core.Domain.Enums; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Core.Domain.Orders; -using Lykke.Service.History.Tests.Init; using MoreLinq; using Xunit; -namespace Lykke.Service.History.Tests +namespace Antares.Service.History.Tests { [Collection("history-tests")] public class PostgresTests @@ -23,7 +23,7 @@ public PostgresTests(TestInitialization initialization) private readonly IContainer _container; - private async Task<(Guid, List)> GenerateData(string[] pairs, string[] assets) + private async Task<(Guid, List)> GenerateData(string[] pairs, string[] assets) { var walletId = Guid.NewGuid(); var random = new Random(); diff --git a/tests/Lykke.Service.History.Tests/TransferTests.cs b/tests/Antares.Service.History.Tests/TransferTests.cs similarity index 94% rename from tests/Lykke.Service.History.Tests/TransferTests.cs rename to tests/Antares.Service.History.Tests/TransferTests.cs index 54cae22..164491e 100644 --- a/tests/Lykke.Service.History.Tests/TransferTests.cs +++ b/tests/Antares.Service.History.Tests/TransferTests.cs @@ -1,14 +1,14 @@ using System; using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Tests.Init; using Autofac; using Lykke.Cqrs; -using Lykke.Service.History.Core.Domain.History; -using Lykke.Service.History.Tests.Init; using Lykke.Service.PostProcessing.Contracts.Cqrs; using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Xunit; -namespace Lykke.Service.History.Tests +namespace Antares.Service.History.Tests { [Collection("history-tests")] public class TransferTests diff --git a/tests/Lykke.Service.History.Tests/UtilsTests.cs b/tests/Antares.Service.History.Tests/UtilsTests.cs similarity index 90% rename from tests/Lykke.Service.History.Tests/UtilsTests.cs rename to tests/Antares.Service.History.Tests/UtilsTests.cs index d53c9f5..8262067 100644 --- a/tests/Lykke.Service.History.Tests/UtilsTests.cs +++ b/tests/Antares.Service.History.Tests/UtilsTests.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using Lykke.Service.History.Core; +using Antares.Service.History.Core; using Xunit; -namespace Lykke.Service.History.Tests +namespace Antares.Service.History.Tests { public class UtilsTests { diff --git a/tests/Lykke.Service.History.Tests/Lykke.Service.History.Tests.csproj b/tests/Lykke.Service.History.Tests/Lykke.Service.History.Tests.csproj deleted file mode 100644 index d33bc41..0000000 --- a/tests/Lykke.Service.History.Tests/Lykke.Service.History.Tests.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - netcoreapp2.2 - 1.0.0 - - - - - - - - - - - - - - - - - From 1f0bff3af9b821a81213d1b952f0b422955f4817 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Mon, 11 Jan 2021 17:22:37 +0400 Subject: [PATCH 04/60] Added workflows --- .github/workflows/release-api-client.yml | 25 ++++++++++++ .github/workflows/release-service.yml | 51 ++++++++++++++++++++++++ .github/workflows/validate-master.yml | 22 ++++++++++ README.md | 10 ++--- 4 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release-api-client.yml create mode 100644 .github/workflows/release-service.yml create mode 100644 .github/workflows/validate-master.yml diff --git a/.github/workflows/release-api-client.yml b/.github/workflows/release-api-client.yml new file mode 100644 index 0000000..13c08b5 --- /dev/null +++ b/.github/workflows/release-api-client.yml @@ -0,0 +1,25 @@ +name: Release API client nuget + +on: + push: + tags: "api-client-*" + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.100 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release + - name: Create the package + run: dotnet pack --configuration Release src/Api.ApiClient /p:Version=${GITHUB_REF#refs/tags/api-client-} + - name: Publish the package to GPR + run: dotnet nuget push src/Api.ApiClient/bin/Release/*.nupkg -s "https://api.nuget.org/v3/index.json" -k ${{ secrets.NUGET_TOCKEN }} diff --git a/.github/workflows/release-service.yml b/.github/workflows/release-service.yml new file mode 100644 index 0000000..c7a2bec --- /dev/null +++ b/.github/workflows/release-service.yml @@ -0,0 +1,51 @@ +name: Release Service + +on: + push: + tags: "service-*" + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.101 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release + - name: Publish API + run: dotnet publish ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} + - name: Publish worker + run: dotnet publish ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} + - name: Check Webhooks dir + run: ls ./publish-webhooks + - name: Check API dir + run: ls ./publish-api + - name: Check worker dir + run: ls ./publish-worker + - name: Publish API to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-api + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-api + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + tag_name_skip: service- + - name: Publish worker to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-job + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-worker + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + tag_name_skip: service- \ No newline at end of file diff --git a/.github/workflows/validate-master.yml b/.github/workflows/validate-master.yml new file mode 100644 index 0000000..a520c40 --- /dev/null +++ b/.github/workflows/validate-master.yml @@ -0,0 +1,22 @@ +name: Validate master + +on: + push: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.101 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release \ No newline at end of file diff --git a/README.md b/README.md index 3e331b3..03dc6c6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Lykke.Service.History +# Antares.Service.History # Purpose @@ -6,13 +6,13 @@ # Contracts -Input (v1, Lykke.Service.PostProcessing events; RabbitMQ, protobuf): +Input (v1, Antares.Service.PostProcessing events; RabbitMQ, protobuf): - CashInProcessedEvent, CashOutProcessedEvent, CashTransferProcessedEvent, ExecutionProcessedEvent, OrderPlacedEvent, OrderCancelledEvent. -Input (v2, Lykke.Service.BlockchainCashinDetector; RabbitMQ, messagepack): +Input (v2, Antares.Service.BlockchainCashinDetector; RabbitMQ, messagepack): - CashinCompletedEvent. -Input (v3, Lykke.Service.BlockchainCashoutProcessor; RabbitMQ, messagepack): +Input (v3, Antares.Service.BlockchainCashoutProcessor; RabbitMQ, messagepack): - CashoutCompletedEvent. Input (v4, bitcoinservice; RabbitMQ, messagepack): @@ -47,4 +47,4 @@ Output (HTTP): - RabbitMQ (Cqrs); # Service owners -Core team +Swisschain team From 266507677cd5b8fcf08b90037b0db80079c41be3 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 13:18:01 +0400 Subject: [PATCH 05/60] intermediate commit --- .gitignore | 1 + Antares.Service.History.sln | 6 ++++++ .../Antares.Job.History.csproj | 2 +- src/Antares.Job.History/Startup.cs | 21 +++++++++++++++++-- .../Antares.Service.History.Core.csproj | 2 +- .../Antares.Service.History.csproj | 2 +- .../Controllers/HistoryController.cs | 2 +- .../Controllers/OrdersController.cs | 2 +- src/Antares.Service.History/Startup.cs | 20 ++++++++++++++++-- 9 files changed, 49 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a70883a..df2b36c 100644 --- a/.gitignore +++ b/.gitignore @@ -337,3 +337,4 @@ ASALocalRun/ appsettings.*.json /client/**/*.xml +launchSettings.json \ No newline at end of file diff --git a/Antares.Service.History.sln b/Antares.Service.History.sln index a29b1fc..5e7af8a 100644 --- a/Antares.Service.History.sln +++ b/Antares.Service.History.sln @@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Cli EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Contracts", "client\Antares.Service.History.Contracts\Antares.Service.History.Contracts.csproj", "{E4199193-31F4-401B-8464-96783A6195D2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Sdk", "..\Lykke.Sdk\src\Antares.Sdk\Antares.Sdk.csproj", "{E20A35C0-C442-48C7-A64A-2A046E2C6F45}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -72,6 +74,10 @@ Global {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.Build.0 = Release|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index 2d31df4..4d679a0 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -23,7 +23,6 @@ - @@ -41,6 +40,7 @@ + diff --git a/src/Antares.Job.History/Startup.cs b/src/Antares.Job.History/Startup.cs index 836519b..272ba2f 100644 --- a/src/Antares.Job.History/Startup.cs +++ b/src/Antares.Job.History/Startup.cs @@ -3,9 +3,12 @@ using Antares.Sdk; using Antares.Service.History.Core.Settings; using Antares.Service.History.PostgresRepositories.Mappings; +using Autofac; using AutoMapper; using JetBrains.Annotations; +using Lykke.SettingsReader; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Antares.Job.History @@ -19,8 +22,11 @@ public class Startup ApiVersion = "v1" }; + private IReloadingManagerWithConfiguration _settings; + private LykkeServiceOptions _lykkeOptions; + [UsedImplicitly] - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { Mapper.Initialize(cfg => { @@ -28,7 +34,8 @@ public IServiceProvider ConfigureServices(IServiceCollection services) cfg.AddProfiles(typeof(RepositoryProfile)); }); - return services.BuildServiceProvider(options => + //DependencyResolver + (_lykkeOptions, _settings) = services.ConfigureServices(options => { options.SwaggerOptions = _swaggerOptions; @@ -71,6 +78,16 @@ public IServiceProvider ConfigureServices(IServiceCollection services) }); } + [UsedImplicitly] + public void ConfigureContainer(ContainerBuilder builder) + { + var configurationRoot = new ConfigurationBuilder() + .AddEnvironmentVariables() + .Build(); + + builder.ConfigureContainerBuilder(_lykkeOptions, configurationRoot, _settings); + } + [UsedImplicitly] public void Configure(IApplicationBuilder app) { diff --git a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj index a5efe62..4f0992c 100644 --- a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj +++ b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj @@ -6,7 +6,7 @@ 1.0.0 - + diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index 42fcc04..4cb1760 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -22,7 +22,6 @@ - @@ -37,6 +36,7 @@ + diff --git a/src/Antares.Service.History/Controllers/HistoryController.cs b/src/Antares.Service.History/Controllers/HistoryController.cs index 5b6c6b8..acd8311 100644 --- a/src/Antares.Service.History/Controllers/HistoryController.cs +++ b/src/Antares.Service.History/Controllers/HistoryController.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; using Antares.Service.History.Contracts.History; -using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.History; using AutoMapper; using Microsoft.AspNetCore.Mvc; diff --git a/src/Antares.Service.History/Controllers/OrdersController.cs b/src/Antares.Service.History/Controllers/OrdersController.cs index 5565cdf..59eca9f 100644 --- a/src/Antares.Service.History/Controllers/OrdersController.cs +++ b/src/Antares.Service.History/Controllers/OrdersController.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; using Antares.Service.History.Contracts.Orders; -using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; using Microsoft.AspNetCore.Mvc; diff --git a/src/Antares.Service.History/Startup.cs b/src/Antares.Service.History/Startup.cs index 85a905b..d5de968 100644 --- a/src/Antares.Service.History/Startup.cs +++ b/src/Antares.Service.History/Startup.cs @@ -3,9 +3,12 @@ using Antares.Service.History.AutoMapper; using Antares.Service.History.Core.Settings; using Antares.Service.History.PostgresRepositories.Mappings; +using Autofac; using AutoMapper; using JetBrains.Annotations; +using Lykke.SettingsReader; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Antares.Service.History @@ -19,8 +22,21 @@ public class Startup ApiVersion = "v1" }; + private LykkeServiceOptions _lykkeOptions; + private IReloadingManagerWithConfiguration _settings; + + [UsedImplicitly] + public void ConfigureContainer(ContainerBuilder builder) + { + var configurationRoot = new ConfigurationBuilder() + .AddEnvironmentVariables() + .Build(); + + builder.ConfigureContainerBuilder(_lykkeOptions, configurationRoot, _settings); + } + [UsedImplicitly] - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { Mapper.Initialize(cfg => { @@ -28,7 +44,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services) cfg.AddProfiles(typeof(RepositoryProfile)); }); - return services.BuildServiceProvider(options => + (_lykkeOptions, _settings) = services.ConfigureServices(options => { options.SwaggerOptions = _swaggerOptions; From a5309c52514deaa52bf31ce7e368694fd38ce95e Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 14:23:14 +0400 Subject: [PATCH 06/60] fixed mapping --- .../Properties/launchSettings.json | 3 +- .../Controllers/HistoryController.cs | 17 +++++++++- .../Controllers/OrdersController.cs | 33 ++++++++++++++++--- .../Properties/launchSettings.json | 3 +- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/Antares.Job.History/Properties/launchSettings.json b/src/Antares.Job.History/Properties/launchSettings.json index d44eaac..2c37808 100644 --- a/src/Antares.Job.History/Properties/launchSettings.json +++ b/src/Antares.Job.History/Properties/launchSettings.json @@ -4,8 +4,7 @@ "commandName": "Project", "environmentVariables": { "ENV_INFO": "home", - "SettingsUrl": - "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/c6462006-d3b2-44d9-9b47-0989b05700ea/Lykke.Service.History", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/79ab4c5c-fae6-480a-8742-d9b233addfd2/Lykke.Service.History", "ASPNETCORE_ENVIRONMENT": "Development" } }, diff --git a/src/Antares.Service.History/Controllers/HistoryController.cs b/src/Antares.Service.History/Controllers/HistoryController.cs index acd8311..715ee45 100644 --- a/src/Antares.Service.History/Controllers/HistoryController.cs +++ b/src/Antares.Service.History/Controllers/HistoryController.cs @@ -51,7 +51,22 @@ public async Task> GetHistory( if (type.Length == 0) type = Enum.GetValues(typeof(HistoryType)).Cast().ToArray(); - var data = await _historyRecordsRepository.GetByWalletAsync(walletId, type, offset, limit, assetPairId, assetId, from, to); + var mappedType = type.Select(x => x switch + { + HistoryType.CashIn => Antares.Service.History.Core.Domain.Enums.HistoryType.CashIn, + HistoryType.CashOut => Antares.Service.History.Core.Domain.Enums.HistoryType.CashOut, + HistoryType.Trade => Antares.Service.History.Core.Domain.Enums.HistoryType.Trade, + HistoryType.OrderEvent => Antares.Service.History.Core.Domain.Enums.HistoryType.OrderEvent, + + _ => throw new ArgumentOutOfRangeException(nameof(x), x, null) + }).ToArray(); + var data = await _historyRecordsRepository.GetByWalletAsync(walletId, mappedType, + offset, + limit, + assetPairId, + assetId, + from, + to); return Mapper.Map>(data); } diff --git a/src/Antares.Service.History/Controllers/OrdersController.cs b/src/Antares.Service.History/Controllers/OrdersController.cs index 59eca9f..750b909 100644 --- a/src/Antares.Service.History/Controllers/OrdersController.cs +++ b/src/Antares.Service.History/Controllers/OrdersController.cs @@ -63,10 +63,32 @@ public async Task> GetOrders( if (type.Length == 0) type = Enum.GetValues(typeof(OrderType)).Cast().ToArray(); + var mappedType = type.Select(x => x switch + { + OrderType.Unknown => Antares.Service.History.Core.Domain.Enums.OrderType.Unknown, + OrderType.Market => Antares.Service.History.Core.Domain.Enums.OrderType.Market, + OrderType.Limit => Antares.Service.History.Core.Domain.Enums.OrderType.Limit, + OrderType.StopLimit => Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit, + _ => throw new ArgumentOutOfRangeException(nameof(x), x, null) + }).ToArray(); + + var mappedStatus = status.Select(x => x switch + { + OrderStatus.Unknown => Antares.Service.History.Core.Domain.Enums.OrderStatus.Unknown, + OrderStatus.Placed => Antares.Service.History.Core.Domain.Enums.OrderStatus.Placed, + OrderStatus.PartiallyMatched => Antares.Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched, + OrderStatus.Matched => Antares.Service.History.Core.Domain.Enums.OrderStatus.Matched, + OrderStatus.Pending => Antares.Service.History.Core.Domain.Enums.OrderStatus.Pending, + OrderStatus.Cancelled => Antares.Service.History.Core.Domain.Enums.OrderStatus.Cancelled, + OrderStatus.Replaced => Antares.Service.History.Core.Domain.Enums.OrderStatus.Replaced, + OrderStatus.Rejected => Antares.Service.History.Core.Domain.Enums.OrderStatus.Rejected, + _ => throw new ArgumentOutOfRangeException(nameof(x), x, null) + }).ToArray(); + var data = await _ordersRepository.GetOrdersAsync( walletId, - type, - status, + mappedType, + mappedStatus, assetPairId, offset, limit); @@ -122,8 +144,11 @@ public async Task> GetActiveOrders( { var data = await _ordersRepository.GetOrdersAsync( walletId, - new[] { OrderType.Limit, OrderType.StopLimit }, - new[] { OrderStatus.Placed, OrderStatus.PartiallyMatched, OrderStatus.Pending }, + new[] { Antares.Service.History.Core.Domain.Enums.OrderType.Limit, + Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit }, + new[] { Antares.Service.History.Core.Domain.Enums.OrderStatus.Placed, + Antares.Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched, + Antares.Service.History.Core.Domain.Enums.OrderStatus.Pending }, assetPairId, offset, limit); diff --git a/src/Antares.Service.History/Properties/launchSettings.json b/src/Antares.Service.History/Properties/launchSettings.json index d44eaac..2c37808 100644 --- a/src/Antares.Service.History/Properties/launchSettings.json +++ b/src/Antares.Service.History/Properties/launchSettings.json @@ -4,8 +4,7 @@ "commandName": "Project", "environmentVariables": { "ENV_INFO": "home", - "SettingsUrl": - "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/c6462006-d3b2-44d9-9b47-0989b05700ea/Lykke.Service.History", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/79ab4c5c-fae6-480a-8742-d9b233addfd2/Lykke.Service.History", "ASPNETCORE_ENVIRONMENT": "Development" } }, From 80d43d275a44d446f0a838b86db92b393b58c38b Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 16:56:58 +0400 Subject: [PATCH 07/60] COMPLETED MIGRATION TO ANTARES.SDK and .NET 5.0 --- Antares.Service.History.sln | 6 ------ src/Antares.Job.History/Antares.Job.History.csproj | 2 +- .../Antares.Service.History.Core.csproj | 2 +- src/Antares.Service.History/Antares.Service.History.csproj | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Antares.Service.History.sln b/Antares.Service.History.sln index 5e7af8a..a29b1fc 100644 --- a/Antares.Service.History.sln +++ b/Antares.Service.History.sln @@ -34,8 +34,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Cli EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Contracts", "client\Antares.Service.History.Contracts\Antares.Service.History.Contracts.csproj", "{E4199193-31F4-401B-8464-96783A6195D2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Sdk", "..\Lykke.Sdk\src\Antares.Sdk\Antares.Sdk.csproj", "{E20A35C0-C442-48C7-A64A-2A046E2C6F45}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -74,10 +72,6 @@ Global {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.Build.0 = Release|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index 4d679a0..bfb9ff6 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -23,6 +23,7 @@ + @@ -40,7 +41,6 @@ - diff --git a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj index 4f0992c..fb0ecd7 100644 --- a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj +++ b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj @@ -6,7 +6,7 @@ 1.0.0 - + diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index 4cb1760..c143b3a 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -22,6 +22,7 @@ + @@ -36,7 +37,6 @@ - From 4b1b8e5babce00dc725a24ffbf9045811c0bbd0d Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 19:34:20 +0400 Subject: [PATCH 08/60] added ci --- .github/workflows/ci-dev.yml | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ci-dev.yml diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml new file mode 100644 index 0000000..93359fa --- /dev/null +++ b/.github/workflows/ci-dev.yml @@ -0,0 +1,62 @@ +name: CI dev build + +on: + push: + branches: + - dev-* + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.101 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release + - name: Publish API + run: dotnet publish ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release + - name: Publish worker + run: dotnet publish ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release + - name: Check Webhooks dir + run: ls ./publish-webhooks + - name: Check API dir + run: ls ./publish-api + - name: Check worker dir + run: ls ./publish-worker + - name: Publish API to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-api:dev + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-api + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + - name: Publish worker to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-job:dev + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-worker + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + - name: Restart service + uses: swisschain/kube-restart-pods@master + env: + KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} + NAMESPACE: lykke-service + POD: history + - name: Restart service + uses: swisschain/kube-restart-pods@master + env: + KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} + NAMESPACE: lykke-job + POD: history-job \ No newline at end of file From f1713a1d96f86bc4e6351f1867d1f174602ef64e Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 13:18:01 +0400 Subject: [PATCH 09/60] intermediate commit --- .gitignore | 1 + Antares.Service.History.sln | 6 ++++++ .../Antares.Job.History.csproj | 2 +- src/Antares.Job.History/Startup.cs | 21 +++++++++++++++++-- .../Antares.Service.History.Core.csproj | 2 +- .../Antares.Service.History.csproj | 2 +- .../Controllers/HistoryController.cs | 2 +- .../Controllers/OrdersController.cs | 2 +- src/Antares.Service.History/Startup.cs | 20 ++++++++++++++++-- 9 files changed, 49 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a70883a..df2b36c 100644 --- a/.gitignore +++ b/.gitignore @@ -337,3 +337,4 @@ ASALocalRun/ appsettings.*.json /client/**/*.xml +launchSettings.json \ No newline at end of file diff --git a/Antares.Service.History.sln b/Antares.Service.History.sln index a29b1fc..5e7af8a 100644 --- a/Antares.Service.History.sln +++ b/Antares.Service.History.sln @@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Cli EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Contracts", "client\Antares.Service.History.Contracts\Antares.Service.History.Contracts.csproj", "{E4199193-31F4-401B-8464-96783A6195D2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Sdk", "..\Lykke.Sdk\src\Antares.Sdk\Antares.Sdk.csproj", "{E20A35C0-C442-48C7-A64A-2A046E2C6F45}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -72,6 +74,10 @@ Global {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.Build.0 = Release|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index 2d31df4..4d679a0 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -23,7 +23,6 @@ - @@ -41,6 +40,7 @@ + diff --git a/src/Antares.Job.History/Startup.cs b/src/Antares.Job.History/Startup.cs index 836519b..272ba2f 100644 --- a/src/Antares.Job.History/Startup.cs +++ b/src/Antares.Job.History/Startup.cs @@ -3,9 +3,12 @@ using Antares.Sdk; using Antares.Service.History.Core.Settings; using Antares.Service.History.PostgresRepositories.Mappings; +using Autofac; using AutoMapper; using JetBrains.Annotations; +using Lykke.SettingsReader; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Antares.Job.History @@ -19,8 +22,11 @@ public class Startup ApiVersion = "v1" }; + private IReloadingManagerWithConfiguration _settings; + private LykkeServiceOptions _lykkeOptions; + [UsedImplicitly] - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { Mapper.Initialize(cfg => { @@ -28,7 +34,8 @@ public IServiceProvider ConfigureServices(IServiceCollection services) cfg.AddProfiles(typeof(RepositoryProfile)); }); - return services.BuildServiceProvider(options => + //DependencyResolver + (_lykkeOptions, _settings) = services.ConfigureServices(options => { options.SwaggerOptions = _swaggerOptions; @@ -71,6 +78,16 @@ public IServiceProvider ConfigureServices(IServiceCollection services) }); } + [UsedImplicitly] + public void ConfigureContainer(ContainerBuilder builder) + { + var configurationRoot = new ConfigurationBuilder() + .AddEnvironmentVariables() + .Build(); + + builder.ConfigureContainerBuilder(_lykkeOptions, configurationRoot, _settings); + } + [UsedImplicitly] public void Configure(IApplicationBuilder app) { diff --git a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj index a5efe62..4f0992c 100644 --- a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj +++ b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj @@ -6,7 +6,7 @@ 1.0.0 - + diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index 42fcc04..4cb1760 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -22,7 +22,6 @@ - @@ -37,6 +36,7 @@ + diff --git a/src/Antares.Service.History/Controllers/HistoryController.cs b/src/Antares.Service.History/Controllers/HistoryController.cs index 5b6c6b8..acd8311 100644 --- a/src/Antares.Service.History/Controllers/HistoryController.cs +++ b/src/Antares.Service.History/Controllers/HistoryController.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; using Antares.Service.History.Contracts.History; -using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.History; using AutoMapper; using Microsoft.AspNetCore.Mvc; diff --git a/src/Antares.Service.History/Controllers/OrdersController.cs b/src/Antares.Service.History/Controllers/OrdersController.cs index 5565cdf..59eca9f 100644 --- a/src/Antares.Service.History/Controllers/OrdersController.cs +++ b/src/Antares.Service.History/Controllers/OrdersController.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Net; using System.Threading.Tasks; +using Antares.Service.History.Contracts.Enums; using Antares.Service.History.Contracts.Orders; -using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; using Microsoft.AspNetCore.Mvc; diff --git a/src/Antares.Service.History/Startup.cs b/src/Antares.Service.History/Startup.cs index 85a905b..d5de968 100644 --- a/src/Antares.Service.History/Startup.cs +++ b/src/Antares.Service.History/Startup.cs @@ -3,9 +3,12 @@ using Antares.Service.History.AutoMapper; using Antares.Service.History.Core.Settings; using Antares.Service.History.PostgresRepositories.Mappings; +using Autofac; using AutoMapper; using JetBrains.Annotations; +using Lykke.SettingsReader; using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Antares.Service.History @@ -19,8 +22,21 @@ public class Startup ApiVersion = "v1" }; + private LykkeServiceOptions _lykkeOptions; + private IReloadingManagerWithConfiguration _settings; + + [UsedImplicitly] + public void ConfigureContainer(ContainerBuilder builder) + { + var configurationRoot = new ConfigurationBuilder() + .AddEnvironmentVariables() + .Build(); + + builder.ConfigureContainerBuilder(_lykkeOptions, configurationRoot, _settings); + } + [UsedImplicitly] - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { Mapper.Initialize(cfg => { @@ -28,7 +44,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services) cfg.AddProfiles(typeof(RepositoryProfile)); }); - return services.BuildServiceProvider(options => + (_lykkeOptions, _settings) = services.ConfigureServices(options => { options.SwaggerOptions = _swaggerOptions; From 5d026d0bd275adb03ed63f12b928827aea9ffa3c Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 14:23:14 +0400 Subject: [PATCH 10/60] fixed mapping --- .../Properties/launchSettings.json | 3 +- .../Controllers/HistoryController.cs | 17 +++++++++- .../Controllers/OrdersController.cs | 33 ++++++++++++++++--- .../Properties/launchSettings.json | 3 +- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/Antares.Job.History/Properties/launchSettings.json b/src/Antares.Job.History/Properties/launchSettings.json index d44eaac..2c37808 100644 --- a/src/Antares.Job.History/Properties/launchSettings.json +++ b/src/Antares.Job.History/Properties/launchSettings.json @@ -4,8 +4,7 @@ "commandName": "Project", "environmentVariables": { "ENV_INFO": "home", - "SettingsUrl": - "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/c6462006-d3b2-44d9-9b47-0989b05700ea/Lykke.Service.History", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/79ab4c5c-fae6-480a-8742-d9b233addfd2/Lykke.Service.History", "ASPNETCORE_ENVIRONMENT": "Development" } }, diff --git a/src/Antares.Service.History/Controllers/HistoryController.cs b/src/Antares.Service.History/Controllers/HistoryController.cs index acd8311..715ee45 100644 --- a/src/Antares.Service.History/Controllers/HistoryController.cs +++ b/src/Antares.Service.History/Controllers/HistoryController.cs @@ -51,7 +51,22 @@ public async Task> GetHistory( if (type.Length == 0) type = Enum.GetValues(typeof(HistoryType)).Cast().ToArray(); - var data = await _historyRecordsRepository.GetByWalletAsync(walletId, type, offset, limit, assetPairId, assetId, from, to); + var mappedType = type.Select(x => x switch + { + HistoryType.CashIn => Antares.Service.History.Core.Domain.Enums.HistoryType.CashIn, + HistoryType.CashOut => Antares.Service.History.Core.Domain.Enums.HistoryType.CashOut, + HistoryType.Trade => Antares.Service.History.Core.Domain.Enums.HistoryType.Trade, + HistoryType.OrderEvent => Antares.Service.History.Core.Domain.Enums.HistoryType.OrderEvent, + + _ => throw new ArgumentOutOfRangeException(nameof(x), x, null) + }).ToArray(); + var data = await _historyRecordsRepository.GetByWalletAsync(walletId, mappedType, + offset, + limit, + assetPairId, + assetId, + from, + to); return Mapper.Map>(data); } diff --git a/src/Antares.Service.History/Controllers/OrdersController.cs b/src/Antares.Service.History/Controllers/OrdersController.cs index 59eca9f..750b909 100644 --- a/src/Antares.Service.History/Controllers/OrdersController.cs +++ b/src/Antares.Service.History/Controllers/OrdersController.cs @@ -63,10 +63,32 @@ public async Task> GetOrders( if (type.Length == 0) type = Enum.GetValues(typeof(OrderType)).Cast().ToArray(); + var mappedType = type.Select(x => x switch + { + OrderType.Unknown => Antares.Service.History.Core.Domain.Enums.OrderType.Unknown, + OrderType.Market => Antares.Service.History.Core.Domain.Enums.OrderType.Market, + OrderType.Limit => Antares.Service.History.Core.Domain.Enums.OrderType.Limit, + OrderType.StopLimit => Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit, + _ => throw new ArgumentOutOfRangeException(nameof(x), x, null) + }).ToArray(); + + var mappedStatus = status.Select(x => x switch + { + OrderStatus.Unknown => Antares.Service.History.Core.Domain.Enums.OrderStatus.Unknown, + OrderStatus.Placed => Antares.Service.History.Core.Domain.Enums.OrderStatus.Placed, + OrderStatus.PartiallyMatched => Antares.Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched, + OrderStatus.Matched => Antares.Service.History.Core.Domain.Enums.OrderStatus.Matched, + OrderStatus.Pending => Antares.Service.History.Core.Domain.Enums.OrderStatus.Pending, + OrderStatus.Cancelled => Antares.Service.History.Core.Domain.Enums.OrderStatus.Cancelled, + OrderStatus.Replaced => Antares.Service.History.Core.Domain.Enums.OrderStatus.Replaced, + OrderStatus.Rejected => Antares.Service.History.Core.Domain.Enums.OrderStatus.Rejected, + _ => throw new ArgumentOutOfRangeException(nameof(x), x, null) + }).ToArray(); + var data = await _ordersRepository.GetOrdersAsync( walletId, - type, - status, + mappedType, + mappedStatus, assetPairId, offset, limit); @@ -122,8 +144,11 @@ public async Task> GetActiveOrders( { var data = await _ordersRepository.GetOrdersAsync( walletId, - new[] { OrderType.Limit, OrderType.StopLimit }, - new[] { OrderStatus.Placed, OrderStatus.PartiallyMatched, OrderStatus.Pending }, + new[] { Antares.Service.History.Core.Domain.Enums.OrderType.Limit, + Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit }, + new[] { Antares.Service.History.Core.Domain.Enums.OrderStatus.Placed, + Antares.Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched, + Antares.Service.History.Core.Domain.Enums.OrderStatus.Pending }, assetPairId, offset, limit); diff --git a/src/Antares.Service.History/Properties/launchSettings.json b/src/Antares.Service.History/Properties/launchSettings.json index d44eaac..2c37808 100644 --- a/src/Antares.Service.History/Properties/launchSettings.json +++ b/src/Antares.Service.History/Properties/launchSettings.json @@ -4,8 +4,7 @@ "commandName": "Project", "environmentVariables": { "ENV_INFO": "home", - "SettingsUrl": - "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/c6462006-d3b2-44d9-9b47-0989b05700ea/Lykke.Service.History", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/79ab4c5c-fae6-480a-8742-d9b233addfd2/Lykke.Service.History", "ASPNETCORE_ENVIRONMENT": "Development" } }, From e94e8768d8f7110d0ad263e1cd4ed08c4e477481 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 16:56:58 +0400 Subject: [PATCH 11/60] COMPLETED MIGRATION TO ANTARES.SDK and .NET 5.0 --- Antares.Service.History.sln | 6 ------ src/Antares.Job.History/Antares.Job.History.csproj | 2 +- .../Antares.Service.History.Core.csproj | 2 +- src/Antares.Service.History/Antares.Service.History.csproj | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Antares.Service.History.sln b/Antares.Service.History.sln index 5e7af8a..a29b1fc 100644 --- a/Antares.Service.History.sln +++ b/Antares.Service.History.sln @@ -34,8 +34,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Cli EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Contracts", "client\Antares.Service.History.Contracts\Antares.Service.History.Contracts.csproj", "{E4199193-31F4-401B-8464-96783A6195D2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Sdk", "..\Lykke.Sdk\src\Antares.Sdk\Antares.Sdk.csproj", "{E20A35C0-C442-48C7-A64A-2A046E2C6F45}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -74,10 +72,6 @@ Global {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.Build.0 = Release|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E20A35C0-C442-48C7-A64A-2A046E2C6F45}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index 4d679a0..bfb9ff6 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -23,6 +23,7 @@ + @@ -40,7 +41,6 @@ - diff --git a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj index 4f0992c..fb0ecd7 100644 --- a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj +++ b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj @@ -6,7 +6,7 @@ 1.0.0 - + diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index 4cb1760..c143b3a 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -22,6 +22,7 @@ + @@ -36,7 +37,6 @@ - From 7d9219ff1c973b5f6a2eed2416ce689191cdac24 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 19:34:20 +0400 Subject: [PATCH 12/60] added ci --- .github/workflows/ci-dev.yml | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ci-dev.yml diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml new file mode 100644 index 0000000..93359fa --- /dev/null +++ b/.github/workflows/ci-dev.yml @@ -0,0 +1,62 @@ +name: CI dev build + +on: + push: + branches: + - dev-* + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.101 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release + - name: Publish API + run: dotnet publish ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release + - name: Publish worker + run: dotnet publish ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release + - name: Check Webhooks dir + run: ls ./publish-webhooks + - name: Check API dir + run: ls ./publish-api + - name: Check worker dir + run: ls ./publish-worker + - name: Publish API to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-api:dev + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-api + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + - name: Publish worker to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-job:dev + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-worker + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + - name: Restart service + uses: swisschain/kube-restart-pods@master + env: + KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} + NAMESPACE: lykke-service + POD: history + - name: Restart service + uses: swisschain/kube-restart-pods@master + env: + KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} + NAMESPACE: lykke-job + POD: history-job \ No newline at end of file From db92d5837157069f69ce442eec2f3d3e7f979b06 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 19:45:38 +0400 Subject: [PATCH 13/60] fixed --- .github/workflows/ci-dev.yml | 4 ++-- src/Antares.Job.History/Antares.Job.History.csproj | 2 +- src/Antares.Service.History/Antares.Service.History.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index 93359fa..7772bbd 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -21,9 +21,9 @@ jobs: - name: Test run: dotnet test --no-build --configuration Release - name: Publish API - run: dotnet publish ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release + run: dotnet publish --no-build ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release - name: Publish worker - run: dotnet publish ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release + run: dotnet publish --no-build ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release - name: Check Webhooks dir run: ls ./publish-webhooks - name: Check API dir diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index bfb9ff6..e1b05a1 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -10,7 +10,7 @@ latest - bin\Debug\netcoreapp2.0\Lykke.Job.History.xml + bin\Debug\net5.0\Antares.Job.History.xml 1701;1702;1705;1591 latest diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index c143b3a..05ba572 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -12,7 +12,7 @@ latest - bin\Debug\netcoreapp2.0\Lykke.Service.History.xml + bin\Debug\net5.0\Antares.Service.History.xml 1701;1702;1705;1591 latest From f4ee6ca7418a7821f9f7a875a59a93f740735bb4 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 19:51:11 +0400 Subject: [PATCH 14/60] fixed --- src/Antares.Job.History/Antares.Job.History.csproj | 2 +- src/Antares.Service.History/Antares.Service.History.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index e1b05a1..dddb875 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -10,7 +10,7 @@ latest - bin\Debug\net5.0\Antares.Job.History.xml + 1701;1702;1705;1591 latest diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index 05ba572..dc35257 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -12,7 +12,7 @@ latest - bin\Debug\net5.0\Antares.Service.History.xml + 1701;1702;1705;1591 latest From a7d41ba3c2c9a1de8e57c5772a21145dd8a904b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 19:55:40 +0400 Subject: [PATCH 15/60] fixed --- src/Antares.Job.History/Antares.Job.History.csproj | 4 ++-- src/Antares.Service.History/Antares.Service.History.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index dddb875..250de84 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -5,12 +5,12 @@ 1.0.1 - bin\Release\netcoreapp2.0\Lykke.Job.History.xml + bin\Release\net5.0\Antares.Job.History.xml 1701;1702;1705;1591 latest - + bin\Debug\net5.0\Antares.Job.History.xml 1701;1702;1705;1591 latest diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index dc35257..85f9602 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -7,12 +7,12 @@ Antares.Service.History - bin\Release\netcoreapp2.0\Lykke.Service.History.xml + bin\Release\net5.0\Antares.Service.History.xml 1701;1702;1705;1591 latest - + bin\Debug\net5.0\Antares.Service.History.xml 1701;1702;1705;1591 latest From 65bb32d09c84b5c0289f68f84c7b61b0bba9164e Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 20:01:17 +0400 Subject: [PATCH 16/60] fixed --- .github/workflows/ci-dev.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index 7772bbd..f8a9121 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -24,8 +24,6 @@ jobs: run: dotnet publish --no-build ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release - name: Publish worker run: dotnet publish --no-build ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release - - name: Check Webhooks dir - run: ls ./publish-webhooks - name: Check API dir run: ls ./publish-api - name: Check worker dir From 64d561f534203418954e7c8665852dbb7886d8cc Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 20:07:50 +0400 Subject: [PATCH 17/60] fixed docker image --- src/Antares.Service.History/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Antares.Service.History/Dockerfile b/src/Antares.Service.History/Dockerfile index 3314010..c6c187a 100644 --- a/src/Antares.Service.History/Dockerfile +++ b/src/Antares.Service.History/Dockerfile @@ -1,4 +1,4 @@ -FROM FROM mcr.microsoft.com/dotnet/aspnet:5.0.1-buster-slim +FROM mcr.microsoft.com/dotnet/aspnet:5.0.1-buster-slim WORKDIR /app COPY . . ENTRYPOINT ["dotnet", "Lykke.Service.History.dll"] From 4ae00f2d5029f0dd57a54526fe0a978a0384b0f8 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 20:19:27 +0400 Subject: [PATCH 18/60] fixed ci --- .github/workflows/ci-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index f8a9121..9c0feb6 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -56,5 +56,5 @@ jobs: uses: swisschain/kube-restart-pods@master env: KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} - NAMESPACE: lykke-job + NAMESPACE: lykke-jobs POD: history-job \ No newline at end of file From f13dd9e83440d6149abcebea642352d5f7a42db1 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 20:22:23 +0400 Subject: [PATCH 19/60] fixed dll names --- src/Antares.Job.History/Dockerfile | 2 +- src/Antares.Service.History/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Antares.Job.History/Dockerfile b/src/Antares.Job.History/Dockerfile index 97050b6..72ae612 100644 --- a/src/Antares.Job.History/Dockerfile +++ b/src/Antares.Job.History/Dockerfile @@ -1,4 +1,4 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0.1-buster-slim WORKDIR /app COPY . . -ENTRYPOINT ["dotnet", "Lykke.Job.History.dll"] +ENTRYPOINT ["dotnet", "Antares.Job.History.dll"] diff --git a/src/Antares.Service.History/Dockerfile b/src/Antares.Service.History/Dockerfile index c6c187a..ff47ec9 100644 --- a/src/Antares.Service.History/Dockerfile +++ b/src/Antares.Service.History/Dockerfile @@ -1,4 +1,4 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0.1-buster-slim WORKDIR /app COPY . . -ENTRYPOINT ["dotnet", "Lykke.Service.History.dll"] +ENTRYPOINT ["dotnet", "Antares.Service.History.dll"] From 68585c221c014457f7f45dccdcb170bb5716d3ed Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 22:21:30 +0400 Subject: [PATCH 20/60] added ci for test --- .github/workflows/ci-dev.yml | 2 +- .github/workflows/ci-test.yml | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci-test.yml diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index 9c0feb6..7a3f7b0 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -52,7 +52,7 @@ jobs: KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} NAMESPACE: lykke-service POD: history - - name: Restart service + - name: Restart job uses: swisschain/kube-restart-pods@master env: KUBE_CONFIG_DATA: ${{ secrets.LYKKE_DEV_KUBE_CONFIG_DATA }} diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml new file mode 100644 index 0000000..37ffb70 --- /dev/null +++ b/.github/workflows/ci-test.yml @@ -0,0 +1,60 @@ +name: CI test build + +on: + push: + branches: + - test-* + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.101 + - name: Build + run: dotnet build --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release + - name: Publish API + run: dotnet publish --no-build ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release + - name: Publish worker + run: dotnet publish --no-build ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release + - name: Check API dir + run: ls ./publish-api + - name: Check worker dir + run: ls ./publish-worker + - name: Publish API to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-api:test + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-api + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + - name: Publish worker to Registry + uses: swisschain/Publish-Docker-Github-Action@master + with: + name: swisschains/antares-history-job:test + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + workdir: ./publish-worker + # snapshot: true # use snapshot to push an additional image, which is tagged with {YEAR}{MONTH}{DAY}{HOUR}{MINUTE}{SECOND}{first 6 digits of the git sha} + tag_names: true + - name: Restart service + uses: swisschain/kube-restart-pods@master + env: + KUBE_CONFIG_DATA: ${{ secrets.LYKKE_TEST_KUBE_CONFIG_DATA }} + NAMESPACE: services + POD: history + - name: Restart job + uses: swisschain/kube-restart-pods@master + env: + KUBE_CONFIG_DATA: ${{ secrets.LYKKE_TEST_KUBE_CONFIG_DATA }} + NAMESPACE: lykke-jobs + POD: history-job \ No newline at end of file From 6cb9a60c861dd29218ee873922c646e1b1034de5 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 12 Jan 2021 22:25:10 +0400 Subject: [PATCH 21/60] fixed --- src/Antares.Job.History/Modules/CqrsModule.cs | 4 ++-- .../Workflow/Projections/TransactionHashProjection.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Antares.Job.History/Modules/CqrsModule.cs b/src/Antares.Job.History/Modules/CqrsModule.cs index 423ca08..1568164 100644 --- a/src/Antares.Job.History/Modules/CqrsModule.cs +++ b/src/Antares.Job.History/Modules/CqrsModule.cs @@ -156,13 +156,13 @@ private CqrsEngine CreateEngine( .WithEndpointResolver(sagasMessagePackEndpointResolver) .WithProjection(typeof(TransactionHashProjection), BlockchainCashinDetectorBoundedContext.Name) - .ListeningEvents(typeof(Job.SiriusDepositsDetector.Contract.Events.CashinCompletedEvent)) + .ListeningEvents(typeof(Lykke.Job.SiriusDepositsDetector.Contract.Events.CashinCompletedEvent)) .From(SiriusDepositsDetectorBoundedContext.Name) .On(defaultRoute) .WithEndpointResolver(sagasMessagePackEndpointResolver) .WithProjection(typeof(TransactionHashProjection), SiriusDepositsDetectorBoundedContext.Name) - .ListeningEvents(typeof(Job.SiriusCashoutProcessor.Contract.Events.CashoutCompletedEvent)) + .ListeningEvents(typeof(Lykke.Job.SiriusCashoutProcessor.Contract.Events.CashoutCompletedEvent)) .From(SiriusCashoutProcessorBoundedContext.Name) .On(defaultRoute) .WithEndpointResolver(sagasMessagePackEndpointResolver) diff --git a/src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs b/src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs index 6f17a10..b91e630 100644 --- a/src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs +++ b/src/Antares.Job.History/Workflow/Projections/TransactionHashProjection.cs @@ -90,7 +90,7 @@ public async Task Handle( /// /// public async Task Handle( - Job.SiriusDepositsDetector.Contract.Events.CashinCompletedEvent @event) + Lykke.Job.SiriusDepositsDetector.Contract.Events.CashinCompletedEvent @event) { if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, @event.TransactionHash)) { @@ -134,7 +134,7 @@ public async Task Handle( /// /// public async Task Handle( - Job.SiriusCashoutProcessor.Contract.Events.CashoutCompletedEvent @event) + Lykke.Job.SiriusCashoutProcessor.Contract.Events.CashoutCompletedEvent @event) { if (!await _historyRecordsRepository.UpdateBlockchainHashAsync(@event.OperationId, @event.TransactionHash)) { From be4d5d3de6dadaa9c5f811ffba969d5e9681146e Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Wed, 13 Jan 2021 17:26:26 +0400 Subject: [PATCH 22/60] fixed release service workflow --- .github/workflows/release-service.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-service.yml b/.github/workflows/release-service.yml index c7a2bec..8b8fa80 100644 --- a/.github/workflows/release-service.yml +++ b/.github/workflows/release-service.yml @@ -20,9 +20,9 @@ jobs: - name: Test run: dotnet test --no-build --configuration Release - name: Publish API - run: dotnet publish ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} + run: dotnet publish --no-build ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} - name: Publish worker - run: dotnet publish ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} + run: dotnet publish --no-build ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} - name: Check Webhooks dir run: ls ./publish-webhooks - name: Check API dir From 2ecad9e078443255c1c548d4f22528758b011da6 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Wed, 13 Jan 2021 19:20:37 +0400 Subject: [PATCH 23/60] fixed automapper --- src/Antares.Service.History/AutoMapper/ServiceProfile.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Antares.Service.History/AutoMapper/ServiceProfile.cs b/src/Antares.Service.History/AutoMapper/ServiceProfile.cs index 3d8695d..fdca475 100644 --- a/src/Antares.Service.History/AutoMapper/ServiceProfile.cs +++ b/src/Antares.Service.History/AutoMapper/ServiceProfile.cs @@ -3,7 +3,6 @@ using Antares.Service.History.Core.Domain.Orders; using AutoMapper; using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; -using TradeModel = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.TradeModel; namespace Antares.Service.History.AutoMapper { @@ -11,7 +10,7 @@ public class ServiceProfile : Profile { public ServiceProfile() { - CreateMap(); + CreateMap(); CreateMap(); From a2531d02e14b2ecbcaf507f9d43508f3efb7c913 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Wed, 13 Jan 2021 19:21:51 +0400 Subject: [PATCH 24/60] fixed ci cd --- .github/workflows/ci-dev.yml | 2 +- .github/workflows/ci-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index 7a3f7b0..3bf34a2 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -3,7 +3,7 @@ name: CI dev build on: push: branches: - - dev-* + - dev jobs: build: diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 37ffb70..df27399 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -3,7 +3,7 @@ name: CI test build on: push: branches: - - test-* + - test jobs: build: From 71180fe74ac074a0c1bf8b7f5f6272c25086eed8 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Wed, 13 Jan 2021 19:58:38 +0400 Subject: [PATCH 25/60] fixed terrible mapping mistake (DO NOT USE AUTOMAPPER) --- src/Antares.Service.History/Controllers/TradesController.cs | 2 +- src/Antares.Service.History/Properties/launchSettings.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Antares.Service.History/Controllers/TradesController.cs b/src/Antares.Service.History/Controllers/TradesController.cs index 712e85f..e5d7219 100644 --- a/src/Antares.Service.History/Controllers/TradesController.cs +++ b/src/Antares.Service.History/Controllers/TradesController.cs @@ -3,10 +3,10 @@ using System.Net; using System.Threading.Tasks; using Antares.Service.History.Contracts.Enums; +using Antares.Service.History.Contracts.History; using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; diff --git a/src/Antares.Service.History/Properties/launchSettings.json b/src/Antares.Service.History/Properties/launchSettings.json index 2c37808..f5780df 100644 --- a/src/Antares.Service.History/Properties/launchSettings.json +++ b/src/Antares.Service.History/Properties/launchSettings.json @@ -11,7 +11,7 @@ "History local test settings": { "commandName": "Project", "environmentVariables": { - "SettingsUrl": "token_to_test_settings", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/0dff4c82-f84e-435a-8412-f68e29cfaeef/Lykke.Service.History", "ASPNETCORE_ENVIRONMENT": "Staging" } }, From 11a3b561b3d82fecd74ca2db3c0c5f4ce772f036 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Thu, 14 Jan 2021 19:01:56 +0400 Subject: [PATCH 26/60] fixed release workflow --- .github/workflows/release-service.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release-service.yml b/.github/workflows/release-service.yml index 8b8fa80..7efd196 100644 --- a/.github/workflows/release-service.yml +++ b/.github/workflows/release-service.yml @@ -23,8 +23,6 @@ jobs: run: dotnet publish --no-build ./src/Antares.Service.History/Antares.Service.History.csproj --output ./publish-api --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} - name: Publish worker run: dotnet publish --no-build ./src/Antares.Job.History/Antares.Job.History.csproj --output ./publish-worker --configuration Release /p:AssemblyVersion=${GITHUB_REF#refs/tags/service-} - - name: Check Webhooks dir - run: ls ./publish-webhooks - name: Check API dir run: ls ./publish-api - name: Check worker dir From 0ea257fc3c8fa700296d784ffd75c9d0d7b7075e Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Thu, 14 Jan 2021 19:01:05 +0400 Subject: [PATCH 27/60] intermediate commit --- .../Antares.Job.History.csproj | 1 + .../RabbitSubscribers/MeRabbitSubscriber.cs | 345 ++++++++++++++++++ .../Settings/RabbitMqSettings.cs | 21 ++ 3 files changed, 367 insertions(+) create mode 100644 src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs create mode 100644 src/Antares.Service.History.Core/Settings/RabbitMqSettings.cs diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index 47e3de4..ba27bf3 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -32,6 +32,7 @@ + diff --git a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs new file mode 100644 index 0000000..d615a04 --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs @@ -0,0 +1,345 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Antares.Service.History.Core.Domain.Enums; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Settings; +using Autofac; +using AutoMapper; +using Common; +using Common.Log; +using JetBrains.Annotations; +using Lykke.Common.Log; +using Lykke.Cqrs; +using Lykke.MatchingEngine.Connector.Models.Events; +using Lykke.RabbitMqBroker; +using Lykke.RabbitMqBroker.Deduplication; +using Lykke.RabbitMqBroker.Subscriber; +using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; +using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; +using Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums; +using OrderStatus = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderStatus; +using OrderType = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType; +using TradeRole = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.TradeRole; + +namespace Antares.Job.History.RabbitSubscribers +{ + [UsedImplicitly] + public class MeRabbitSubscriber : IStartable, IStopable + { + [NotNull] private readonly ILogFactory _logFactory; + private readonly RabbitMqSettings _rabbitMqSettings; + private readonly ICqrsEngine _cqrsEngine; + private readonly List _subscribers = new List(); + private readonly IDeduplicator _deduplicator; + private readonly IHistoryRecordsRepository _historyRecordsRepository; + private readonly IReadOnlyList _walletIds; + private readonly ILog _log; + + private const string QueueName = "lykke.spot.matching.engine.out.events.post-processing"; + private const bool QueueDurable = true; + + public MeRabbitSubscriber( + [NotNull] ILogFactory logFactory, + [NotNull] RabbitMqSettings rabbitMqSettings, + [NotNull] ICqrsEngine cqrsEngine, + [NotNull] IDeduplicator deduplicator, + IHistoryRecordsRepository _historyRecordsRepository, + IReadOnlyList walletIds) + { + _logFactory = logFactory ?? throw new ArgumentNullException(nameof(logFactory)); + _log = _logFactory.CreateLog(this); + _rabbitMqSettings = rabbitMqSettings ?? throw new ArgumentNullException(nameof(rabbitMqSettings)); + _cqrsEngine = cqrsEngine ?? throw new ArgumentNullException(nameof(cqrsEngine)); + _deduplicator = deduplicator ?? throw new ArgumentNullException(nameof(deduplicator)); + this._historyRecordsRepository = _historyRecordsRepository; + _walletIds = walletIds; + } + + public void Start() + { + _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.CashIn, ProcessMessageAsync)); + _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.CashOut, ProcessMessageAsync)); + _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.CashTransfer, ProcessMessageAsync)); + _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.Order, ProcessMessageAsync)); + } + + private RabbitMqSubscriber Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType messageType, Func func) + { + var settings = new RabbitMqSubscriptionSettings + { + ConnectionString = _rabbitMqSettings.ConnectionString, + QueueName = $"{QueueName}.{messageType}", + ExchangeName = _rabbitMqSettings.Exchange, + RoutingKey = ((int)messageType).ToString(), + IsDurable = QueueDurable + }; + + return new RabbitMqSubscriber( + _logFactory, + settings, + new ResilientErrorHandlingStrategy(_logFactory, settings, + retryTimeout: TimeSpan.FromSeconds(10), + next: new DeadQueueErrorHandlingStrategy(_logFactory, settings))) + .SetMessageDeserializer(new ProtobufMessageDeserializer()) + .SetMessageReadStrategy(new MessageReadQueueStrategy()) + .Subscribe(func) + .CreateDefaultBinding() + .SetAlternativeExchange(_rabbitMqSettings.AlternativeConnectionString) + .SetDeduplicator(_deduplicator) + .Start(); + } + + + private async Task ProcessMessageAsync(CashInEvent message) + { + var fees = message.CashIn.Fees; + var fee = fees?.FirstOrDefault()?.Transfer; + + var entity = new Cashin() + { + AssetId = message.CashIn.AssetId, + //BlockchainHash = , + FeeSize = ParseNullabe(fee?.Volume), + Id = Guid.Parse(message.Header.RequestId), + State = HistoryState.Finished, + Timestamp = message.Header.Timestamp, + Volume = Math.Abs(decimal.Parse(message.CashIn.Volume)), + WalletId = Guid.Parse(message.CashIn.WalletId) + }; + + if (!await _historyRecordsRepository.TryInsertAsync(entity)) + _log.Warning($"Skipped duplicated cashin record", context: new + { + id = message.Header.RequestId + }); + } + + private async Task ProcessMessageAsync(CashOutEvent message) + { + var fees = message.CashOut.Fees; + var fee = fees?.FirstOrDefault()?.Transfer; + + var entity = new Cashout() + { + //BlockchainHash = , + FeeSize = ParseNullabe(fee?.Volume), + State = HistoryState.Finished, + Id = Guid.Parse(message.Header.RequestId), + WalletId = Guid.Parse(message.CashOut.WalletId), + AssetId = message.CashOut.AssetId, + Timestamp = message.Header.Timestamp, + Volume = -Math.Abs(decimal.Parse(message.CashOut.Volume)) + }; + + if (!await _historyRecordsRepository.TryInsertAsync(entity)) + _log.Warning($"Skipped duplicated cashout record", context: new + { + id = message.Header.RequestId + }); + } + + private async Task ProcessMessageAsync(CashTransferEvent message) + { + var fees = message.CashTransfer.Fees; + var fee = fees?.FirstOrDefault()?.Transfer; + var operationId = Guid.Parse(message.Header.RequestId); + var fromWallet = Guid.Parse(message.CashTransfer.FromWalletId); + var toWallet = Guid.Parse(message.CashTransfer.ToWalletId); + var volume = decimal.Parse(message.CashTransfer.Volume); + var timestamp = message.Header.Timestamp; + var assetId = message.CashTransfer.AssetId; + var feeSourceWalletId = fee != null ? Guid.Parse(fee.SourceWalletId) : (Guid?) null; + var feeSize = ParseNullabe(fee?.Volume); + + var cashInOuts = new BaseHistoryRecord[] { + new Cashout() + { + Id = operationId, + WalletId = fromWallet, + Volume = -Math.Abs(volume), + Timestamp = timestamp, + AssetId = assetId, + FeeSize = fromWallet == feeSourceWalletId ? feeSize : null, + State = Antares.Service.History.Core.Domain.Enums.HistoryState.Finished + }, + new Cashin() + { + Id = operationId, + WalletId = toWallet, + Volume = Math.Abs(volume), + Timestamp = timestamp, + AssetId = assetId, + FeeSize = toWallet == feeSourceWalletId ? feeSize : null, + State = Antares.Service.History.Core.Domain.Enums.HistoryState.Finished + }}; + + foreach (var cashInOut in cashInOuts) + if (!await _historyRecordsRepository.TryInsertAsync(cashInOut)) + _log.Warning($"Skipped duplicated transfer record", context: new + { + id = operationId + }); + } + + private Task ProcessMessageAsync(ExecutionEvent message) + { + var orders = message.Orders.Select(x => new OrderModel + { + Id = Guid.Parse(x.ExternalId), + WalletId = Guid.Parse(x.WalletId), + Volume = decimal.Parse(x.Volume), + AssetPairId = x.AssetPairId, + CreateDt = x.CreatedAt, + LowerLimitPrice = ParseNullabe(x.LowerLimitPrice), + LowerPrice = ParseNullabe(x.LowerPrice), + MatchDt = x.LastMatchTime, + MatchingId = Guid.Parse(x.Id), + Price = ParseNullabe(x.Price), + RegisterDt = x.Registered, + RejectReason = x.RejectReason, + RemainingVolume = ParseNullabe(x.RemainingVolume), + Side = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderSide)(int)x.Side, + Status = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderStatus)(int)x.Status, + StatusDt = x.StatusDate, + Straight = x.OrderType == OrderType.Limit || x.OrderType == OrderType.StopLimit || x.Straight, + Type = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType)(int)x.OrderType, + UpperLimitPrice = ParseNullabe(x.UpperLimitPrice), + UpperPrice = ParseNullabe(x.UpperPrice), + Trades = x.Trades?.Select(t => new TradeModel + { + Id = Guid.Parse(t.TradeId), + WalletId = Guid.Parse(x.WalletId), + AssetPairId = x.AssetPairId, + BaseAssetId = t.BaseAssetId, + BaseVolume = decimal.Parse(t.BaseVolume), + Price = decimal.Parse(t.Price), + Timestamp = t.Timestamp, + QuotingAssetId = t.QuotingAssetId, + QuotingVolume = decimal.Parse(t.QuotingVolume), + Index = t.Index, + Role = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.TradeRole)(int)t.Role, + FeeSize = ParseNullabe(t.Fees?.FirstOrDefault()?.Volume), + FeeAssetId = t.Fees?.FirstOrDefault()?.AssetId, + OppositeWalletId = Guid.Parse(t.OppositeWalletId), + }).ToList() + }).ToList(); + + foreach (var order in orders.Where(x => _walletIds.Contains(x.WalletId.ToString()))) + { + _log.Info("Order from ME", $"order: {new { order.Id, order.Status, message.Header.SequenceNumber }.ToJson()}"); + } + + var @event = new ExecutionProcessedEvent + { + SequenceNumber = message.Header.SequenceNumber, + Orders = orders + }; + _cqrsEngine.PublishEvent(@event, BoundedContext.Name); + + foreach (var order in orders.Where(x => x.Trades != null && x.Trades.Any())) + { + var tradeProcessedEvent = new ManualOrderTradeProcessedEvent + { + Order = order + }; + _cqrsEngine.PublishEvent(tradeProcessedEvent, BoundedContext.Name); + } + + foreach (var order in message.Orders.Where(x => x.Trades != null && x.Trades.Count > 0)) + { + var orderType = order.OrderType == OrderType.Market ? FeeOperationType.Trade : FeeOperationType.LimitTrade; + var orderId = order.Id; + foreach (var trade in order.Trades) + { + if (trade.Fees != null) + { + var feeEvent = new FeeChargedEvent + { + OperationId = orderId, + OperationType = orderType, + Fee = trade.Fees.ToJson() + }; + _cqrsEngine.PublishEvent(feeEvent, BoundedContext.Name); + } + } + } + + var limitOrders = orders.Where(x => x.Type == Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType.Limit || + x.Type == Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType.StopLimit).ToList(); + foreach (var order in limitOrders.Where(x => x.Status == OrderStatus.Cancelled)) + { + var orderCancelledEvent = new OrderCancelledEvent + { + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price, + Timestamp = order.StatusDt, + Volume = order.Volume, + WalletId = order.WalletId + }; + _cqrsEngine.PublishEvent(orderCancelledEvent, BoundedContext.Name); + } + + foreach (var order in limitOrders.Where(x => x.Status == OrderStatus.Placed)) + { + var orderPlacedEvent = new OrderPlacedEvent + { + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price, + Timestamp = order.StatusDt, + Volume = order.Volume, + WalletId = order.WalletId, + CreateDt = order.CreateDt + }; + _cqrsEngine.PublishEvent(orderPlacedEvent, BoundedContext.Name); + } + + foreach (var order in limitOrders.Where(x => + (x.Status == OrderStatus.Matched || x.Status == OrderStatus.PartiallyMatched) + && x.Trades.Any(t => t.Role == TradeRole.Taker))) + { + var orderPlacedEvent = new OrderPlacedEvent + { + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price, + Timestamp = order.StatusDt, + Volume = order.Volume, + WalletId = order.WalletId, + CreateDt = order.CreateDt + }; + _cqrsEngine.PublishEvent(orderPlacedEvent, BoundedContext.Name); + } + + return Task.CompletedTask; + } + + private decimal? ParseNullabe(string value) + { + return !string.IsNullOrEmpty(value) ? decimal.Parse(value) : (decimal?)null; + } + + public void Dispose() + { + foreach (var subscriber in _subscribers) + { + subscriber?.Dispose(); + } + + } + + public void Stop() + { + foreach (var subscriber in _subscribers) + { + subscriber?.Stop(); + } + } + } +} diff --git a/src/Antares.Service.History.Core/Settings/RabbitMqSettings.cs b/src/Antares.Service.History.Core/Settings/RabbitMqSettings.cs new file mode 100644 index 0000000..793a33a --- /dev/null +++ b/src/Antares.Service.History.Core/Settings/RabbitMqSettings.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JetBrains.Annotations; +using Lykke.SettingsReader.Attributes; + +namespace Antares.Service.History.Core.Settings +{ + [UsedImplicitly] + public class RabbitMqSettings + { + [AmqpCheck] + public string ConnectionString { get; set; } + [AmqpCheck] + [Optional] + public string AlternativeConnectionString { get; set; } + public string Exchange { get; set; } + } +} From 8e517e6124ca31fa9658cd0a1c679f23bffc5287 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Fri, 15 Jan 2021 20:17:09 +0400 Subject: [PATCH 28/60] intermediate commit - mapping is finished --- .../Antares.Job.History.csproj | 1 - .../AutoMapper/CashTransferConverter.cs | 37 --- .../AutoMapper/ExecutionConverter.cs | 2 +- .../AutoMapper/ServiceProfile.cs | 18 +- src/Antares.Job.History/Modules/CqrsModule.cs | 19 -- .../Events/ExecutionProcessedEvent.cs | 19 ++ .../Events/OrderCancelledEvent.cs | 34 +++ .../Events/OrderPlacedEvent.cs | 38 +++ .../RabbitSubscribers/MeRabbitSubscriber.cs | 229 +++++++++--------- .../Models/Enums/OrderSide.cs | 9 + .../Models/Enums/OrderStatus.cs | 14 ++ .../Models/Enums/OrderType.cs | 10 + .../Models/Enums/TradeRole.cs | 9 + .../RabbitSubscribers/Models/OrderModel.cs | 77 ++++++ .../RabbitSubscribers/Models/TradeModel.cs | 55 +++++ .../ExecutionQueueReader.cs | 3 +- .../OrderEventQueueReader.cs | 3 +- .../Workflow/Projections/CashInProjection.cs | 35 --- .../Workflow/Projections/CashOutProjection.cs | 35 --- .../Projections/CashTransferProjection.cs | 37 --- .../Repositories/HistoryRecordsRepository.cs | 1 + .../Antares.Service.History.csproj | 1 - .../AutoMapper/ServiceProfile.cs | 2 +- .../Antares.Service.History.Tests.csproj | 1 - .../CashinTests.cs | 104 ++++---- .../CashoutTests.cs | 122 +++++----- .../Init/TestInitialization.cs | 19 -- .../TransferTests.cs | 154 ++++++------ 28 files changed, 582 insertions(+), 506 deletions(-) delete mode 100644 src/Antares.Job.History/AutoMapper/CashTransferConverter.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderSide.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderStatus.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderType.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Models/Enums/TradeRole.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Models/OrderModel.cs create mode 100644 src/Antares.Job.History/RabbitSubscribers/Models/TradeModel.cs delete mode 100644 src/Antares.Job.History/Workflow/Projections/CashInProjection.cs delete mode 100644 src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs delete mode 100644 src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index ba27bf3..d02a306 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -36,7 +36,6 @@ - diff --git a/src/Antares.Job.History/AutoMapper/CashTransferConverter.cs b/src/Antares.Job.History/AutoMapper/CashTransferConverter.cs deleted file mode 100644 index 0a25330..0000000 --- a/src/Antares.Job.History/AutoMapper/CashTransferConverter.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using Antares.Service.History.Core.Domain.History; -using AutoMapper; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; - -namespace Antares.Job.History.AutoMapper -{ - public class CashTransferConverter : ITypeConverter> - { - public IEnumerable Convert(CashTransferProcessedEvent source, IEnumerable destination, - ResolutionContext context) - { - yield return new Cashout - { - Id = source.OperationId, - WalletId = source.FromWalletId, - Volume = -Math.Abs(source.Volume), - Timestamp = source.Timestamp, - AssetId = source.AssetId, - FeeSize = source.FromWalletId == source.FeeSourceWalletId ? source.FeeSize : null, - State = Antares.Service.History.Core.Domain.Enums.HistoryState.Finished - }; - - yield return new Cashin - { - Id = source.OperationId, - WalletId = source.ToWalletId, - Volume = Math.Abs(source.Volume), - Timestamp = source.Timestamp, - AssetId = source.AssetId, - FeeSize = source.ToWalletId == source.FeeSourceWalletId ? source.FeeSize : null, - State = Antares.Service.History.Core.Domain.Enums.HistoryState.Finished - }; - } - } -} diff --git a/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs b/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs index 05ffd0a..db8bfad 100644 --- a/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs +++ b/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; +using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; namespace Antares.Job.History.AutoMapper { diff --git a/src/Antares.Job.History/AutoMapper/ServiceProfile.cs b/src/Antares.Job.History/AutoMapper/ServiceProfile.cs index ab27084..b5c2164 100644 --- a/src/Antares.Job.History/AutoMapper/ServiceProfile.cs +++ b/src/Antares.Job.History/AutoMapper/ServiceProfile.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Contracts.Cqrs.Commands; using Antares.Service.History.Contracts.History; using Antares.Service.History.Core; @@ -7,9 +8,8 @@ using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; -using TradeModel = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.TradeModel; +using OrderModel = Antares.Job.History.RabbitSubscribers.Models.OrderModel; +using TradeModel = Antares.Job.History.RabbitSubscribers.Models.TradeModel; namespace Antares.Job.History.AutoMapper { @@ -17,18 +17,6 @@ public class ServiceProfile : Profile { public ServiceProfile() { - CreateMap() - .ForMember(x => x.Id, o => o.MapFrom(s => s.OperationId)) - .ForMember(x => x.State, o => o.UseValue(HistoryState.Finished)) - .ForMember(x => x.Volume, o => o.MapFrom(s => Math.Abs(s.Volume))); - - CreateMap() - .ForMember(x => x.Id, o => o.MapFrom(s => s.OperationId)) - .ForMember(x => x.State, o => o.UseValue(HistoryState.Finished)) - .ForMember(x => x.Volume, o => o.MapFrom(s => -Math.Abs(s.Volume))); - - CreateMap>().ConvertUsing(); - CreateMap(); CreateMap(); diff --git a/src/Antares.Job.History/Modules/CqrsModule.cs b/src/Antares.Job.History/Modules/CqrsModule.cs index 1568164..841fece 100644 --- a/src/Antares.Job.History/Modules/CqrsModule.cs +++ b/src/Antares.Job.History/Modules/CqrsModule.cs @@ -23,8 +23,6 @@ using Lykke.Messaging.Contract; using Lykke.Messaging.RabbitMq; using Lykke.Messaging.Serialization; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Lykke.SettingsReader; using RabbitMQ.Client; @@ -67,9 +65,6 @@ protected override void Load(ContainerBuilder builder) .WithParameter(new NamedParameter("batchCount", _settings.PostgresOrdersBatchSize)) .SingleInstance(); - builder.RegisterType(); - builder.RegisterType(); - builder.RegisterType(); builder.RegisterType(); builder.RegisterType(); @@ -129,20 +124,6 @@ private CqrsEngine CreateEngine( Register.EventInterceptors(new DefaultEventLoggingInterceptor(ctx.Resolve())), Register.BoundedContext(HistoryBoundedContext.Name) - .ListeningEvents(typeof(CashInProcessedEvent)) - .From(PostProcessingBoundedContext.Name) - .On(defaultRoute) - .WithProjection(typeof(CashInProjection), PostProcessingBoundedContext.Name) - - .ListeningEvents(typeof(CashOutProcessedEvent)) - .From(PostProcessingBoundedContext.Name) - .On(defaultRoute) - .WithProjection(typeof(CashOutProjection), PostProcessingBoundedContext.Name) - - .ListeningEvents(typeof(CashTransferProcessedEvent)) - .From(PostProcessingBoundedContext.Name) - .On(defaultRoute) - .WithProjection(typeof(CashTransferProjection), PostProcessingBoundedContext.Name) .ListeningEvents(typeof(CashoutCompletedEvent), typeof(CashinCompletedEvent)) .From(BitcoinBoundedContext.Name) diff --git a/src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs b/src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs new file mode 100644 index 0000000..7885d25 --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using ProtoBuf; +using OrderModel = Antares.Job.History.RabbitSubscribers.Models.OrderModel; + +namespace Antares.Job.History.RabbitSubscribers.Events +{ + /// + /// Exectuion processed event + /// + [ProtoContract] + public class ExecutionProcessedEvent + { + [ProtoMember(1, IsRequired = true)] + public IReadOnlyList Orders { get; set; } + + [ProtoMember(2, IsRequired = true)] + public long SequenceNumber { get; set; } + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs b/src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs new file mode 100644 index 0000000..df43dfc --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs @@ -0,0 +1,34 @@ +using System; +using ProtoBuf; +using OrderStatus = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderStatus; + +namespace Antares.Job.History.RabbitSubscribers.Events +{ + /// + /// An order was cancelled. + /// + [ProtoContract] + public class OrderCancelledEvent + { + [ProtoMember(1, IsRequired = true)] + public Guid OrderId { get; set; } + + [ProtoMember(2, IsRequired = true)] + public Guid WalletId { get; set; } + + [ProtoMember(3, IsRequired = true)] + public OrderStatus Status { get; set; } + + [ProtoMember(4, IsRequired = true)] + public string AssetPairId { get; set; } + + [ProtoMember(5, IsRequired = false)] + public decimal? Price { get; set; } + + [ProtoMember(6, IsRequired = true)] + public decimal Volume { get; set; } + + [ProtoMember(7, IsRequired = true)] + public DateTime Timestamp { get; set; } + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs b/src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs new file mode 100644 index 0000000..2c76eca --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs @@ -0,0 +1,38 @@ +using System; +using ProtoBuf; +using OrderStatus = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderStatus; + +namespace Antares.Job.History.RabbitSubscribers.Events +{ + /// + /// An order was placed. + /// + [ProtoContract] + public class OrderPlacedEvent + { + [ProtoMember(1, IsRequired = true)] + public Guid OrderId { get; set; } + + [ProtoMember(2, IsRequired = true)] + public Guid WalletId { get; set; } + + [ProtoMember(3, IsRequired = true)] + public OrderStatus Status { get; set; } + + [ProtoMember(4, IsRequired = true)] + public string AssetPairId { get; set; } + + [ProtoMember(5, IsRequired = false)] + public decimal? Price { get; set; } + + [ProtoMember(6, IsRequired = true)] + public decimal Volume { get; set; } + + [ProtoMember(7, IsRequired = true)] + public DateTime Timestamp { get; set; } + + [ProtoMember(8, IsRequired = true)] + public DateTime CreateDt { get; set; } + + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs index d615a04..3eddf43 100644 --- a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs +++ b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Settings; @@ -15,13 +16,16 @@ using Lykke.MatchingEngine.Connector.Models.Events; using Lykke.RabbitMqBroker; using Lykke.RabbitMqBroker.Deduplication; +using Lykke.RabbitMqBroker.Publisher; using Lykke.RabbitMqBroker.Subscriber; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums; -using OrderStatus = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderStatus; -using OrderType = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType; -using TradeRole = Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.TradeRole; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using OrderModel = Antares.Job.History.RabbitSubscribers.Models.OrderModel; +using OrderSide = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderSide; +using OrderStatus = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderStatus; +using OrderType = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderType; +using TradeModel = Antares.Job.History.RabbitSubscribers.Models.TradeModel; +using TradeRole = Antares.Job.History.RabbitSubscribers.Models.Enums.TradeRole; +using Utils = Antares.Service.History.Core.Utils; namespace Antares.Job.History.RabbitSubscribers { @@ -30,6 +34,7 @@ public class MeRabbitSubscriber : IStartable, IStopable { [NotNull] private readonly ILogFactory _logFactory; private readonly RabbitMqSettings _rabbitMqSettings; + [NotNull] private readonly CqrsSettings _cqrsSettings; private readonly ICqrsEngine _cqrsEngine; private readonly List _subscribers = new List(); private readonly IDeduplicator _deduplicator; @@ -37,24 +42,33 @@ public class MeRabbitSubscriber : IStartable, IStopable private readonly IReadOnlyList _walletIds; private readonly ILog _log; - private const string QueueName = "lykke.spot.matching.engine.out.events.post-processing"; + private const string QueueName = "lykke.spot.matching.engine.out.events.antares-history"; private const bool QueueDurable = true; public MeRabbitSubscriber( [NotNull] ILogFactory logFactory, [NotNull] RabbitMqSettings rabbitMqSettings, + [NotNull] CqrsSettings cqrsSettings, [NotNull] ICqrsEngine cqrsEngine, [NotNull] IDeduplicator deduplicator, - IHistoryRecordsRepository _historyRecordsRepository, + IHistoryRecordsRepository historyRecordsRepository, IReadOnlyList walletIds) { _logFactory = logFactory ?? throw new ArgumentNullException(nameof(logFactory)); _log = _logFactory.CreateLog(this); _rabbitMqSettings = rabbitMqSettings ?? throw new ArgumentNullException(nameof(rabbitMqSettings)); + _cqrsSettings = cqrsSettings ?? throw new ArgumentNullException(nameof(cqrsSettings)); _cqrsEngine = cqrsEngine ?? throw new ArgumentNullException(nameof(cqrsEngine)); _deduplicator = deduplicator ?? throw new ArgumentNullException(nameof(deduplicator)); - this._historyRecordsRepository = _historyRecordsRepository; + _historyRecordsRepository = historyRecordsRepository; _walletIds = walletIds; + var rabbitPublisher = new RabbitMqPublisher(_logFactory, new RabbitMqSubscriptionSettings() + { + ConnectionString = cqrsSettings.RabbitConnString, + ExchangeName = _rabbitMqSettings.Exchange, + RoutingKey = nameof(ExecutionProcessedEvent), + IsDurable = QueueDurable + }); } public void Start() @@ -150,10 +164,10 @@ private async Task ProcessMessageAsync(CashTransferEvent message) var volume = decimal.Parse(message.CashTransfer.Volume); var timestamp = message.Header.Timestamp; var assetId = message.CashTransfer.AssetId; - var feeSourceWalletId = fee != null ? Guid.Parse(fee.SourceWalletId) : (Guid?) null; + var feeSourceWalletId = fee != null ? Guid.Parse(fee.SourceWalletId) : (Guid?)null; var feeSize = ParseNullabe(fee?.Volume); - var cashInOuts = new BaseHistoryRecord[] { + var cashInOuts = new BaseHistoryRecord[] { new Cashout() { Id = operationId, @@ -185,29 +199,35 @@ private async Task ProcessMessageAsync(CashTransferEvent message) private Task ProcessMessageAsync(ExecutionEvent message) { - var orders = message.Orders.Select(x => new OrderModel + var orders = message.Orders.Select(x => { - Id = Guid.Parse(x.ExternalId), - WalletId = Guid.Parse(x.WalletId), - Volume = decimal.Parse(x.Volume), - AssetPairId = x.AssetPairId, - CreateDt = x.CreatedAt, - LowerLimitPrice = ParseNullabe(x.LowerLimitPrice), - LowerPrice = ParseNullabe(x.LowerPrice), - MatchDt = x.LastMatchTime, - MatchingId = Guid.Parse(x.Id), - Price = ParseNullabe(x.Price), - RegisterDt = x.Registered, - RejectReason = x.RejectReason, - RemainingVolume = ParseNullabe(x.RemainingVolume), - Side = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderSide)(int)x.Side, - Status = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderStatus)(int)x.Status, - StatusDt = x.StatusDate, - Straight = x.OrderType == OrderType.Limit || x.OrderType == OrderType.StopLimit || x.Straight, - Type = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType)(int)x.OrderType, - UpperLimitPrice = ParseNullabe(x.UpperLimitPrice), - UpperPrice = ParseNullabe(x.UpperPrice), - Trades = x.Trades?.Select(t => new TradeModel + var order = new Antares.Service.History.Core.Domain.Orders.Order + { + Id = Guid.Parse(x.ExternalId), + WalletId = Guid.Parse(x.WalletId), + Volume = decimal.Parse(x.Volume), + AssetPairId = x.AssetPairId, + CreateDt = x.CreatedAt, + LowerLimitPrice = ParseNullabe(x.LowerLimitPrice), + LowerPrice = ParseNullabe(x.LowerPrice), + MatchDt = x.LastMatchTime, + MatchingId = Guid.Parse(x.Id), + Price = ParseNullabe(x.Price), + RegisterDt = x.Registered, + RejectReason = x.RejectReason, + RemainingVolume = ParseNullabe(x.RemainingVolume) ?? 0m, + Side = (Antares.Service.History.Core.Domain.Enums.OrderSide)(int)x.Side, + Status = (Antares.Service.History.Core.Domain.Enums.OrderStatus)(int)x.Status, + StatusDt = x.StatusDate, + Straight = x.OrderType == Lykke.MatchingEngine.Connector.Models.Events.OrderType.Limit || + x.OrderType == Lykke.MatchingEngine.Connector.Models.Events.OrderType.StopLimit || x.Straight, + SequenceNumber = message.Header.SequenceNumber, + Type = (Antares.Service.History.Core.Domain.Enums.OrderType)(int)x.OrderType, + UpperLimitPrice = ParseNullabe(x.UpperLimitPrice), + UpperPrice = ParseNullabe(x.UpperPrice), + }; + + order.Trades = x.Trades?.Select(t => new Antares.Service.History.Core.Domain.History.Trade() { Id = Guid.Parse(t.TradeId), WalletId = Guid.Parse(x.WalletId), @@ -219,11 +239,14 @@ private Task ProcessMessageAsync(ExecutionEvent message) QuotingAssetId = t.QuotingAssetId, QuotingVolume = decimal.Parse(t.QuotingVolume), Index = t.Index, - Role = (Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.TradeRole)(int)t.Role, + Role = (Antares.Service.History.Core.Domain.Enums.TradeRole)(int)t.Role, FeeSize = ParseNullabe(t.Fees?.FirstOrDefault()?.Volume), FeeAssetId = t.Fees?.FirstOrDefault()?.AssetId, - OppositeWalletId = Guid.Parse(t.OppositeWalletId), - }).ToList() + OrderId = order.Id + //OppositeWalletId = Guid.Parse(t.OppositeWalletId), + }).ToList(); + + return order; }).ToList(); foreach (var order in orders.Where(x => _walletIds.Contains(x.WalletId.ToString()))) @@ -231,90 +254,76 @@ private Task ProcessMessageAsync(ExecutionEvent message) _log.Info("Order from ME", $"order: {new { order.Id, order.Status, message.Header.SequenceNumber }.ToJson()}"); } - var @event = new ExecutionProcessedEvent - { - SequenceNumber = message.Header.SequenceNumber, - Orders = orders - }; - _cqrsEngine.PublishEvent(@event, BoundedContext.Name); + var limitOrders = orders.Where(x => x.Type == Antares.Service.History.Core.Domain.Enums.OrderType.Limit || + x.Type == Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit).ToList(); + var historyOrders = new List(limitOrders.Count); - foreach (var order in orders.Where(x => x.Trades != null && x.Trades.Any())) - { - var tradeProcessedEvent = new ManualOrderTradeProcessedEvent - { - Order = order - }; - _cqrsEngine.PublishEvent(tradeProcessedEvent, BoundedContext.Name); - } - foreach (var order in message.Orders.Where(x => x.Trades != null && x.Trades.Count > 0)) + + foreach (var order in limitOrders) { - var orderType = order.OrderType == OrderType.Market ? FeeOperationType.Trade : FeeOperationType.LimitTrade; - var orderId = order.Id; - foreach (var trade in order.Trades) + switch (order.Status) { - if (trade.Fees != null) + case Service.History.Core.Domain.Enums.OrderStatus.Cancelled: + { + var orderEvent = new OrderEvent() + { + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price ?? 0, + Timestamp = order.StatusDt, + Volume = order.Volume, + WalletId = order.WalletId, + Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Cancelled) + }; + + historyOrders.Add(orderEvent); + + break; + } + case Service.History.Core.Domain.Enums.OrderStatus.Placed: { - var feeEvent = new FeeChargedEvent + var orderEvent = new OrderEvent() { - OperationId = orderId, - OperationType = orderType, - Fee = trade.Fees.ToJson() + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price ?? 0, + Timestamp = order.CreateDt, + Volume = order.Volume, + WalletId = order.WalletId, + Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Placed) }; - _cqrsEngine.PublishEvent(feeEvent, BoundedContext.Name); - } - } - } - var limitOrders = orders.Where(x => x.Type == Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType.Limit || - x.Type == Lykke.Service.PostProcessing.Contracts.Cqrs.Models.Enums.OrderType.StopLimit).ToList(); - foreach (var order in limitOrders.Where(x => x.Status == OrderStatus.Cancelled)) - { - var orderCancelledEvent = new OrderCancelledEvent - { - OrderId = order.Id, - Status = order.Status, - AssetPairId = order.AssetPairId, - Price = order.Price, - Timestamp = order.StatusDt, - Volume = order.Volume, - WalletId = order.WalletId - }; - _cqrsEngine.PublishEvent(orderCancelledEvent, BoundedContext.Name); - } + historyOrders.Add(orderEvent); - foreach (var order in limitOrders.Where(x => x.Status == OrderStatus.Placed)) - { - var orderPlacedEvent = new OrderPlacedEvent - { - OrderId = order.Id, - Status = order.Status, - AssetPairId = order.AssetPairId, - Price = order.Price, - Timestamp = order.StatusDt, - Volume = order.Volume, - WalletId = order.WalletId, - CreateDt = order.CreateDt - }; - _cqrsEngine.PublishEvent(orderPlacedEvent, BoundedContext.Name); - } + break; + } + case Service.History.Core.Domain.Enums.OrderStatus.Matched: + case Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched: + { + if (!order.Trades.Any(t => t.Role == Service.History.Core.Domain.Enums.TradeRole.Taker)) + break; + var orderEvent = new OrderEvent() + { + OrderId = order.Id, + Status = Service.History.Core.Domain.Enums.OrderStatus.Placed, + AssetPairId = order.AssetPairId, + Price = order.Price ?? 0, + Timestamp = order.CreateDt, + Volume = order.Volume, + WalletId = order.WalletId, + Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Placed) + }; - foreach (var order in limitOrders.Where(x => - (x.Status == OrderStatus.Matched || x.Status == OrderStatus.PartiallyMatched) - && x.Trades.Any(t => t.Role == TradeRole.Taker))) - { - var orderPlacedEvent = new OrderPlacedEvent - { - OrderId = order.Id, - Status = order.Status, - AssetPairId = order.AssetPairId, - Price = order.Price, - Timestamp = order.StatusDt, - Volume = order.Volume, - WalletId = order.WalletId, - CreateDt = order.CreateDt - }; - _cqrsEngine.PublishEvent(orderPlacedEvent, BoundedContext.Name); + historyOrders.Add(orderEvent); + + break; + } + default: + continue; + } } return Task.CompletedTask; diff --git a/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderSide.cs b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderSide.cs new file mode 100644 index 0000000..f40e279 --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderSide.cs @@ -0,0 +1,9 @@ +namespace Antares.Job.History.RabbitSubscribers.Models.Enums +{ + public enum OrderSide + { + Unknown, + Buy, + Sell + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderStatus.cs b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderStatus.cs new file mode 100644 index 0000000..a837e2a --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderStatus.cs @@ -0,0 +1,14 @@ +namespace Antares.Job.History.RabbitSubscribers.Models.Enums +{ + public enum OrderStatus + { + Unknown, + Placed, + PartiallyMatched, + Matched, + Pending, + Cancelled, + Replaced, + Rejected + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderType.cs b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderType.cs new file mode 100644 index 0000000..35e4be3 --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/OrderType.cs @@ -0,0 +1,10 @@ +namespace Antares.Job.History.RabbitSubscribers.Models.Enums +{ + public enum OrderType + { + Unknown, + Market, + Limit, + StopLimit + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Models/Enums/TradeRole.cs b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/TradeRole.cs new file mode 100644 index 0000000..564d1fa --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Models/Enums/TradeRole.cs @@ -0,0 +1,9 @@ +namespace Antares.Job.History.RabbitSubscribers.Models.Enums +{ + public enum TradeRole + { + Unknown, + Maker, + Taker + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Models/OrderModel.cs b/src/Antares.Job.History/RabbitSubscribers/Models/OrderModel.cs new file mode 100644 index 0000000..4156ebb --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Models/OrderModel.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using Antares.Job.History.RabbitSubscribers.Models.Enums; +using ProtoBuf; + +namespace Antares.Job.History.RabbitSubscribers.Models +{ + /// + /// Executed order + /// + [ProtoContract] + public class OrderModel + { + [ProtoMember(1, IsRequired = true)] + public Guid Id { get; set; } + + [ProtoMember(2, IsRequired = true)] + public Guid MatchingId { get; set; } + + [ProtoMember(3, IsRequired = true)] + public Guid WalletId { get; set; } + + [ProtoMember(4, IsRequired = true)] + public OrderType Type { get; set; } + + [ProtoMember(5, IsRequired = true)] + public OrderSide Side { get; set; } + + [ProtoMember(6, IsRequired = true)] + public OrderStatus Status { get; set; } + + [ProtoMember(7, IsRequired = true)] + public string AssetPairId { get; set; } + + [ProtoMember(8, IsRequired = true)] + public decimal Volume { get; set; } + + [ProtoMember(9, IsRequired = false)] + public decimal? Price { get; set; } + + [ProtoMember(10, IsRequired = true)] + public DateTime CreateDt { get; set; } + + [ProtoMember(11, IsRequired = true)] + public DateTime RegisterDt { get; set; } + + [ProtoMember(12, IsRequired = true)] + public DateTime StatusDt { get; set; } + + [ProtoMember(13, IsRequired = false)] + public DateTime? MatchDt { get; set; } + + [ProtoMember(14, IsRequired = false)] + public decimal? RemainingVolume { get; set; } + + [ProtoMember(15, IsRequired = true)] + public string RejectReason { get; set; } + + [ProtoMember(16, IsRequired = false)] + public decimal? LowerLimitPrice { get; set; } + + [ProtoMember(17, IsRequired = false)] + public decimal? LowerPrice { get; set; } + + [ProtoMember(18, IsRequired = false)] + public decimal? UpperLimitPrice { get; set; } + + [ProtoMember(19, IsRequired = false)] + public decimal? UpperPrice { get; set; } + + [ProtoMember(20, IsRequired = true)] + public bool Straight { get; set; } = true; + + [ProtoMember(21, IsRequired = false)] + public IReadOnlyCollection Trades { get; set; } = new List(); + } +} diff --git a/src/Antares.Job.History/RabbitSubscribers/Models/TradeModel.cs b/src/Antares.Job.History/RabbitSubscribers/Models/TradeModel.cs new file mode 100644 index 0000000..f4c0eec --- /dev/null +++ b/src/Antares.Job.History/RabbitSubscribers/Models/TradeModel.cs @@ -0,0 +1,55 @@ +using System; +using Antares.Job.History.RabbitSubscribers.Models.Enums; +using ProtoBuf; + +namespace Antares.Job.History.RabbitSubscribers.Models +{ + /// + /// User trade item + /// + [ProtoContract] + public class TradeModel + { + [ProtoMember(1, IsRequired = true)] + public Guid Id { get; set; } + + [ProtoMember(2, IsRequired = true)] + public Guid WalletId { get; set; } + + [ProtoMember(3, IsRequired = true)] + public string AssetPairId { get; set; } + + [ProtoMember(4, IsRequired = true)] + public string BaseAssetId { get; set; } + + [ProtoMember(5, IsRequired = true)] + public decimal BaseVolume { get; set; } + + [ProtoMember(6, IsRequired = true)] + public decimal Price { get; set; } + + [ProtoMember(7, IsRequired = true)] + public DateTime Timestamp { get; set; } + + [ProtoMember(8, IsRequired = true)] + public string QuotingAssetId { get; set; } + + [ProtoMember(9, IsRequired = true)] + public decimal QuotingVolume { get; set; } + + [ProtoMember(10, IsRequired = true)] + public int Index { get; set; } + + [ProtoMember(11, IsRequired = true)] + public TradeRole Role { get; set; } + + [ProtoMember(12, IsRequired = false)] + public decimal? FeeSize { get; set; } + + [ProtoMember(13, IsRequired = false)] + public string FeeAssetId { get; set; } + + [ProtoMember(14, IsRequired = true)] + public Guid OppositeWalletId { get; set; } + } +} diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs index 0203983..87e027a 100644 --- a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs @@ -2,14 +2,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; using Common; using Lykke.Common.Log; using Lykke.RabbitMqBroker.Subscriber; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using MoreLinq; using RabbitMQ.Client; using RabbitMQ.Client.Events; diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs index a9a10a3..ee69aeb 100644 --- a/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs @@ -2,13 +2,12 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Core.Domain.History; using AutoMapper; using Common; using Lykke.Common.Log; using Lykke.RabbitMqBroker.Subscriber; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using RabbitMQ.Client; using RabbitMQ.Client.Events; diff --git a/src/Antares.Job.History/Workflow/Projections/CashInProjection.cs b/src/Antares.Job.History/Workflow/Projections/CashInProjection.cs deleted file mode 100644 index 019eedc..0000000 --- a/src/Antares.Job.History/Workflow/Projections/CashInProjection.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Threading.Tasks; -using Antares.Service.History.Core.Domain.History; -using AutoMapper; -using Common.Log; -using Lykke.Common.Log; -using Lykke.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; - -namespace Antares.Job.History.Workflow.Projections -{ - public class CashInProjection - { - private readonly IHistoryRecordsRepository _historyRecordsRepository; - private readonly ILog _logger; - - public CashInProjection(IHistoryRecordsRepository historyRecordsRepository, ILogFactory logFactory) - { - _historyRecordsRepository = historyRecordsRepository; - _logger = logFactory.CreateLog(this); - } - - public async Task Handle(CashInProcessedEvent @event) - { - var entity = Mapper.Map(@event); - - if (!await _historyRecordsRepository.TryInsertAsync(entity)) - _logger.Warning($"Skipped duplicated cashin record", context: new - { - id = @event.OperationId - }); - - return CommandHandlingResult.Ok(); - } - } -} diff --git a/src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs b/src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs deleted file mode 100644 index 7dbf539..0000000 --- a/src/Antares.Job.History/Workflow/Projections/CashOutProjection.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Threading.Tasks; -using Antares.Service.History.Core.Domain.History; -using AutoMapper; -using Common.Log; -using Lykke.Common.Log; -using Lykke.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; - -namespace Antares.Job.History.Workflow.Projections -{ - public class CashOutProjection - { - private readonly IHistoryRecordsRepository _historyRecordsRepository; - private readonly ILog _logger; - - public CashOutProjection(IHistoryRecordsRepository historyRecordsRepository, ILogFactory logFactory) - { - _historyRecordsRepository = historyRecordsRepository; - _logger = logFactory.CreateLog(this); - } - - public async Task Handle(CashOutProcessedEvent @event) - { - var entity = Mapper.Map(@event); - - if (!await _historyRecordsRepository.TryInsertAsync(entity)) - _logger.Warning($"Skipped duplicated cashout record", context: new - { - id = @event.OperationId - }); - - return CommandHandlingResult.Ok(); - } - } -} diff --git a/src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs b/src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs deleted file mode 100644 index 83a5dc3..0000000 --- a/src/Antares.Job.History/Workflow/Projections/CashTransferProjection.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Antares.Service.History.Core.Domain.History; -using AutoMapper; -using Common.Log; -using Lykke.Common.Log; -using Lykke.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; - -namespace Antares.Job.History.Workflow.Projections -{ - public class CashTransferProjection - { - private readonly IHistoryRecordsRepository _historyRecordsRepository; - private readonly ILog _logger; - - public CashTransferProjection(IHistoryRecordsRepository historyRecordsRepository, ILogFactory logFactory) - { - _historyRecordsRepository = historyRecordsRepository; - _logger = logFactory.CreateLog(this); - } - - public async Task Handle(CashTransferProcessedEvent @event) - { - var cashInOuts = Mapper.Map>(@event); - - foreach (var cashInOut in cashInOuts) - if (!await _historyRecordsRepository.TryInsertAsync(cashInOut)) - _logger.Warning($"Skipped duplicated transfer record", context: new - { - id = @event.OperationId - }); - - return CommandHandlingResult.Ok(); - } - } -} diff --git a/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs b/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs index 69ed46b..f6641b9 100644 --- a/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs +++ b/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs @@ -81,6 +81,7 @@ public async Task InsertBulkAsync(IEnumerable records) try { + //TODO: Save Async BulkMapping.SaveAll(connection, baseHistoryRecords.Select(HistoryTypeMapper.Map)); } catch (PostgresException e) when (e.SqlState == DuplicateSqlState) diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index 85f9602..d2b1880 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -32,7 +32,6 @@ - diff --git a/src/Antares.Service.History/AutoMapper/ServiceProfile.cs b/src/Antares.Service.History/AutoMapper/ServiceProfile.cs index fdca475..5c75b57 100644 --- a/src/Antares.Service.History/AutoMapper/ServiceProfile.cs +++ b/src/Antares.Service.History/AutoMapper/ServiceProfile.cs @@ -1,8 +1,8 @@ using Antares.Service.History.Contracts.History; +using Antares.Service.History.Contracts.Orders; using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Domain.Orders; using AutoMapper; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Models; namespace Antares.Service.History.AutoMapper { diff --git a/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj b/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj index 1a164b5..d643463 100644 --- a/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj +++ b/tests/Antares.Service.History.Tests/Antares.Service.History.Tests.csproj @@ -5,7 +5,6 @@ - diff --git a/tests/Antares.Service.History.Tests/CashinTests.cs b/tests/Antares.Service.History.Tests/CashinTests.cs index b9306a5..5e3c9b7 100644 --- a/tests/Antares.Service.History.Tests/CashinTests.cs +++ b/tests/Antares.Service.History.Tests/CashinTests.cs @@ -1,66 +1,66 @@ -using System; -using System.Threading.Tasks; -using Antares.Service.History.Core.Domain.History; -using Antares.Service.History.Tests.Init; -using Autofac; -using Lykke.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -using Xunit; +//using System; +//using System.Threading.Tasks; +//using Antares.Service.History.Core.Domain.History; +//using Antares.Service.History.Tests.Init; +//using Autofac; +//using Lykke.Cqrs; +//using Lykke.Service.PostProcessing.Contracts.Cqrs; +//using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; +//using Xunit; -namespace Antares.Service.History.Tests -{ - [Collection("history-tests")] - public class CashinTests - { - public CashinTests(TestInitialization initialization) - { - _container = initialization.Container; - } +//namespace Antares.Service.History.Tests +//{ +// [Collection("history-tests")] +// public class CashinTests +// { +// public CashinTests(TestInitialization initialization) +// { +// _container = initialization.Container; +// } - private readonly IContainer _container; +// private readonly IContainer _container; - private CashInProcessedEvent CreateCashinRecord() - { - var cqrs = _container.Resolve(); +// private CashInProcessedEvent CreateCashinRecord() +// { +// var cqrs = _container.Resolve(); - var id = Guid.NewGuid(); - var clientId = Guid.NewGuid(); - var volume = 54.31M; +// var id = Guid.NewGuid(); +// var clientId = Guid.NewGuid(); +// var volume = 54.31M; - var @event = new CashInProcessedEvent - { - OperationId = id, - WalletId = clientId, - Volume = volume, - AssetId = "EUR", - Timestamp = DateTime.UtcNow, - FeeSize = 10 - }; +// var @event = new CashInProcessedEvent +// { +// OperationId = id, +// WalletId = clientId, +// Volume = volume, +// AssetId = "EUR", +// Timestamp = DateTime.UtcNow, +// FeeSize = 10 +// }; - cqrs.PublishEvent(@event, PostProcessingBoundedContext.Name); +// cqrs.PublishEvent(@event, PostProcessingBoundedContext.Name); - return @event; - } +// return @event; +// } - [Fact] - public async Task SaveCashin_Test() - { - var command = CreateCashinRecord(); +// [Fact] +// public async Task SaveCashin_Test() +// { +// var command = CreateCashinRecord(); - await Task.Delay(3000); +// await Task.Delay(3000); - var repo = _container.Resolve(); +// var repo = _container.Resolve(); - var item = await repo.GetAsync(command.OperationId, command.WalletId); +// var item = await repo.GetAsync(command.OperationId, command.WalletId); - Assert.NotNull(item); - Assert.True(item is Cashin); +// Assert.NotNull(item); +// Assert.True(item is Cashin); - var cashin = item as Cashin; +// var cashin = item as Cashin; - Assert.Equal(command.FeeSize, cashin.FeeSize); - Assert.Equal(Math.Abs(command.Volume), cashin.Volume); - } - } -} +// Assert.Equal(command.FeeSize, cashin.FeeSize); +// Assert.Equal(Math.Abs(command.Volume), cashin.Volume); +// } +// } +//} diff --git a/tests/Antares.Service.History.Tests/CashoutTests.cs b/tests/Antares.Service.History.Tests/CashoutTests.cs index 2ec554e..351108b 100644 --- a/tests/Antares.Service.History.Tests/CashoutTests.cs +++ b/tests/Antares.Service.History.Tests/CashoutTests.cs @@ -1,61 +1,61 @@ -using System; -using System.Threading.Tasks; -using Antares.Service.History.Core.Domain.History; -using Antares.Service.History.Tests.Init; -using Autofac; -using Lykke.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -using Xunit; - -namespace Antares.Service.History.Tests -{ - [Collection("history-tests")] - public class CashoutTests - { - public CashoutTests(TestInitialization initialization) - { - _container = initialization.Container; - } - - private readonly IContainer _container; - - private CashOutProcessedEvent CreateCashoutRecord() - { - var cqrs = _container.Resolve(); - - var id = Guid.NewGuid(); - var clientId = Guid.NewGuid(); - var volume = 54.31M; - - var @event = new CashOutProcessedEvent - { - OperationId = id, - WalletId = clientId, - Volume = volume, - AssetId = "EUR", - Timestamp = DateTime.UtcNow - }; - - cqrs.PublishEvent(@event, PostProcessingBoundedContext.Name); - - return @event; - } - - [Fact] - public async Task SaveCashout_Test() - { - var command = CreateCashoutRecord(); - - await Task.Delay(3000); - - var repo = _container.Resolve(); - - var item = await repo.GetAsync(command.OperationId, command.WalletId); - - Assert.NotNull(item); - Assert.True(item is Cashout); - Assert.Equal(-Math.Abs(command.Volume), (item as Cashout).Volume); - } - } -} +//using System; +//using System.Threading.Tasks; +//using Antares.Service.History.Core.Domain.History; +//using Antares.Service.History.Tests.Init; +//using Autofac; +//using Lykke.Cqrs; +//using Lykke.Service.PostProcessing.Contracts.Cqrs; +//using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; +//using Xunit; + +//namespace Antares.Service.History.Tests +//{ +// [Collection("history-tests")] +// public class CashoutTests +// { +// public CashoutTests(TestInitialization initialization) +// { +// _container = initialization.Container; +// } + +// private readonly IContainer _container; + +// private CashOutProcessedEvent CreateCashoutRecord() +// { +// var cqrs = _container.Resolve(); + +// var id = Guid.NewGuid(); +// var clientId = Guid.NewGuid(); +// var volume = 54.31M; + +// var @event = new CashOutProcessedEvent +// { +// OperationId = id, +// WalletId = clientId, +// Volume = volume, +// AssetId = "EUR", +// Timestamp = DateTime.UtcNow +// }; + +// cqrs.PublishEvent(@event, PostProcessingBoundedContext.Name); + +// return @event; +// } + +// [Fact] +// public async Task SaveCashout_Test() +// { +// var command = CreateCashoutRecord(); + +// await Task.Delay(3000); + +// var repo = _container.Resolve(); + +// var item = await repo.GetAsync(command.OperationId, command.WalletId); + +// Assert.NotNull(item); +// Assert.True(item is Cashout); +// Assert.Equal(-Math.Abs(command.Volume), (item as Cashout).Volume); +// } +// } +//} diff --git a/tests/Antares.Service.History.Tests/Init/TestInitialization.cs b/tests/Antares.Service.History.Tests/Init/TestInitialization.cs index 4c22e81..98a15c0 100644 --- a/tests/Antares.Service.History.Tests/Init/TestInitialization.cs +++ b/tests/Antares.Service.History.Tests/Init/TestInitialization.cs @@ -19,8 +19,6 @@ using Lykke.Logs.Loggers.LykkeConsole; using Lykke.Messaging; using Lykke.Messaging.Contract; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; using Lykke.SettingsReader.ReloadingManager; using Xunit; @@ -58,10 +56,6 @@ public IContainer CreateContainer() builder.Register(context => new AutofacDependencyResolver(context)).As() .SingleInstance(); - builder.RegisterType(); - builder.RegisterType(); - builder.RegisterType(); - builder.RegisterType(); builder.Register(ctx => @@ -131,19 +125,6 @@ private CqrsEngine CreateEngine( new DefaultEndpointProvider(), true, Register.DefaultEndpointResolver(new InMemoryEndpointResolver()), - Register.BoundedContext(PostProcessingBoundedContext.Name) - .PublishingEvents(typeof(CashInProcessedEvent)) - .With(defaultRoute) - .WithLoopback() - .WithProjection(typeof(CashInProjection), PostProcessingBoundedContext.Name) - .PublishingEvents(typeof(CashOutProcessedEvent)) - .With(defaultRoute) - .WithLoopback() - .WithProjection(typeof(CashOutProjection), PostProcessingBoundedContext.Name) - .PublishingEvents(typeof(CashTransferProcessedEvent)) - .With(defaultRoute) - .WithLoopback() - .WithProjection(typeof(CashTransferProjection), PostProcessingBoundedContext.Name), Register.BoundedContext(HistoryBoundedContext.Name) .ListeningCommands(typeof(CreateForwardCashinCommand), typeof(DeleteForwardCashinCommand)) diff --git a/tests/Antares.Service.History.Tests/TransferTests.cs b/tests/Antares.Service.History.Tests/TransferTests.cs index 164491e..95803dd 100644 --- a/tests/Antares.Service.History.Tests/TransferTests.cs +++ b/tests/Antares.Service.History.Tests/TransferTests.cs @@ -1,77 +1,77 @@ -using System; -using System.Threading.Tasks; -using Antares.Service.History.Core.Domain.History; -using Antares.Service.History.Tests.Init; -using Autofac; -using Lykke.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs; -using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; -using Xunit; - -namespace Antares.Service.History.Tests -{ - [Collection("history-tests")] - public class TransferTests - { - public TransferTests(TestInitialization initialization) - { - _container = initialization.Container; - } - - private readonly IContainer _container; - - private CashTransferProcessedEvent CreateTransferRecord() - { - var cqrs = _container.Resolve(); - - var id = Guid.NewGuid(); - var walletFrom = Guid.NewGuid(); - var walletTo = Guid.NewGuid(); - var volume = new Random().Next(1, 100); - - var @event = new CashTransferProcessedEvent - { - OperationId = id, - FromWalletId = walletFrom, - ToWalletId = walletTo, - Volume = volume, - AssetId = "EUR", - Timestamp = DateTime.UtcNow, - FeeSize = 0.5M, - FeeSourceWalletId = walletTo - }; - - cqrs.PublishEvent(@event, PostProcessingBoundedContext.Name); - - return @event; - } - - [Fact] - public async Task SaveTransfer_Test() - { - var command = CreateTransferRecord(); - - await Task.Delay(3000); - - var repo = _container.Resolve(); - - var itemFrom = await repo.GetAsync(command.OperationId, command.FromWalletId); - var itemTo = await repo.GetAsync(command.OperationId, command.ToWalletId); - - Assert.NotNull(itemFrom); - Assert.NotNull(itemTo); - - Assert.True(itemFrom is Cashout); - Assert.True(itemTo is Cashin); - - var transferFrom = itemFrom as Cashout; - var transferTo = itemTo as Cashin; - - Assert.Equal(-Math.Abs(command.Volume), transferFrom.Volume); - Assert.Equal(Math.Abs(command.Volume), transferTo.Volume); - - Assert.Null(transferFrom.FeeSize); - Assert.Equal(command.FeeSize, transferTo.FeeSize); - } - } -} +//using System; +//using System.Threading.Tasks; +//using Antares.Service.History.Core.Domain.History; +//using Antares.Service.History.Tests.Init; +//using Autofac; +//using Lykke.Cqrs; +//using Lykke.Service.PostProcessing.Contracts.Cqrs; +//using Lykke.Service.PostProcessing.Contracts.Cqrs.Events; +//using Xunit; + +//namespace Antares.Service.History.Tests +//{ +// [Collection("history-tests")] +// public class TransferTests +// { +// public TransferTests(TestInitialization initialization) +// { +// _container = initialization.Container; +// } + +// private readonly IContainer _container; + +// private CashTransferProcessedEvent CreateTransferRecord() +// { +// var cqrs = _container.Resolve(); + +// var id = Guid.NewGuid(); +// var walletFrom = Guid.NewGuid(); +// var walletTo = Guid.NewGuid(); +// var volume = new Random().Next(1, 100); + +// var @event = new CashTransferProcessedEvent +// { +// OperationId = id, +// FromWalletId = walletFrom, +// ToWalletId = walletTo, +// Volume = volume, +// AssetId = "EUR", +// Timestamp = DateTime.UtcNow, +// FeeSize = 0.5M, +// FeeSourceWalletId = walletTo +// }; + +// cqrs.PublishEvent(@event, PostProcessingBoundedContext.Name); + +// return @event; +// } + +// [Fact] +// public async Task SaveTransfer_Test() +// { +// var command = CreateTransferRecord(); + +// await Task.Delay(3000); + +// var repo = _container.Resolve(); + +// var itemFrom = await repo.GetAsync(command.OperationId, command.FromWalletId); +// var itemTo = await repo.GetAsync(command.OperationId, command.ToWalletId); + +// Assert.NotNull(itemFrom); +// Assert.NotNull(itemTo); + +// Assert.True(itemFrom is Cashout); +// Assert.True(itemTo is Cashin); + +// var transferFrom = itemFrom as Cashout; +// var transferTo = itemTo as Cashin; + +// Assert.Equal(-Math.Abs(command.Volume), transferFrom.Volume); +// Assert.Equal(Math.Abs(command.Volume), transferTo.Volume); + +// Assert.Null(transferFrom.FeeSize); +// Assert.Equal(command.FeeSize, transferTo.FeeSize); +// } +// } +//} From 45a8df670210ad086d0a57801a03fff854296f5d Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Mon, 18 Jan 2021 13:13:48 +0400 Subject: [PATCH 29/60] updated --- settings.yaml | 12 ++ .../AutoMapper/ExecutionConverter.cs | 26 --- .../AutoMapper/ServiceProfile.cs | 14 -- src/Antares.Job.History/Modules/CqrsModule.cs | 21 +- .../Events/ExecutionProcessedEvent.cs | 19 -- .../Events/OrderCancelledEvent.cs | 34 --- .../Events/OrderPlacedEvent.cs | 38 ---- .../RabbitSubscribers/MeRabbitSubscriber.cs | 150 ------------- src/Antares.Job.History/ShutdownManager.cs | 7 +- src/Antares.Job.History/StartupManager.cs | 7 +- .../ExecutionEventHandler.cs | 201 ++++++++++++++++++ .../ExecutionQueueReader.cs | 64 ++---- .../OrderEventQueueReader.cs | 95 --------- .../Settings/HistorySettings.cs | 6 + 14 files changed, 254 insertions(+), 440 deletions(-) delete mode 100644 src/Antares.Job.History/AutoMapper/ExecutionConverter.cs delete mode 100644 src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs delete mode 100644 src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs delete mode 100644 src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs create mode 100644 src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs delete mode 100644 src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs diff --git a/settings.yaml b/settings.yaml index a9b54d7..8fadd5a 100644 --- a/settings.yaml +++ b/settings.yaml @@ -6,6 +6,18 @@ HistoryService: settings-key: HistoryService-LogsConnString types: - AzureTableStorage + MatchingEngineRabbit: + ConnectionString: + settings-key: MatchingEngineRabbitMqConnectionString + types: + - RabbitMq + AlternativeConnectionString: + settings-key: AlternateMatchingEngineRabbitMqConnectionString + types: + - RabbitMq + - Optional + Exchange: + settings-key: MatchingEngineSpotEventsExchange Cqrs: RabbitConnString: settings-key: CqrsRabbitConnString diff --git a/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs b/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs deleted file mode 100644 index db8bfad..0000000 --- a/src/Antares.Job.History/AutoMapper/ExecutionConverter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using Antares.Job.History.RabbitSubscribers.Events; -using Antares.Service.History.Core.Domain.Orders; -using AutoMapper; - -namespace Antares.Job.History.AutoMapper -{ - public class ExecutionConverter : ITypeConverter> - { - public IEnumerable Convert(ExecutionProcessedEvent source, IEnumerable destination, - ResolutionContext context) - { - foreach (var item in source.Orders) - { - var order = Mapper.Map(item); - - order.SequenceNumber = source.SequenceNumber; - - foreach (var trade in order.Trades) - trade.OrderId = order.Id; - - yield return order; - } - } - } -} diff --git a/src/Antares.Job.History/AutoMapper/ServiceProfile.cs b/src/Antares.Job.History/AutoMapper/ServiceProfile.cs index b5c2164..f47df29 100644 --- a/src/Antares.Job.History/AutoMapper/ServiceProfile.cs +++ b/src/Antares.Job.History/AutoMapper/ServiceProfile.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; -using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Contracts.Cqrs.Commands; using Antares.Service.History.Contracts.History; -using Antares.Service.History.Core; using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Domain.Orders; @@ -21,17 +18,6 @@ public ServiceProfile() CreateMap(); - CreateMap>().ConvertUsing(); - - CreateMap() - .ForMember(x => x.Status, o => o.UseValue(OrderStatus.Placed)) - .ForMember(x => x.Id, o => o.MapFrom(s => Utils.IncrementGuid(s.OrderId, (int)OrderStatus.Placed))) - .ForMember(x => x.Timestamp, o => o.MapFrom(s => s.CreateDt)); - - CreateMap() - .ForMember(x => x.Status, o => o.UseValue(OrderStatus.Cancelled)) - .ForMember(x => x.Id, o => o.MapFrom(s => Utils.IncrementGuid(s.OrderId, (int)OrderStatus.Cancelled))); - CreateMap() .ForMember(x => x.Id, o => o.MapFrom(s => s.OperationId)) .ForMember(x => x.State, o => o.UseValue(HistoryState.Finished)) diff --git a/src/Antares.Job.History/Modules/CqrsModule.cs b/src/Antares.Job.History/Modules/CqrsModule.cs index 841fece..4cc76dd 100644 --- a/src/Antares.Job.History/Modules/CqrsModule.cs +++ b/src/Antares.Job.History/Modules/CqrsModule.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Antares.Job.History.RabbitSubscribers; using Antares.Job.History.Workflow.ExecutionProcessing; using Antares.Job.History.Workflow.Handlers; using Antares.Job.History.Workflow.Projections; @@ -39,6 +40,18 @@ public CqrsModule(IReloadingManager settingsManager) protected override void Load(ContainerBuilder builder) { + builder + .RegisterType() + .WithParameter(TypedParameter.From(_settings.MatchingEngineRabbit)) + .WithParameter(TypedParameter.From(_settings.WalletIdsToLog)) + .SingleInstance(); + + builder.RegisterType() + .As() + .SingleInstance() + .WithParameter(TypedParameter.From(_settings.MatchingEngineRabbit)) + .WithParameter(TypedParameter.From(_settings.WalletIdsToLog)); + builder.Register(context => new AutofacDependencyResolver(context)).As() .SingleInstance(); @@ -54,13 +67,7 @@ protected override void Load(ContainerBuilder builder) builder.RegisterType() .WithParameter(TypedParameter.From(_settings.Cqrs.RabbitConnString)) .WithParameter(TypedParameter.From(_settings.WalletIdsToLog)) - .WithParameter(new NamedParameter("prefetchCount", _settings.RabbitPrefetchCount)) - .WithParameter(new NamedParameter("batchCount", _settings.PostgresOrdersBatchSize)) - .SingleInstance(); - - builder.RegisterType() - .WithParameter(TypedParameter.From(_settings.Cqrs.RabbitConnString)) - .WithParameter(TypedParameter.From(_settings.WalletIdsToLog)) + .WithParameter(TypedParameter.From(_settings.)) .WithParameter(new NamedParameter("prefetchCount", _settings.RabbitPrefetchCount)) .WithParameter(new NamedParameter("batchCount", _settings.PostgresOrdersBatchSize)) .SingleInstance(); diff --git a/src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs b/src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs deleted file mode 100644 index 7885d25..0000000 --- a/src/Antares.Job.History/RabbitSubscribers/Events/ExecutionProcessedEvent.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using ProtoBuf; -using OrderModel = Antares.Job.History.RabbitSubscribers.Models.OrderModel; - -namespace Antares.Job.History.RabbitSubscribers.Events -{ - /// - /// Exectuion processed event - /// - [ProtoContract] - public class ExecutionProcessedEvent - { - [ProtoMember(1, IsRequired = true)] - public IReadOnlyList Orders { get; set; } - - [ProtoMember(2, IsRequired = true)] - public long SequenceNumber { get; set; } - } -} diff --git a/src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs b/src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs deleted file mode 100644 index df43dfc..0000000 --- a/src/Antares.Job.History/RabbitSubscribers/Events/OrderCancelledEvent.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using ProtoBuf; -using OrderStatus = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderStatus; - -namespace Antares.Job.History.RabbitSubscribers.Events -{ - /// - /// An order was cancelled. - /// - [ProtoContract] - public class OrderCancelledEvent - { - [ProtoMember(1, IsRequired = true)] - public Guid OrderId { get; set; } - - [ProtoMember(2, IsRequired = true)] - public Guid WalletId { get; set; } - - [ProtoMember(3, IsRequired = true)] - public OrderStatus Status { get; set; } - - [ProtoMember(4, IsRequired = true)] - public string AssetPairId { get; set; } - - [ProtoMember(5, IsRequired = false)] - public decimal? Price { get; set; } - - [ProtoMember(6, IsRequired = true)] - public decimal Volume { get; set; } - - [ProtoMember(7, IsRequired = true)] - public DateTime Timestamp { get; set; } - } -} diff --git a/src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs b/src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs deleted file mode 100644 index 2c76eca..0000000 --- a/src/Antares.Job.History/RabbitSubscribers/Events/OrderPlacedEvent.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using ProtoBuf; -using OrderStatus = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderStatus; - -namespace Antares.Job.History.RabbitSubscribers.Events -{ - /// - /// An order was placed. - /// - [ProtoContract] - public class OrderPlacedEvent - { - [ProtoMember(1, IsRequired = true)] - public Guid OrderId { get; set; } - - [ProtoMember(2, IsRequired = true)] - public Guid WalletId { get; set; } - - [ProtoMember(3, IsRequired = true)] - public OrderStatus Status { get; set; } - - [ProtoMember(4, IsRequired = true)] - public string AssetPairId { get; set; } - - [ProtoMember(5, IsRequired = false)] - public decimal? Price { get; set; } - - [ProtoMember(6, IsRequired = true)] - public decimal Volume { get; set; } - - [ProtoMember(7, IsRequired = true)] - public DateTime Timestamp { get; set; } - - [ProtoMember(8, IsRequired = true)] - public DateTime CreateDt { get; set; } - - } -} diff --git a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs index 3eddf43..657b574 100644 --- a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs +++ b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs @@ -2,12 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Antares.Job.History.RabbitSubscribers.Events; using Antares.Service.History.Core.Domain.Enums; using Antares.Service.History.Core.Domain.History; using Antares.Service.History.Core.Settings; using Autofac; -using AutoMapper; using Common; using Common.Log; using JetBrains.Annotations; @@ -16,15 +14,7 @@ using Lykke.MatchingEngine.Connector.Models.Events; using Lykke.RabbitMqBroker; using Lykke.RabbitMqBroker.Deduplication; -using Lykke.RabbitMqBroker.Publisher; using Lykke.RabbitMqBroker.Subscriber; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using OrderModel = Antares.Job.History.RabbitSubscribers.Models.OrderModel; -using OrderSide = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderSide; -using OrderStatus = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderStatus; -using OrderType = Antares.Job.History.RabbitSubscribers.Models.Enums.OrderType; -using TradeModel = Antares.Job.History.RabbitSubscribers.Models.TradeModel; -using TradeRole = Antares.Job.History.RabbitSubscribers.Models.Enums.TradeRole; using Utils = Antares.Service.History.Core.Utils; namespace Antares.Job.History.RabbitSubscribers @@ -62,13 +52,6 @@ public MeRabbitSubscriber( _deduplicator = deduplicator ?? throw new ArgumentNullException(nameof(deduplicator)); _historyRecordsRepository = historyRecordsRepository; _walletIds = walletIds; - var rabbitPublisher = new RabbitMqPublisher(_logFactory, new RabbitMqSubscriptionSettings() - { - ConnectionString = cqrsSettings.RabbitConnString, - ExchangeName = _rabbitMqSettings.Exchange, - RoutingKey = nameof(ExecutionProcessedEvent), - IsDurable = QueueDurable - }); } public void Start() @@ -76,7 +59,6 @@ public void Start() _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.CashIn, ProcessMessageAsync)); _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.CashOut, ProcessMessageAsync)); _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.CashTransfer, ProcessMessageAsync)); - _subscribers.Add(Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.Order, ProcessMessageAsync)); } private RabbitMqSubscriber Subscribe(Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType messageType, Func func) @@ -197,138 +179,6 @@ private async Task ProcessMessageAsync(CashTransferEvent message) }); } - private Task ProcessMessageAsync(ExecutionEvent message) - { - var orders = message.Orders.Select(x => - { - var order = new Antares.Service.History.Core.Domain.Orders.Order - { - Id = Guid.Parse(x.ExternalId), - WalletId = Guid.Parse(x.WalletId), - Volume = decimal.Parse(x.Volume), - AssetPairId = x.AssetPairId, - CreateDt = x.CreatedAt, - LowerLimitPrice = ParseNullabe(x.LowerLimitPrice), - LowerPrice = ParseNullabe(x.LowerPrice), - MatchDt = x.LastMatchTime, - MatchingId = Guid.Parse(x.Id), - Price = ParseNullabe(x.Price), - RegisterDt = x.Registered, - RejectReason = x.RejectReason, - RemainingVolume = ParseNullabe(x.RemainingVolume) ?? 0m, - Side = (Antares.Service.History.Core.Domain.Enums.OrderSide)(int)x.Side, - Status = (Antares.Service.History.Core.Domain.Enums.OrderStatus)(int)x.Status, - StatusDt = x.StatusDate, - Straight = x.OrderType == Lykke.MatchingEngine.Connector.Models.Events.OrderType.Limit || - x.OrderType == Lykke.MatchingEngine.Connector.Models.Events.OrderType.StopLimit || x.Straight, - SequenceNumber = message.Header.SequenceNumber, - Type = (Antares.Service.History.Core.Domain.Enums.OrderType)(int)x.OrderType, - UpperLimitPrice = ParseNullabe(x.UpperLimitPrice), - UpperPrice = ParseNullabe(x.UpperPrice), - }; - - order.Trades = x.Trades?.Select(t => new Antares.Service.History.Core.Domain.History.Trade() - { - Id = Guid.Parse(t.TradeId), - WalletId = Guid.Parse(x.WalletId), - AssetPairId = x.AssetPairId, - BaseAssetId = t.BaseAssetId, - BaseVolume = decimal.Parse(t.BaseVolume), - Price = decimal.Parse(t.Price), - Timestamp = t.Timestamp, - QuotingAssetId = t.QuotingAssetId, - QuotingVolume = decimal.Parse(t.QuotingVolume), - Index = t.Index, - Role = (Antares.Service.History.Core.Domain.Enums.TradeRole)(int)t.Role, - FeeSize = ParseNullabe(t.Fees?.FirstOrDefault()?.Volume), - FeeAssetId = t.Fees?.FirstOrDefault()?.AssetId, - OrderId = order.Id - //OppositeWalletId = Guid.Parse(t.OppositeWalletId), - }).ToList(); - - return order; - }).ToList(); - - foreach (var order in orders.Where(x => _walletIds.Contains(x.WalletId.ToString()))) - { - _log.Info("Order from ME", $"order: {new { order.Id, order.Status, message.Header.SequenceNumber }.ToJson()}"); - } - - var limitOrders = orders.Where(x => x.Type == Antares.Service.History.Core.Domain.Enums.OrderType.Limit || - x.Type == Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit).ToList(); - var historyOrders = new List(limitOrders.Count); - - - - foreach (var order in limitOrders) - { - switch (order.Status) - { - case Service.History.Core.Domain.Enums.OrderStatus.Cancelled: - { - var orderEvent = new OrderEvent() - { - OrderId = order.Id, - Status = order.Status, - AssetPairId = order.AssetPairId, - Price = order.Price ?? 0, - Timestamp = order.StatusDt, - Volume = order.Volume, - WalletId = order.WalletId, - Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Cancelled) - }; - - historyOrders.Add(orderEvent); - - break; - } - case Service.History.Core.Domain.Enums.OrderStatus.Placed: - { - var orderEvent = new OrderEvent() - { - OrderId = order.Id, - Status = order.Status, - AssetPairId = order.AssetPairId, - Price = order.Price ?? 0, - Timestamp = order.CreateDt, - Volume = order.Volume, - WalletId = order.WalletId, - Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Placed) - }; - - historyOrders.Add(orderEvent); - - break; - } - case Service.History.Core.Domain.Enums.OrderStatus.Matched: - case Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched: - { - if (!order.Trades.Any(t => t.Role == Service.History.Core.Domain.Enums.TradeRole.Taker)) - break; - var orderEvent = new OrderEvent() - { - OrderId = order.Id, - Status = Service.History.Core.Domain.Enums.OrderStatus.Placed, - AssetPairId = order.AssetPairId, - Price = order.Price ?? 0, - Timestamp = order.CreateDt, - Volume = order.Volume, - WalletId = order.WalletId, - Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Placed) - }; - - historyOrders.Add(orderEvent); - - break; - } - default: - continue; - } - } - - return Task.CompletedTask; - } - private decimal? ParseNullabe(string value) { return !string.IsNullOrEmpty(value) ? decimal.Parse(value) : (decimal?)null; diff --git a/src/Antares.Job.History/ShutdownManager.cs b/src/Antares.Job.History/ShutdownManager.cs index 662108a..06d5ae9 100644 --- a/src/Antares.Job.History/ShutdownManager.cs +++ b/src/Antares.Job.History/ShutdownManager.cs @@ -7,21 +7,16 @@ namespace Antares.Job.History public class ShutdownManager : IShutdownManager { private readonly ExecutionQueueReader _executionQueueReader; - private readonly OrderEventQueueReader _orderEventQueueReader; public ShutdownManager( - ExecutionQueueReader executionQueueReader, - OrderEventQueueReader orderEventQueueReader - ) + ExecutionQueueReader executionQueueReader) { _executionQueueReader = executionQueueReader; - _orderEventQueueReader = orderEventQueueReader; } public Task StopAsync() { _executionQueueReader.Stop(); - _orderEventQueueReader.Stop(); return Task.CompletedTask; } diff --git a/src/Antares.Job.History/StartupManager.cs b/src/Antares.Job.History/StartupManager.cs index f6761ba..12c0ea1 100644 --- a/src/Antares.Job.History/StartupManager.cs +++ b/src/Antares.Job.History/StartupManager.cs @@ -9,23 +9,18 @@ public class StartupManager : IStartupManager { private readonly ICqrsEngine _cqrsEngine; private readonly ExecutionQueueReader _executionQueueReader; - private readonly OrderEventQueueReader _orderEventQueueReader; public StartupManager( ICqrsEngine cqrsEngine, - ExecutionQueueReader executionQueueReader, - OrderEventQueueReader orderEventQueueReader - ) + ExecutionQueueReader executionQueueReader) { _cqrsEngine = cqrsEngine; _executionQueueReader = executionQueueReader; - _orderEventQueueReader = orderEventQueueReader; } public Task StartAsync() { _executionQueueReader.Start(); - _orderEventQueueReader.Start(); _cqrsEngine.StartSubscribers(); return Task.CompletedTask; diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs new file mode 100644 index 0000000..e7e5a46 --- /dev/null +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs @@ -0,0 +1,201 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Antares.Service.History.Core; +using Antares.Service.History.Core.Domain.History; +using Antares.Service.History.Core.Domain.Orders; +using Antares.Service.History.Core.Settings; +using Common; +using Common.Log; +using JetBrains.Annotations; +using Lykke.Common.Log; +using Lykke.MatchingEngine.Connector.Models.Events; +using MoreLinq; +using Utils = Antares.Service.History.Core.Utils; + +namespace Antares.Job.History.Workflow.ExecutionProcessing +{ + public class ExecutionEventHandler + { + private const int TradesBulkSize = 5000; + + private readonly IHistoryRecordsRepository _historyRecordsRepository; + private readonly IOrdersRepository _ordersRepository; + private readonly IReadOnlyList _walletIds; + private readonly ILog _log; + + public ExecutionEventHandler( + [NotNull] ILogFactory logFactory, + IHistoryRecordsRepository historyRecordsRepository, + IOrdersRepository ordersRepository, + IReadOnlyList walletIds) + { + _log = logFactory.CreateLog(nameof(ExecutionEventHandler)); + _historyRecordsRepository = historyRecordsRepository; + _ordersRepository = ordersRepository; + _walletIds = walletIds; + } + + public async Task HandleAsync(IReadOnlyCollection executionEvents) + { + var pairs = executionEvents.Select(Map).ToArray(); + var orders = pairs.SelectMany(x => x.Orders).ToList(); + var orderEvents = pairs.SelectMany(x => x.OrderEvent).ToList(); + var batchId = Guid.NewGuid().ToString(); + + foreach (var order in orders.Where(x => _walletIds.Contains(x.WalletId.ToString()))) + { + _log.Info("Saving order (ProcessBatch)", context: $"order: {new { order.Id, order.Status, order.SequenceNumber, batchId }.ToJson()}"); + } + + await _ordersRepository.UpsertBulkAsync(orders); + + var trades = orders.SelectMany(x => x.Trades); + + var batched = trades.Batch(TradesBulkSize).ToList(); + + foreach (var tradesBatch in batched) + await _historyRecordsRepository.InsertBulkAsync(tradesBatch); + + await _historyRecordsRepository.InsertBulkAsync(orderEvents); + } + + private (IReadOnlyCollection Orders, IReadOnlyCollection OrderEvent) + Map(ExecutionEvent executionEvent) + { + var orders = executionEvent.Orders.Select(x => + { + var order = new Antares.Service.History.Core.Domain.Orders.Order + { + Id = Guid.Parse(x.ExternalId), + WalletId = Guid.Parse(x.WalletId), + Volume = decimal.Parse(x.Volume), + AssetPairId = x.AssetPairId, + CreateDt = x.CreatedAt, + LowerLimitPrice = ParseNullabe(x.LowerLimitPrice), + LowerPrice = ParseNullabe(x.LowerPrice), + MatchDt = x.LastMatchTime, + MatchingId = Guid.Parse(x.Id), + Price = ParseNullabe(x.Price), + RegisterDt = x.Registered, + RejectReason = x.RejectReason, + RemainingVolume = ParseNullabe(x.RemainingVolume) ?? 0m, + Side = (Antares.Service.History.Core.Domain.Enums.OrderSide)(int)x.Side, + Status = (Antares.Service.History.Core.Domain.Enums.OrderStatus)(int)x.Status, + StatusDt = x.StatusDate, + Straight = x.OrderType == Lykke.MatchingEngine.Connector.Models.Events.OrderType.Limit || + x.OrderType == Lykke.MatchingEngine.Connector.Models.Events.OrderType.StopLimit || x.Straight, + SequenceNumber = executionEvent.Header.SequenceNumber, + Type = (Antares.Service.History.Core.Domain.Enums.OrderType)(int)x.OrderType, + UpperLimitPrice = ParseNullabe(x.UpperLimitPrice), + UpperPrice = ParseNullabe(x.UpperPrice), + }; + + order.Trades = x.Trades?.Select(t => new Antares.Service.History.Core.Domain.History.Trade() + { + Id = Guid.Parse(t.TradeId), + WalletId = Guid.Parse(x.WalletId), + AssetPairId = x.AssetPairId, + BaseAssetId = t.BaseAssetId, + BaseVolume = decimal.Parse(t.BaseVolume), + Price = decimal.Parse(t.Price), + Timestamp = t.Timestamp, + QuotingAssetId = t.QuotingAssetId, + QuotingVolume = decimal.Parse(t.QuotingVolume), + Index = t.Index, + Role = (Antares.Service.History.Core.Domain.Enums.TradeRole)(int)t.Role, + FeeSize = ParseNullabe(t.Fees?.FirstOrDefault()?.Volume), + FeeAssetId = t.Fees?.FirstOrDefault()?.AssetId, + OrderId = order.Id + //OppositeWalletId = Guid.Parse(t.OppositeWalletId), + }).ToList(); + + return order; + }).ToList(); + + foreach (var order in orders.Where(x => _walletIds.Contains(x.WalletId.ToString()))) + { + _log.Info("Order from ME", $"order: {new { order.Id, order.Status, executionEvent.Header.SequenceNumber }.ToJson()}"); + } + + var limitOrders = orders.Where(x => x.Type == Antares.Service.History.Core.Domain.Enums.OrderType.Limit || + x.Type == Antares.Service.History.Core.Domain.Enums.OrderType.StopLimit).ToList(); + var historyOrders = new List(limitOrders.Count); + + foreach (var order in limitOrders) + { + switch (order.Status) + { + case Service.History.Core.Domain.Enums.OrderStatus.Cancelled: + { + var orderEvent = new OrderEvent() + { + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price ?? 0, + Timestamp = order.StatusDt, + Volume = order.Volume, + WalletId = order.WalletId, + Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Cancelled) + }; + + historyOrders.Add(orderEvent); + + break; + } + case Service.History.Core.Domain.Enums.OrderStatus.Placed: + { + var orderEvent = new OrderEvent() + { + OrderId = order.Id, + Status = order.Status, + AssetPairId = order.AssetPairId, + Price = order.Price ?? 0, + Timestamp = order.CreateDt, + Volume = order.Volume, + WalletId = order.WalletId, + Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Placed) + }; + + historyOrders.Add(orderEvent); + + break; + } + case Service.History.Core.Domain.Enums.OrderStatus.Matched: + case Service.History.Core.Domain.Enums.OrderStatus.PartiallyMatched: + { + if (!order.Trades.Any(t => t.Role == Service.History.Core.Domain.Enums.TradeRole.Taker)) + break; + var orderEvent = new OrderEvent() + { + OrderId = order.Id, + Status = Service.History.Core.Domain.Enums.OrderStatus.Placed, + AssetPairId = order.AssetPairId, + Price = order.Price ?? 0, + Timestamp = order.CreateDt, + Volume = order.Volume, + WalletId = order.WalletId, + Id = Utils.IncrementGuid(order.Id, (int)Service.History.Core.Domain.Enums.OrderStatus.Placed) + }; + + historyOrders.Add(orderEvent); + + break; + } + default: + continue; + } + } + + return (orders, historyOrders); + } + + private decimal? ParseNullabe(string value) + { + return !string.IsNullOrEmpty(value) ? decimal.Parse(value) : (decimal?)null; + } + } +} diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs index 87e027a..99d60bc 100644 --- a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs @@ -2,49 +2,45 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Antares.Job.History.RabbitSubscribers.Events; -using Antares.Service.History.Core.Domain.History; -using Antares.Service.History.Core.Domain.Orders; -using AutoMapper; +using Antares.Service.History.Core.Settings; using Common; using Lykke.Common.Log; +using Lykke.MatchingEngine.Connector.Models.Events; using Lykke.RabbitMqBroker.Subscriber; -using MoreLinq; using RabbitMQ.Client; using RabbitMQ.Client.Events; namespace Antares.Job.History.Workflow.ExecutionProcessing { - public class ExecutionQueueReader : BaseBatchQueueReader> + public class ExecutionQueueReader : BaseBatchQueueReader { - private const int TradesBulkSize = 5000; - - private readonly IHistoryRecordsRepository _historyRecordsRepository; - private readonly IOrdersRepository _ordersRepository; + private readonly RabbitMqSettings _rabbitMqSettings; + private readonly ExecutionEventHandler _executionEventHandler; public ExecutionQueueReader( ILogFactory logFactory, string connectionString, - IHistoryRecordsRepository historyRecordsRepository, - IOrdersRepository ordersRepository, int prefetchCount, int batchCount, - IReadOnlyList walletIds) + IReadOnlyList walletIds, + RabbitMqSettings rabbitMqSettings, + ExecutionEventHandler executionEventHandler) : base(logFactory, connectionString, prefetchCount, batchCount, walletIds) { - _historyRecordsRepository = historyRecordsRepository; - _ordersRepository = ordersRepository; + _rabbitMqSettings = rabbitMqSettings; + _executionEventHandler = executionEventHandler; } - protected override string ExchangeName => $"lykke.{PostProcessingBoundedContext.Name}.events.exchange"; + protected override string ExchangeName => _rabbitMqSettings.Exchange; - protected override string QueueName => $"lykke.history.queue.{PostProcessingBoundedContext.Name}.events.execution-reader"; + protected override string QueueName => + $"lykke.spot.matching.engine.out.events.antares-history.{Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.Order}"; - protected override string[] RoutingKeys => new[] { nameof(ExecutionProcessedEvent) }; + protected override string[] RoutingKeys => new[] { ((int)Lykke.MatchingEngine.Connector.Models.Events.Common.MessageType.Order).ToString() }; protected override EventHandler CreateOnMessageReceivedEventHandler(IModel channel) { - var deserializer = new ProtobufMessageDeserializer(); + var deserializer = new ProtobufMessageDeserializer(); void OnMessageReceived(object o, BasicDeliverEventArgs basicDeliverEventArgs) { @@ -52,14 +48,7 @@ void OnMessageReceived(object o, BasicDeliverEventArgs basicDeliverEventArgs) { var message = deserializer.Deserialize(basicDeliverEventArgs.Body); - var orders = Mapper.Map>(message).ToList(); - - foreach (var order in orders.Where(x => WalletIds.Contains(x.WalletId.ToString()))) - { - Log.Info("Order from ME (ExecutionProcessedEvent)", context: $"order: {new {order.Id, order.Status, order.SequenceNumber}.ToJson()}"); - } - - Queue.Enqueue(new CustomQueueItem>(orders, + Queue.Enqueue(new CustomQueueItem(message, basicDeliverEventArgs.DeliveryTag, channel)); } catch (Exception e) @@ -73,24 +62,9 @@ void OnMessageReceived(object o, BasicDeliverEventArgs basicDeliverEventArgs) return OnMessageReceived; } - protected override async Task ProcessBatch(IList>> batch) + protected override async Task ProcessBatch(IList> batch) { - var orders = batch.SelectMany(x => x.Value).ToList(); - var batchId = Guid.NewGuid().ToString(); - - foreach (var order in orders.Where(x => WalletIds.Contains(x.WalletId.ToString()))) - { - Log.Info("Saving order (ProcessBatch)", context: $"order: {new {order.Id, order.Status, order.SequenceNumber, batchId}.ToJson()}"); - } - - await _ordersRepository.UpsertBulkAsync(orders); - - var trades = orders.SelectMany(x => x.Trades); - - var batched = trades.Batch(TradesBulkSize).ToList(); - - foreach (var tradesBatch in batched) - await _historyRecordsRepository.InsertBulkAsync(tradesBatch); + await _executionEventHandler.HandleAsync(batch.Select(x => x.Value).ToArray()); } protected override void LogQueue() @@ -99,7 +73,7 @@ protected override void LogQueue() { if (Queue.TryDequeue(out var item)) { - var orders = item.Value.Select(x => new {x.Id, x.Status, x.SequenceNumber}).ToList() + var orders = item.Value.Orders.Select(x => new {x.Id, x.Status, item.Value.Header.SequenceNumber}).ToList() .ToJson(); Log.Info("Orders in queue on shutdown", context: $"orders: {orders}"); diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs deleted file mode 100644 index ee69aeb..0000000 --- a/src/Antares.Job.History/Workflow/ExecutionProcessing/OrderEventQueueReader.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Antares.Job.History.RabbitSubscribers.Events; -using Antares.Service.History.Core.Domain.History; -using AutoMapper; -using Common; -using Lykke.Common.Log; -using Lykke.RabbitMqBroker.Subscriber; -using RabbitMQ.Client; -using RabbitMQ.Client.Events; - -namespace Antares.Job.History.Workflow.ExecutionProcessing -{ - public class OrderEventQueueReader : BaseBatchQueueReader - { - private readonly IHistoryRecordsRepository _historyRecordsRepository; - - public OrderEventQueueReader( - ILogFactory logFactory, - string connectionString, - IHistoryRecordsRepository historyRecordsRepository, - int prefetchCount, - int batchCount, - IReadOnlyList walletIds) - : base(logFactory, connectionString, prefetchCount, batchCount, walletIds) - { - _historyRecordsRepository = historyRecordsRepository; - } - - protected override string ExchangeName => $"lykke.{PostProcessingBoundedContext.Name}.events.exchange"; - - protected override string QueueName => $"lykke.history.queue.{PostProcessingBoundedContext.Name}.events.order-event-reader"; - - protected override string[] RoutingKeys => new[] { nameof(OrderPlacedEvent), nameof(OrderCancelledEvent) }; - - protected override EventHandler CreateOnMessageReceivedEventHandler(IModel channel) - { - var orderPlacedDeserializer = new ProtobufMessageDeserializer(); - var orderCancelledDeserializer = new ProtobufMessageDeserializer(); - - void OnMessageReceived(object o, BasicDeliverEventArgs basicDeliverEventArgs) - { - try - { - switch (basicDeliverEventArgs.RoutingKey) - { - case nameof(OrderPlacedEvent): - Queue.Enqueue(new CustomQueueItem( - Mapper.Map( - orderPlacedDeserializer.Deserialize(basicDeliverEventArgs.Body)), - basicDeliverEventArgs.DeliveryTag, channel)); - break; - case nameof(OrderCancelledEvent): - Queue.Enqueue(new CustomQueueItem( - Mapper.Map( - orderCancelledDeserializer.Deserialize(basicDeliverEventArgs.Body)), - basicDeliverEventArgs.DeliveryTag, channel)); - break; - default: - throw new ArgumentOutOfRangeException(basicDeliverEventArgs.RoutingKey); - } - - } - catch (Exception e) - { - Log.Error(e); - - channel.BasicReject(basicDeliverEventArgs.DeliveryTag, false); - } - } - - return OnMessageReceived; - } - - protected override Task ProcessBatch(IList> batch) - { - return _historyRecordsRepository.InsertBulkAsync(batch.Select(x => x.Value)); - } - - protected override void LogQueue() - { - while (Queue.Count > 0) - { - if (Queue.TryDequeue(out var item)) - { - var order = $"order: {new {item.Value.Id, item.Value.Status}.ToJson()}"; - - Log.Info("Orders in queue on shutdown", context: order); - } - } - } - } -} diff --git a/src/Antares.Service.History.Core/Settings/HistorySettings.cs b/src/Antares.Service.History.Core/Settings/HistorySettings.cs index cbe9396..d6e0b7b 100644 --- a/src/Antares.Service.History.Core/Settings/HistorySettings.cs +++ b/src/Antares.Service.History.Core/Settings/HistorySettings.cs @@ -12,6 +12,12 @@ public class HistorySettings public CqrsSettings Cqrs { get; set; } + public RabbitMqSettings MatchingEngineRabbit + { + get; + set; + } + [Optional] public int RabbitPrefetchCount { get; set; } = 500; From ed31e553e11f73ff01df2c59471b6e5e184545be Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Mon, 18 Jan 2021 15:28:22 +0400 Subject: [PATCH 30/60] finished dev --- src/Antares.Job.History/Modules/CqrsModule.cs | 11 ++++++---- .../Properties/launchSettings.json | 2 +- .../RabbitSubscribers/MeRabbitSubscriber.cs | 11 +--------- .../ExecutionEventHandler.cs | 22 +++++++++++++------ .../ExecutionQueueReader.cs | 3 +-- .../Domain/Orders/Order.cs | 2 +- .../PostgresTests.cs | 2 +- 7 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/Antares.Job.History/Modules/CqrsModule.cs b/src/Antares.Job.History/Modules/CqrsModule.cs index 4cc76dd..5a9079f 100644 --- a/src/Antares.Job.History/Modules/CqrsModule.cs +++ b/src/Antares.Job.History/Modules/CqrsModule.cs @@ -24,6 +24,7 @@ using Lykke.Messaging.Contract; using Lykke.Messaging.RabbitMq; using Lykke.Messaging.Serialization; +using Lykke.RabbitMqBroker.Deduplication; using Lykke.SettingsReader; using RabbitMQ.Client; @@ -40,6 +41,10 @@ public CqrsModule(IReloadingManager settingsManager) protected override void Load(ContainerBuilder builder) { + builder.RegisterType() + .As() + .SingleInstance(); + builder .RegisterType() .WithParameter(TypedParameter.From(_settings.MatchingEngineRabbit)) @@ -49,8 +54,7 @@ protected override void Load(ContainerBuilder builder) builder.RegisterType() .As() .SingleInstance() - .WithParameter(TypedParameter.From(_settings.MatchingEngineRabbit)) - .WithParameter(TypedParameter.From(_settings.WalletIdsToLog)); + .WithParameter(TypedParameter.From(_settings.MatchingEngineRabbit)); builder.Register(context => new AutofacDependencyResolver(context)).As() .SingleInstance(); @@ -65,9 +69,8 @@ protected override void Load(ContainerBuilder builder) builder.RegisterType().As(); builder.RegisterType() - .WithParameter(TypedParameter.From(_settings.Cqrs.RabbitConnString)) .WithParameter(TypedParameter.From(_settings.WalletIdsToLog)) - .WithParameter(TypedParameter.From(_settings.)) + .WithParameter(TypedParameter.From(_settings.MatchingEngineRabbit)) .WithParameter(new NamedParameter("prefetchCount", _settings.RabbitPrefetchCount)) .WithParameter(new NamedParameter("batchCount", _settings.PostgresOrdersBatchSize)) .SingleInstance(); diff --git a/src/Antares.Job.History/Properties/launchSettings.json b/src/Antares.Job.History/Properties/launchSettings.json index 2c37808..40fa16a 100644 --- a/src/Antares.Job.History/Properties/launchSettings.json +++ b/src/Antares.Job.History/Properties/launchSettings.json @@ -4,7 +4,7 @@ "commandName": "Project", "environmentVariables": { "ENV_INFO": "home", - "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/79ab4c5c-fae6-480a-8742-d9b233addfd2/Lykke.Service.History", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/de1f7d42-e533-4127-8fa3-b691d47ce13a/Antares.Service.History", "ASPNETCORE_ENVIRONMENT": "Development" } }, diff --git a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs index 657b574..e1eb3e3 100644 --- a/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs +++ b/src/Antares.Job.History/RabbitSubscribers/MeRabbitSubscriber.cs @@ -24,12 +24,9 @@ public class MeRabbitSubscriber : IStartable, IStopable { [NotNull] private readonly ILogFactory _logFactory; private readonly RabbitMqSettings _rabbitMqSettings; - [NotNull] private readonly CqrsSettings _cqrsSettings; - private readonly ICqrsEngine _cqrsEngine; private readonly List _subscribers = new List(); private readonly IDeduplicator _deduplicator; private readonly IHistoryRecordsRepository _historyRecordsRepository; - private readonly IReadOnlyList _walletIds; private readonly ILog _log; private const string QueueName = "lykke.spot.matching.engine.out.events.antares-history"; @@ -38,20 +35,14 @@ public class MeRabbitSubscriber : IStartable, IStopable public MeRabbitSubscriber( [NotNull] ILogFactory logFactory, [NotNull] RabbitMqSettings rabbitMqSettings, - [NotNull] CqrsSettings cqrsSettings, - [NotNull] ICqrsEngine cqrsEngine, [NotNull] IDeduplicator deduplicator, - IHistoryRecordsRepository historyRecordsRepository, - IReadOnlyList walletIds) + IHistoryRecordsRepository historyRecordsRepository) { _logFactory = logFactory ?? throw new ArgumentNullException(nameof(logFactory)); _log = _logFactory.CreateLog(this); _rabbitMqSettings = rabbitMqSettings ?? throw new ArgumentNullException(nameof(rabbitMqSettings)); - _cqrsSettings = cqrsSettings ?? throw new ArgumentNullException(nameof(cqrsSettings)); - _cqrsEngine = cqrsEngine ?? throw new ArgumentNullException(nameof(cqrsEngine)); _deduplicator = deduplicator ?? throw new ArgumentNullException(nameof(deduplicator)); _historyRecordsRepository = historyRecordsRepository; - _walletIds = walletIds; } public void Start() diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs index e7e5a46..e126617 100644 --- a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionEventHandler.cs @@ -13,6 +13,7 @@ using Lykke.Common.Log; using Lykke.MatchingEngine.Connector.Models.Events; using MoreLinq; +using Trade = Antares.Service.History.Core.Domain.History.Trade; using Utils = Antares.Service.History.Core.Utils; namespace Antares.Job.History.Workflow.ExecutionProcessing @@ -52,14 +53,20 @@ public async Task HandleAsync(IReadOnlyCollection executionEvent await _ordersRepository.UpsertBulkAsync(orders); - var trades = orders.SelectMany(x => x.Trades); + var trades = orders.SelectMany(x => x.Trades)?.ToArray(); - var batched = trades.Batch(TradesBulkSize).ToList(); + if (trades.Any()) + { + var batched = trades.Batch(TradesBulkSize).ToArray(); - foreach (var tradesBatch in batched) - await _historyRecordsRepository.InsertBulkAsync(tradesBatch); + foreach (var tradesBatch in batched) + await _historyRecordsRepository.InsertBulkAsync(tradesBatch); + } - await _historyRecordsRepository.InsertBulkAsync(orderEvents); + { + foreach (var batch in orderEvents.Batch(TradesBulkSize)) + await _historyRecordsRepository.InsertBulkAsync(batch); + } } private (IReadOnlyCollection Orders, IReadOnlyCollection OrderEvent) @@ -93,7 +100,8 @@ public async Task HandleAsync(IReadOnlyCollection executionEvent UpperPrice = ParseNullabe(x.UpperPrice), }; - order.Trades = x.Trades?.Select(t => new Antares.Service.History.Core.Domain.History.Trade() + order.Trades = x.Trades == null ? Array.Empty() : + x.Trades.Select(t => new Antares.Service.History.Core.Domain.History.Trade() { Id = Guid.Parse(t.TradeId), WalletId = Guid.Parse(x.WalletId), @@ -110,7 +118,7 @@ public async Task HandleAsync(IReadOnlyCollection executionEvent FeeAssetId = t.Fees?.FirstOrDefault()?.AssetId, OrderId = order.Id //OppositeWalletId = Guid.Parse(t.OppositeWalletId), - }).ToList(); + }).ToArray(); return order; }).ToList(); diff --git a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs index 99d60bc..f0c6ef7 100644 --- a/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs +++ b/src/Antares.Job.History/Workflow/ExecutionProcessing/ExecutionQueueReader.cs @@ -19,13 +19,12 @@ public class ExecutionQueueReader : BaseBatchQueueReader public ExecutionQueueReader( ILogFactory logFactory, - string connectionString, int prefetchCount, int batchCount, IReadOnlyList walletIds, RabbitMqSettings rabbitMqSettings, ExecutionEventHandler executionEventHandler) - : base(logFactory, connectionString, prefetchCount, batchCount, walletIds) + : base(logFactory, rabbitMqSettings.ConnectionString, prefetchCount, batchCount, walletIds) { _rabbitMqSettings = rabbitMqSettings; _executionEventHandler = executionEventHandler; diff --git a/src/Antares.Service.History.Core/Domain/Orders/Order.cs b/src/Antares.Service.History.Core/Domain/Orders/Order.cs index 70662cc..43a70b6 100644 --- a/src/Antares.Service.History.Core/Domain/Orders/Order.cs +++ b/src/Antares.Service.History.Core/Domain/Orders/Order.cs @@ -47,7 +47,7 @@ public class Order public bool Straight { get; set; } - public List Trades { get; set; } = new List(); + public Trade[] Trades { get; set; } = Array.Empty(); public long SequenceNumber { get; set; } } diff --git a/tests/Antares.Service.History.Tests/PostgresTests.cs b/tests/Antares.Service.History.Tests/PostgresTests.cs index 8d668bb..a504e8b 100644 --- a/tests/Antares.Service.History.Tests/PostgresTests.cs +++ b/tests/Antares.Service.History.Tests/PostgresTests.cs @@ -129,7 +129,7 @@ Trade GetTrade() Straight = true, Type = (OrderType) random.Next(0, 4), WalletId = walletId, - Trades = Enumerable.Range(1, random.Next(1, 20)).Select(x => GetTrade()).ToList() + Trades = Enumerable.Range(1, random.Next(1, 20)).Select(x => GetTrade()).ToArray() }; return orderModel; From accd8384a6a591ea30b7e7ea46b00c202d7786fe Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 19 Jan 2021 13:21:58 +0400 Subject: [PATCH 31/60] write everything to different schema --- sql/1.2/script.sql | 65 +++++++++++++++++++ .../Constants.cs | 2 + .../DataContext.cs | 6 +- .../Mappings/HistoryEntityBulkMapping.cs | 2 +- .../Repositories/HistoryRecordsRepository.cs | 8 +-- .../Repositories/OrdersRepository.cs | 13 ++-- 6 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 sql/1.2/script.sql diff --git a/sql/1.2/script.sql b/sql/1.2/script.sql new file mode 100644 index 0000000..195ecb5 --- /dev/null +++ b/sql/1.2/script.sql @@ -0,0 +1,65 @@ +CREATE SCHEMA IF NOT EXISTS history + +CREATE TABLE history.history ( + id uuid NOT NULL, + wallet_id uuid NOT NULL, + asset_id text, + assetpair_id text, + volume numeric(28,10) NOT NULL, + type integer NOT NULL, + create_dt timestamp with time zone NOT NULL, + context jsonb +); + +CREATE TABLE history.orders ( + id uuid NOT NULL, + matching_id uuid NOT NULL, + wallet_id uuid NOT NULL, + type integer NOT NULL, + side integer NOT NULL, + status integer NOT NULL, + assetpair_id text NOT NULL, + volume numeric(28,10) NOT NULL, + price numeric(28,10), + create_dt timestamp with time zone NOT NULL, + register_dt timestamp with time zone NOT NULL, + status_dt timestamp with time zone NOT NULL, + match_dt timestamp with time zone, + remaining_volume numeric(28,10) NOT NULL, + reject_reason text, + lower_limit_price numeric(28,10), + lower_price numeric(28,10), + upper_limit_price numeric(28,10), + upper_price numeric(28,10), + straight boolean NOT NULL, + sequence_number bigint NOT NULL +); + +ALTER TABLE ONLY history.history + ADD CONSTRAINT history_pkey PRIMARY KEY (id, wallet_id); + +ALTER TABLE ONLY history.orders + ADD CONSTRAINT orders_pkey PRIMARY KEY (id); + +CREATE INDEX history_type_pair_date_idx ON history.history USING btree (type, assetpair_id, create_dt DESC); + +CREATE INDEX history_wallet_type_date_idx ON history.history USING btree (wallet_id, type, create_dt DESC); + +CREATE INDEX orders_wallet_type_date_idx ON history.orders USING btree (wallet_id, type, create_dt DESC); + +alter table history.orders alter column volume type numeric; +alter table history.orders alter column price type numeric; +alter table history.orders alter column remaining_volume type numeric; +alter table history.orders alter column lower_limit_price type numeric; +alter table history.orders alter column lower_price type numeric; +alter table history.orders alter column upper_limit_price type numeric; +alter table history.orders alter column upper_price type numeric; +alter table history.history alter column volume type numeric; + +insert into history.history +select * from public.history +ON CONFLICT (id, wallet_id) DO NOTHING; + +insert into history.orders +select * from public.orders +ON CONFLICT (id) DO NOTHING; \ No newline at end of file diff --git a/src/Antares.Service.History.PostgresRepositories/Constants.cs b/src/Antares.Service.History.PostgresRepositories/Constants.cs index c45c122..00e92c4 100644 --- a/src/Antares.Service.History.PostgresRepositories/Constants.cs +++ b/src/Antares.Service.History.PostgresRepositories/Constants.cs @@ -9,5 +9,7 @@ internal class Constants public const string TempOrdersTableName = "temporders"; public const string DateTimeFormat = "yyyy-MM-dd HH:mm:ss.fff"; + + public const string HistorySchemaName = "history"; } } diff --git a/src/Antares.Service.History.PostgresRepositories/DataContext.cs b/src/Antares.Service.History.PostgresRepositories/DataContext.cs index 5d1f08d..8905ffc 100644 --- a/src/Antares.Service.History.PostgresRepositories/DataContext.cs +++ b/src/Antares.Service.History.PostgresRepositories/DataContext.cs @@ -18,10 +18,14 @@ public DataContext(string connectionString) internal virtual DbSet Orders { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.HasDefaultSchema(Constants.HistorySchemaName); + } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.ReplaceService(); - optionsBuilder.UseNpgsql(_connectionString); } } diff --git a/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs b/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs index b206f36..0defacb 100644 --- a/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs +++ b/src/Antares.Service.History.PostgresRepositories/Mappings/HistoryEntityBulkMapping.cs @@ -7,7 +7,7 @@ internal class HistoryEntityBulkMapping { public static PostgreSQLCopyHelper Generate() { - return new PostgreSQLCopyHelper(Constants.HistoryTableName) + return new PostgreSQLCopyHelper(Constants.HistorySchemaName, Constants.HistoryTableName) .MapUUID("id", x => x.Id) .MapUUID("wallet_id", x => x.WalletId) .MapText("asset_id", x => x.AssetId) diff --git a/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs b/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs index f6641b9..8324590 100644 --- a/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs +++ b/src/Antares.Service.History.PostgresRepositories/Repositories/HistoryRecordsRepository.cs @@ -23,25 +23,25 @@ public class HistoryRecordsRepository : IHistoryRecordsRepository private readonly ConnectionFactory _connectionFactory; private readonly string _insertQuery = $@" -insert into {Constants.HistoryTableName}(id, wallet_id, asset_id, assetpair_id, volume, type, create_dt, context) +insert into {Constants.HistorySchemaName}.{Constants.HistoryTableName}(id, wallet_id, asset_id, assetpair_id, volume, type, create_dt, context) values (@Id, @WalletId, @AssetId, @AssetPairId, @Volume, @Type, @Timestamp, @Context::jsonb) ON CONFLICT (id, wallet_id) DO NOTHING; "; private readonly string _deleteQuery = $@" -delete from {Constants.HistoryTableName} +delete from {Constants.HistorySchemaName}.{Constants.HistoryTableName} where id = @Id and wallet_id = @WalletId "; private readonly string _updateBlockchainHashQuery = $@" -update {Constants.HistoryTableName} +update {Constants.HistorySchemaName}.{Constants.HistoryTableName} set context = jsonb_set(coalesce(context, '{{}}'), '{{{ nameof(HistoryEntityContext.BlockchainHash) }}}', coalesce(to_jsonb(@Hash::text), jsonb 'null')) where id = @Id "; - private readonly string _tradesDateRangeQuery = $@"SELECT * FROM {Constants.HistoryTableName} + private readonly string _tradesDateRangeQuery = $@"SELECT * FROM {Constants.HistorySchemaName}.{Constants.HistoryTableName} WHERE type = {(int)HistoryType.Trade} AND create_dt >= '{{0}}' AND create_dt < '{{1}}' ORDER BY create_dt LIMIT {{2}} OFFSET {{3}}"; diff --git a/src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs b/src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs index 2237004..482a2c5 100644 --- a/src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs +++ b/src/Antares.Service.History.PostgresRepositories/Repositories/OrdersRepository.cs @@ -21,7 +21,7 @@ public class OrdersRepository : IOrdersRepository private static readonly PostgreSQLCopyHelper BulkMapping; private readonly string _bulkUpsertQuery = $@" -insert into {Constants.OrdersTableName} +insert into {Constants.HistorySchemaName}.{Constants.OrdersTableName} select * from {Constants.TempOrdersTableName} ON CONFLICT (id) DO UPDATE set type = excluded.type, @@ -38,17 +38,18 @@ ON CONFLICT (id) DO UPDATE upper_limit_price = excluded.upper_limit_price, upper_price = excluded.upper_price, sequence_number = excluded.sequence_number - where {Constants.OrdersTableName}.sequence_number < excluded.sequence_number"; + where {Constants.HistorySchemaName}.{Constants.OrdersTableName}.sequence_number < excluded.sequence_number"; private readonly ConnectionFactory _connectionFactory; + //Note: Temp tables are created in their own schema (for each session) private readonly string _createTempTableQuery = $@" create temp table if not exists {Constants.TempOrdersTableName} -(like {Constants.OrdersTableName}) +(like {Constants.HistorySchemaName}.{Constants.OrdersTableName}) on commit drop"; private readonly string _insertOrUpdateQuery = $@" -insert into {Constants.OrdersTableName}(id, matching_id, wallet_id, assetpair_id, type, side, status, volume, price, +insert into {Constants.HistorySchemaName}.{Constants.OrdersTableName}(id, matching_id, wallet_id, assetpair_id, type, side, status, volume, price, create_dt, register_dt, status_dt, match_dt, remaining_volume, reject_reason, lower_limit_price, lower_price, upper_limit_price, upper_price, straight, sequence_number) values (@Id, @MatchingId, @WalletId, @AssetPairId, @Type, @Side, @Status, @Volume, @Price, @@ -69,9 +70,9 @@ ON CONFLICT (id) DO UPDATE upper_limit_price = @UpperLimitPrice, upper_price = @UpperPrice, sequence_number = @SequenceNumber - where {Constants.OrdersTableName}.sequence_number < @SequenceNumber"; + where {Constants.HistorySchemaName}.{Constants.OrdersTableName}.sequence_number < @SequenceNumber"; - private readonly string _ordersDateRangeQuery = $@"SELECT * FROM {Constants.OrdersTableName} + private readonly string _ordersDateRangeQuery = $@"SELECT * FROM {Constants.HistorySchemaName}.{Constants.OrdersTableName} WHERE create_dt >= '{{0}}' AND create_dt < '{{1}}' ORDER BY create_dt LIMIT {{2}} OFFSET {{3}}"; From 3e084572988d2f389252b8b953f206965e0e7046 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 19 Jan 2021 13:49:02 +0400 Subject: [PATCH 32/60] separated sql schema creation and data migration --- sql/1.2/{script.sql => 1-create-schema.sql} | 12 ++---------- sql/1.2/2-migrate-data.sql | 7 +++++++ 2 files changed, 9 insertions(+), 10 deletions(-) rename sql/1.2/{script.sql => 1-create-schema.sql} (87%) create mode 100644 sql/1.2/2-migrate-data.sql diff --git a/sql/1.2/script.sql b/sql/1.2/1-create-schema.sql similarity index 87% rename from sql/1.2/script.sql rename to sql/1.2/1-create-schema.sql index 195ecb5..444ea8d 100644 --- a/sql/1.2/script.sql +++ b/sql/1.2/1-create-schema.sql @@ -1,4 +1,4 @@ -CREATE SCHEMA IF NOT EXISTS history +CREATE SCHEMA IF NOT EXISTS history; CREATE TABLE history.history ( id uuid NOT NULL, @@ -54,12 +54,4 @@ alter table history.orders alter column lower_limit_price type numeric; alter table history.orders alter column lower_price type numeric; alter table history.orders alter column upper_limit_price type numeric; alter table history.orders alter column upper_price type numeric; -alter table history.history alter column volume type numeric; - -insert into history.history -select * from public.history -ON CONFLICT (id, wallet_id) DO NOTHING; - -insert into history.orders -select * from public.orders -ON CONFLICT (id) DO NOTHING; \ No newline at end of file +alter table history.history alter column volume type numeric; \ No newline at end of file diff --git a/sql/1.2/2-migrate-data.sql b/sql/1.2/2-migrate-data.sql new file mode 100644 index 0000000..13e94d7 --- /dev/null +++ b/sql/1.2/2-migrate-data.sql @@ -0,0 +1,7 @@ +insert into history.history +select * from public.history +ON CONFLICT (id, wallet_id) DO NOTHING; + +insert into history.orders +select * from public.orders +ON CONFLICT (id) DO NOTHING; \ No newline at end of file From 41f560dcb891264ceb60a73273b92eecf6f94755 Mon Sep 17 00:00:00 2001 From: Sergey Korolev <32951007+1scrooge@users.noreply.github.com> Date: Thu, 21 Jan 2021 11:50:30 +0300 Subject: [PATCH 33/60] Update settings.yaml --- settings.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/settings.yaml b/settings.yaml index 8fadd5a..165c8a7 100644 --- a/settings.yaml +++ b/settings.yaml @@ -18,15 +18,15 @@ HistoryService: - Optional Exchange: settings-key: MatchingEngineSpotEventsExchange + RabbitPrefetchCount: + settings-key: HistoryService-RabbitPrefetchCount + types: + - Optional Cqrs: RabbitConnString: settings-key: CqrsRabbitConnString types: - RabbitMq - RabbitPrefetchCount: - settings-key: HistoryService-RabbitPrefetchCount - types: - - Optional PostgresOrdersBatchSize: settings-key: HistoryService-PostgresOrdersBatchSize types: From f0f27b54cb73a1b1445b7212cddf913bae177516 Mon Sep 17 00:00:00 2001 From: Sergey Korolev <32951007+1scrooge@users.noreply.github.com> Date: Thu, 21 Jan 2021 12:02:56 +0300 Subject: [PATCH 34/60] Update settings.yaml --- settings.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/settings.yaml b/settings.yaml index 165c8a7..8fadd5a 100644 --- a/settings.yaml +++ b/settings.yaml @@ -18,15 +18,15 @@ HistoryService: - Optional Exchange: settings-key: MatchingEngineSpotEventsExchange - RabbitPrefetchCount: - settings-key: HistoryService-RabbitPrefetchCount - types: - - Optional Cqrs: RabbitConnString: settings-key: CqrsRabbitConnString types: - RabbitMq + RabbitPrefetchCount: + settings-key: HistoryService-RabbitPrefetchCount + types: + - Optional PostgresOrdersBatchSize: settings-key: HistoryService-PostgresOrdersBatchSize types: From 97b22dd8960d3e49cdb888d293311e40b5be66b5 Mon Sep 17 00:00:00 2001 From: Sergey Korolev <32951007+1scrooge@users.noreply.github.com> Date: Thu, 21 Jan 2021 14:48:03 +0300 Subject: [PATCH 35/60] Update settings.yaml --- settings.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/settings.yaml b/settings.yaml index 8fadd5a..cd95821 100644 --- a/settings.yaml +++ b/settings.yaml @@ -6,18 +6,6 @@ HistoryService: settings-key: HistoryService-LogsConnString types: - AzureTableStorage - MatchingEngineRabbit: - ConnectionString: - settings-key: MatchingEngineRabbitMqConnectionString - types: - - RabbitMq - AlternativeConnectionString: - settings-key: AlternateMatchingEngineRabbitMqConnectionString - types: - - RabbitMq - - Optional - Exchange: - settings-key: MatchingEngineSpotEventsExchange Cqrs: RabbitConnString: settings-key: CqrsRabbitConnString @@ -34,6 +22,18 @@ HistoryService: WalletIdsToLog: settings-key: HistoryService-WalletIdsToLog types: [Optional, JsonArray] + MatchingEngineRabbit: + ConnectionString: + settings-key: MatchingEngineRabbitMqConnectionString + types: + - RabbitMq + AlternativeConnectionString: + settings-key: AlternateMatchingEngineRabbitMqConnectionString + types: + - RabbitMq + - Optional + Exchange: + settings-key: MatchingEngineSpotEventsExchange MonitoringServiceClient: MonitoringServiceUrl: settings-key: MonitoringServiceUrl From 40b07b86c4bbbe74afcbfea0baffe31ef86dc8c4 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Thu, 21 Jan 2021 16:31:39 +0400 Subject: [PATCH 36/60] added optional setting key to disable cqrs staff --- settings.yaml | 4 +++ src/Antares.Job.History/Modules/CqrsModule.cs | 8 ++++-- .../Properties/launchSettings.json | 2 +- src/Antares.Job.History/StartupManager.cs | 25 ++++++++++++++++--- .../Settings/HistorySettings.cs | 3 +++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/settings.yaml b/settings.yaml index cd95821..49a48a1 100644 --- a/settings.yaml +++ b/settings.yaml @@ -34,6 +34,10 @@ HistoryService: - Optional Exchange: settings-key: MatchingEngineSpotEventsExchange + CqrsEnabled: + settings-key: HistoryService-CqrsEnabled + types: + - Optional MonitoringServiceClient: MonitoringServiceUrl: settings-key: MonitoringServiceUrl diff --git a/src/Antares.Job.History/Modules/CqrsModule.cs b/src/Antares.Job.History/Modules/CqrsModule.cs index 5a9079f..39ae22b 100644 --- a/src/Antares.Job.History/Modules/CqrsModule.cs +++ b/src/Antares.Job.History/Modules/CqrsModule.cs @@ -41,6 +41,8 @@ public CqrsModule(IReloadingManager settingsManager) protected override void Load(ContainerBuilder builder) { + builder.RegisterInstance(_settings).AsSelf(); + builder.RegisterType() .As() .SingleInstance(); @@ -98,11 +100,13 @@ protected override void Load(ContainerBuilder builder) }), new RabbitMqTransportFactory(logFactory)); var cqrsEngine = CreateEngine(ctx, messagingEngine, logFactory); - cqrsEngine.StartPublishers(); + + if (_settings.CqrsEnabled) + cqrsEngine.StartPublishers(); + return cqrsEngine; }) .As() - .AutoActivate() .SingleInstance(); } diff --git a/src/Antares.Job.History/Properties/launchSettings.json b/src/Antares.Job.History/Properties/launchSettings.json index 40fa16a..60c8f43 100644 --- a/src/Antares.Job.History/Properties/launchSettings.json +++ b/src/Antares.Job.History/Properties/launchSettings.json @@ -11,7 +11,7 @@ "History local test settings": { "commandName": "Project", "environmentVariables": { - "SettingsUrl": "token_to_test_settings", + "SettingsUrl": "http://settingsv2.lykke-settings.svc.cluster.local/Home/RepositoryFile/c96b7a34-b21f-49b9-8b29-9c3cd395b584/Antares.Service.History", "ASPNETCORE_ENVIRONMENT": "Staging" } }, diff --git a/src/Antares.Job.History/StartupManager.cs b/src/Antares.Job.History/StartupManager.cs index 12c0ea1..4754ff5 100644 --- a/src/Antares.Job.History/StartupManager.cs +++ b/src/Antares.Job.History/StartupManager.cs @@ -1,27 +1,46 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Antares.Job.History.Workflow.ExecutionProcessing; using Antares.Sdk.Services; +using Antares.Service.History.Core.Settings; +using Common.Log; +using Lykke.Common.Log; using Lykke.Cqrs; namespace Antares.Job.History { public class StartupManager : IStartupManager { + private readonly HistorySettings _historySettings; private readonly ICqrsEngine _cqrsEngine; private readonly ExecutionQueueReader _executionQueueReader; + private readonly ILog _log; public StartupManager( + HistorySettings historySettings, ICqrsEngine cqrsEngine, - ExecutionQueueReader executionQueueReader) + ExecutionQueueReader executionQueueReader, + ILogFactory logFactory) { + _historySettings = historySettings; _cqrsEngine = cqrsEngine; _executionQueueReader = executionQueueReader; + _log = logFactory.CreateLog(nameof(StartupManager)); } public Task StartAsync() { _executionQueueReader.Start(); - _cqrsEngine.StartSubscribers(); + + if (_historySettings.CqrsEnabled) + { + _cqrsEngine.StartSubscribers(); + } + else + { + _log.Info("CQRS Engine is disabled"); + } + return Task.CompletedTask; } diff --git a/src/Antares.Service.History.Core/Settings/HistorySettings.cs b/src/Antares.Service.History.Core/Settings/HistorySettings.cs index d6e0b7b..bddb924 100644 --- a/src/Antares.Service.History.Core/Settings/HistorySettings.cs +++ b/src/Antares.Service.History.Core/Settings/HistorySettings.cs @@ -26,5 +26,8 @@ public RabbitMqSettings MatchingEngineRabbit [Optional] public IReadOnlyList WalletIdsToLog { get; set; } = Array.Empty(); + + [Optional] + public bool CqrsEnabled { get; set; } = false; } } From eef83298f131f2524ff2b0452c5a23ea8404f0c0 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Thu, 21 Jan 2021 16:39:58 +0400 Subject: [PATCH 37/60] added launch settings in git ignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index df2b36c..addfc08 100644 --- a/.gitignore +++ b/.gitignore @@ -337,4 +337,4 @@ ASALocalRun/ appsettings.*.json /client/**/*.xml -launchSettings.json \ No newline at end of file +**/Properties/launchSettings.json \ No newline at end of file From 44258c65d9541699e1a47a6e3d6bcdee08c58ee6 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Tue, 19 Jan 2021 20:12:26 +0400 Subject: [PATCH 38/60] intermediate commit --- Antares.Service.History.sln | 7 + .../Antares.Service.History.GrpcClient.csproj | 58 +++++++ .../ApiClient.cs | 48 ++++++ .../Common/BaseGrpcClient.cs | 50 ++++++ .../IApiClient.cs | 33 ++++ ...ntares.Service.History.GrpcContract.csproj | 39 +++++ .../Common/BigDecimal.cs | 17 ++ .../common.proto | 153 ++++++++++++++++++ .../history.proto | 40 +++++ .../isalive.proto | 23 +++ .../orders.proto | 118 ++++++++++++++ .../trades.proto | 49 ++++++ .../Antares.Job.History.csproj | 2 +- .../Antares.Service.History.Core.csproj | 2 +- .../Antares.Service.History.csproj | 2 +- 15 files changed, 638 insertions(+), 3 deletions(-) create mode 100644 client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj create mode 100644 client/Antares.Service.History.GrpcClient/ApiClient.cs create mode 100644 client/Antares.Service.History.GrpcClient/Common/BaseGrpcClient.cs create mode 100644 client/Antares.Service.History.GrpcClient/IApiClient.cs create mode 100644 client/Antares.Service.History.GrpcContract/Antares.Service.History.GrpcContract.csproj create mode 100644 client/Antares.Service.History.GrpcContract/Common/BigDecimal.cs create mode 100644 client/Antares.Service.History.GrpcContract/common.proto create mode 100644 client/Antares.Service.History.GrpcContract/history.proto create mode 100644 client/Antares.Service.History.GrpcContract/isalive.proto create mode 100644 client/Antares.Service.History.GrpcContract/orders.proto create mode 100644 client/Antares.Service.History.GrpcContract/trades.proto diff --git a/Antares.Service.History.sln b/Antares.Service.History.sln index a29b1fc..4f0779f 100644 --- a/Antares.Service.History.sln +++ b/Antares.Service.History.sln @@ -34,6 +34,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Cli EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Contracts", "client\Antares.Service.History.Contracts\Antares.Service.History.Contracts.csproj", "{E4199193-31F4-401B-8464-96783A6195D2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.GrpcContract", "client\Antares.Service.History.GrpcContract\Antares.Service.History.GrpcContract.csproj", "{FBE93CEC-068E-49C8-98EB-1157731401E7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -72,6 +74,10 @@ Global {E4199193-31F4-401B-8464-96783A6195D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4199193-31F4-401B-8464-96783A6195D2}.Release|Any CPU.Build.0 = Release|Any CPU + {FBE93CEC-068E-49C8-98EB-1157731401E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FBE93CEC-068E-49C8-98EB-1157731401E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FBE93CEC-068E-49C8-98EB-1157731401E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FBE93CEC-068E-49C8-98EB-1157731401E7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -83,6 +89,7 @@ Global {A61FFDEE-5725-4650-A788-6E55EE5EFD5B} = {8F9036B1-5106-4C69-B2D2-B78EE52687A0} {831EC068-8A52-4209-BCCA-6EB5A1FF363B} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} {E4199193-31F4-401B-8464-96783A6195D2} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} + {FBE93CEC-068E-49C8-98EB-1157731401E7} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EB6C0EF4-AA6A-444D-8603-3669F73A58BC} diff --git a/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj b/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj new file mode 100644 index 0000000..5f0efd3 --- /dev/null +++ b/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj @@ -0,0 +1,58 @@ + + + + netstandard2.0 + Swisschain.Sirius.Api.ApiClient + Swisschain.Sirius.Api.ApiClient + Swisschain.Sirius.Api.ApiClient + Swisschain + Sirius + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + $(TargetsForTfmSpecificBuildOutput);PackReferencedProjectOutputs + + + + true + + + + true + + + + + + + + + + diff --git a/client/Antares.Service.History.GrpcClient/ApiClient.cs b/client/Antares.Service.History.GrpcClient/ApiClient.cs new file mode 100644 index 0000000..552d91b --- /dev/null +++ b/client/Antares.Service.History.GrpcClient/ApiClient.cs @@ -0,0 +1,48 @@ +using Swisschain.Sirius.Api.ApiClient.Common; +using Swisschain.Sirius.Api.ApiContract; +using Swisschain.Sirius.Api.ApiContract.Account; +using Swisschain.Sirius.Api.ApiContract.Address; +using Swisschain.Sirius.Api.ApiContract.Asset; +using Swisschain.Sirius.Api.ApiContract.Blockchain; +using Swisschain.Sirius.Api.ApiContract.BrokerAccount; +using Swisschain.Sirius.Api.ApiContract.Deposit; +using Swisschain.Sirius.Api.ApiContract.Monitoring; +using Swisschain.Sirius.Api.ApiContract.Vault; +using Swisschain.Sirius.Api.ApiContract.Withdrawal; + +namespace Swisschain.Sirius.Api.ApiClient +{ + public class ApiClient : BaseGrpcClient, IApiClient + { + public ApiClient(string serverGrpcUrl, string apiKey) : base(serverGrpcUrl, apiKey) + { + Monitoring = new MonitoringService.MonitoringServiceClient(CallInvoker); + Assets = new Assets.AssetsClient(CallInvoker); + Accounts = new Accounts.AccountsClient(CallInvoker); + Blockchains = new Blockchains.BlockchainsClient(CallInvoker); + BrokerAccounts = new BrokerAccounts.BrokerAccountsClient(CallInvoker); + Vaults = new Vaults.VaultsClient(CallInvoker); + Deposits = new Deposits.DepositsClient(CallInvoker); + Withdrawals = new Withdrawals.WithdrawalsClient(CallInvoker); + Addresses = new Addresses.AddressesClient(CallInvoker); + } + + public Addresses.AddressesClient Addresses { get; } + + public MonitoringService.MonitoringServiceClient Monitoring { get; } + + public Assets.AssetsClient Assets { get; } + + public Accounts.AccountsClient Accounts { get; } + + public Blockchains.BlockchainsClient Blockchains { get; } + + public BrokerAccounts.BrokerAccountsClient BrokerAccounts { get; } + + public Vaults.VaultsClient Vaults { get; } + + public Deposits.DepositsClient Deposits { get; } + + public Withdrawals.WithdrawalsClient Withdrawals { get; } + } +} diff --git a/client/Antares.Service.History.GrpcClient/Common/BaseGrpcClient.cs b/client/Antares.Service.History.GrpcClient/Common/BaseGrpcClient.cs new file mode 100644 index 0000000..230613e --- /dev/null +++ b/client/Antares.Service.History.GrpcClient/Common/BaseGrpcClient.cs @@ -0,0 +1,50 @@ +using System; +using Grpc.Core; +using Grpc.Core.Interceptors; + +namespace Swisschain.Sirius.Api.ApiClient.Common +{ + public class BaseGrpcClient : IDisposable + { + private readonly Channel _channel; + + protected CallInvoker CallInvoker { get; } + + protected BaseGrpcClient(string serverGrpcUrl, string apiKey) + { + var lowerCaseUrl = serverGrpcUrl.ToLowerInvariant(); + + if (!lowerCaseUrl.StartsWith("http")) + { + throw new InvalidOperationException("Specify protocol explicitly ('http://' or 'https://')"); + } + + var isHttps = lowerCaseUrl.StartsWith("https://"); + + // It works only when there is no protocol in the URL :-\ + var correctedUrl = serverGrpcUrl + .Replace("https://", string.Empty) + .Replace("http://", string.Empty); + + if (!isHttps) + { + AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); + } + + var credentials = isHttps ? new SslCredentials() : ChannelCredentials.Insecure; + + _channel = new Channel(correctedUrl, credentials); + + CallInvoker = _channel.Intercept(metadata => + { + metadata.Add("Authorization", $"Bearer {apiKey}"); + return metadata; + }); + } + + public void Dispose() + { + _channel.ShutdownAsync().GetAwaiter().GetResult(); + } + } +} diff --git a/client/Antares.Service.History.GrpcClient/IApiClient.cs b/client/Antares.Service.History.GrpcClient/IApiClient.cs new file mode 100644 index 0000000..592df43 --- /dev/null +++ b/client/Antares.Service.History.GrpcClient/IApiClient.cs @@ -0,0 +1,33 @@ +using Swisschain.Sirius.Api.ApiContract.Account; +using Swisschain.Sirius.Api.ApiContract.Address; +using Swisschain.Sirius.Api.ApiContract.Asset; +using Swisschain.Sirius.Api.ApiContract.Blockchain; +using Swisschain.Sirius.Api.ApiContract.BrokerAccount; +using Swisschain.Sirius.Api.ApiContract.Deposit; +using Swisschain.Sirius.Api.ApiContract.Monitoring; +using Swisschain.Sirius.Api.ApiContract.Vault; +using Swisschain.Sirius.Api.ApiContract.Withdrawal; + +namespace Swisschain.Sirius.Api.ApiClient +{ + public interface IApiClient + { + MonitoringService.MonitoringServiceClient Monitoring { get; } + + Assets.AssetsClient Assets { get; } + + Accounts.AccountsClient Accounts { get; } + + Blockchains.BlockchainsClient Blockchains { get; } + + BrokerAccounts.BrokerAccountsClient BrokerAccounts { get; } + + Vaults.VaultsClient Vaults { get; } + + Deposits.DepositsClient Deposits { get; } + + Withdrawals.WithdrawalsClient Withdrawals { get; } + + Addresses.AddressesClient Addresses { get; } + } +} diff --git a/client/Antares.Service.History.GrpcContract/Antares.Service.History.GrpcContract.csproj b/client/Antares.Service.History.GrpcContract/Antares.Service.History.GrpcContract.csproj new file mode 100644 index 0000000..e58819e --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/Antares.Service.History.GrpcContract.csproj @@ -0,0 +1,39 @@ + + + + netstandard2.0 + Antares.Service.History.GrpcContract + Swisschain.Sirius.Api.ApiContract + Antares.Service.History.GrpcContract + Swisschain + Sirius + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + diff --git a/client/Antares.Service.History.GrpcContract/Common/BigDecimal.cs b/client/Antares.Service.History.GrpcContract/Common/BigDecimal.cs new file mode 100644 index 0000000..ad3bdc2 --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/Common/BigDecimal.cs @@ -0,0 +1,17 @@ +using System.Globalization; + +namespace Antares.Service.History.GrpcContract.Common +{ + //public partial class BigDecimal + //{ + // public static implicit operator decimal(BigDecimal value) + // { + // return decimal.Parse(value.Value, CultureInfo.InvariantCulture); + // } + + // public static implicit operator BigDecimal(decimal value) + // { + // return new BigDecimal { Value = value.ToString(CultureInfo.InvariantCulture) }; + // } + //} +} diff --git a/client/Antares.Service.History.GrpcContract/common.proto b/client/Antares.Service.History.GrpcContract/common.proto new file mode 100644 index 0000000..42b1565 --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/common.proto @@ -0,0 +1,153 @@ +syntax = "proto3"; + +option csharp_namespace = "Antares.Service.History.GrpcContract.Common"; + +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +package antares.service.history.common; + +enum PaginationOrder { + ASC = 0; + DESC = 1; +} + +message PaginatedInt64Response { + google.protobuf.Int64Value cursor = 1; + + int32 count = 2; + + PaginationOrder order = 3; +} + +message PaginationInt64 { + PaginationOrder order = 1; + + google.protobuf.Int64Value cursor = 2; + + int32 limit = 3; +} + +message ErrorResponseBody { + + enum ErrorCode { + UNKNOWN = 0; + INVALID_PARAMETERS = 1; + NOT_AUTHORIZED = 2; + NOT_FOUND = 3; + BROKER_ACCOUNT_INACTIVE = 4; + } + + ErrorCode error_code = 1; + string error_message = 2; +} + +message BigDecimal { + string value = 1; +} + +message HistoryResponseItem { + string id = 1; + + string wallet_id = 2; + + google.protobuf.Timestamp timestamp = 3; + + HistoryType type = 4; + + oneof body { + CashInModel cash_in = 5; + CashOutModel cash_out = 6; + TradeModel trade = 7; + OrderEventModel order_event = 8; + } +} + +message TradeModel { + string asset_pair_id = 1; + + antares.service.history.common.BigDecimal base_volume = 2; + + string base_asset_id = 3; + + string quoting_asset_id = 4; + + antares.service.history.common.BigDecimal quoting_volume = 5; + + antares.service.history.common.BigDecimal price = 6; + + antares.service.history.common.BigDecimal fee_size = 7; + + google.protobuf.StringValue fee_asset_id = 8; + + int32 index = 9; + + TradeRole Role = 10; + + string order_id = 11; +} + +message CashInModel { + antares.service.history.common.BigDecimal volume = 1; + + string asset_id = 2; + + google.protobuf.StringValue blockchain_hash = 3; + + antares.service.history.common.BigDecimal fee_size = 4; +} + +message CashOutModel { + antares.service.history.common.BigDecimal volume = 1; + + string asset_id = 2; + + google.protobuf.StringValue blockchain_hash = 3; + + antares.service.history.common.BigDecimal fee_size = 4; +} + + +message OrderEventModel { + antares.service.history.common.BigDecimal volume = 1; + + string asset_pair_id = 2; + + string order_id = 3; + + antares.service.history.common.BigDecimal price = 4; + + OrderStatus status = 5; +} + +enum TradeRole +{ + UNKNOWN = 0; + MAKER = 1; + TAKER = 2; +} + +enum HistoryType { + CASH_IN = 0; + CASH_OUT = 2; + TRADE = 3; + ORDER_EVENT = 4; +} + +enum OrderStatus { + UNKNOWN_ORDER = 0; + PLACED = 1; + PARTIALLY_MATCHED = 2; + MATCHED = 3; + PENDING = 4; + CANCELLED = 5; + REPLACED = 6; + REJECTED = 7; +} + +enum TradeType +{ + BUY = 0; + SELL = 1; +} \ No newline at end of file diff --git a/client/Antares.Service.History.GrpcContract/history.proto b/client/Antares.Service.History.GrpcContract/history.proto new file mode 100644 index 0000000..0ffe20e --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/history.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +option csharp_namespace = "Antares.Service.History.GrpcContract.History"; + +import "common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +package antares.service.history.history; + +service History { + rpc GetHistory (HistoryGetHistoryRequest) returns (HistoryGetHistoryResponse); + + rpc GetHistoryItem (GetHistoryItemRequest) returns (GetHistoryItemResponse); +} + +message GetHistoryItemRequest { + string wallet_id = 1; + string id = 2; +} + +message HistoryGetHistoryRequest { + string wallet_id = 1; + repeated antares.service.history.common.HistoryType type = 2; + google.protobuf.StringValue asset_id = 3; + google.protobuf.StringValue asset_pair_id = 4; + antares.service.history.common.PaginationInt64 pagination = 5; + google.protobuf.Timestamp from = 6; + google.protobuf.Timestamp to = 7; +} + +message GetHistoryItemResponse { + antares.service.history.common.HistoryResponseItem item = 1; +} + +message HistoryGetHistoryResponse { + repeated antares.service.history.common.HistoryResponseItem items = 1; + + antares.service.history.common.PaginatedInt64Response pagination = 2; +} diff --git a/client/Antares.Service.History.GrpcContract/isalive.proto b/client/Antares.Service.History.GrpcContract/isalive.proto new file mode 100644 index 0000000..4ad2992 --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/isalive.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +option csharp_namespace = "Antares.Service.History.GrpcContract.Monitoring"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +package common; + +service MonitoringService { + rpc IsAlive (IsAliveRequest) returns (IsAliveResponse); +} + +message IsAliveRequest { +} + +message IsAliveResponse { + string name = 1; + string version = 2; + google.protobuf.Timestamp started_at = 3; + string env = 4; + string host_name = 5; +} diff --git a/client/Antares.Service.History.GrpcContract/orders.proto b/client/Antares.Service.History.GrpcContract/orders.proto new file mode 100644 index 0000000..4728ff8 --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/orders.proto @@ -0,0 +1,118 @@ +syntax = "proto3"; + +option csharp_namespace = "Antares.Service.History.GrpcContract.Orders"; + +import "common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +package antares.service.history.orders; + +service Orders { + rpc GetOrder (GetOrderRequest) returns (GetOrderResponse); + + rpc GetOrderList (GetOrderListRequest) returns (GetOrderListResponse); + + rpc GetOrdersByDates (GetOrdersByDatesRequest) returns (GetOrderListResponse); + + rpc GetActiveOrders (GetActiveOrdersRequest) returns (GetOrderListResponse); +} + +message GetOrderRequest { + string id = 1; +} + +message GetOrderResponse { + .antares.service.history.orders.OrderModel item = 1; +} + +message GetOrderListResponse { + antares.service.history.common.PaginatedInt64Response pagination = 1; + + repeated .antares.service.history.orders.OrderModel items = 2; +} + +message GetOrderListRequest { + string wallet_id = 1; + repeated antares.service.history.common.OrderStatus status = 2; + repeated OrderType type = 3; + google.protobuf.StringValue asset_pair_id = 4; + antares.service.history.common.PaginationInt64 pagination = 5; +} + +message GetOrdersByDatesRequest { + antares.service.history.common.PaginationInt64 pagination = 1; + google.protobuf.Timestamp from = 2; + google.protobuf.Timestamp to = 3; +} + +message GetActiveOrdersRequest { + string wallet_id = 1; + google.protobuf.StringValue asset_pair_id = 2; + antares.service.history.common.PaginationInt64 pagination = 3; +} + +message GetHistoryItemResponse { + antares.service.history.common.HistoryResponseItem item = 1; +} + +message GetTradesResponse { + repeated antares.service.history.common.HistoryResponseItem items = 1; + + antares.service.history.common.PaginatedInt64Response pagination = 2; +} + +enum OrderType { + UNKNOWN_TYPE = 0; + MARKET = 1; + LIMIT = 2; + STOP_LIMIT = 3; +} + +enum OrderSide { + UNKNOWN = 0; + BUY = 1; + SELL = 2; +} + +message OrderModel { + string id = 1; + + string matching_id = 2; + + string wallet_id = 3; + + OrderType type = 4; + + OrderSide side = 5; + + antares.service.history.common.OrderStatus status = 6; + + string asset_pair_id = 7; + + antares.service.history.common.BigDecimal volume = 8; + + antares.service.history.common.BigDecimal price = 9; + + google.protobuf.Timestamp create_dt = 10; + + google.protobuf.Timestamp register_dt = 11; + + google.protobuf.Timestamp status_dt = 12; + + google.protobuf.Timestamp match_dt = 13; + + antares.service.history.common.BigDecimal remaining_volume = 14; + + google.protobuf.StringValue RejectReason = 15; + + antares.service.history.common.BigDecimal lower_limit_price = 16; + + antares.service.history.common.BigDecimal lower_price = 17; + + antares.service.history.common.BigDecimal upper_limit_price = 18; + + antares.service.history.common.BigDecimal upper_price = 19; + + bool straight = 20; +} \ No newline at end of file diff --git a/client/Antares.Service.History.GrpcContract/trades.proto b/client/Antares.Service.History.GrpcContract/trades.proto new file mode 100644 index 0000000..d62c25e --- /dev/null +++ b/client/Antares.Service.History.GrpcContract/trades.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +option csharp_namespace = "Antares.Service.History.GrpcContract.Trades"; + +import "common.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +package antares.service.history.trades; + +service Trades { + rpc GetTrades (GetTradesRequest) returns (GetTradesResponse); + + rpc GetTradesByOrderId (GetTradesByOrderIdRequest) returns (GetTradesResponse); + + rpc GetTradesByDates (GetTradesByDatesRequest) returns (GetTradesResponse); +} + +message GetTradesByOrderIdRequest { + string wallet_id = 1; + string id = 2; +} + +message GetTradesRequest { + string wallet_id = 1; + repeated antares.service.history.common.HistoryType type = 2; + google.protobuf.StringValue asset_id = 3; + google.protobuf.StringValue asset_pair_id = 4; + antares.service.history.common.PaginationInt64 pagination = 5; + google.protobuf.Timestamp from = 6; + google.protobuf.Timestamp to = 7; + antares.service.history.common.TradeType trade_ype = 8; +} + +message GetTradesByDatesRequest { + antares.service.history.common.PaginationInt64 pagination = 1; + google.protobuf.Timestamp from = 2; + google.protobuf.Timestamp to = 3; +} + +message GetHistoryItemResponse { + antares.service.history.common.HistoryResponseItem item = 1; +} + +message GetTradesResponse { + repeated antares.service.history.common.HistoryResponseItem items = 1; + + antares.service.history.common.PaginatedInt64Response pagination = 2; +} diff --git a/src/Antares.Job.History/Antares.Job.History.csproj b/src/Antares.Job.History/Antares.Job.History.csproj index d02a306..5fb2c66 100644 --- a/src/Antares.Job.History/Antares.Job.History.csproj +++ b/src/Antares.Job.History/Antares.Job.History.csproj @@ -23,7 +23,7 @@ - + diff --git a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj index fb0ecd7..47a507f 100644 --- a/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj +++ b/src/Antares.Service.History.Core/Antares.Service.History.Core.csproj @@ -6,7 +6,7 @@ 1.0.0 - + diff --git a/src/Antares.Service.History/Antares.Service.History.csproj b/src/Antares.Service.History/Antares.Service.History.csproj index d2b1880..33c8f62 100644 --- a/src/Antares.Service.History/Antares.Service.History.csproj +++ b/src/Antares.Service.History/Antares.Service.History.csproj @@ -22,7 +22,7 @@ - + From bf5e8b5fa92b3fb2a32b85dbf90b7f50ad842525 Mon Sep 17 00:00:00 2001 From: Aleksandr Belousov Date: Wed, 20 Jan 2021 13:32:15 +0400 Subject: [PATCH 39/60] Added grpc client --- Antares.Service.History.sln | 7 +++ .../Antares.Service.History.GrpcClient.csproj | 6 +-- .../ApiClient.cs | 48 ------------------- .../Common/BaseGrpcClient.cs | 16 ++----- .../HistoryClient.cs | 23 +++++++++ .../IApiClient.cs | 33 ------------- .../IHistoryGrpcClient.cs | 17 +++++++ .../Antares.Job.History.csproj | 2 +- .../Antares.Service.History.Core.csproj | 2 +- .../Antares.Service.History.csproj | 2 +- 10 files changed, 57 insertions(+), 99 deletions(-) delete mode 100644 client/Antares.Service.History.GrpcClient/ApiClient.cs create mode 100644 client/Antares.Service.History.GrpcClient/HistoryClient.cs delete mode 100644 client/Antares.Service.History.GrpcClient/IApiClient.cs create mode 100644 client/Antares.Service.History.GrpcClient/IHistoryGrpcClient.cs diff --git a/Antares.Service.History.sln b/Antares.Service.History.sln index 4f0779f..5538d31 100644 --- a/Antares.Service.History.sln +++ b/Antares.Service.History.sln @@ -36,6 +36,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.Con EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.GrpcContract", "client\Antares.Service.History.GrpcContract\Antares.Service.History.GrpcContract.csproj", "{FBE93CEC-068E-49C8-98EB-1157731401E7}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Antares.Service.History.GrpcClient", "client\Antares.Service.History.GrpcClient\Antares.Service.History.GrpcClient.csproj", "{E7309202-72EB-4ACB-8BD3-3E704CC433FB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -78,6 +80,10 @@ Global {FBE93CEC-068E-49C8-98EB-1157731401E7}.Debug|Any CPU.Build.0 = Debug|Any CPU {FBE93CEC-068E-49C8-98EB-1157731401E7}.Release|Any CPU.ActiveCfg = Release|Any CPU {FBE93CEC-068E-49C8-98EB-1157731401E7}.Release|Any CPU.Build.0 = Release|Any CPU + {E7309202-72EB-4ACB-8BD3-3E704CC433FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7309202-72EB-4ACB-8BD3-3E704CC433FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7309202-72EB-4ACB-8BD3-3E704CC433FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7309202-72EB-4ACB-8BD3-3E704CC433FB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -90,6 +96,7 @@ Global {831EC068-8A52-4209-BCCA-6EB5A1FF363B} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} {E4199193-31F4-401B-8464-96783A6195D2} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} {FBE93CEC-068E-49C8-98EB-1157731401E7} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} + {E7309202-72EB-4ACB-8BD3-3E704CC433FB} = {CB89F731-A3D8-4AAB-8F8A-F1CCFEED51B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EB6C0EF4-AA6A-444D-8603-3669F73A58BC} diff --git a/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj b/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj index 5f0efd3..ec73d4f 100644 --- a/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj +++ b/client/Antares.Service.History.GrpcClient/Antares.Service.History.GrpcClient.csproj @@ -2,9 +2,9 @@ netstandard2.0 - Swisschain.Sirius.Api.ApiClient + Antares.Service.History.GrpcClient Swisschain.Sirius.Api.ApiClient - Swisschain.Sirius.Api.ApiClient + Antares.Service.History.GrpcClient Swisschain Sirius @@ -27,7 +27,7 @@ - +