{"id":19573955,"url":"https://github.com/hexresearch/crypto-history","last_synced_at":"2026-05-15T09:39:10.245Z","repository":{"id":99625933,"uuid":"141267352","full_name":"hexresearch/crypto-history","owner":"hexresearch","description":"Fetches historical data for cryptocurrencies","archived":false,"fork":false,"pushed_at":"2019-02-01T02:39:26.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-01-09T03:56:58.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexresearch.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":"2018-07-17T09:37:11.000Z","updated_at":"2020-02-13T17:46:09.000Z","dependencies_parsed_at":"2023-04-06T18:13:16.228Z","dependency_job_id":null,"html_url":"https://github.com/hexresearch/crypto-history","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fcrypto-history","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fcrypto-history/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fcrypto-history/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fcrypto-history/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexresearch","download_url":"https://codeload.github.com/hexresearch/crypto-history/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240840106,"owners_count":19866168,"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":[],"created_at":"2024-11-11T06:37:08.232Z","updated_at":"2026-05-15T09:39:10.171Z","avatar_url":"https://github.com/hexresearch.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crypto-history\n\nFetches historical data for cryptocurrencies from [coinmarketcap.com](https://coinmarketcap.com/).\n\n\nWith this library we can load and save historical data for various crypto-currencies.\nIt uses API to [coinmarketcap.com](https://coinmarketcap.com/) to fetch the data.\n\nIn the coinmarketcap the currencies are referenced by special ids.\nwe can query the specific id with the function `getCoinId`:\n\n```haskell\n\u003e import Crypto.History\n\u003e Right coinId \u003c- getCoinId (CoinCode \"ETH\")\n\u003e print coinId\n\u003e CoinId \"ethereum\"\n```\n\nOnce we know the id we can query the historical data:\n\n```haskell\n\u003e Right hist \u003c- getHistory (dateStr \"01-01-2015\") (dateStr \"01-01-2018\") coinId\n```\n\nThe `dateStr` is a helper function to quickly construct `UTCTime` from string in the format `dd-mm-yyyy`.\nAlso we can query all time history data:\n\n```haskell\n\u003e Right hist \u003c- getAllTimeHistory coinId\n```\n\nAll prices are relative to USD. But if we want to relate to another currency we can\nuse a special variant that uses cross-prices to calculate the given relation:\n\n```haskell\n\u003e Right hist \u003c- getHistory2 (dateStr \"01-01-2015\") (dateStr \"01-01-2018\") (coinIdA, coinIdB)\n```\n\nIt uses the function `cross :: History -\u003e History -\u003e History` under the hood\nto create cross-prices relative to specific coins.\n\nWe can save and load the data to/from CSV files:\n\n```haskell\n\u003e writeHistory \"file.csv\" hist\n\u003e Just hist \u003c- readHistory \"file.csv\"\n```\n\nThe function `readHistory` - reads data strictly. For lazy reading we can use `readHistoryLazy`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexresearch%2Fcrypto-history","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexresearch%2Fcrypto-history","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexresearch%2Fcrypto-history/lists"}