Stocks JSON API Documentation

STOCK API

Powered by 30+ exchange rate data sources, the FCS API delivering real-time stock exchange rate data for 30+ Countries and 25,000+ Stocks. The FCS provides different API endpoints, each serving a different data response. FCS provides the latest price for all or a specific pair of stock, retrieving historical stocks data for one or multiple stocks, technical indicators for market analyzing, and stock performance includes company income, cash flow, earnings, and financial reporting.

In this document, you will learn how to use API with its parameters, potential unwanted errors and some code examples. After this document, if you face difficulty to understand API structure, you can contact us any time and our team will be happy to help out.

Get Started

FCS API is designed to quickly access tools. Use any programming language to hit on API URL, you will get a response in standard JSON format.
Use Javascript (Ajax), PHP (Curl or file_get_content), Java OR android (HttpURLConnection), C# (httpWebRequest) or CURL from command line

API Access Key
You need API key in order to access our database. Your API Key is the unique key that is passed into the API base URL's access_key parameter in order to authenticate with the FCS API.

Note: Maximum 10 API request allow/minute. Please use multiple ids in the API URL to reduce API requests.

Sample API:

https://fcsapi.com/api/stock/list?category_id=1&access_key=API_KEY
Sign up for free using the button below to use the FCS Quickstart tool.
Signup

Parameters

Parameters Details
ID Specify Symbol id, Set id in URL parameter to get a stock response
Default: none. Values: 1,2,3... etc,
To get all list of Stock ID's or Symbols use "List API" below.
Symbol Symbol parameter uses to get specific stock data by symbol name from the database.
Default: none. Values: {Any valid stock symbol name}

Note: At least one "id" or "symbol" is required. If the ID parameter exists in URL than the symbol parameter will be ignored. You can use any 1 parameter (ID or Symbol) both will return the same result.
Country It is required when you use "All Stocks list" API, so you will get all stock from your selected country. Support 30 Countries
Default: none.
Valid Values:
    brazil, canada, china,
    denmark, dubai, finland, france,
    germany, hong-kong,
    india, indonesia, ireland,
    japan, malaysia, mexico, netherlands,
    pakistan, philippines, russia,
    saudi-arabia, singapore, south-africa, south-korea, spain, sweden, switzerland,
    thailand, turkey, united-kingdom, united-states,

Note: You can set 1 or more country names to get all stocks from multiple countries by comma-separated names.
Category_id When you need all stocks of specific category from any country. Set category_id={category_id} in URL parameter.
Default: none.
Valid Values: {any valid Category id as shown in "All Stock List" API}

Note: You can set 1 or more category id to get all stocks from multiple category id by comma-separated ids.

Note: If the "Country" parameter exists in URL than the "country_id" parameter will be ignored.
Period It is required in a few API requests, when you request for candle prices, history, signals, moving average lines, pivot points. So you need to specify which time frames data you want.

Default: 1h
Valid Values: 5m, 15m, 30m,1h, 5h, 1d, 1w, month
OR Alternate: 5, 15, 30,60, 300, 1440, 10080, 43200
From
(Optional)
When you access history API of any stock and you need historical data from a specific date, you need to specify date between from/to date by using (from, to) parameter

Default: none
Date Format: YYYY-MM-DD E.g: 2018-01-01
OR YYYY-MM-DDTHour:Min E.g: 2018-01-01T12:30
To
(Optional)
When you access history API.

Default: none
Date Format: YYYY-MM-DD E.g: 2018-01-31
OR YYYY-MM-DDTHour:Min E.g: 2018-01-31T12:30

Note: When you do not specify FROM and TO parameters, then history will return latest 300 candles.

What is T in date format!!! It is nothing, we use it to remove space between time. It has no use and no validation.
Output
(Optional)
Set your API response format.
Default: json
Valid Values: json, object, xml, serialize and array

Stocks Category

You can get all the list of supported categories in your favorite country. You can use these categories ids in the "All Stocks List" API. Enter your category name in parameters to get a category list.

Parameters:
country={any valid supported country name} (optional)
access_key=API_KEY

Categories by country:
https://fcsapi.com/api/stock/category?country=indonesia&access_key=API_KEY
Multiple list by country:
https://fcsapi.com/api/stock/category?country=japan,turkey,indonesia&access_key=API_KEY
All category list from all countries:
https://fcsapi.com/api/stock/category?access_key=API_KEY
Response:
{ 
  "id"1,
  "country""United-states",
  "category_name""Nasdaq 100"
},
{

  "id"2,
  "country""Japan",
  "category_name""Topix 500"
},
{
and more}

All Supported Stocks List

You can get all list of our supported stocks names, ids and category name.

Parameters:
country={any valid supported country name}
category_id={any valid supported category id} (optional)
access_key=API_KEY

