Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beancount/beanprice
Daily price quotes fetching library for plain-text accounting
https://github.com/beancount/beanprice
beancount beancount-prices
Last synced: 18 days ago
JSON representation
Daily price quotes fetching library for plain-text accounting
- Host: GitHub
- URL: https://github.com/beancount/beanprice
- Owner: beancount
- License: gpl-2.0
- Created: 2020-07-25T15:03:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T15:27:36.000Z (6 months ago)
- Last Synced: 2024-11-16T09:46:43.512Z (27 days ago)
- Topics: beancount, beancount-prices
- Language: Python
- Homepage:
- Size: 136 KB
- Stars: 69
- Watchers: 9
- Forks: 37
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
- my-awesome - beancount/beanprice - prices pushed_at:2024-06 star:0.1k fork:0.0k Daily price quotes fetching library for plain-text accounting (Python)
README
# beanprice: Price quotes fetcher for Beancount
## Description
A script to fetch market data prices from various sources on the internet
and render them for plain text accounting price syntax (and Beancount).This used to be located within Beancount itself (at v2) under beancount.prices.
This repo will contain all future updates to that script and to those price
sources.## Documentation
Some documentation is still part of Beancount. More about how to use this can be
found on that [mailing-list](https://groups.google.com/forum/#!forum/beancount).
Otherwise read the source.## Quick start
To install beanprice, run:
```shell
pip install git+https://github.com/beancount/beanprice.git
```You can fetch the latest price of a stock by running:
```shell
bean-price -e 'USD:yahoo/AAPL'
```To fetch the latest prices from your beancount file, first ensure that commodities have price metadata, e.g.
```
2000-01-01 commodity AAPL
price: "USD:yahoo/AAPL"
```Then run:
```shell
bean-price ledger.beancount
```To update prices up to the present day, run:
```shell
bean-price --update ledger.beancount
```For more detailed guide for price fetching, read .
## Price source info
The following price sources are available:| Name | Module | Provides prices for | Base currency | Latest price? | Historical price? |
|-------------------------|---------------------------|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------|---------------|-------------------|
| Alphavantage | `beanprice.alphavantage` | [Stocks, FX, Crypto](http://alphavantage.co) | Many currencies | ✓ | ✕ |
| Coinbase | `beanprice.coinbase` | [Most common (crypto)currencies](https://api.coinbase.com/v2/exchange-rates) | [Many currencies](https://api.coinbase.com/v2/currencies) | ✓ | ✓ |
| Coincap | `beanprice.coincap` | [Most common (crypto)currencies](https://docs.coincap.io) | USD | ✓ | ✓ |
| Coinmarketcap | `beanprice.coinmarketcap` | [Most common (crypto)currencies](https://coinmarketcap.com/api/documentation/v1/) | Many Currencies | ✓ | ✕ |
| IEX | `beanprice.iex` | [Trading symbols](https://iextrading.com/trading/eligible-symbols/) | USD | ✓ | 🚧 (Not yet!) |
| OANDA | `beanprice.oanda` | [Many currencies](https://developer.oanda.com/exchange-rates-api/v1/currencies/) | [Many currencies](https://developer.oanda.com/exchange-rates-api/v1/currencies/) | ✓ | ✓ |
| Quandl | `beanprice.quandl` | [Various datasets](https://www.quandl.com/search) | [Various datasets](https://www.quandl.com/search) | ✓ | ✓ |
| Rates API | `beanprice.ratesapi` | [Many currencies](https://api.exchangerate.host/symbols) | [Many currencies](https://api.exchangerate.host/symbols) | ✓ | ✓ |
| Thrift Savings Plan | `beanprice.tsp` | TSP Funds | USD | ✓ | ✓ |
| Yahoo | `beanprice.yahoo` | Many currencies | Many currencies | ✓ | ✓ |
| EastMoneyFund(天天基金) | `beanprice.eastmoneyfund` | [Chinese Funds](http://fund.eastmoney.com/js/fundcode_search.js) | CNY | ✓ | ✓ |## Testing
Run tests:
```
pytest beanprice
```Lint:
```
pylint beanprice
```Type checker:
```
mypy beanprice --ignore-missing-imports
```## Copyright and License
Copyright (C) 2007-2020 Martin Blais. All Rights Reserved.
This code is distributed under the terms of the "GNU GPLv2 only".
See COPYING file for details.