{"id":15933408,"url":"https://github.com/paulrberg/cryptfolio-scripts","last_synced_at":"2025-03-24T20:32:59.987Z","repository":{"id":237432174,"uuid":"746319805","full_name":"PaulRBerg/cryptfolio-scripts","owner":"PaulRBerg","description":"A collection of Google Apps Script custom functions for tracking crypto portfolios in Google Sheets","archived":false,"fork":false,"pushed_at":"2024-07-03T16:44:16.000Z","size":132,"stargazers_count":20,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T07:21:32.913Z","etag":null,"topics":["crypto","cryptocurrency","google-apps-script","google-sheets","portfolio","spreadsheet"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/PaulRBerg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-01-21T18:01:59.000Z","updated_at":"2024-08-10T14:07:57.000Z","dependencies_parsed_at":"2024-05-01T19:09:14.601Z","dependency_job_id":null,"html_url":"https://github.com/PaulRBerg/cryptfolio-scripts","commit_stats":null,"previous_names":["paulrberg/cryptfolio-scripts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fcryptfolio-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fcryptfolio-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fcryptfolio-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRBerg%2Fcryptfolio-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulRBerg","download_url":"https://codeload.github.com/PaulRBerg/cryptfolio-scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245348390,"owners_count":20600634,"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":["crypto","cryptocurrency","google-apps-script","google-sheets","portfolio","spreadsheet"],"created_at":"2024-10-07T02:22:31.540Z","updated_at":"2025-03-24T20:32:59.655Z","avatar_url":"https://github.com/PaulRBerg.png","language":"JavaScript","funding_links":["https://github.com/sponsors/PaulRBerg"],"categories":[],"sub_categories":[],"readme":"# Cryptfolio Scripts\n\nA collection of Google Apps Script custom functions for tracking crypto portfolios in Google Sheets.\n\nThe price data is pulled using [CoinGecko's API](https://www.coingecko.com/en/api), and the token balances are obtained\nby making queries to various RPC servers like [PublicNode](https://publicnode.com/).\n\n_If this project helped you, consider buying me a coffee via [3Cities][3cities] or [GitHub Sponsors][sponsors]_.\n\n## How to Use\n\n1. Obtain a CoinGecko Demo API by following the instructions\n   [here](https://support.coingecko.com/hc/en-us/articles/21880397454233-User-Guide-How-to-sign-up-for-CoinGecko-Demo-API-and-generate-an-API-key).\n2. Open the [Cryptfolio template][template] in Google Sheets.\n3. Click on \"File\", and then \"Make a copy\". This will create a copy of the template in Google Sheets.\n4. From the toolbar, click on \"Extensions\", and then on \"Apps Script\". You should be able to see the code now.\n5. Add the chains and tokens you want to track in the `chainIDs` and `tokenData` variables.\n6. Query the price data by running the `GET_ALL_PRICES` function.\n7. Use the `GET_ERC20_BALANCE` and `GET_NATIVE_BALANCE` functions to query your holdings in real-time.\n8. Calculate the USD value of your holdings by reading the local price data with `INDEX` and `MATCH`.\n\n\u003e [!NOTE]\n\u003e\n\u003e The `GET_ALL_PRICES` can only be run from within Apps Script. See the [Custom Functions](#custom-functions) section\n\u003e below.\n\n## Template\n\nThe [template][template] shows how to query balances for ARB, ETH, MKR, and OP, and how to calculate the values of the\nholdings:\n\n![Demo](./demo.png)\n\n## Rationale\n\nI built this because I was frustrated with the existing solutions, which are either too complex, too expensive, or too\nunstable.\n\nCryptfolio is:\n\n- Free to use\n- Minimalist\n- DYI and easy to customize\n- Functional; it just works\n\n## Customization\n\nThis project is meant to be forked and customized to your needs. Here are two common use cases:\n\n### Chains\n\nTo track a new chain:\n\n- Add it in the `Chains` sheet in the spreadsheet.\n- Edit `chainIds` in [`cryptfolio.gs`](./src/cryptfolio.gs).\n\n### Tokens\n\nTo track a new token:\n\n- List it in the `Prices` sheet in the spreadsheet. Ensure that the `CRYPTO_IDS` range got updated, too.\n- Edit the `tokenData` object in [`cryptfolio.gs`](./src/cryptfolio.gs).\n\n## Custom Functions\n\nHere's a table with the custom functions enabled by this project.\n\nThe Read functions can be called from either Google Sheets or Apps Script, but the Write functions can only be run from\nwithin the Apps Script environment. This is because a\n[custom function](https://developers.google.com/apps-script/guides/sheets/functions?hl=en) cannot affect cells other\nthan those it returns a value to.\n\n| Function                 | Type  | Params                   | Description                                                                  |\n| ------------------------ | ----- | ------------------------ | ---------------------------------------------------------------------------- |\n| `GET_ERC20_BALANCE`      | Read  | (chainID,symbol,account) | Get the ERC-20 token balance of `account` on the chain with ID `chainID`     |\n| `GET_EVM_NATIVE_BALANCE` | Read  | (chainID,account)        | Get the EVM native asset balance of `account` on the chain with ID `chainID` |\n| `GET_ALL_PRICES`         | Write | (fiat)                   | Get the current `fiat` prices for all `CRYPTO_IDS`                           |\n| `GET_PRICE`              | Write | (crypto,fiat)            | Get the current `fiat` price for `crypto`                                    |\n\n## Contributing\n\nFeel free to dive in! [Open](https://github.com/PaulRBerg/cryptfolio-scripts/issues/new) an issue,\n[start](https://github.com/PaulRBerg/cryptfolio-scripts/discussions/new) a discussion or submit a PR.\n\n## CoinGecko\n\nThis project couldn't exist without the [CoinGecko API](https://www.coingecko.com/en/api). Thank you for providing such\na valuable service for free!\n\n![CoinGecko Logo](./coingecko.png)\n\n## License\n\nThis project is licensed under MIT.\n\n[3cities]: https://3cities.xyz/#/pay?c=CAESFAKY9DMuOFdjE4Wzl2YyUFipPiSfIgICATICCAJaFURvbmF0aW9uIHRvIFBhdWwgQmVyZw\n[sponsors]: https://github.com/sponsors/PaulRBerg\n[template]: https://docs.google.com/spreadsheets/d/1V3uIiz5BxVd1ZBRh1s3thso5mW74tHATqcGovox2FlU/edit?usp=sharing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulrberg%2Fcryptfolio-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulrberg%2Fcryptfolio-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulrberg%2Fcryptfolio-scripts/lists"}