This is my custom API for IQ OPTION, created using C# NETCORE 3.1
- Get Server Time
- Set Local Time
- Get Profile info
- Get Active list
- Get Profile Info
- Set Balance account type
- Get Candle List
- Get Realtime Candles
- Request Buy
- Check Buy Result
- Sma
- Ema
- RSI
- MACD
- Bollinger Band
- Fractal
using IqApiNetCore;
using IqApiNetCore.Models;
using IqApiNetCore.Utilities;
API api = new API();
connected = await api.ConnectAsync("username@username.com" "password");
api.ChangeBalanceAsync(BalanceType.Real);
api.ChangeBalanceAsync(BalanceType.Practice);
decimal balance = api.profile.balance;
DateTime serverDateTime = api.serverTime.GetRealServerDateTime();
long lastCandleTimeStamp = TimeConverter.FromDateTime(serverDateTime);
(List<Active> binaryActives, List<Active> turboActives) = await api.GetActiveList(true);
Active active = turboActives[0];
int periodInSeconds = 60
long lastCandleTimeStamp = TimeConverter.FromDateTime(api.serverTime.GetRealServerDateTime());
int candleCount = 100;
List<Candle> candles = await api.GetCandlesAsync(active, periodInSeconds, lastCandleTimeStamp, candleCount);
int periodInSeconds = 60;
Active active = turboActives[0];
candles = new List<Candle>();
api.StartCandlesStream(periodInSeconds,OnReceiveCandle); //used to start receiving candle realtime
//function example
void OnReceiveCandle(object data, EventArgs e)
{
Candle candle = (Candle)data;
if(candle.active_id == active.id)
{
if (candles[candles.Count - 1].fromDateTime == candle.fromDateTime)
candles[candles.Count - 1] = candle;
else
candles.Add(candle);
}
}
api.StopCandlesStream();
API.BuyDirection direction = API.BuyDirection.put; //API.BuyDirection.call to use CALL
decimal buyValue = 1;
(string status, Operation op) = await api.BuyAsync(active, periodInSeconds, direction, buyValue);
OperationStatus opStat = await api.CheckBuyResult(op.option_id)
List<Candle> candleList = await api.GetCandlesAsync(active, periodInSeconds, lastCandleTimeStamp, candleCount);
decimal[] sma = Indicators.GetSMA(period, candleList)
int period 12;
decimal[] ema = Indicators.GetEMA(period, candleList)
int deviation = 2;
BollingerBand[] bb = Indicators.GetBollingerBand(period, deviation, candleList);
MACD macd = Indicators.GetMACD(fastEMAPeriod,slowEMAPeriod,signalPeriod,candleList);
float[] rsi = Indicators.GetRSI(period, candleList);
(decimal[] fracUp, decimal[] fracDown) = Indicators.GetFractal(period, candlesList);