diff --git a/csharp/TraderBot/Program.cs b/csharp/TraderBot/Program.cs index 39669303..29eb60d0 100644 --- a/csharp/TraderBot/Program.cs +++ b/csharp/TraderBot/Program.cs @@ -2,7 +2,7 @@ using Tinkoff.InvestApi; using TraderBot; -var builder = Host.CreateDefaultBuilder(args); +var builder = Host.CreateDefaultBuilder(); var host = builder .ConfigureServices((context, services) => { diff --git a/csharp/TraderBot/TradingService.cs b/csharp/TraderBot/TradingService.cs index 3462dde1..931d3633 100644 --- a/csharp/TraderBot/TradingService.cs +++ b/csharp/TraderBot/TradingService.cs @@ -26,7 +26,15 @@ public TradingService(ILogger logger, InvestApiClient investApi, Settings = settings; Logger.LogInformation($"ETF ticker: {Settings.EtfTicker}"); Logger.LogInformation($"CashCurrency: {Settings.CashCurrency}"); - CurrentAccount = InvestApi.Users.GetAccounts().Accounts[0]; + CurrentAccount = InvestApi.Users.GetAccounts().Accounts[2]; + if(InvestApi.Users.GetAccounts().Accounts.Count > 0) + { + Console.WriteLine("Choose Account:"); + foreach(var acc in InvestApi.Users.GetAccounts().Accounts){ + Console.WriteLine(acc); + } + CurrentAccount = InvestApi.Users.GetAccounts().Accounts[int.Parse(Console.ReadLine())]; + } Logger.LogInformation($"CurrentAccount: {CurrentAccount}"); CurrentInstrument = InvestApi.Instruments.Etfs().Instruments.First(etf => etf.Ticker == Settings.EtfTicker); Logger.LogInformation($"CurrentInstrument: {CurrentInstrument}");