aboutsummaryrefslogtreecommitdiffstats
path: root/python/citco_ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/citco_ops')
-rw-r--r--python/citco_ops/bowdst.py17
-rw-r--r--python/citco_ops/cash.py10
2 files changed, 21 insertions, 6 deletions
diff --git a/python/citco_ops/bowdst.py b/python/citco_ops/bowdst.py
index 527a35a8..15759895 100644
--- a/python/citco_ops/bowdst.py
+++ b/python/citco_ops/bowdst.py
@@ -3,6 +3,8 @@ import datetime
from serenitas.ops.trade_dataclasses import Deal, Ccy
from typing import ClassVar
+_nt_to_currency = {"EURO - EUR": "EUR", "U.S. DOLLARS - USD": "USD"}
+
@dataclass
class Wire(Deal, table_name="custodian_wires", deal_type="custodian_wires"):
@@ -43,3 +45,18 @@ class BowdstWire(Wire, fund="BOWDST"):
else line["Transaction Description 2"],
unique_ref=line["Reference Number"],
)
+
+
+class IsoselWire(Wire, fund="ISOSEL"):
+ @classmethod
+ def from_passport_line(cls, line: dict):
+ return cls(
+ date=line["Through date"],
+ entry_date=line["D-GL-POST"],
+ value_date=line["D-TRAN-EFF"],
+ pay_date=line["D-TRAN-EFF"],
+ currency=_nt_to_currency[line["N-GL-AC30"]],
+ amount=line["Net amount - local"],
+ wire_details=line["narrative"],
+ unique_ref=line["C-EXTL-SYS-TRN-DSC-3"],
+ )
diff --git a/python/citco_ops/cash.py b/python/citco_ops/cash.py
index 78f26330..84a8c80b 100644
--- a/python/citco_ops/cash.py
+++ b/python/citco_ops/cash.py
@@ -61,15 +61,13 @@ class CashReport:
class IsoselCashReport(CashReport, fund="ISOSEL", account_number="ISOS01"):
- def download_reports(self):
+ @classmethod
+ def download_reports(cls, date=datetime.date.today()):
em = ExchangeMessage()
for msg in em.get_msgs(path=["SeleneOps", "Passport"]):
for attach in msg.attachments:
message_time = attach.last_modified_time
- if (
- attach.name == "Attachment1.pgp"
- and prev_business_day(message_time.date()) == self.date
- ):
+ if attach.name == "Attachment1.pgp" and message_time.date() == date:
dest = get_dir(message_time.date())
dest.mkdir(exist_ok=True, parents=True)
with attach.fp as fp:
@@ -87,7 +85,7 @@ class IsoselCashReport(CashReport, fund="ISOSEL", account_number="ISOS01"):
csvFile.write(text)
def to_db(self):
- self.download_reports()
+ self.download_reports(self.date)
p = max(
[
f