View Source QuickFSPublicAPI.Api.Datapoints (quick_fs_public_api v0.0.2)
API calls for all endpoints tagged Datapoints.
Link to this section Summary
Functions
Full Datasets Pull metadata and all financial statements (annual and quarterly) for all periods for a single stock in one API call. For example: GET https://public-api.quickfs.net/v1/data/all-data/IBM:US?api_key={your_api_key} Successful calls to this endpoint count are counted as 10 datapoints against your daily quota.
Batch Requests
Batch requests allow you to retrieve multiple metrics in a single API call that returns a customized JSON document. To utilize the batch request endpoint, simply construct a JSON object containing the QFS() function that you'd like to resolve as leaf nodes and POST it to the API in the data field of your request body. The response will return your data structure with datapoints resolved in-line. Here's a sample request body to give you an idea of how this works: <br> <b>Comparing Return on Assets and Return on Invested Capital for multiple companies</b> { "data": { "roa" : { "Coca-Cola Co" : "QFS(KO:US,roa,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roa,FY-2:FY)" }, "roic" : { "Coca-Cola Co" : "QFS(KO:US,roic,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roic,FY-2:FY)" } } } resolves to { "data": { "roa" : { "Coca-Cola Co" : [0.0736, 0.0142, 0.0752], "PepsiCo" : [0.0884, 0.0633, 0.1589] }, "roic" : { "Coca-Cola Co" : [0.1058, 0.0202, 0.1087], "PepsiCo" : [0.1678, 0.1232, 0.3207] } } } <br> The structure of the request body under data is completely arbitrary. This gives you the power to design your own data structures, post them to our server, and get the results back in a format that suits your purpose. <br> <b>Full Python example:</b> import requests, json api_key = "" header = {'x-qfs-api-key': api_key} request_body = { "data" : { "roa" : { "Coca-Cola Co" : "QFS(KO:US,roa,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roa,FY-2:FY)" }, "roic" : { "Coca-Cola Co" : "QFS(KO:US,roic,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roic,FY-2:FY)" } } } r = requests.post("https://public-api.quickfs.net/v1/data/batch",json=request_body,headers=header) print(r.status_code, r.reason) my_data = r.json() print(my_data)
Data Ranges Resolve a range of datapoints for a single company metric. Here are a few sample requests to get you started: <b><u><a href="/v1/data/IBM/revenue?period=FY-19:FY&api_key={your_api_key}" target="_blank">20 years of historical revenue for International Business Machines Corp.</a></u></b> GET /v1/data/IBM/revenue?period=FY-19:FY&api_key={your_api_key} <b><u><a href="/v1/data/FFH:CA/mkt_cap?api_key={your_api_key}" target="_blank">Current market capitalization of Fairfax Financial Holdings Ltd</a></u></b> GET /v1/data/FFH:CA/mkt_cap?api_key={your_api_key} > Notice that the query for the Canadian-listed Fairfax Financial includes :CA as part of the ticker symbol. It's better to use the country identifier code for non-U.S. stocks. If you do not specify a country, the API will first try to match a U.S.-listed symbol and, if none is found, will then match with a non-U.S. company with the same symbol.
Link to this section Functions
Specs
data_all_data_symbol_get(Tesla.Env.client(), String.t(), keyword()) :: {:ok, QuickFSPublicAPI.Model.RequestError.t()} | {:ok, Map.t()} | {:error, Tesla.Env.t()}
Full Datasets Pull metadata and all financial statements (annual and quarterly) for all periods for a single stock in one API call. For example: GET https://public-api.quickfs.net/v1/data/all-data/IBM:US?api_key={your_api_key} Successful calls to this endpoint count are counted as 10 datapoints against your daily quota.
Parameters
- connection (QuickFSPublicAPI.Connection): Connection to server
- symbol (String.t): Company symbol or qfs_symbol (e.g. IBM or IBM:US)
- opts (KeywordList): [optional] Optional parameters
Returns
on success {:error, Tesla.Env.t} on failure
Specs
data_batch_post(Tesla.Env.client(), String.t(), keyword()) :: {:ok, QuickFSPublicAPI.Model.DatapointBatch.t()} | {:ok, QuickFSPublicAPI.Model.RequestError.t()} | {:ok, QuickFSPublicAPI.Model.DatapointBatchErrors.t()} | {:error, Tesla.Env.t()}
Batch Requests
Batch requests allow you to retrieve multiple metrics in a single API call that returns a customized JSON document. To utilize the batch request endpoint, simply construct a JSON object containing the QFS() function that you'd like to resolve as leaf nodes and POST it to the API in the data field of your request body. The response will return your data structure with datapoints resolved in-line. Here's a sample request body to give you an idea of how this works: <br> <b>Comparing Return on Assets and Return on Invested Capital for multiple companies</b> { "data": { "roa" : { "Coca-Cola Co" : "QFS(KO:US,roa,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roa,FY-2:FY)" }, "roic" : { "Coca-Cola Co" : "QFS(KO:US,roic,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roic,FY-2:FY)" } } } resolves to { "data": { "roa" : { "Coca-Cola Co" : [0.0736, 0.0142, 0.0752], "PepsiCo" : [0.0884, 0.0633, 0.1589] }, "roic" : { "Coca-Cola Co" : [0.1058, 0.0202, 0.1087], "PepsiCo" : [0.1678, 0.1232, 0.3207] } } } <br> The structure of the request body under data is completely arbitrary. This gives you the power to design your own data structures, post them to our server, and get the results back in a format that suits your purpose. <br> <b>Full Python example:</b> import requests, json api_key = "" header = {'x-qfs-api-key': api_key} request_body = { "data" : { "roa" : { "Coca-Cola Co" : "QFS(KO:US,roa,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roa,FY-2:FY)" }, "roic" : { "Coca-Cola Co" : "QFS(KO:US,roic,FY-2:FY)", "PepsiCo" : "QFS(PEP:US,roic,FY-2:FY)" } } } r = requests.post("https://public-api.quickfs.net/v1/data/batch",json=request_body,headers=header) print(r.status_code, r.reason) my_data = r.json() print(my_data)
Parameters
- connection (QuickFSPublicAPI.Connection): Connection to server
- x_qfsapi_key (String.t):
- opts (KeywordList): [optional] Optional parameters
on success {:error, Tesla.Env.t} on failure
Specs
data_symbol_metric_get(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, QuickFSPublicAPI.Model.RequestError.t()} | {:ok, QuickFSPublicAPI.Model.DatapointRangeErrors.t()} | {:ok, QuickFSPublicAPI.Model.DatapointRange.t()} | {:error, Tesla.Env.t()}
Data Ranges Resolve a range of datapoints for a single company metric. Here are a few sample requests to get you started: <b><u><a href="/v1/data/IBM/revenue?period=FY-19:FY&api_key={your_api_key}" target="_blank">20 years of historical revenue for International Business Machines Corp.</a></u></b> GET /v1/data/IBM/revenue?period=FY-19:FY&api_key={your_api_key} <b><u><a href="/v1/data/FFH:CA/mkt_cap?api_key={your_api_key}" target="_blank">Current market capitalization of Fairfax Financial Holdings Ltd</a></u></b> GET /v1/data/FFH:CA/mkt_cap?api_key={your_api_key} > Notice that the query for the Canadian-listed Fairfax Financial includes :CA as part of the ticker symbol. It's better to use the country identifier code for non-U.S. stocks. If you do not specify a country, the API will first try to match a U.S.-listed symbol and, if none is found, will then match with a non-U.S. company with the same symbol.
Parameters
- connection (QuickFSPublicAPI.Connection): Connection to server
- symbol (String.t): Company symbol or qfs_symbol (e.g. BRK.A or BRK.A:US)
- metric (String.t): QuickFS metric name (e.g. eps_diluted)
- opts (KeywordList): [optional] Optional parameters
on success {:error, Tesla.Env.t} on failure