Stock list by country:
https://fcsapi.com/api/stock/list?country=United-states&access_key=API_KEY
https://fcsapi.com/api/stock/list?country=United-states,Japan&access_key=API_KEY
Stock list by category id:
https://fcsapi.com/api/stock/list?category_id=1&access_key=API_KEY
https://fcsapi.com/api/stock/list?category_id=1,2,3&access_key=API_KEY
Response:
{ 
  "stock_id"1,
  "name""Advanced Micro Devices Inc",
  "symbol""AMD",
  "country""United-states",
},
{

  "stock_id"2,
  "name""Apple Inc",
  "symbol""AAPL",
  "country""United-states",
},
{
Many More Stock List}

Stock Latest Price

The most common part of API is to get the latest price of stocks, You can get one or multiple stock prices at the same time. To do so, simply append the stock ID/symbol parameter to your API request and set it to one or more by comma-separated.
Note: Prices update in every 30 seconds

Parameters:
id={any valid supported stock id}
symbol={any valid supported stock short name}
access_key=API_KEY

Stock Prices API:
https://fcsapi.com/api/stock/latest?id=1&access_key=API_KEY
https://fcsapi.com/api/stock/latest?id=1,2,3,4,5&access_key=API_KEY
Stocks by symbol:
https://fcsapi.com/api/stock/latest?symbol=AMD,AAPL,MSFT,FB&access_key=API_KEY
Response:
{ 
  "symbol""Facebook",
  "price""183.28", // Open Price
  "price""188.89", // Current/Close Price
  "high""190.38", // High
  "low""183.66", // Low
  "chg""+5.61", // Change in 1 Day
  "chg_percent"+3.06%", // Change in percentage in 1 Day
  "dateTime""2019-10-15 12:30:00" // When price changed last time
},
{
and more}

Historical Price API

Returns stocks historical candle price data for a specific stock. Historical rates are available for most stocks all the way back to the year of the stock starting date. You can query the FCS API for historical rates by appending a date (format YYYY-MM-DD) to the base URL and specify the period time {5m, 15m, 30m,1h, 5h, 1d, 1w, month}

Accepted Parameters :
id = {Any valid Stock ID}
symbol = {Any valid stock short name}
period = {Currency time period}
from = {History date from} & To = {date to} (Use both at a time or ignore both for latest)
access_key = API_KEY

If you always need the latest history, then please do not set From/To parameter, it will work better.
Note: Below API does not support multiple ids in URL as a parameter. Send only 1 ID/Symbol name at a time with the API request.

Quick Latest 300 Candles History
https://fcsapi.com/api/stock/history?id=1&period=1h&access_key=API_KEY
https://fcsapi.com/api/stock/history?symbol=IBM&period=1h&access_key=API_KEY
For Graphic Charts

Return response in special json format so you can use it directly in graph charts. Develop for HTML/JS graphs.

https://fcsapi.com/api/stock/history?id=1&period=1h&access_key=API_KEY&chart=1
History Between Specific Date {YYYY-MM-DD}
Returns specific time period historical exchange rate data between two specified dates for all available symbols. Use FROM/TO parameters.
https://fcsapi.com/api/stock/history 
   ?id=1
   &period=1d
   &from=2019-05-01
   &to=2019-11-11
   &access_key=API_KEY
Or Between Specific Date-Time
https://fcsapi.com/api/stock/history?id=1&period=1d&from=2019-05-01T12:00&to=2019-11-11T12:00&access_key=API_KEY
Response:
{ 
  "symbol""FB",
  "candle": {
     "o""134.22", // Open
     "h""136.48", // High
     "l""134.15", // Low
     "c""135.22", // Close
     "t"1573430400, // Time Unix Format (UTC)
     "tm""2019-11-11" // Date Time (UTC)
  },
  {
and 300 more historical candles},
}

Technical Indicator

Technical indicators are calculated with the help of top chart indicators (MA, RSI, STOCH, ATR etc). The collection of chart indicators powerful & profitable stock trading strategies and systems that work. It is developed to get latest technical indicator values. In Response you will get a result of top indicators.

Parameters:
id={any valid supported stock id}
symbol={any valid supported stock short name}
access_key=API_KEY

Technical Stocks API:
https://fcsapi.com/api/stock/technicals?id=1&access_key=API_KEY
https://fcsapi.com/api/stock/technicals?id=1,2,3,4,5&access_key=API_KEY
Technical Stocks by symbol:
https://fcsapi.com/api/stock/technicals?symbol=TSLA,MSFT,FB&access_key=API_KEY
Response:
{ 
  "id"1,
  "symbol""TSLA",
  "hourly""Strong Buy",
  "daily""Sell",
  "weekly""Strong Sell",
  "monthly""Strong Sell"
},
{
and more}

Performance

Get stock performance, when and how much stock price performs.

Parameters:
id={any valid supported stock id}
symbol={any valid supported stock short name}
access_key=API_KEY

