Cryptocurrency Portfolio CLI
npm install @phatpham9/crypto-portfolio-cli- [x] Read transactions data from comma-separated CSV file
- [x] Fetch token price in USD from cryptocompare.com
- [x] Calculate portfolio value of a single or multiple tokens
- [x] Calculate portfolio value on a specific date in the history
- Language: TypeScript
- CLI framework: Commander.js
- CLI utils: Figlet cli-table
- Testing framework: Jest cli-testing-library
- CSV to JSON parser: PapaParse
- HTTP client: Axios
- Configuration: node-config
- CI/CD: GitHub Actions
- Dev tools: Standard commitlint standard-version lint-staged Husky
``shrun directly via npx
npx @phatpham9/crypto-portfolio-cli
Usage
The CLI fetches price from cryptocompare.com. Please create an account and get your API key prior
`sh
export cryptocompare API key
export CRYPTO_COMPARE_API_KEY=xxxread transactions data CSV file. by default it will look for ./data.csv in your current working directory
portfolio -f /path/to/csv/fileportfolio of all tokens
portfolioportfolio of a BTC token
portfolio BTCportfolio of all tokens on 2023-01-01
portfolio -d 2023-01-01portfolio of a BTC token on 2023-01-01
portfolio -d 2023-01-01 BTCshow help
portfolio -h
`Develop
Clone the repo in your local development, navigate to the project and run the following commands
`sh
watch & rebuild changes
npm run build -- --watchrun a command. e.g. show help
npm run start -- --helprun test suite
npm run testlint code style
npm run lintlint & fix code style
npm run lint:fixrelease version
npm run release:as 1.0.0
``Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.