示例#1
0
        public async Task RunSample()
        {
            var trader   = new IqOptionApi.IqOptionApi("*****@*****.**", "Code11054");
            var follower = new IqOptionApi.IqOptionApi("*****@*****.**", "Code11054");

            await Task.WhenAll(trader.ConnectAsync(), follower.ConnectAsync());

            trader.InfoDatasObservable.Select(x => x[0]).Where(x => x.Win == "equal").Subscribe(x => {
                follower.BuyAsync(x.ActiveId, (int)x.Sum, x.Direction, x.Expired);
            });
        }
示例#2
0
        public async Task RunSample()
        {
            var api = new IqOptionApi.IqOptionApi(_config.Email, _config.Password);

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


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

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

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


                // open order EurUsd in smallest period (1min)
                var exp       = DateTime.Now.AddMinutes(1);
                var buyResult = await api.BuyAsync(ActivePair.EURUSD, 1, OrderDirection.Call, exp);


                // get candles data
                var candles = await api.GetCandlesAsync(ActivePair.EURUSD, TimeFrame.Min1, 100, DateTimeOffset.Now);

                _logger.Information($"CandleCollections received {candles.Count}");


                // subscribe to pair to get real-time data for tf1min and tf5min
                var streamMin1 = await api.SubscribeRealtimeDataAsync(ActivePair.EURUSD, TimeFrame.Min1);

                var streamMin5 = await api.SubscribeRealtimeDataAsync(ActivePair.EURUSD, TimeFrame.Min5);

                streamMin5.Merge(streamMin1)
                .Subscribe(candleInfo => {
                    _logger.Information($"Now {ActivePair.EURUSD} {candleInfo.TimeFrame} : Bid={candleInfo.Bid}\t Ask={candleInfo.Ask}\t");
                });

                // after this line no-more realtime data for min5 print on console
                await api.UnSubscribeRealtimeData(ActivePair.EURUSD, TimeFrame.Min5);


                //when price down with
            }
        }
示例#3
0
        public async Task RunSample()
        {
            var api = new IqOptionApi.IqOptionApi(textBox1.Text, textBox2.Text);


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


                // get candles data
                var candles = await api.GetCandlesAsync(ActivePair.AUDJPY, TimeFrame.Min1, 100, DateTimeOffset.Now);



                // subscribe to pair to get real-time data for tf1min and tf5min
                var streamMin1 = await api.SubscribeRealtimeDataAsync(ActivePair.AUDJPY, TimeFrame.Min1);



                streamMin1
                .Subscribe(candleInfo => {
                    double a = candleInfo.Bid;
                    double b = candleInfo.Ask;
                    double c = (a + b) / 2;

                    SetText(c);
                    SetText2(candleInfo.Bid.ToString());
                    SetText3(candleInfo.Ask.ToString());
                    Console.WriteLine(candleInfo.Bid.ToString());
                });



                // after this line no-more realtime data for min5 print on console
                await api.UnSubscribeRealtimeData(ActivePair.EURUSD, TimeFrame.Min5);


                //when price down with
            }
        }