Stock API
Elk Layer API is available for all big stock exchange markets of more than 30 countries. We have designed the programming interface that provides a line streaming of real time data of the stock market that investors can easily use to make final decisions by making sell or buying rates. Elk Layer API offers real-time and historical information of stock exchange markets. You can obtain real time stock data at every minute and every day, where you can search more than 5 years old accurate historical stock market data. We have built this API powerful, simple and scalable with a peak time of close to 100% that will not take you more than five minutes to get a start right away.
Our Elk Layer API is a cutting edge technology, a highly scalable infrastructure with hundreds of requests hits every day. You can install a server by utilizing the different API to get live-time Data information just like currency converters to check the most recent rates and it sounds like the most significant API we have offered you now.
Parameters and their use
Parameter | Usage |
---|---|
ID | Set pair ID in parameter value to get your required pair data. Default: none. Example: id=1,2,3... etc, To get all list of Pair ID's or Pair short name use "Pair List API". |
Symbol | You can use currency pair name, instant of ID when you need. Default: none. Example: symbol=EURUSD,USDJPY,GBPNZD etc, Note: When you use ID and symbol parameter, than symbol param will be ignored. |
Category | Category is used to get all paris in specific stock category, to get all stock pairs, use category=stock Default: none. Valid values: forex, crypto, stock |
Period | To get specifi time period history or candle prices, use the period parameter Default: 1h Valid Values: 1m,5m,15m,30m,1h,2h,4h,1d,1w,month Alternate: 1,5,15,30,60,120,240,1440,10080,43200 |
From | When you need history data of specific date. Default: none. Example: id=1,2,3... etc, Format: YYYY-MM-DD E.g: 2024-07-06 OR: YYYY-MM-DD Hour:Min E.g: 2024-07-06 07:07 |
To | When you need history data of specific date. Default: none. Format:YYYY-MM-DD E.g: 2024-07-06 TO:YYYY-MM-DD Hour:Min E.g: 2024-07-06 07:07 |
Candle | Latest Rates API return last 2 candles of each pair, so you can filter, which candle you need. A previous closed candle, or current active candle prices. Default: active Values: active, close, both |
Output | Set your API response format. Default:JSON Valid Values:JSON, JSONP, object, XML, serialize and array |
Available Pairs List
This API will return all available stock pairs list that we have in our database. First you need to use this api to get all IDs and pairs name to use in other APIs.
category = stock
auth_key = AUTH_KEY
API:
Return All stock currency symbols list.
https://elklayer.com/api/v1/list?category=stock&auth_key=AUTH_KEY
Response:
{
"id": 2001,
"name": "3SBio Inc CFD",
"symbol": "3SBio Inc CFD",
"category": "stock",
"country": "hong kong",
"decimals": "2",
"points": "0.01",
"base": "HKD", // Base Currency
"quote": "HKD", // Quote Currency
},
{and more...},
Stock Pair Details
Get pair profile details such as id, name, decimals, Trading times, bank, country
id = {any valid ID}
symbol = {any valid short name}
category = major,exotic,minor
auth_key = AUTH_KEY
Profile by IDs
https://elklayer.com/api/v1/profile?id=2001,2002,2003&auth_key=AUTH_KEY
By Symbol Combination:
https://elklayer.com/api/v1/profile?symbol=3SBio Inc CFD,Agricultural Bank of China CFD&auth_key=AUTH_KEY
By Currency Short Name:
https://elklayer.com/api/v1/profile?category=stock&auth_key=AUTH_KEY
Response:
{ //Stock Currency Profile
"id" : 2001,
"short_name" : "3SBio Inc CFD",
"name" : "3SBio Inc CFD",
"status" : 1,
"decimals" : 2,
"points" : "0.01",
"base_curr" : "HKD",
"quote_curr" : "HKD",
"category" : "stock",
"type" : "stock",
"trading_days" : ["..."],
},
{and more...},
Currency Latest Price
Forex latest price API is very useful, you must have to get in touch with the updated price of a currency That's why the latest prices are included in any API which is the most common part. We provide one or multiple currency prices at the same time, To do so, you just have to send the request with symbols parameter in API request and set it to one or more comma-separated codes of a currency.
Note: We update the prices of each currency in every 30 seconds or less. And use Last Candle API if you need time frame latest price, like 5m,1h,1week candle price.
Accepted Parameters :id = {Any valid FX ID} symbol = {Any valid FX symbol} period = {Any valid period} candle = {active,close,both} category = {Any valid category} auth_key = AUTH_KEY
Request Credit Usage:1 credit count for each 100 record returned (rounded up). Price of one id:
https://elklayer.com/api/v1/latest?id=2001&auth_key=AUTH_KEY
Multiple prices by ids:
https://elklayer.com/api/v1/latest?id=2001,2002,2003&auth_key=AUTH_KEY
Prices by candle:
https://elklayer.com/api/v1/latest?candle=active&auth_key=AUTH_KEY
{
"id": 2001,
"s": "3SBio Inc CFD", // Symbol
"o": "1.18000", // Open
"h": "1.18038", // High
"l": "1.17972", // Low
"c": "1.18027", // Price/Close, Current price
"a": "1.18038", // Ask
"b": "1.18016", // Bid
"sp": "2.2", // Spread
"ch": "+0.0002", // Change in 1 day candle
"cp: "+0.02%, // Change in percentage
"v": "64124", // Volume
"t": "1596575732", // When update last time Time Unix Format (UTC)
"tm": "2020-08-04 21:15:03", // When update last time (UTC)
"up": "2020-08-04 21:14:30",
},
{and more...},
Base Currency
On the base of 1 currency, it will return all quote prices of all available currencies.
symbol = {Any FX/Crypto currency symbol} e.g: EUR,USD, JPY etc
auth_key = AUTH_KEY
https://elklayer.com/api/v1/base?symbol=USD&auth_key=AUTH_KEY
{
"prices": {
"AUD": "1.4886269",
"EUR": "0.9472567",
"USD": "1"
}
"update_time": {
"AUD": "1677493260",
"EUR": "1677493200",
"USD": "1677493200"
}
}
Stock Historical Price API
Elk Layer API will give you all the information of stock rates with historical data with instance access to the users with most recent currencies pairs. Elk Layer is a simple forex documentations API, with high accuracy of rates, and best level security codes, extensive data collection of main indicators that are ready to use any time. You will find the historical data by appending a date (format YYYY-MM-DD) in API URL with the base URL and specify the period parameter values: {1m, 5m, 30m, 1h, 2h, 4h, 5h, 1d, 1w, and month}
id = {Any valid stock ID} symbol = {Any valid stock symbol} period = {TimeFrame period} {1m,5m,15m,30m,1h,2h,4h,5h,1d,1w,month} from = {Date from} & To = {date to} (Use both at a time or ignore both for latest history) auth_key = AUTH_KEY
Return Latest candles
https://elklayer.com/api/v1/history?id=2001&period=1h&auth_key=AUTH_KEY
History Between Specific Date {YYYY-MM-DD}
https://elklayer.com/api/v1/history
?symbol=EUR/USD
&period=1d
&from=2024-01-01 OR 1704067200 // Unix format
&to=2024-07-08 OR 1720396800
&auth_key=AUTH_KEY
Do not use FROM and TO parameter : If you always need the latest history upto 900 candles, then you must have to take care of From/To parameter, that should not be assigned and remove them from URL, Then it will work better, With FROM and TO parameter it will take more time in response.
Or Between Specific Date-Time
https://elklayer.com/api/v1/history?symbol=EUR/USD&period=1d&from=2024-01-01T12:00&to=2024-07-08T12:00&auth_key=AUTH_KEY
Or Between Specific Date-Time
{
"o": "0.9765", // Open
"h": "0.9806", // High
"l": "0.9765", // Low
"c": "0.9792", // Close
"t": 1665712800000, // Time Unix Format (UTC)
"tm": "2022-10-14 02:00:00" // Date Time (UTC)
},
{and 900 more historical candles...},
Eligibility :Free users can't use "From/To" parameters.
Response:
{
"o": "0.9765", // Open
"h": "0.9806", // High
"l": "0.9765", // Low
"c": "0.9792", // Close
"t": 1665712800000, // Time Unix Format (UTC)
"tm": "2022-10-14 02:00:00" // Date Time (UTC)
},
{and 900 more historical candles...},