A collection of Bash scripts for fetching authoritative market prices (Stocks, Mutual Funds, Gold, NPS, Crypto, Currency) and formatting them for hledger.
These scripts prioritize official, authoritative sources for maximum accuracy and reliability:
- Indian Stocks: Parsed directly from the official BSE Bhavcopy (daily trade report CSVs).
- Mutual Funds: Fetched from the Association of Mutual Funds in India (AMFI) master NAV file.
- NPS (National Pension System): Sourced from the Protean (NSDL) CRA daily NAV archives.
- Gold Rates: Extracted from IBJA (India Bullion and Jewellers Association), the benchmark rate-setting organization for bullion in India.
Separately, this repo also incldes:
- Bank Import Helpers: cleaning scripts for Kotak Mahindra and YES Bank CSV statements.
Downloads the daily BSE Bhavcopy CSV, extracts closing prices for stocks defined in your ledger, and formats them.
Downloads the daily NAV file from AMFI and extracts prices for your funds.
Fetches 24K (999) and 22K (916) Gold rates from IBJA. Prices are normalized to per-gram for consistency.
Downloads and parses the daily NAV ZIP file from the NSDL/Protean CRA website.
Fetches exchange rates for all currencies found in your ledger.
- Multiple sources: Supports Frankfurter, CurrencyBeacon, and AlphaVantage.
- Usage:
./ledger_get-currency-prices.sh [currencybeacon|frankfurter](Defaults to CurrencyBeacon).
Fetches latest crypto prices in your base currency (INR/USD).
- Multiple sources: Supports CoinMarketCap and CoinGecko.
-
Clone the repository: git clone git@github.com:the-solipsist/hledger-scripts.git
-
Dependencies: Ensure these standard tools are installed:
curl,jq,hledger,python3(for HTML entity decoding),awk. -
Configuration: Scripts that require API keys (CurrencyBeacon, CoinMarketCap) look for
.keyfiles in the same directory:key_currencybeacon-api.key:key="YOUR_KEY"key_coinmarketcap-api.key:key="YOUR_KEY"
All code is licensed under the MIT License - see the LICENSE file for details.