{"id":15406857,"url":"https://github.com/dannyben/eod","last_synced_at":"2025-08-02T23:09:46.249Z","repository":{"id":56824483,"uuid":"476387875","full_name":"DannyBen/eod","owner":"DannyBen","description":"EOD Historical Data API Library and Command Line","archived":false,"fork":false,"pushed_at":"2023-03-29T07:58:59.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-01T14:12:06.622Z","etag":null,"topics":["api","api-client","command-line","economic-data","eod-data-downloader","financial-data","gem","ruby","stock-data"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DannyBen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-31T16:25:14.000Z","updated_at":"2024-02-08T16:57:00.000Z","dependencies_parsed_at":"2024-10-01T16:26:01.722Z","dependency_job_id":"d1092482-4058-4576-b715-35085cdb7f00","html_url":"https://github.com/DannyBen/eod","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"ffe97f87478aca11379ded5bebdaff8c6672e5b0"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Feod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Feod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Feod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DannyBen%2Feod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DannyBen","download_url":"https://codeload.github.com/DannyBen/eod/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":220053631,"owners_count":16588697,"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","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":["api","api-client","command-line","economic-data","eod-data-downloader","financial-data","gem","ruby","stock-data"],"created_at":"2024-10-01T16:25:58.639Z","updated_at":"2025-08-02T23:09:46.232Z","avatar_url":"https://github.com/DannyBen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EOD Historical Data API Library and Command Line\n\nThis gem provides both a Ruby library and a command line interface for the \n[EOD Historical Data][docs] data service.\n\nThis gem is not affiliated with EOD Historical Data.\n\n---\n\n\n## Install\n\n```\n$ gem install eod\n```\n\n\n## Features\n\n* Easy to use interface.\n* Use as a library or through the command line.\n* Access any EOD Historical Data endpoint and option directly, no need to learn\n  anything other than the original API documentation.\n* Display output as JSON, YAML or CSV.\n* Save output to a file as JSON, YAML or CSV.\n* Includes a built in file cache, so you can avoid wasting API calls.\n* Lightweight.\n* Future proof. In case new endpoints are added to the API, they will\n  immediately become available in the Ruby library (but not in the CLI).\n\n\n## Usage\n\nFirst, require and initialize with your EOD API token:\n\n```ruby\nrequire 'eod'\napi_token = 'OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX'  # demo token\napi = EOD::API.new api_token\n```\n\nNow, you can access any of the API endpoints with any optional parameter, like\nthis:\n\n```ruby\nresult = api.get \"eod\", 'AAPL.US', period: 'm'\n```\n\nIn addition, for convenience, you can use the first part of the endpoint as\na method name, like this:\n\n```ruby\nresult = api.eod 'AAPL.US', period: 'm', from: '2022-01-01'\n```\n\nIn other words, these calls are the same:\n\n```ruby\napi.get 'endpoint', param: value\napi.endpoint, param: value\n```\n\nas well as these two:\n\n```ruby\napi.get 'endpoint/sub', param: value\napi.endpoint 'sub', param: value\n```\n\nBy default, you will get a ruby hash in return. If you wish to have more \ncontrol over the response, use the `get!` method instead:\n\n```ruby\npayload = api.get! 'eod', 'AAPL.US'\n\n# Request Object\np payload.request.class\n# =\u003e HTTParty::Request\n\n# Response Object\np payload.response.class\n# =\u003e Net::HTTPOK\n\np payload.response.body\n# =\u003e JSON string\n\np payload.response.code\n# =\u003e 200\n\np payload.response.msg\n# =\u003e OK\n\n# Headers Object\np payload.headers\n# =\u003e Hash with headers\n\n# Parsed Response Object\np payload.parsed_response\n# =\u003e Hash with HTTParty parsed response \n#    (this is the content returned with #get)\n```\n\nYou can get the response as CSV by calling `get_csv`:\n\n```ruby\nresult = api.get_csv \"eod\", 'AAPL.US'\n# =\u003e CSV string\n```\n\nor, if you prefer, you can request a CSV from the API directly, by using the\n`fmt` argument:\n\n```ruby\nresult = api.eod 'AAPL.US', fmt: 'csv'\n# =\u003e CSV string\n```\n\nTo save the output directly to a file, use the `save` method:\n\n```ruby\napi.save 'filename.json', 'eod/AAPL.US', period: 'm'\n```\n\nOr, to save CSV, use the `save_csv` method:\n\n```ruby\napi.save_csv \"filename.csv\", \"eod/AAPL.US\", period: 'm'\n```\n\n## Command Line Interface\n\nThe command line utility `eod` that is installed when installing the gem acts\nin a similar way. The main difference is that you provide any API query string\nargument using the `key:value` format. \n\nFirst, set your API token in the environment variable `EOD_API_TOKEN`:\n\n```bash\n$ export EOD_API_TOKEN=OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX\n````\n\nNow, you can run one of the many API commands, for example:\n\n```shell\n# Show monthly AAPL data in a pretty colorful output\n$ eod data AAPL.US period:m\n\n# Show monthly AAPL data in CSV format\n$ eod data AAPL.US --format csv from:2022-01-01 period:m\n\n# Saves a file\n$ eod data AAPL.US --format csv --save aapl.csv from:2022-01-01 period:m\n\n# Show live (delayed) data\n# eod live AAPL.US\n```\n\nRun [`eod --help`](#full-command-line-usage-patterns) for the full list of usage\npatterns.\n\n## Supported endpoints\n\n- The Ruby library supports all current and future endpoints.\n- The CLI supports most (if not all) current endpoints. If you know of an\n  endpoint that is not supported, please create an [issue][issues].\n\n\n## Caching\n\nWe are using the [Lightly][lightly] gem for automatic HTTP caching.\n\nYou can disable or customize it by either passing options on \ninitialization, or by accessing the `WebCache` object directly at \na later stage.\n\n```ruby\n# Disable cache completely\napi = EOD::API.new api_token,  use_cache: false\n\n# Set different cache directory or lifetime\napi = EOD::API.new api_token, cache_dir: 'data', cache_ilfe: '2h'\n\n# Or configure cache after initializaation:\n\napi = EOD::API.new api_token\napi.cache.disable\napi.cache.enable\napi.cache.dir = 'tmp/cache'   # Change cache folder\napi.cache.life = '30m'        # Change cache life to 30 minutes\n```\n\nTo enable caching for the command line, simply set one or both of \nthese environment variables:\n\n```shell\n$ export EOD_CACHE_DIR=cache   # default: 'cache'\n$ export EOD_CACHE_LIFE=2h     # default: 3600 (1 hour)\n```\n\nTo disable cache for the CLI, set `EOD_CACHE_LIFE=off`.\n\nThe cache life argument supports these formats:\n\n- `20s` - 20 seconds\n- `10m` - 10 minutes\n- `10h` - 10 hours\n- `10d` - 10 days\n\n## Full command line usage patterns\n\n\u003c!-- USAGE --\u003e\n```\n$ eod --help\n\nEOD Historical Data API\n\n  API Documentation:\n  https://eodhistoricaldata.com/financial-apis/\n\nUsage:\n  eod bond SYMBOL [options] [PARAMS...]\n  eod bulk EXCHANGE [options] [PARAMS...]\n  eod calendar CALENDAR [options] [PARAMS...]\n  eod data SYMBOL [options] [PARAMS...]\n  eod dividends SYMBOL [options] [PARAMS...]\n  eod events [options] [PARAMS...]\n  eod exchange EXCHANGE [options] [PARAMS...]\n  eod exchanges [options] [PARAMS...]\n  eod fundamental SYMBOL [options] [PARAMS...]\n  eod fundamental_bulk SYMBOL [options] [PARAMS...]\n  eod insider [options] [PARAMS...]\n  eod intraday SYMBOL [options] [PARAMS...]\n  eod live SYMBOL [options] [PARAMS...]\n  eod macro COUNTRY [options] [PARAMS...]\n  eod news [options] [PARAMS...]\n  eod opts SYMBOL [options] [PARAMS...]\n  eod screener [options] [PARAMS...]\n  eod search QUERY [options] [PARAMS...]\n  eod splits SYMBOL [options] [PARAMS...]\n  eod symbols EXCHANGE [options] [PARAMS...]\n  eod technical SYMBOL [options] [PARAMS...]\n  eod (-h|--help|--version)\n\nCommands:\n  bond\n    Bond fundamental data (/bond-fundamentals)\n\n  bulk\n    Historical EOD bulk data (/eod-bulk-last-day)\n\n  calendar\n    Calendar data (earnings, trends, IPOs and splits) (/calendar)\n\n  data\n    Historical EOD data (/eod)\n\n  dividends\n    Dividends data (/div)\n\n  events\n    Economic events data (/economic-events)\n\n  exchange\n    Details about an exchange (/exchanges-details)\n\n  exchanges\n    List of exchanges (/exchanges-list)\n\n  fundamental\n    Fundamental data (/fundamentals)\n\n  fundamental_bulk\n    Bulk fundamental data (/bulk-fundamentals)\n\n  insider\n    Insider transactions data (/insider-transactions)\n\n  intraday\n    Intraday data (/intraday)\n\n  live\n    Live data (/real-time)\n\n  macro\n    Macroeconomics data (/macro-indicator)\n\n  news\n    Financial news (/news)\n\n  opts\n    Options data (/options)\n\n  screener\n    Stock market screener (/screener)\n\n  search\n    Search for stocks, ETFs, funds or indices (/search)\n\n  splits\n    Splits data (/splits)\n\n  symbols\n    List of symbols for an exchange (/exchange-symbol-list)\n\n  technical\n    Technical data (/technical)\n\nOptions:\n  -f --format FORMAT\n    Output format: csv, json, yaml, pretty or url [default: pretty]\n\n  -s --save PATH\n    Save output to file\n\n  -h --help\n    Show this help\n\n  --version\n    Show version number\n\nParameters:\n  SYMBOL\n    Ticker symbol\n\n  CALENDAR\n    Calendar type: earnings, trends, ipos or splits\n\n  COUNTRY\n    Country code in the Alpha-3 ISO format\n\n  EXCHANGE\n    Exchange code\n\n  PARAMS\n    An optional list of query string parameters, separated by a space, to send\n    with the request. Each parameter should be in the format of key:value.\n    example: period:w from:2022-01-01\n    \n    See https://eodhistoricaldata.com/financial-apis/ for all supported params.\n\nEnvironment Variables:\n  EOD_API_TOKEN\n    Your EOD Historical Data API token [required]\n\n  EOD_CACHE_DIR\n    API cache diredctory [default: cache]\n\n  EOD_CACHE_LIFE\n    API cache life. These formats are supported:\n    off - No cache\n    20s - 20 seconds\n    10m - 10 minutes\n    10h - 10 hours\n    10d - 10 days\n\n  EOD_API_URI\n    Override the API URI [default: https://eodhistoricaldata.com/api]\n\nExamples:\n  eod symbols NASDAQ\n  eod data AAPL.US\n  eod data AAPL.US --format csv period:m from:2022-01-01\n  eod live AAPL.US -fyaml\n  eod fundamental 'AAPL.US' filter:General\n  eod technical AAPL.US function:sma\n  eod macro USA indicator:inflation_consumer_prices_annual\n\n```\n\u003c!-- USAGE --\u003e\n\n\n## Contributing / Support\n\nIf you experience any issue, have a question or a suggestion, or if you wish\nto contribute, feel free to [open an issue][issues].\n\n\n\n[docs]: https://eodhistoricaldata.com/financial-apis\n[issues]: https://github.com/DannyBen/eod/issues\n[lightly]: https://github.com/DannyBen/lightly\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Feod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannyben%2Feod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannyben%2Feod/lists"}