diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/ops/funds.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/python/ops/funds.py b/python/ops/funds.py index 90511733..e9364404 100644 --- a/python/ops/funds.py +++ b/python/ops/funds.py @@ -1,6 +1,7 @@ import csv import datetime import pathlib +from csv_headers.citco import GTL from serenitas.utils.remote import FtpClient, SftpClient from serenitas.utils.exchange import ExchangeMessage, FileAttachment from io import StringIO @@ -25,10 +26,10 @@ class Fund: def build_buffer(cls, trade_type): buf = StringIO() csvwriter = csv.writer(buf) - headers = get_headers(trade_type, cls.name) - csvwriter.writerow(headers) + cls.set_headers(trade_type) + csvwriter.writerow(cls.headers) csvwriter.writerows( - [[obj.get(h) for h in headers] for obj in cls.staging_queue] + [[obj.get(h) for h in cls.headers] for obj in cls.staging_queue] ) buf = buf.getvalue().encode() dest = cls.get_filepath(DAILY_DIR, trade_type) @@ -67,7 +68,7 @@ class Fund: else: trade_tag = d[trade_type] - timestamp = datetime.datetime.now() + timestamp = datetime.datetime.now() return ( base_dir / str(timestamp.date()) @@ -114,6 +115,13 @@ class Bowdst(Fund, fund_name="BOWDST"): class Selene(Fund, fund_name="ISOSEL"): + filepath_pattern = "innocap_serenitas_trades_{timestamp:%Y%m%d%H%M%S}.csv" + headers = GTL + + @classmethod + def set_headers(cls, trade_type): + pass + @classmethod def stage(cls, trade, *, action="NEW", **kwargs): cls.staging_queue.append(trade.to_citco(action)) |
