diff options
Diffstat (limited to 'python/ops/funds.py')
| -rw-r--r-- | python/ops/funds.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/python/ops/funds.py b/python/ops/funds.py index 101deea2..bf8ab290 100644 --- a/python/ops/funds.py +++ b/python/ops/funds.py @@ -8,8 +8,9 @@ from io import StringIO from pickle import dumps from typing import Tuple, Union from serenitas.utils.env import DAILY_DIR -from .file_gen import get_headers, build_line +from .file_gen import build_line from .trade_dataclasses import DealKind +from .headers import get_headers, MTM_HEADERS class Fund: @@ -66,6 +67,7 @@ class Fund: "iam": "IamDeal", "trs": "TRSDeal", "irs": "IRSDeal", + "mtm": cls.product_type.capitalize(), } trade_tag: str if isinstance(trade_type, tuple): @@ -143,3 +145,22 @@ class Selene(Fund, fund_name="ISOSEL"): cls.staging_queue.append(obj.to_citco(trade["action"])) else: redis_pipeline.rpush("product_queue", dumps((trade_type, trade))) + + +class MTM(Fund, fund_name="MTM"): + filepath_pattern = "MTM.{timestamp:%Y%m%d.%H%M%S}.{trade_tag}.csv" + product_type: str + + @classmethod + def set_headers(cls, trade_type): + cls.headers = MTM_HEADERS[trade_type] + + @classmethod + def stage(cls, trade, *, trade_type, **kwargs): + obj = DealKind[trade_type].from_dict(**trade) + cls.staging_queue.append(obj.to_markit()) + + @staticmethod + def upload(buf, dest): + sftp = SftpClient.from_creds("mtm") + sftp.put(buf, dest) |
