diff --git a/xexe/rate_writing.py b/xexe/rate_writing.py index 6b661cd..8996a3b 100644 --- a/xexe/rate_writing.py +++ b/xexe/rate_writing.py @@ -1,4 +1,5 @@ import csv +import datetime import pathlib from abc import ABC, abstractmethod @@ -20,9 +21,11 @@ class CSVRateWriter(RateWriter): def write_rates(self, rates: ExchangeRates) -> None: with open(self.output_file_path, mode="w") as csv_file: csv_writer = csv.writer(csv_file) - csv_writer.writerow(["from_currency", "to_currency", "rate", "rate_date"]) + csv_writer.writerow( + ["from_currency", "to_currency", "rate", "rate_date", "exported_at"] + ) - # Write the exchange rate data + exported_at = datetime.datetime.now() for rate in rates._rate_index.values(): csv_writer.writerow( [ @@ -30,5 +33,6 @@ class CSVRateWriter(RateWriter): rate.to_currency.value, rate.rate.amount, rate.rate_date.strftime("%Y-%m-%d"), + exported_at.isoformat(timespec="seconds"), ] )