https://github.com/bnjmnt4n/hledger-prices
A CLI utility to obtain given stock prices and currency exchange rates from the Alpha Vantage API, and print them out in hledger’s price format.
https://github.com/bnjmnt4n/hledger-prices
alphavantage hledger
Last synced: 8 months ago
JSON representation
A CLI utility to obtain given stock prices and currency exchange rates from the Alpha Vantage API, and print them out in hledger’s price format.
- Host: GitHub
- URL: https://github.com/bnjmnt4n/hledger-prices
- Owner: bnjmnt4n
- Created: 2023-01-04T09:49:09.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T10:28:38.000Z (almost 3 years ago)
- Last Synced: 2024-10-13T22:26:42.922Z (about 1 year ago)
- Topics: alphavantage, hledger
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hledger-prices
A CLI utility to obtain given stock prices and currency exchange rates from the [Alpha Vantage API](https://www.alphavantage.co/documentation/), and print them out in [hledger’s price format](https://hledger.org/1.28/hledger.html#declaring-market-prices).
## Installation
With Go:
```sh
$ go install github.com/bnjmnt4n/hledger-prices@latest
```
For Nix users:
```sh
$ nix run github:bnjmnt4n/hledger-prices
```
## Usage
```sh
$ hledger-prices -alphavantage-key $ALPHA_VANTAGE_KEY -base-currency SGD -currencies USD,ETH -stocks VT,VWRA.LON -rate-limit 5
; Generated by https://github.com/bnjmnt4n/hledger-prices on 2023/01/06 22:20:24
; Stocks
P 2023/01/05 VT USD 86.400000
P 2023/01/05 VWRA USD 96.930000
; Currencies
P 2023/01/06 ETH SGD 1682.684934
P 2023/01/06 USD SGD 1.344500
```
This command will get the most recent exchange rates between SGD/USD and SGD/ETH and stock prices of VT and VWRA (in the London exchange), with a rate limit of 5 requests per minute.
Note:
- only the records for the most recent day are fetched.
- the following APIs are used: [stock latest price](https://www.alphavantage.co/documentation/#latestprice), [stock search endpoint](https://www.alphavantage.co/documentation/#symbolsearch) and [currency exchange](https://www.alphavantage.co/documentation/#currency-exchange).