{"id":21284471,"url":"https://github.com/nasdaq/data-link-r","last_synced_at":"2025-10-11T03:54:04.825Z","repository":{"id":62459211,"uuid":"501402351","full_name":"Nasdaq/data-link-r","owner":"Nasdaq","description":"This is Nasdaq Data Link's R package. The Nasdaq Data Link R package uses the [Nasdaq Data Link API](https://docs.data.nasdaq.com/). The official Nasdaq Data Link R package manual can be found [here](https://cran.r-project.org/package=NasdaqDataLink).","archived":false,"fork":false,"pushed_at":"2022-06-20T18:17:54.000Z","size":43,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-28T10:57:38.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nasdaq.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-08T20:33:40.000Z","updated_at":"2024-05-20T15:27:41.000Z","dependencies_parsed_at":"2022-11-02T00:45:26.816Z","dependency_job_id":null,"html_url":"https://github.com/Nasdaq/data-link-r","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Nasdaq/data-link-r","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nasdaq%2Fdata-link-r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nasdaq%2Fdata-link-r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nasdaq%2Fdata-link-r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nasdaq%2Fdata-link-r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nasdaq","download_url":"https://codeload.github.com/Nasdaq/data-link-r/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nasdaq%2Fdata-link-r/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006109,"owners_count":26084026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T11:16:07.036Z","updated_at":"2025-10-11T03:54:04.808Z","avatar_url":"https://github.com/Nasdaq.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"Nasdaq Data Link R Package\n=========\n\nThis is Nasdaq Data Link's R package. The NasdaqDataLink R package uses the [Nasdaq Data Link API](https://docs.data.nasdaq.com/). The official Nasdaq Data Link R package manual can be found [here](https://cran.r-project.org/package=NasdaqDataLink).\n\nLicense provided by MIT.\n\nFor more information please contact connect@data.nasdaq.com\n\n# Installation\n\nTo install the [devtools](https://cran.r-project.org/package=devtools) package:\n\n    install.packages(\"devtools\")\n    library(devtools)\n    install_github(\"nasdaq/data-link-r\")\n\n## CRAN\n\nTo install the most recent package from CRAN type:\n\n    install.packages(\"NasdaqDataLink\")\n    library(NasdaqDataLink)\n\nNote that the version on CRAN might not reflect the most recent changes made to this package.\n\n# Authentication\n\nTo make full use of the package we recommend you set your [api key](https://docs.data.nasdaq.com/docs/getting-started#getting-an-api-key). To do this create or sign into your account and go to your [account api key page](https://data.nasdaq.com/account/profile). Then input your API key (with quotes):\n\n```r\nNasdaqDataLink.api_key(\"tEsTkEy123456789\")\n```\n\n# Usage\n\nThe NasdaqDataLink package functions use the NasdaqDataLink API. Optional Nasdaq Data Link API query parameters can be passed into each function. For more information on supported query parameters, please see the [Nasdaq Data Link API documentation page](https://docs.data.nasdaq.com). Once you find the data you would like to load into R on Nasdaq Data Link, copy the Nasdaq Data Link code from the description box and paste it into the function.\n\n```r\ndata \u003c- NasdaqDataLink(\"NSE/OIL\")\n```\n\n## Graphing Data Example\nTo create a graph of Google's performance month-over-month:\n\n```r\nplot(stl(NasdaqDataLink(\"WIKI/GOOG\",type=\"ts\",collapse=\"monthly\")[,11],s.window=\"per\"))\n```\n\nNote: `collapse` is a Nasdaq Data Link API query parameter. Click [here](https://docs.data.nasdaq.com/docs/time-series) for a full list of query parameter options.\n\n## Return Types\n\nThe supported return types for the `NasdaqDataLink(code)` function are:\n* raw (which returns a data.frame)\n* [ts](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ts.html)\n* [zoo](https://cran.r-project.org/package=zoo)\n* [xts](https://cran.r-project.org/package=xts)\n* [timeSeries](https://cran.r-project.org/package=timeSeries)\n\nTo request a specific type, assign the `type` argument the return type:\n\n```r\ndata \u003c- NasdaqDataLink('NSE/OIL', type = \"xts\")\n```\n\n### Date Formats\n\nzoo, xts, and ts have their own time series date formats. For example:\n\n```r\ndata \u003c- NasdaqDataLink('NSE/OIL', collapse = \"quarterly\", type = \"zoo\", limit = 3)\n```\n\n`data` will have indexes `2015 Q1`, `2015 Q2`, and `2015 Q3`:\n\n```r\n         Open  High    Low   Last  Close Total Trade Quantity Turnover (Lacs)\n2015 Q1 459.8 462.8 452.45 454.45 454.95               277225         1265.84\n2015 Q2 448.0 451.7 445.10 447.80 446.80               352514         1576.93\n2015 Q3 456.0 465.0 454.15 456.80 456.75               174154          797.79\n```\n\nIf you want the time series index to be displayed as dates, you will need to set `force_irregular = TRUE`:\n\n```r\ndata \u003c- NasdaqDataLink('NSE/OIL', collapse = \"quarterly\", type = \"zoo\", limit = 3, force_irregular = TRUE)\n```\n\n`data` will now have indexes `2015-03-31`, `2015-06-30`, and `2015-09-30`:\n\n```r\n            Open  High    Low   Last  Close Total Trade Quantity Turnover (Lacs)\n2015-03-31 459.8 462.8 452.45 454.45 454.95               277225         1265.84\n2015-06-30 448.0 451.7 445.10 447.80 446.80               352514         1576.93\n2015-09-30 456.0 465.0 454.15 456.80 456.75               174154          797.79\n```\n\n## Merged Dataset Data\nIf you want to get multiple codes at once, delimit the codes with ',', and put them into an array. This will return a multiset.\n\n```r\nmerged_data \u003c- NasdaqDataLink(c('GOOG/NASDAQ_AAPL', 'GOOG/NASDAQ_MSFT'))\n```\n\nYou can also specify specific columns to retrieve. For example, if you only want column 1 from `GOOG/NASDAQ_AAPL` and column 2 from `GOOG/NASDAQ_MSFT`:\n\n```r\nmerged_data \u003c- NasdaqDataLink(c('GOOG/NASDAQ_AAPL.1', 'GOOG/NASDAQ_MSFT.2'))\n```\n\n## Downloading Entire Database\n\nAn entire database's data can be downloaded. For example, to download the database `ZEA`:\n\n```r\nNasdaqDataLink.database.bulk_download_to_file(\"ZEA\", \"./ZEA.zip\")\n```\n\nNote you must set your [api key](#authentication) to download [premium databases](https://data.nasdaq.com/search?type=premium) to which you are subscribed.\n\nFor a full list of optional query parameters for downloading an entire database, click [here](https://docs.data.nasdaq.com/docs/parameters-2).\n\n## Datatables\n\nTo retrieve Datatable data, provide a Datatable code to the NasdaqDataLink datatables function:\n\n```r\ndata = NasdaqDataLink.datatable('ZACKS/FC')\n```\n\nThe output format is `data.frame`. Given the volume of data stored in datatables, this call will retrieve the first page of the ZACKS/FC datatable. You may turn on pagination to return more data by using:\n\n```r\ndata = NasdaqDataLink.datatable('ZACKS/FC', paginate=TRUE)\n```\n\nThis will retrieve multiple pages of data and merge them together as if they were one large page. In some cases, however, you will still exceed the request limit. In this case we recommend you filter your data using the available query parameters, as in the following example:\n\n```r\nNasdaqDataLink.datatable('ZACKS/FC', ticker=c('AAPL', 'MSFT'), per_end_date.gt='2015-01-01', qopts.columns=c('ticker', 'per_end_date', 'tot_revnu'))\n```\n\nIn this query we are asking for more pages of data, ticker values of either AAPL or MSFT and a per_end_date that is greater than or equal to 2015-01-01. We are also filtering the returned columns on ticker, per_end_date and tot_revnu rather than all available columns.\n\n## Search\nSearching Nasdaq Data Link from within the R console is now supported. The search function is:\n\n```r\nNasdaqDataLink.search(query = \"Search Term\", page = n, database_code = \"Specific database to search\", silent = TRUE|FALSE)\n```\n\n* **query**: Required; Your search term, as a string\n* **page**: Optional; page number of search you wish returned, defaults to 1.\n* **per_page**: Optional; number of results per page, defaults to 10 in the Nasdaq Data Link R package.\n* **database_code**: Optional; Name of a specific source you wish to search, as a string\n* **silent**: Optional; specifies whether you wish the first three results printed to the console, defaults to True (see example below).\n\nWhich outputs to console a list containing the following information for every item returned by the search:\n\n* Name\n* Nasdaq Data Link code\n* Description\n* Frequency\n* Column names\n\n\n### Example\nA search for Oil,  searching only the National Stock Exchange of India (NSE).\n\n```r\nNasdaqDataLink.search(\"Oil\", database_code = \"NSE\", per_page = 3)\n```\n\nprints:\n\n```r\nOil India Limited\nCode: NSE/OIL\nDesc: Historical prices for Oil India Limited\u003cbr\u003e\u003cbr\u003eNational Stock Exchange of India\u003cbr\u003e\u003cbr\u003eTicker: OIL\u003cbr\u003e\u003cbr\u003eISIN: INE274J01014\nFreq: daily\nCols: Date | Open | High | Low | Last | Close | Total Trade Quantity | Turnover (Lacs)\n\nOil Country Tubular Limited\nCode: NSE/OILCOUNTUB\nDesc: Historical prices for Oil Country Tubular Limited\u003cbr\u003e\u003cbr\u003eNational Stock Exchange of India\u003cbr\u003e\u003cbr\u003eTicker: OILCOUNTUB\u003cbr\u003e\u003cbr\u003eISIN: INE591A01010\nFreq: daily\nCols: Date | Open | High | Low | Last | Close | Total Trade Quantity | Turnover (Lacs)\n\nGulf Oil Corporation Limited\nCode: NSE/GULFOILCOR\nDesc: Historical prices for Gulf Oil Corporation Limited (GULFOILCOR), (ISIN: INE077F01027),  National Stock Exchange of India.\nFreq: daily\nCols: Date | Open | High | Low | Last | Close | Total Trade Quantity | Turnover (Lacs)\n```\n\n## Point in Time\n\nPointInTime works similarly to datatables but filtering the data based on dates. For example, a simple way to retrieve datatable information for a specific date would be:\n\n```r\nNasdaqDataLink.pit.asofdate('DATABASE/CODE', '2020-01-01')\n```\n\n## Date Format\n\nDates passed to `NasdaqDataLink.pit` calls must be a valid `ISO 8601` datetime. For example, the follow values are valid dates:\n\n- `2021-03-02`\n- `2021-03-02T13:45:00`\n- `2021-03-02T12:55:00-05:00`\n\nWhile the following are invalid:\n\n- `2021-03-02 13:45:00` (missing `T` between date and time)\n- `March 2nd, 2021` (not `ISO 8601` compliant)\n\n### Available functions\n\n| Interval | Explanation | Required params | Example |\n|----------|-------------|-----------------|---------|\n| asofdate | Returns data as of a specific date | date | `NasdaqDataLink.pit.asofdate('DATABASE/CODE', 'yyyy-mm-dd', ...)` |\n| fromto | Returns data from `start` up to but excluding `end`; [start, end) | start_date, end_date  | `NasdaqDataLink.pit.fromto('DATABASE/CODE', '2020-01-01', '2020-02-01', ...)` |\n| between | Returns data inclusively between dates; [start, end] | start_end, end_date  | `NasdaqDataLink.pit.between('DATABASE/CODE', '2019-01-01', '2020-01-31', ...)` |\n\n### Additional Examples\n\nFilter Point in Time records for specific columns:\n\n```r\nNasdaqDataLink.pit.asofdate('DATABASE/CODE', '2020-01-01', qopts.columns=c('x', 'y', 'z'))\nNasdaqDataLink.pit.fromto('DATABASE/CODE', '2020-01-01', '2020-02-01', qopts.columns=c('x', 'y', 'z'))\nNasdaqDataLink.pit.between('DATABASE/CODE', '2020-01-01', '2020-01-31', qopts.columns=c('x', 'y', 'z'))\n```\n\n## Additional Resources\n\nMore help can be found at [Nasdaq Data Link](https://data.nasdaq.com) in our [R](https://data.nasdaq.com/tools/r) and [API](https://docs.data.nasdaq.com/) pages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasdaq%2Fdata-link-r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnasdaq%2Fdata-link-r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasdaq%2Fdata-link-r/lists"}