Stocks Performance API
https://fcsapi.com/api/stock/performance?id=1&access_key=API_KEY
https://fcsapi.com/api/stock/performance?id=1,2,3,4,5&access_key=API_KEY
Performance by symbol:
https://fcsapi.com/api/stock/performance?symbol=TSLA,MSFT,FB&access_key=API_KEY
Response:
{ 
  "id"1,
  "symbol""MSFT",
  "daily""+1.6 %",
  "week""-9.29 %",
  "month""+2.6 %",
  "ytd""+15.62 %",
  "year""+52.6 %",
  "year3""-23.47 %"
},
{
and more}

Fundamental

Get stock fundamental to track stock performance for screening.

Stock Fundamental API:
https://fcsapi.com/api/stock/fundamental?id=1,2,3,4,5&access_key=API_KEY
https://fcsapi.com/api/stock/fundamental?id=1&access_key=API_KEY
Fundamental API by Symbol:
https://fcsapi.com/api/stock/fundamental?symbol=MYTX,AHAP,BMAS&access_key=API_KEY
Response:
{ 
  "id"1,
  "symbol""MYTX",
  "avg_vol_3m""5.05K",
  "market_cap""139.74B",
  "revenue""163.95B",
  "pe_ratio""48.65",
  "beta""2",
},
{
and more}

Finance

Finance is a heart of stock, You can get all current and historical income of stock, Balance and cash flow.
Below are 4 different API sample URLs.

Note: Below API does not support multiple ids in URL as a parameter. Send only 1 ID/Symbol name at a time with API request.

Parameters:
id={any valid supported stock id}
symbol={any valid supported stock short name}
access_key=API_KEY

Income API:
https://fcsapi.com/api/stock/income?id=1&access_key=API_KEY
Balance API:
https://fcsapi.com/api/stock/balance?id=1&access_key=API_KEY
Cash Flow API:
https://fcsapi.com/api/stock/cash?id=1&access_key=API_KEY
Earnig API:
https://fcsapi.com/api/stock/earning?id=1&access_key=API_KEY
Response:
Response are different for above 4 API's.
{ 
  "id"1,
  "symbol""FB",
  "type""Income",
  "report""Annual",
  "data""{...}" // more detail
}


Profile

The most common part of API is to get the latest price of a currency, You can get one or multiple currency prices at the same time. To do so, simply append the FCS API's symbols parameter to your API request and set it to one or more comma-separated currency codes.

Parameters:
id={any valid supported stock id}
symbol={any valid supported stock short name}
access_key=API_KEY

Price of one symbol:
https://fcsapi.com/api/stock/profile?id=1&access_key=API_KEY
Multiple prices by ids:
https://fcsapi.com/api/stock/profile?id=1,2,3,4&access_key=API_KEY
Multiple prices by name:
https://fcsapi.com/api/stock/profile?symbol=TSLA,MSFT,FB,AAPL&access_key=API_KEY
Response:
{ 
  "id"1,
  "symbol""NFLX",
  "name""Netflix Inc",
  "country""United-states",
  "sector""Services",
  "industry""Broadcasting & Cable TV",
  "employees""7000",
  "equity_type""ORD",
  "info" {
     "Address""---",
     "City""Los Gatos",
     "Postal_code""CA 95032-1815",
     "Country""United-states",
     "Phone""+1-408-996****",
     "Fax""+1-408-996****",
     "Website""-",
  },
},
{
and more}

Sample Code PHP

Real-time rates: Find below a simple PHP example for getting exchange rate data via the FCS API's latest endpoint.

$access_key = "API_KEY"; // Your API access key, Signup to get API KEY 
$id = 1; // Stock id

// Enter your API URL below
$api_url = "https://fcsapi.com/api/stock/latest?id=".$id."&access_key=".$access_key;

// Initialize CURL:
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch); // Store the data
curl_close($ch);

$response = json_decode($json, true); // convert JSON into Array
print_r($response);

Sample Code jQuery.ajax

Real-time rates: Find below a simple jQuery.ajax example of getting exchange rate data via the FCS API's latest endpoint.

access_key = "API_KEY"; // Your API access key, Signup to get API KEY 
id = 1; // Stock id

$.ajax({
    url:
"https://fcsapi.com/api/stock/latest?id=" + id + "&access_key=" + access_key,
    dataType:
"json",
    success: function(data) {
        console.log(data);
    }
});

Disclaimer

Stock Prices, Profile, Market trends and signals, and historical data are not designed for trading purpose, These signals are only for education or noncommercial purpose use. Data contained in this application/website is not necessarily real-time nor accurate and so prices may not be accurate and may differ from the actual market price, meaning prices are indicative and not appropriate for trading purposes. Therefore we doesn`t bear any responsibility for any trading losses you might incur as a result of using this data.