aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/__init__.py')
-rw-r--r--python/analytics/__init__.py57
1 files changed, 0 insertions, 57 deletions
diff --git a/python/analytics/__init__.py b/python/analytics/__init__.py
deleted file mode 100644
index b46dd4f3..00000000
--- a/python/analytics/__init__.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import sys
-
-sys.path.append("..")
-# indicates whether we use local pricing
-_local = True
-_include_todays_cashflows = False
-from utils.db import serenitas_engine, dawn_engine, dbconn, DataError, serenitas_pool
-from functools import lru_cache
-from .index import CreditIndex, ForwardIndex
-from .option import (
- BlackSwaption,
- Swaption,
- ATMstrike,
- ProbSurface,
- QuoteSurface,
- VolSurface,
- BlackSwaptionVolSurface,
-)
-from .portfolio import Portfolio
-from .basket_index import MarkitBasketIndex
-from .singlename_cds import SingleNameCds
-from .tranche_basket import DualCorrTranche, TrancheBasket, ManualTrancheBasket
-from .ir_swaption import IRSwaption
-
-import datetime
-
-
-@lru_cache(32)
-def on_the_run(index: str, value_date: datetime.date = datetime.date.today()) -> int:
- if index == "HY":
- interval = "+ INTERVAL '7 days'"
- else:
- interval = ""
- r = serenitas_engine.execute(
- "SELECT max(series) FROM index_maturity WHERE index=%s "
- f"AND issue_date {interval}<= %s",
- (index, value_date),
- )
- (series,) = r.fetchone()
- return series
-
-
-def init_ontr(value_date: datetime.date = datetime.date.today()) -> None:
- global _ontr, _beta
- _ontr = {
- k: CreditIndex(k, on_the_run(k, value_date), "5yr", value_date)
- for k in ("HY", "IG", "EU", "XO")
- }
- for k, index in _ontr.items():
- index.mark()
- r = dawn_engine.execute(
- "SELECT DISTINCT ON (asset_class) "
- "asset_class, beta FROM beta "
- "WHERE date <= %s ORDER BY asset_class, date desc",
- (value_date,),
- )
- _beta = {e.asset_class: e.beta for e in r}