https://ifxcopr.com/partners/
Register as partner
Partner login

Charts API

As part of development strategy and with the aim to provide its partners with the most relevant and convenient systems and technologies, InstaForex broker offers a new service of currency pair charts drawing - Charts API. Thanks to this service, a partner can place a chart reflecting online change in price of a certain pair on his resource. Charts API from InstaForex is a convenient and useful tool for modern trader which will perfectly underscore the relevance of your resource. This service enables working with the requests both created on C# and PHP. You can download and study InstaForex Charts API typical uses. C# and PHP code examples are available now for downloading. The Charts API is provided in OHLC format, which can be used to plot charts of various types (Japanese candlestick, bar, line), numerous financial instruments, and different timeframes. InstaForex Company does not cease to develop new and up-to-dated services due to which the work of our clients and partners becomes more effective and comfortable.

The document contains examples of applications for most widely used programming languages.

Example PHP:

$params = array( 'chartRequest' => array( 'From' => 0, #since which moment the search of candlesticks will be performed
'To' => 1351620300, #until which moment the search of candlesticks will be performed
'Symbol' => "EURUSD", #the currency pair on which the historical data will be received
'Type' => "MN" #the type of candlestick. The possible readings: MN, W1, D1, H4, H1, M30, M15, M5, and M1
)
);

$client = new SoapClient('https://client-api.instaforex.com/soapservices/charts.svc?wsdl);
try
{ print_r($client->GetCharts($params), true); }
catch(SoapFault $fault)
{ echo $fault->faultstring; }

Example C#:

var sc = new ChartServiceClient();
try
{ var candles = sc.GetCharts(new ChartRequest{From = 0, To = 1351620300, Symbol = "EURUSD", Type = ChartType.MN});
foreach (var candle in candles) Console.WriteLine("Timestamp: {0}; Open: {1}", candle.Timestamp, candle.Open);
}
finally
{ if(sc.State != CommunicationState.Closed)
sc.Abort();
}
See also
InstaForex portal for partners © Copyright 2007-2024
Trademarks of the InstaFintech group of companies