InstaForex is an Official Asian and CIS
Trading Partner of Liverpool Footbal Club
The Best Broker in Asia 2009 - 2015*
*According to International Finance Magazine, World Finance Award, ShowFx World and CIOT Exhibitions
Register as partner

Advanced statistics

Full information on profits and attracted customers in a real time mode

More



Quotes distribution

InstaForex offers free access to real-time Forex quotes from InstaForex Company for web masters and website owners. All trading symbols presented in InstaTrader platform are available.

On this web page you can find information that allows web masters and website owners to get free access to real-time quotes of Forex instruments from InstaForex. You can get all trading symbols presented in InstaTrader platform as online quotes on your web resource.

Using online quotes from InstaForex will help you to enrich the informational content of your resource and attract new clients thanks to regularly updated information about short- and long-term market fluctuations.

In order to receive Forex quotations it is necessary to use the information presented below on PHP-request sent to the public page of receiving quotations from InstaForex. If you use the provided quotations we strongly recommend to place the link www.instaforex.com as a source of information.

Getting quotes

API description: https://quotes.instaforex.com/

Getting ticks: https://quotes.instaforex.com/api/quotesTick

Available output formats

1. JSON - To get quotes in the JSON format, add parameter m=json to the query.

#Query example: https://quotes.instaforex.com/api/quotesTick?m=json
file_get_contents("https://quotes.instaforex.com/api/quotesTick?m=json");

Query result:

[{"digits":4, "ask":1.1341, "bid":1.1338, "change":0.0001, "symbol":"EURUSD", "lasttime":1466444034, "change24h":0.0005}, {"digits":4, "ask":1.4654, "bid":1.4651, "change":0.0001, "symbol":"GBPUSD", "lasttime":1466444036, "change24h":0.0181}, {"digits":2, "ask":104.55, "bid":104.52, "change":-0.01, "symbol":"USDJPY", "lasttime":1466444036, "change24h":-0.17}, {"digits":4, "ask":0.9606, "bid":0.9603, "change":-0.0001, "symbol":"USDCHF", "lasttime":1466444036, "change24h":-0.0008}, {"digits":4, "ask":1.2797, "bid":1.2794, "change":-0.0001, "symbol":"USDCAD", "lasttime":1466444034, "change24h":-0.0053}]

2. XML - To get quotes in the XML format, add parameter m=xml to the query.

#Query example: https://quotes.instaforex.com/api/quotesTick?m=xml
file_get_contents("https://quotes.instaforex.com/api/quotesTick?m=xml");

Query result:

        <?xml version="1.0" encoding="UTF-8"?>
        <items>
            <item>
                <digits>4</digits>
                <ask>1.1347</ask>
                <bid>1.1344</bid>
                <change>0.0001</change>
                <symbol>EURUSD</symbol>
                <lasttime>1466443591</lasttime>
                <change24h>0.0011</change24h>
            </item>
            <item>
                <digits>4</digits>
                <ask>1.4652</ask>
                <bid>1.4649</bid>
                <change>-0.0001</change>
                <symbol>GBPUSD</symbol>
                <lasttime>1466443585</lasttime>
                <change24h>0.0179</change24h>
            </item>
            ...
            <item>
                <digits>2</digits>
                <ask>1280.8</ask>
                <bid>1280.2</bid>
                <change>0.01</change>
                <symbol>GOLD</symbol>
                <lasttime>1466443592</lasttime>
                <change24h>-9.14</change24h>
            </item>
        </items>
    

Warning: Output in the XML format may be removed in a future release.

Displaying only specific currency pairs

To get only specific currency pairs, pass parameter q= with a list of currency pairs separated by commas.

#Query example: https://quotes.instaforex.com/api/quotesTick?m=json&q=eurusd,gold,%23bitcoin
file_get_contents("https://quotes.instaforex.com/api/quotesTick?m=json&q=eurusd,gold,%23bitcoin");

Query result:

[{"digits":4, "ask":1.1344, "bid":1.1341, "change":-0.0001, "symbol":"EURUSD", "lasttime":1466444823, "change24h":0.0008}, {"digits":2, "ask":1285.71, "bid":1285.11, "change":-0.03, "symbol":"GOLD", "lasttime":1466444824, "change24h":-4.23}, {"digits":2, "ask":743.98, "bid":739.98, "change":-0.05, "symbol":"#Bitcoin", "lasttime":1466444795, "change24h":-16.18}]

Notations

Notations used to display results (key legend):

symbol - the currency pair symbol
bid - the bid value
ask - the ask value
change - the value indicating change in relation to the previous price of the currency pair
digits - the value showing how many digits after the decimal point are displayed in the currency pair price
lasttime - the value indicating the last change time of the currency pair price
change24h - the change in relation to the previous day's close

Getting the list of all available instruments

Available output formats: JSON

#Query example: https://quotes.instaforex.com/api/quotesList
file_get_contents("https://quotes.instaforex.com/api/quotesList");

Query result:

{"quotesList": [{"symbol":"EURUSD", "group":{"name":"Forex", "id":0}, "desc":"Euro vs US Dollar"}, {"symbol":"GBPUSD", "group":{"name":"Forex", "id":0}, "desc":"Great Britain Pound vs US Dollar"}]}

Getting the list sorted by group

Example: https://quotes.instaforex.com/api/quotesList?groupId=21

0-5 - Forex Group
6 - Metals
7 - CFDs
16-19, 21 - Futures/Indices

Using Library in PHP (PHP version requirement > 5.2)

1. Getting data via the HTTP protocol:
Code sample located in the archive, file: example_http.php

2. Getting data via the socket:
Code sample located in the archive, file: example_socket.php

Download archive

See also