Skip to content

Instantly share code, notes, and snippets.

@simonmichael
Last active August 29, 2021 19:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonmichael/9ca4d74b30567dcc3b93763ffe88abf9 to your computer and use it in GitHub Desktop.
Save simonmichael/9ca4d74b30567dcc3b93763ffe88abf9 to your computer and use it in GitHub Desktop.
make rules and short symbols setup for market-prices.py (https://github.com/barrucadu/hledger-scripts#market-prices)
YEAR:=$(shell date +%Y)
PRICES=$(YEAR).prices
# Fetch latest market prices, add P records to prices file.
MARKET_PRICES=~/src/PLAINTEXTACCOUNTING/hledger-scripts/market-prices/market-prices.py <market-prices.json
.PHONY: prices prices-dry
prices-dry:
@$(MARKET_PRICES)
prices:
@$(MARKET_PRICES) >>$(PRICES)
{ "commodities":
{ "BTC": { "provider": "coinbase" }
, "ETH": { "provider": "coinbase" }
, "E": { "base": "EUR", "provider": "ft_currency" }
, "P": { "base": "GBP", "provider": "ft_currency" }
, "Y": { "base": "JPY", "provider": "ft_currency" }
}
, "symbols":
{ "USD": "$"
}
}
$ make prices-dry
P 2019-03-08 BTC $3891.995
P 2019-03-08 ETH $137.005
P 2019-03-08 E $1.1242
P 2019-03-08 P $1.3014
P 2019-03-08 Y $0.009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment