GuruFocus.com API Version 3.0.0 (07/23/2015)In computer programming, an application programming interface (API) is a set of routines, protocols, and tools for building software applications.
GuruFocus.com API is using REST architecture. The format of response is JSON. You can use any programming language you like to build your own winning strategy based on our Guru/Insider/Financial data.
Trial membership only allow 100 requests.
GuruFocus API is for
Premium and
PremiumPLUS
Members use only. Please obtain your personal Token
now.
Company Financials up to 20 years of annual data and 80 quarters of quarterly data.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/financials |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/financials |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the financial data.
Example:
"financials": {
"annuals": {
"Fiscal Year": [
"1996-01",
"1997-01",
"1998-01",
"1999-01",
"2000-01",
"2001-01",
"2002-01",
"2003-01",
"2004-01",
"2005-01",
"2006-01",
"2007-01",
"2008-01",
"2009-01",
"2010-01",
"2011-01",
"2012-01",
"2013-01",
"2014-01",
"2015-01"
], "income_statement": {"Revenue": ["93627", "104859", "117958", "137634",
"165013", "191329", "205823", "231577", "258681", "284310", "312101", "348368",
"378476", "404374", "408085", "421849", "446950", "468651", "476294", "485651"],
"Cost of Goods Sold":["73260", "82047", "91804", "106853", "127289", "147387",
"159097", "178299", "198747", "216832", "237649", "263979", "286350", "304056",
"304444", "314946", "335127", "352297", "358069", "365086"]...
}
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Company current key statistics data.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/keyratios |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/keyratios |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the key statistics data.
Example:
"Performance": {
"1-W Change (%)": "-1.06",
"4-W Change (%)": "0.49",
"12-W Change (%)": "-5.82",
"24-W Change (%)": "-14.55",
"52-W Change (%)": "-2.66",
"3-Y Change (%)": "2.88",
"5-Y Change (%)": "9.89",
"10-Y Change (%)": "5.58",
"YTD Change (%)": "-13.74",
"Beta": "0.75",
"Short Ratio": "2.94",
"Trade Volume": "9336754"
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Company current quote data.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/quote |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/quote |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the stock quote data.
Example:
{
"timestamp": "1461006301",
"datetime": "2016-04-18 19:05:01 (UTC)",
"price": "107.16",
"price change": "-2.69",
"price pct change": "-2.45",
"open": "108.89",
"volumn": "47665590",
"low": "106.94",
"high": "108.95",
"currency": "USD"
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Company historical price data.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/price |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/price |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the price data. Data format : date ,
split-adjusted close price
Example:
[
[
"01-02-1990",
5.891
],
[
"01-03-1990",
5.891
],
[
"01-05-1990",
5.859
]
]
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Company current price, valuations ratios and ranks, summary information.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/summary |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/summary |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the stock summary data.
Example:
"ratio": {
"Current Ratio": {
"indu": {
"global_rank": "245",
"indu_med": "1.21",
"indu_tot": "336"
},
"value": "0.89",
"status": "1",
"his": {
"low": "0.80",
"high": "1.64"
}
},
"Quick Ratio": {
"indu": {
"global_rank": "314",
"indu_med": "0.75",
"indu_tot": "336"
},
"value": "0.23",
"status": "1",
"his": {
"low": "0.12",
"high": "0.28"
}
}
......
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Real-time Guru stock trades and current holdings data for specific companies.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/gurus |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/gurus |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the guru picks data.
Example:
{
"WMT": {
"picks": [
{
"guru": "Warren Buffett",
"date": "2015-03-31",
"action": "Reduce",
"impact": "0",
"price_min": "80.69",
"price_max": "90.47",
"Avg": "85.11",
"comment": "Reduce 0.00%",
"current_shares": "60385293"
},
{
"guru": "Dodge & Cox",
"date": "2015-03-31",
"action": "Add",
"impact": "0.01",
"price_min": "80.69",
"price_max": "90.47",
"Avg": "85.11",
"comment": "Add 0.37%",
"current_shares": "30876839"
}
}
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Company Real-time insider trades data.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/{symbol?}/insider |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/stock/WMT/insider |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the insider data.
Example:
{
"WMT": [
{
"insider": "Whaley Steven P",
"position": "Senior Vice President",
"date": "2015-03-05",
"type": "S",
"trans_share": "2,400",
"final_share": "28,189",
"price": "83.28",
"cost": "199.9",
"change": "-13.39"
},
{
"insider": "BREWER ROSALIND G",
"position": "Executive Vice President",
"date": "2014-11-25",
"type": "S",
"trans_share": "7,000",
"final_share": "181,535",
"price": "84.96",
"cost": "594.7",
"change": "-15.1"
}
]
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
List all gurus and personlized gurus.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/gurulist |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the list of guru names with ids.
Example:
{
"all": {
"us": [
[
"1",
"Vanguard Health Care Fund"
]
]
...}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
List guru stock picks using guru id and date.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/guru/{ids?}/picks/{date?} |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/guru/7/picks/2014-09-30 |
| Type | Params | Values |
|---|---|---|
| GET | {id} Guru id got from https://www.gurufocus.com/api/public/user/{your personal token?}/gurulist |
string |
| GET | {date?} Starting date for guru picks. Ending date is current date. Date format is YYYY-mm-dd. |
string |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the list of gurus stock picks.
Example:
{
"Jean-Marie Eveillard": {
"port": [
{
"symbol": "ARQL",
"exchange": "NAS",
"company": "Arqule Inc",
"price": "2.09",
"currency": null,
"GuruName": "Jean-Marie Eveillard",
"type": "realtime",
"RecmDate": "2015-04-29",
"RecmAction": "Add",
"trans_share": "0.02",
"RecmPrice": "2.05",
"price_min": "2.05",
"price_max": "2.05",
"change": "2",
"share_current": "8719968",
"industry": "Biotechnology",
"sector": "Healthcare",
"symbol_ori": "ARQL",
"currency_txt": "USD",
"comment": "Add 96.18%"
}
]
...}
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
List aggregated portfolios.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/guru/{ids?}/aggregated |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/guru/7/aggregated |
| Type | Params | Values |
|---|---|---|
| GET | {id} Guru id got from https://www.gurufocus.com/api/public/user/{your personal token?}/gurulist |
string |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the list of gurus portfolios.
Example:
{
"7": {
"summary": {
"firm": "Berkshire Hathaway",
"num_new": "2",
"number_of_stocks": "47",
"equity": "109365",
"turnover": "3",
"country": "",
"date": "2014-12-31"
},
"port": [
{
"13f_date": "2014-12-31",
"share": "463458123",
"symbol": "WFC",
"exchange": "NYSE",
"industry": "Banks - Global",
"sector": "Financial Services",
"company": "Wells Fargo & Co",
"price": "55.61",
"currency": null,
"52l": "16.5",
"52h": "1.2",
"mktcap": "286051.100",
"pe": "13.50",
"yield": "2.50",
"change": "0.00",
"value": "25406800.00",
"position": "23.2",
"impact": "0",
"pct": "9.00",
"symbol_ori": "WFC",
"currency_txt": "USD"
}
]...
}
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
List worldwide exchanges.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/exchange_list |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/exchange_list |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the list of exchanges.
Example:
{
"USA": [
"NAS",
"NYSE",
"OTCPK",
"",
"OTCBB",
"AMEX",
"ARCA",
"ASE"
],
"Canada": [
"TSXV",
"TSX",
"XCNQ"
],
...
}
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Get list of all stocks of a particular exchange.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/exchange_stocks/{exchange_name?} |
| Example | https://www.gurufocus.com/api/public/user/{your personal token?}/exchange_stocks/NYSE |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the list of stocks in the exchange.
Example:
[
{
"symbol": "A",
"exchange": "NYSE",
"company": "Agilent Technologies Inc",
"currency": "USD"
},
{
"symbol": "AA",
"exchange": "NYSE",
"company": "Alcoa Inc",
"currency": "USD"
}
...
]
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
Get list of latest insider trades ordered by insider transctions time.
| Method | URL |
|---|---|
| GET | https://www.gurufocus.com/api/public/user/{your personal token?}/insider_updates |
| Status | Response |
|---|---|
| 200 | Response will be an object containing the list of insider trades ordered by
transction date.
Example:
[
{
"insider": "Black Mark A",
"position": "EVP",
"trans_date": "2016-04-11",
"type": "S",
"trans_share": "2,678",
"final_share": "43,586",
"price": "248.16",
"cost": "664.6"
},
{
"insider": "Blachar Doron",
"position": "CFO",
"trans_date": "2016-04-11",
"type": "S",
"trans_share": "13,158",
"final_share": "0",
"price": "40.37",
"cost": "531.2"
},
...
]
|
| 200 | If Authorization is wrong, will return "Authorization required. Please follow the document." |
The following code using JAVA to output the P/E ratio in Valuation ratios for WMT.
Prerequest Libraries:
org-json-java
Commons
IO
The output JAVA String of P/E ratio:
The following code using C# to output the P/E ratio in Valuation ratios for WMT.
First, we will need to download the json.net library from https://json.codeplex.com/
The C# output of P/E ratio:
The following code using Python 3+ to output the P/S ratio in Valuation ratios for WMT.
The Python output of P/S ratio:
If you encountered "403 Forbidden error", please see this page.
This is probably because of mod_security or some similar server security feature which blocks known spider/bot user agents (urllib uses something like python urllib/3.3.0, it's easily detected). Try setting a known browser user agent.
The following code using PHP to output the Valuation ratios for WMT.
The output PHP array:
Using the awesome ImportJSON tool in combination with this wonderful script, you are able to get the GuruFocus API data into a google spreadsheet in a matter of minutes. Here’s how:
For example, if you want to use GuruFocus API to get valuation ratios in Google Spreadsheet, just try the following function in your spreadsheet
The output will be:
The following code using R to output the P/E ratio in Valuation ratios for WMT.
Prerequest Libraries:
jsonlite
curl
The output object of P/E ratio: