aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/api_quotes/api.py1
-rw-r--r--python/api_quotes/quotes.py10
-rw-r--r--sql/serenitasdb.sql3
3 files changed, 11 insertions, 3 deletions
diff --git a/python/api_quotes/api.py b/python/api_quotes/api.py
index 4d6f5783..6bc8191a 100644
--- a/python/api_quotes/api.py
+++ b/python/api_quotes/api.py
@@ -41,4 +41,5 @@ class MarkitAPI:
def read_api(r):
df = pd.DataFrame.from_dict(json.loads(r.text))
df.columns = df.columns.str.lower()
+ df[df["confidence"] == 10]
return df.to_dict(orient="records")
diff --git a/python/api_quotes/quotes.py b/python/api_quotes/quotes.py
index aff245b9..4be90866 100644
--- a/python/api_quotes/quotes.py
+++ b/python/api_quotes/quotes.py
@@ -2,6 +2,7 @@ from serenitas.ops.trade_dataclasses import Deal
from dataclasses import dataclass, field
import datetime
from typing import Literal
+from serenitas.utils.db2 import dbconn
firmness = Literal["FIRM", "INDICATIVE"]
asset_class = Literal["CD"]
@@ -44,11 +45,18 @@ class Quote(Deal, table_name="markit_quotes", deal_type=None):
"msg_id": d["message"]["id"],
"quotedate": d["receiveddatetime"],
"quotesource": d["sourceshortname"],
+ "tenor": f"{d['tenor']}Y",
}
d.update(additional_attributes)
- breakpoint()
return cls.from_dict(**d)
@property
def message(self):
return QuoteDetails.from_tradeid(self.msg_id)
+
+
+Quote.init_dbconn(dbconn("serenitasdb"))
+Quote._sql_insert = Quote._sql_insert.replace(
+ "RETURNING *", "ON CONFLICT DO NOTHING RETURNING *"
+)
+breakpoint()
diff --git a/sql/serenitasdb.sql b/sql/serenitasdb.sql
index 15625f69..41557de9 100644
--- a/sql/serenitasdb.sql
+++ b/sql/serenitasdb.sql
@@ -1243,7 +1243,7 @@ CREATE TABLE markit_quotes (
redcode text,
ticker text,
maturity date,
- tenor tenor,
+ tenor text,
runningcoupon int,
bidconventionalspread float,
bidupfront float,
@@ -1253,7 +1253,6 @@ CREATE TABLE markit_quotes (
asksize float,
firmness quote_firmness,
msg_id text,
- source text,
quotedate timestamptz NULL,
quotesource varchar(4) NULL
); \ No newline at end of file