{"id":22585618,"url":"https://github.com/espiramarvin/crypto-portfolio-cli","last_synced_at":"2026-05-03T19:32:03.148Z","repository":{"id":106018531,"uuid":"563404848","full_name":"EspiraMarvin/crypto-portfolio-cli","owner":"EspiraMarvin","description":"A Web3 Portfolio CLI with Nodejs","archived":false,"fork":false,"pushed_at":"2022-11-14T08:17:57.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T17:18:27.448Z","etag":null,"topics":["cli","node-cli","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EspiraMarvin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-08T14:44:40.000Z","updated_at":"2023-04-07T16:43:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"254676e6-e3fc-4d07-9267-704a2783ff31","html_url":"https://github.com/EspiraMarvin/crypto-portfolio-cli","commit_stats":null,"previous_names":["espiramarvin/crypto-portfolio-cli"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EspiraMarvin%2Fcrypto-portfolio-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EspiraMarvin%2Fcrypto-portfolio-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EspiraMarvin%2Fcrypto-portfolio-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EspiraMarvin%2Fcrypto-portfolio-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EspiraMarvin","download_url":"https://codeload.github.com/EspiraMarvin/crypto-portfolio-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068308,"owners_count":20718503,"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":["cli","node-cli","nodejs"],"created_at":"2024-12-08T07:09:04.089Z","updated_at":"2026-05-03T19:32:03.098Z","avatar_url":"https://github.com/EspiraMarvin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## setting the project\n\nTo install dependencies run\n\n1. git clone on your work dir and cd into it\n\n2. yarn / npm install\n\n3. copy details in the .env.example create an .env file and copy its content\n\n## DB Setup (used MYSQL Database)\n\n1. Steps create a database name I called it portfolio\n2. Create a table with these fields\n   \u003e id as auto increment, time_stamp, token and transaction_type\n\n```bash\n\nCREATE TABLE portfolios(id BIGINT NOT NULL AUTO_INCREMENT, time_stamp INT NOT NULL, transaction_type VARCHAR(10) NOT NULL,token VARCHAR(10) NOT NULL, amount INT NOT NULL, PRIMARY KEY(id))\n\n```\n\n## Add the CSV FILE inside the /var/lib/mysql-files\n\nLOAD DATA INFILE '/var/lib/mysql-files/transactions.csv' INTO TABLE porfolios fieLds terminated BY ',' IGNORE 1 lines (time_stamp, transaction_type, token, amount);\n\n\u003e Note: My machine has Ubuntu OS, so I added the csv file inside /var/lib/mysql-files, this is the location where I pull the file and saved to the db using `LOAD DATA INFILE`.\n\n## index fields\n\nALTER TABLE portfolios ADD INDEX index_time_stamp (time_stamp) to add index to the timestamp column, this helps our improve query time.\n\n\n## commands (recommended for testing)\n\n```bash\n\n# Get the latest portfolio per token\n\n node commands.js lp \n\n# Get the latest portfolio given a token\n\n node commands.js lpt \n\n# Get portfolio value on a given date\n\n node commands.js pd \n\n# Get portfolio value on a given date and token\n\n node commands.js pdt \n\n```\n\n\n## to link to the shell \n\n1. I added the code below at the top commands.js file.\n\n```js\n#!/usr/bin/env node\n```\n\n2. At the package.json file I added the scripts below\n\n```bash\n  \"preferGlobal\": true,\n  \"bin\": \"./commands.js\",\n```\n\nthe last script `\"bin\" : \"./commands.js\"` makes the commands global\n\n3. created asym link by running,\n   \u003e npm link\n\nTo unlink just run `npm unlink`\n\n4. Now you can call commands on any location on our CMD starting with the name of our script in the package.json file `cli-web3`\n\n# after publishing run commands\n\nversion 1.0.0 should be the output\n```bash\n cli-web3 --version\n\nget the help page\n\n cli-web3 --help \n\n cli-web3 lp \n\n cli-web3 lpt\n\n cli-web3 pd \n\n cli-web3 pdt\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespiramarvin%2Fcrypto-portfolio-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fespiramarvin%2Fcrypto-portfolio-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespiramarvin%2Fcrypto-portfolio-cli/lists"}