1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
from exchangelib import HTMLBody
from report_ops.utils import Monitor
from report_ops.misc import _cc_recipients
_new_strategy_recipients = {
"SERCGMAST": ("serenitas.ops@sscinc.com",),
"BOWDST": (
"hedgemark.lmcg.ops@sscinc.com",
"pjadhav@sscinc.com",
"sagar.bansode@sscinc.com",
),
}
class NewStrategyEmail(
Monitor,
headers=(
"portfolio",
"strategy",
),
num_format=[],
):
@classmethod
def email(cls, fund):
if not cls._staging_queue:
return
cls._em.send_email(
f"New Portfolio/Folder Setup Request {fund}",
HTMLBody(
f"""
<html>
<head>
<style>
table, th, td {{ border: 1px solid black; border-collapse: collapse;}}
th, td {{ padding: 5px; }}
</style>
</head>
<body>
Hello,<br><br>Could you please set up the below portfolio and strategy combinations for this fund: {fund}<br><br>{cls.to_tabulate()}
</body>
</html>"""
),
to_recipients=_new_strategy_recipients[fund],
cc_recipients=_cc_recipients[fund],
)
def email_new_strategy(fund, new_strategies):
for strategy in new_strategies:
NewStrategyEmail.stage(strategy)
NewStrategyEmail.email(fund)
NewStrategyEmail.clear()
if __name__ == "__main__":
"""Set up new strategy for globeop via email"""
new_strategies = [
{"portfolio": "AUTOS", "strategy": "AUTOL_SNR"},
{"portfolio": "AUTOS", "strategy": "AUTOL_JNR"},
]
for fund in (
"SERCGMAST",
"BOWDST",
):
email_new_strategy(fund, new_strategies)
|