blob: e53d0071a522c8b634bce9e9fdb6fc2dca7de2da (
plain)
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
|
import argparse
import datetime
from serenitas.ops.trade_dataclasses import BondDeal
from serenitas.ops.funds import UMB
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"trade_date",
type=datetime.date.fromisoformat,
default=datetime.date.today(),
)
args = parser.parse_args()
with BondDeal._conn.cursor() as c:
c.execute(
"SELECT id FROM bond_trades WHERE fund= %s " "AND trade_date = %s ",
(
"SERCGMAST",
args.trade_date,
),
)
for (tid,) in c:
trade = BondDeal.from_allocationid(tid)
UMB.staging_queue.append(next(trade.to_umb("NEW")))
buf, dest = UMB.build_buffer("bond")
UMB.upload(buf, dest)
|