ofx-processor/ofx_processor/revolut_processor/main.py

19 lines
589 B
Python
Raw Normal View History

2020-01-16 19:02:17 +01:00
import csv
import click
from ofx_processor.revolut_processor.revolut_processor import RevolutProcessor
2020-02-12 00:00:05 +01:00
from ofx_processor.utils import ynab
2020-01-16 19:02:17 +01:00
@click.command(help="Process Revolut bank statement (CSV)")
@click.argument("csv_filename")
def cli(csv_filename):
with open(csv_filename) as f:
reader = csv.DictReader(f, delimiter=";")
processor = RevolutProcessor(reader)
ynab_transactions = processor.get_transactions()
click.secho(f"Processed {len(ynab_transactions)} transactions total.", fg="blue")
ynab.push_transactions(ynab_transactions, "revolut")