Â
API - Personal Data
Personal Data
API Usage Information
Get user API Usage Information.
Request
GET /api_usage
Example
GET https://api.gurufocus.com/public/user/{api_token}/api_usage
Response
Response will be an object containing the user's API usage information.
{
"API Usage": 20,
"API Requests Remaining": "Unlimited"
}
User Portfolios
Get list of personal portfolios.
Request
GET /portfolio/my_portfolios
Example
GET https://api.gurufocus.com/public/user/{api_token}/portfolio/my_portfolios
Response
Response will be an array containing the list of personal portfolios.
[
{
"id": "123456",
"uid": "654321",
"portid": "123456",
"portname": "Portfolio 1",
"modified": "1541386018",
"intro": "764850",
"private": 0,
"email": "0",
"alert": "",
"settings": "",
"created": "2018-11-04 20:46:58",
"num_stocks": 10,
"p_all": null,
"p_1m": null,
"p_3m": null,
"p_6m": null,
"p_12m": null,
"p_3y": null,
"p_5y": null,
"p_10y": null,
"p_rel_sp500": null,
"is_article": null,
"is_deleted": "0",
"deleted_time": null,
"description": "All-In-One Guru Screener - GuruFocus.com http://gurufocus.com/screener/",
"detail": [
{
"id": "5057214",
"symbol": "OTCPK:ALRT",
"in_price": "0.05",
"price": "0.04",
"currency": "USD",
"pettm": "0.00",
"ps": "0.00",
"pb": "0.00",
"gain": "0",
"gain_p": "-20%",
"gain_today": "0",
"p_change": "0.00",
"p_pct_change": "-5.67",
"open": "0.05",
"high": "0.05",
"low": "0.04",
"volume": "284119",
"date_add": "11/04/2018",
"cost_per_share": "0.05",
"shares": 0,
"company": "ALR Technologies Inc"
},
{
"id": "5057215",
"symbol": "OTCPK:BIIO",
"in_price": "0.28",
"price": "0.35",
"currency": "USD",
"pettm": "0.00",
"ps": "0.00",
"pb": "0.00",
"gain": "0",
"gain_p": "25%",
"gain_today": "0",
"p_change": "0.00",
"p_pct_change": "0.00",
"open": "0.00",
"high": "0.00",
"low": "0.00",
"volume": "0",
"date_add": "11/04/2018",
"cost_per_share": "0.28",
"shares": 0,
"company": "Bionovate Technologies Corp"
}
]
}
]
List User Portfolios (V2)
Get list of personal portfolios.
Request
GET https://api.gurufocus.com/v2/{api_token}/portfolios
Example
GET https://api.gurufocus.com/v2/{api_token}/portfolios
Response
Response will be an array containing the list of personal portfolios.
{
"data": [
{
"id": 1,
"created_at": "2017-05-05T09:09:05Z",
"updated_at": "2019-12-19T04:28:31Z",
"deleted_at": null,
"name": "TEST Portfolio",
"desc": "",
"user_id": 1,
"private": 1,
"is_basket": 0,
"locked": false,
"has_transaction": false,
"email": false,
"stock_count": 16,
"stocks": null,
"summary": null,
"currencies_summary": null,
"weighted_summary": null,
"statics": {
"super_sectors": null,
"sectors": null,
"groups": null,
"country": null
},
"settings": {
"currency": "USD"
}
}
],
"total": 80
}
Load User Portfolios (V2)
Load personal portfolio detail by portfolio id.
Request
POST https://api.gurufocus.com/v2/{api_token}/portfolios/{portfolio_id}
Request body
Request body should be a JSON object containing the following properties:
- fields Required|Array Fields list of portfolio stocks, eg: ["symbol","exchange","price","mktcap_norm"], all fields are listed at https://api.gurufocus.com/v2/{api_token}/fields
- sort Required|String Result order, eg: "price|DESC" will sort the result by current price desc or asc
Example
POST https://api.gurufocus.com/v2/{api_token}/portfolios/{portfolio_id}
{
"fields": [
"sales",
"revenue",
"currency"
],
"sorts":"sales|desc"
}
Response
Response will be the detail of the loaded portfolio.
{
"id": 1,
"created_at": "2017-05-05T09:09:05Z",
"updated_at": "2019-12-19T04:28:31Z",
"deleted_at": null,
"name": "TEST Portfolio",
"desc": "",
"user_id": 1,
"private": 1,
"is_basket": 0,
"stock_count": 16,
"stocks": [
{
"currency": "USD",
"revenue": 246,
"sales": 246,
"stockid": "US2FS1",
"transaction_summary": {
"annualized_gain": 24.502886,
"annualized_gain_dividend": 28.304064,
"commission": 0,
"cost": 141660.16,
"cost_fifo": 141660.16,
"cost_per_share": 30.44,
"cost_per_share_fifo": 30.44,
"day_gain": 2001.1125,
"dividend_earned": 11262.074,
"dividend_yield_on_cost": 4.599211,
"gain": 77624.55,
"price_change_since_first_transaction": 46.846256,
"realized_gain": 11262.074,
"realized_gain_percent": 7.9500647,
"rel_spy": 7.7587547,
"share_of_earnings": 5072.588,
"shares": 4653.75,
"unrealized_gain": 66362.48,
"unrealized_gain_percent": 46.846252,
"value": 208022.62,
"value_weight": 0.01841062
},
"transactions": [
{
"portfolio_id": 75849,
"stockid": "US2FS1",
"morn_secr_id": "0P0001Q6LD",
"price": 30.44,
"split_factor": 1,
"spinoff_adj_factor": 1,
"shares": 4653.75,
"commission": 0,
"commission_per_share": 0,
"dividend_earned_pershare": 2.42,
"type": "",
"value": 0,
"adjust_shares": 4653.75,
"adjust_price": 30.44,
"add_time": "2022-12-13T10:25:05Z",
"oid": 10833686,
"id": 326090612,
"created_at": "2022-12-13T10:25:05Z",
"updated_at": "2022-12-13T10:25:05Z",
"deleted_at": null
}
]
}
],
"summary": {
"annualized_gain": -24.4772,
"annualized_gain_dividend": 32.9206,
"commission": "NaN",
"cost": 9884047,
"cost_fifo": 9884047,
"day_gain": 36724.3906,
"dividend_earned": 922774.5,
"gain": 2337782.5,
"realized_gain": 922774.5,
"realized_gain_percent": null,
"rel_spy": -73.2397,
"true_gain": null,
"unrealized_gain": 1415008.25,
"unrealized_gain_percent": null,
"value": 11299056,
"p_change": 0.0049437545,
"p_pct_change": 1.2475001,
"base_currency": "USD",
"to_currency": "USD",
"base_currency_symbol": "$",
"to_currency_symbol": "$",
"exchange_rate": 1,
"to_usd_currency_exchange_rate": 1,
"base_usd_currency_exchange_rate": 1
},
"weighted_summary": {
"dividend_earned": 187039.33,
"dividend_yield_on_cost": 1.9867402
},
"statics": {
"super_sectors": [
{
"display_name": "Cyclical",
"code": "1",
"value": 6706284,
"percent": 59.35261
},
{
"display_name": "Defensive",
"code": "2",
"value": 4374606.5,
"percent": 38.716568
},
{
"display_name": "Sensitive",
"code": "3",
"value": 218164.45,
"percent": 1.9308203
}
],
"sectors": [
{
"display_name": "Financial Services",
"code": "103",
"value": 5007165,
"percent": 44.3149
},
{
"display_name": "Healthcare",
"code": "206",
"value": 4374606.5,
"percent": 38.716568
},
{
"display_name": "Consumer Cyclical",
"code": "102",
"value": 1554729.2,
"percent": 13.759817
},
{
"display_name": "Consumer Defensive",
"code": "205",
"value": 0,
"percent": 0
},
{
"display_name": "Communication Services",
"code": "308",
"value": 218164.45,
"percent": 1.9308203
},
{
"display_name": "Real Estate",
"code": "104",
"value": 144390.06,
"percent": 1.277895
}
],
"groups": [
{
"display_name": "Asset Management",
"code": "10310",
"value": 3181544.5,
"percent": 28.157616
},
{
"display_name": "Medical Distribution",
"code": "20670",
"value": 2696421.8,
"percent": 23.864136
},
{
"display_name": "Insurance",
"code": "10340",
"value": 1825620.8,
"percent": 16.157288
},
{
"display_name": "Vehicles & Parts",
"code": "10200",
"value": 1300278.6,
"percent": 11.5078535
},
{
"display_name": "Tobacco Products",
"code": "20560",
"value": 0,
"percent": 0
},
{
"display_name": "Drug Manufacturers",
"code": "20620",
"value": 1678184.6,
"percent": 14.852433
},
{
"display_name": "Manufacturing - Apparel & Accessories",
"code": "10240",
"value": 236275.2,
"percent": 2.091106
},
{
"display_name": "Media - Diversified",
"code": "30820",
"value": 218164.45,
"percent": 1.9308203
},
{
"display_name": "Real Estate",
"code": "10410",
"value": 144390.06,
"percent": 1.277895
},
{
"display_name": "Retail - Cyclical",
"code": "10280",
"value": 18175.379,
"percent": 0.16085751
}
],
"country": [
{
"display_name": "USA",
"code": "USA",
"value": 8461815,
"percent": 74.88958
},
{
"display_name": "CHN",
"code": "CHN",
"value": 1300278.6,
"percent": 11.5078535
},
{
"display_name": "DEL",
"code": "DEL",
"value": 867817.94,
"percent": 7.6804476
},
{
"display_name": "FRA",
"code": "FRA",
"value": 524752.6,
"percent": 4.644217
},
{
"display_name": "HKG",
"code": "HKG",
"value": 144390.06,
"percent": 1.277895
}
]
}
}
User Screeners
Get a list of user's customized screeners.
Request
GET /user_screeners
Example
GET https://api.gurufocus.com/public/user/{api_token}/user_screeners
Response
Response will be an array containing the list of screener information.
[
{
"id": 55636,
"user_id": 753587,
"name": "test save screener",
"note": "test",
"is_public": true,
"is_hidden": 0,
"default_exchanges": [
"NAS",
"NYSE",
"OTCPK",
"OTCBB",
"AMEX",
"ARCA",
"IEXG",
"BATS",
"GREY"
],
"default_view": null,
"is_predefined": false,
"updated_at": "2021-10-18 22:18:12",
"created_at": "2021-10-18 22:18:12",
"default_ranking": null,
"alerts": []
}
]
User Screener DataÂ
Detailed information about a screener. Each page contains 100 stocks, such that to get all the stocks of a screener, you need to run multiple queries with the page variable equals 1 to res['stocks']['total'] / 100.
Notice that this API is only available for premium plus members. The maximum page is 50 so only the top 5000 stocks of a screener can be fetched.
Request
GET /user_screeners/{screener_id}/{page}
Example
GET https://api.gurufocus.com/public/user/{api_token}/user_screeners/55636/1
Response
Response will be an object containing the screener information. Notice the stock information is partial.
{
"id": 55636,
"user_id": 753587,
"name": "some name",
"note": "some note",
"is_public": true,
"is_hidden": 0,
"default_exchanges": [
"NAS",
"NYSE",
"OTCPK",
"OTCBB",
"AMEX",
"ARCA",
"IEXG",
"BATS",
"GREY"
],
"default_view": null,
"is_predefined": false,
"updated_at": "2021-10-18 22:18:12",
"created_at": "2021-10-18 22:18:12",
"default_ranking": null,
"stocks": {
"total": 4,
"per_page": 100,
"current_page": 1,
"last_page": 1,
"from": 1,
"to": 4,
"data": [
{
"ranks": "-",
"overall_rank": "-",
"guru_trading_ids": "-",
"insider_trading_ids": "-",
"exchange": "OTCPK",
"symbol": "CZMWY",
"display_symbol": "CZMWY",
"price": 194.6,
"currency_symbol": {
"currency": "USD",
"rate": "1.000000",
"currency_symbol": "$",
"timestamp": "1634669163"
},
"company": "Carl Zeiss Meditec AG",
"region": "U",
"mktcap_norm": "17405.024",
"stockid": "US0FCH"
}
],
"allfilters": [
{
"id": 1984961,
"screener_id": 55636,
"field_id": 53023,
"operator": "=",
"right": "0",
"sequence": null,
"updated_at": "2021-10-18 22:18:12",
"created_at": "2021-10-18 22:18:12",
"field": {
"id": 53023,
"field_name": "use_in_region",
"financial_name": null,
"display_name": "Display Multiple Classes in One Region",
"field_type": "boolean",
"options": {
"all_in_one_screener": {
"type": "select",
"data": [
{
"label": "Yes",
"value": true
},
{
"label": "No",
"value": false
}
]
},
"user_id": -1,
"is_basic": true,
"is_predefined": true,
"is_group": false,
"is_hidden": false,
"is_positive": 0,
"is_increase": 0,
"category": 1,
"updated_at": "2020-08-27 16:36:28",
"created_at": "2020-08-27 15:37:13",
"basic_fields": "use_in_region"
}
}
}
],
"alerts": []
}
}
Continue to read: API Reference - Backtesting