aboutsummaryrefslogtreecommitdiffstats
path: root/python/book_bbg.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/book_bbg.py')
-rw-r--r--python/book_bbg.py54
1 files changed, 6 insertions, 48 deletions
diff --git a/python/book_bbg.py b/python/book_bbg.py
index d9d139a7..7da29b01 100644
--- a/python/book_bbg.py
+++ b/python/book_bbg.py
@@ -12,39 +12,6 @@ import pandas as pd
from sqlalchemy.exc import SQLAlchemyError
import time
-_funds = {"SERENITAS_CGMF": "SERCGMAST", "BOWDOINST": "BOWDST"}
-_fcms = {"Bank of America, N.A.": "BAML", "Goldman Sachs": "GS"}
-_cdx_cp = {
- "MSDU": "MSCSNY",
- "GSMX": "GOLDNY",
- "JPGP": "JPCBNY",
- "JFF": "JEFF",
- "BMLE": "BAMSNY",
- "BARX": "BARCNY",
- "CSDA": "CSFBBO",
- "EBNP": "BNPBNY",
- "WFCD": "WELFEI",
- "BSEF": "BSEONY",
- "JPOS": "JPCBNY",
- "CGCI": "CITINY",
-}
-_bond_cp = {
- "CG": "CITINY",
- "WFBS": "WELFEI",
- "MZZ": "MIZUNY",
- "BABS": "BAML",
- "PTRU": "PERFCH",
- "BARC": "BARCNY",
- "MS": "MORGNY",
- "BA": "BAML",
- "FB": "CSUINY",
- "INTC": "STONEX",
- "SOCG": "SGSANY",
- "NOM": "NOMINY",
- "JP": "JPCBNY",
- "BTIG": "BTIG",
-}
-
def get_indic_data(conn, redcode, tenor):
sql_str = (
@@ -84,21 +51,13 @@ def cdx_booking_process(path, conn):
def bond_booking_process(path, fname):
- reader = csv.DictReader(path)
- for line in reader:
- line["bbg_ticket_id"] = fname
- trade = BondDeal
+ for row in csv.DictReader(path):
+ line = {"bbg_ticket_id": fname}
+ line.update(row)
+ breakpoint()
+ trade = BondDeal.from_bbg_line(line)
trade.stage()
- try:
- BondDeal.insert_bbg_line(line)
- except Exception as e:
- pass
- BondDeal._insert_queue.clear()
- print("error")
- else:
- _cache[fname] = None
- finally:
- BondDeal.commit()
+ BondDeal.commit()
def get_bbg_id(name):
@@ -109,7 +68,6 @@ if __name__ == "__main__":
from serenitas.utils.db import serenitas_pool, dawn_engine
conn = serenitas_pool.getconn()
- _cache = LRU(128)
while True:
d = datetime.date.today()
sftp = SftpClient.from_creds("bbg")