Scripts designed to be composable by pipe and standard unix utilities. There are two kinds of scripts: fetch raw data and processing to the proper .ledger format.
- fetch
- csv2ledger
- xml2ledger
Workflow shell be like the following: for the Privat24
fetch -> xml2ledger -> ledger
for the Payoneer
manually download -> csv2ledger -> ledger
- python3
- pipenv
issue command pipenv sync
to install python dependencies
setup merchant account according to the Privat24 Merchant API
for further steps you neer to have Merchant ID and Merchant password, for the convenience you can setup environment variables
PRIVAT_MERCHANT_ID
PRIVAT_MERCHANT_PASSWORD
then issue the following command replacing 5167XXXXXXXXXXXX with your merchant card
./fetch.py --sd=1.10.2019 --ed=31.12.2019 --card=5167XXXXXXXXXXXX > privat.xml
fetch and save payoyeer CSV file manually to some file, for example to payoneer.csv
cat privat.xml | ./xml2ledger > privat24.ledger
cat payoyeer.csv | ./csv2ledger > payoyeer.ledger
You can combine two ledger from Privat24 and Payoner by using only unix commands like this
cat privat24.ledger payoneer.ledger > combined.ledger
Use separate currencies file for analysis
Example: currencies.ledger
P 2019/01/01 00:00:01 UAH $0.035837
P 2019/02/01 00:00:01 UAH $0.035972
P 2019/03/01 00:00:01 UAH $0.0369
P 2019/04/01 00:00:01 UAH $0.0368375
P 2019/05/01 00:00:01 UAH $0.0379045
P 2019/06/01 00:00:01 UAH $0.037227
P 2019/07/01 00:00:01 UAH $0.0380305
P 2019/08/01 00:00:01 UAH $0.039379
P 2019/09/01 00:00:01 UAH $0.0398045
P 2019/10/01 00:00:01 UAH $0.040892
P 2019/11/01 00:00:01 UAH $0.04031028
P 2019/12/01 00:00:01 UAH $0.04183353
P 2019/01/01 02:18:01 EUR $1.12
P 2019/01/01 02:18:01 NOK $0.11
For the currency history you can use GOOGLEFINANCE function from the google sheets and your sheet like this
=GOOGLEFINANCE("CURRENCY:UAHUSD","price",date)
Run combined ledger as following:
ledger -f currencies.ledger -f combined.ledger -V bal
Use privat_example.py
and payoneer_example.py
as example, rename to privat.py
and payoneer.py
and create your own implementation.