A Vietnamese market-tracking CLI tool that displays real-time prices for gasoline, gold (SJC), cryptocurrencies (BTC/ETH), and Vietnam ETFs — all from your terminal.
| Category | Data Source | Details |
|---|---|---|
| Gasoline | PV Oil | RON 95-III, E10 RON 95-III, E5 RON 92-II |
| Gold | SJC via vnstock | Buy / Sell prices |
| Cryptocurrency | Binance | BTC/USDT, ETH/USDT |
| Vietnam ETFs | vnstock | E1VFVN30 (VN30), FUEVFVND (VN Diamond) |
- Node.js v18 or higher
- npm v8 or higher or Yarn v1.22 or higher
- A Binance account with API key & secret
# Clone the repository
git clone https://github.com/your-username/market-watch-vn.git
cd market-watch-vnnpm
npm install
npm run devyarn
yarn install
yarn devThis lets you run market-watch from anywhere on your machine.
# Clone and enter the repo
git clone https://github.com/your-username/market-watch-vn.git
cd market-watch-vnnpm
npm install
npm run build
npm linkyarn
yarn install
yarn build
yarn linkAfter linking, the market-watch command becomes available in any terminal session:
market-watchTo unlink later:
npm
npm unlink -g market-watchyarn
yarn unlink market-watchThis project requires environment variables to connect to external APIs. Two loading strategies are supported:
Create a .env file in the project root:
PVOIL_ENDPOINT=https://...
BINANCE_APIKEY=your_binance_api_key
BINANCE_SECRETKEY=your_binance_secret_keyWhen running market-watch as a global command, the local .env is not in scope. Instead, create a config file in your home directory:
Windows: C:\Users\<YourName>\.market-watch.env
macOS / Linux: ~/.market-watch.env
PVOIL_ENDPOINT=https://...
BINANCE_APIKEY=your_binance_api_key
BINANCE_SECRETKEY=your_binance_secret_keyThe CLI automatically falls back to
~/.market-watch.envif no local.envis found.
| Variable | Required | Description |
|---|---|---|
PVOIL_ENDPOINT |
Yes | PV Oil price page URL (HTML scraping endpoint) |
BINANCE_APIKEY |
Yes | Your Binance API key |
BINANCE_SECRETKEY |
Yes | Your Binance API secret |
market-watchAn interactive prompt will appear. Use arrow keys to navigate, Space to select categories, and Enter to confirm.
Available categories:
Tất cả— fetch all data at onceGiá xăng hôm nay— current gasoline pricesGiá vàng hôm nay— SJC gold prices (buy/sell)Bitcoin— BTC/USDT price from BinanceEthereum— ETH/USDT price from BinanceETF VN30— E1VFVN30 reference priceETF VN Diamond— FUEVFVND reference price
After viewing results, you can choose to check more categories or exit.
| Description | npm | yarn |
|---|---|---|
| Run in development mode (no build) | npm run dev |
yarn dev |
Compile TypeScript to dist/ |
npm run build |
yarn build |
| Run the compiled build | npm start |
yarn start |
src/
├── index.ts # CLI entry point & interactive prompt
├── constants/
│ └── env.ts # Environment variable loading
├── interfaces/
│ └── index.ts # TypeScript interfaces
├── services/
│ ├── binance.ts # Binance crypto price fetching
│ ├── pvoil.ts # PV Oil gasoline price scraping
│ └── vnstock.ts # Gold & ETF prices via vnstock-js
└── utils/
└── index.ts # Number formatting utilities