@phatpham9/crypto-portfolio-cli
v0.0.4
Published
Cryptocurrency Portfolio CLI
Downloads
8
Maintainers
Readme
Features
- [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
Techstack
- 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
Install
# run directly via npx
npx @phatpham9/crypto-portfolio-cli
# install as global module
npm install --global @phatpham9/crypto-portfolio-cli
Usage
The CLI fetches price from cryptocompare.com. Please create an account and get your API key prior
# export cryptocompare API key
export CRYPTO_COMPARE_API_KEY=xxx
# read transactions data CSV file. by default it will look for ./data.csv in your current working directory
portfolio -f /path/to/csv/file
# portfolio of all tokens
portfolio
# portfolio of a BTC token
portfolio BTC
# portfolio of all tokens on 2023-01-01
portfolio -d 2023-01-01
# portfolio of a BTC token on 2023-01-01
portfolio -d 2023-01-01 BTC
# show help
portfolio -h
Develop
Clone the repo in your local development, navigate to the project and run the following commands
# watch & rebuild changes
npm run build -- --watch
# run a command. e.g. show help
npm run start -- --help
# run test suite
npm run test
# lint code style
npm run lint
# lint & fix code style
npm run lint:fix
# release version
npm run release:as 1.0.0
Contributing
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.