Пример #1
0
        public async Task Run()
        {
            var api = new IqOptionApi(_config.Email, _config.Password);

            _logger.LogInformation($"Connecting to {_config.Host} for {_config.Email}");


            if (await api.ConnectAsync())
            {
                _logger.LogInformation("Connect Success");

                //get profile
                var profile = await api.GetProfileAsync();

                _logger.LogInformation($"Success Get Profile for {_config.Email}");

                //get updated instruments
                var instruments = await api.GetInstrumentsAsync();

                //_logger.LogInformation($"Change balance to {profile.Balances[0].Id}");
                //if (await api.ChangeBalanceAsync(profile.Balances[0].Id)) {
                //}
                while (true)
                {
                    var buyResult = await api.BuyAsync(ActivePair.EURUSD, 1, OrderDirection.Call);
                }

                await api.GetInstrumentsAsync();
            }
        }
Пример #2
0
        public async Task ConnectAsyncTask_WithValidUserId_ConnectMustBeTrue()
        {
            //arrange
            var api = new IqOptionApi(Configuration.Email, Configuration.Password);

            //act
            var result = await api.ConnectAsync();

            //assert
            result.ShouldBeTrue();
        }