добавил отключение приема данных с биржи через env файл
test / deploy_trader_prod (push) Successful in 2m31s Details

main
vlad zverzhkhovskiy 2025-08-28 16:17:24 +03:00
parent faac2b74e4
commit f6b98e949d
5 changed files with 11 additions and 3 deletions

View File

@ -2,6 +2,7 @@
{ {
public class ExchangeConfig public class ExchangeConfig
{ {
public bool ExchangeDataRecievingEnabled { get; set; }
public decimal FutureComission { get; set; } public decimal FutureComission { get; set; }
public decimal ShareComission { get; set; } public decimal ShareComission { get; set; }
public decimal AccountCashPart { get; set; } public decimal AccountCashPart { get; set; }

View File

@ -24,11 +24,12 @@ namespace KLHZ.Trader.Core.Exchange.Services
private readonly IDbContextFactory<TraderDbContext> _dbContextFactory; private readonly IDbContextFactory<TraderDbContext> _dbContextFactory;
private readonly CancellationTokenSource _cts = new(); private readonly CancellationTokenSource _cts = new();
private readonly IDataBus _eventBus; private readonly IDataBus _eventBus;
private readonly bool _exchangeDataRecievingEnabled;
public ExchangeDataReader(InvestApiClient investApiClient, IDataBus eventBus, public ExchangeDataReader(InvestApiClient investApiClient, IDataBus eventBus,
IOptions<ExchangeConfig> options, IDbContextFactory<TraderDbContext> dbContextFactory, IOptions<ExchangeConfig> options, IDbContextFactory<TraderDbContext> dbContextFactory,
ILogger<ExchangeDataReader> logger) ILogger<ExchangeDataReader> logger)
{ {
_exchangeDataRecievingEnabled = options.Value.ExchangeDataRecievingEnabled;
_eventBus = eventBus; _eventBus = eventBus;
_dbContextFactory = dbContextFactory; _dbContextFactory = dbContextFactory;
_investApiClient = investApiClient; _investApiClient = investApiClient;
@ -71,7 +72,10 @@ namespace KLHZ.Trader.Core.Exchange.Services
{ {
try try
{ {
await SubscribePrices(); if (_exchangeDataRecievingEnabled)
{
await SubscribePrices();
}
await Task.Delay(1000); await Task.Delay(1000);
//await SubscribeCandles(); //await SubscribeCandles();
} }

View File

@ -8,6 +8,7 @@
}, },
"LokiUrl": "", "LokiUrl": "",
"ExchangeConfig": { "ExchangeConfig": {
"ExchangeDataRecievingEnabled": true,
"Token": "", "Token": "",
"ManagingAccountNamePatterns": [ "автотрейд 1" ], "ManagingAccountNamePatterns": [ "автотрейд 1" ],
"AllowedInstrumentsFigis": [ "BBG004730N88", "FUTIMOEXF000" ], "AllowedInstrumentsFigis": [ "BBG004730N88", "FUTIMOEXF000" ],

View File

@ -11,4 +11,5 @@ services:
LokiUrl: "loki:3100" LokiUrl: "loki:3100"
TgBotConfig__Token: "${TG_BOT_TOKEN}" TgBotConfig__Token: "${TG_BOT_TOKEN}"
ExchangeConfig__Token: "${EXCHANGE_API_TOKEN}" ExchangeConfig__Token: "${EXCHANGE_API_TOKEN}"
ConnectionStrings__PostgresConnection: "${PG_CONNECTION_STRING}" ConnectionStrings__PostgresConnection: "${PG_CONNECTION_STRING}"
ExchangeConfig__ExchangeDataRecievingEnabled: "${PRICES_RECIEVING_ENABLED}"

View File

@ -14,6 +14,7 @@ services:
TgBotConfig__Token: "${TG_BOT_TOKEN}" TgBotConfig__Token: "${TG_BOT_TOKEN}"
ExchangeConfig__Token: "${EXCHANGE_API_TOKEN}" ExchangeConfig__Token: "${EXCHANGE_API_TOKEN}"
ConnectionStrings__PostgresConnection: "${PG_CONNECTION_STRING}" ConnectionStrings__PostgresConnection: "${PG_CONNECTION_STRING}"
ExchangeConfig__ExchangeDataRecievingEnabled: "${PRICES_RECIEVING_ENABLED}"
# postgresql: # postgresql:
# ports: # ports: