From 1449483bc7ad383c2e0a29dffffef5188da4628c Mon Sep 17 00:00:00 2001
From: Avantgarde Asset Management
<120227333+avantgardeam@users.noreply.github.com>
Date: Sun, 31 Dec 2023 18:52:20 -0300
Subject: [PATCH] Refactor `bquery.bql` method so a list is returned (#36)
* add .ipynb docs
* correct .ipynb title
* Refactor BlpQuery.bql to return a list of dfs instead of stacking them
* update docs to reflect new bql behavior
---
doc/source/quickstart.ipynb | 1071 +++++++++++++++++------------------
doc/source/quickstart.py | 4 +-
doc/source/quickstart.qmd | 4 +-
src/blp/blp.py | 50 +-
4 files changed, 546 insertions(+), 583 deletions(-)
diff --git a/doc/source/quickstart.ipynb b/doc/source/quickstart.ipynb
index 8c07aca..76504d0 100644
--- a/doc/source/quickstart.ipynb
+++ b/doc/source/quickstart.ipynb
@@ -252,7 +252,7 @@
"
0 | \n",
" CL1 Comdty | \n",
" Generic 1st 'CL' Future | \n",
- " 77.43 | \n",
+ " 75.27 | \n",
" \n",
" \n",
"\n",
@@ -260,7 +260,7 @@
],
"text/plain": [
" security NAME PX_LAST\n",
- "0 CL1 Comdty Generic 1st 'CL' Future 77.43"
+ "0 CL1 Comdty Generic 1st 'CL' Future 75.27"
]
},
"execution_count": 4,
@@ -312,123 +312,123 @@
" \n",
" \n",
" 0 | \n",
- " BOF4 | \n",
- " 2.80 | \n",
+ " BOH4 | \n",
+ " 2.67 | \n",
"
\n",
" \n",
" 1 | \n",
" C H4 | \n",
- " 4.24 | \n",
+ " 4.31 | \n",
"
\n",
" \n",
" 2 | \n",
- " CLF4 | \n",
- " 8.44 | \n",
+ " CLH4 | \n",
+ " 8.47 | \n",
"
\n",
" \n",
" 3 | \n",
" COH4 | \n",
- " 7.81 | \n",
+ " 7.92 | \n",
"
\n",
" \n",
" 4 | \n",
" CTH4 | \n",
- " 1.53 | \n",
+ " 1.55 | \n",
"
\n",
" \n",
" 5 | \n",
" GCG4 | \n",
- " 16.41 | \n",
+ " 17.52 | \n",
"
\n",
" \n",
" 6 | \n",
" HGH4 | \n",
- " 5.30 | \n",
+ " 5.56 | \n",
"
\n",
" \n",
" 7 | \n",
- " HOF4 | \n",
- " 2.07 | \n",
+ " HOH4 | \n",
+ " 2.00 | \n",
"
\n",
" \n",
" 8 | \n",
" KCH4 | \n",
- " 3.19 | \n",
+ " 3.74 | \n",
"
\n",
" \n",
" 9 | \n",
" KWH4 | \n",
- " 1.35 | \n",
+ " 1.44 | \n",
"
\n",
" \n",
" 10 | \n",
- " LAF24 | \n",
- " 4.12 | \n",
+ " LAH24 | \n",
+ " 4.43 | \n",
"
\n",
" \n",
" 11 | \n",
" LCG4 | \n",
- " 3.86 | \n",
+ " 3.84 | \n",
"
\n",
" \n",
" 12 | \n",
" LHG4 | \n",
- " 1.68 | \n",
+ " 1.60 | \n",
"
\n",
" \n",
" 13 | \n",
- " LLF4 | \n",
- " 1.00 | \n",
+ " LLH4 | \n",
+ " 0.93 | \n",
"
\n",
" \n",
" 14 | \n",
- " LNF4 | \n",
- " 1.73 | \n",
+ " LNH4 | \n",
+ " 1.74 | \n",
"
\n",
" \n",
" 15 | \n",
- " LXF4 | \n",
- " 2.54 | \n",
+ " LXH4 | \n",
+ " 2.66 | \n",
"
\n",
" \n",
" 16 | \n",
- " NGF24 | \n",
- " 7.37 | \n",
+ " NGH24 | \n",
+ " 5.62 | \n",
"
\n",
" \n",
" 17 | \n",
- " QSF4 | \n",
- " 2.71 | \n",
+ " QSH4 | \n",
+ " 2.67 | \n",
"
\n",
" \n",
" 18 | \n",
- " S F4 | \n",
- " 5.47 | \n",
+ " S H4 | \n",
+ " 5.45 | \n",
"
\n",
" \n",
" 19 | \n",
" SBH4 | \n",
- " 3.84 | \n",
+ " 2.95 | \n",
"
\n",
" \n",
" 20 | \n",
" SIH4 | \n",
- " 4.74 | \n",
+ " 4.97 | \n",
"
\n",
" \n",
" 21 | \n",
- " SMF4 | \n",
- " 3.38 | \n",
+ " SMH4 | \n",
+ " 3.12 | \n",
"
\n",
" \n",
" 22 | \n",
" W H4 | \n",
- " 2.21 | \n",
+ " 2.55 | \n",
"
\n",
" \n",
" 23 | \n",
- " XBF4 | \n",
- " 2.21 | \n",
+ " XBH4 | \n",
+ " 2.28 | \n",
"
\n",
" \n",
"\n",
@@ -436,30 +436,30 @@
],
"text/plain": [
" Member Ticker and Exchange Code Percentage Weight\n",
- "0 BOF4 2.80\n",
- "1 C H4 4.24\n",
- "2 CLF4 8.44\n",
- "3 COH4 7.81\n",
- "4 CTH4 1.53\n",
- "5 GCG4 16.41\n",
- "6 HGH4 5.30\n",
- "7 HOF4 2.07\n",
- "8 KCH4 3.19\n",
- "9 KWH4 1.35\n",
- "10 LAF24 4.12\n",
- "11 LCG4 3.86\n",
- "12 LHG4 1.68\n",
- "13 LLF4 1.00\n",
- "14 LNF4 1.73\n",
- "15 LXF4 2.54\n",
- "16 NGF24 7.37\n",
- "17 QSF4 2.71\n",
- "18 S F4 5.47\n",
- "19 SBH4 3.84\n",
- "20 SIH4 4.74\n",
- "21 SMF4 3.38\n",
- "22 W H4 2.21\n",
- "23 XBF4 2.21"
+ "0 BOH4 2.67\n",
+ "1 C H4 4.31\n",
+ "2 CLH4 8.47\n",
+ "3 COH4 7.92\n",
+ "4 CTH4 1.55\n",
+ "5 GCG4 17.52\n",
+ "6 HGH4 5.56\n",
+ "7 HOH4 2.00\n",
+ "8 KCH4 3.74\n",
+ "9 KWH4 1.44\n",
+ "10 LAH24 4.43\n",
+ "11 LCG4 3.84\n",
+ "12 LHG4 1.60\n",
+ "13 LLH4 0.93\n",
+ "14 LNH4 1.74\n",
+ "15 LXH4 2.66\n",
+ "16 NGH24 5.62\n",
+ "17 QSH4 2.67\n",
+ "18 S H4 5.45\n",
+ "19 SBH4 2.95\n",
+ "20 SIH4 4.97\n",
+ "21 SMH4 3.12\n",
+ "22 W H4 2.55\n",
+ "23 XBH4 2.28"
]
},
"execution_count": 5,
@@ -665,387 +665,387 @@
" \n",
" | \n",
" security | \n",
- " Price:D-1 | \n",
- " Market Cap | \n",
- " S&P LT FC Iss Cred Rtg | \n",
- " Ticker | \n",
- " Moody's Issuer Rtg | \n",
- " Tier 1 Cap Rt LF | \n",
" Tot Rsk Bsd Cap Rt LF | \n",
+ " Ticker | \n",
" Short Name | \n",
+ " Market Cap | \n",
+ " Price:D-1 | \n",
+ " Tier 1 Cap Rt LF | \n",
+ " Moody's Issuer Rtg | \n",
+ " S&P LT FC Iss Cred Rtg | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 8331 JP | \n",
- " 7.451469 | \n",
- " 6.089966e+09 | \n",
- " A- | \n",
- " 8331 JP | \n",
- " A1 | \n",
- " 11.510000 | \n",
" 11.580000 | \n",
+ " 8331 JP | \n",
" CHIBA BANK LTD | \n",
+ " 5.757796e+09 | \n",
+ " 7.071664 | \n",
+ " 11.510000 | \n",
+ " A1 | \n",
+ " A- | \n",
"
\n",
" \n",
" 1 | \n",
" ABN NA | \n",
- " 13.956888 | \n",
- " 1.201920e+10 | \n",
- " A | \n",
- " ABN NA | \n",
- " A1 | \n",
- " 16.500000 | \n",
" 19.799999 | \n",
+ " ABN NA | \n",
" ABN AMRO BANK-CV | \n",
+ " 1.285043e+10 | \n",
+ " 14.816520 | \n",
+ " 16.500000 | \n",
+ " Aa3 | \n",
+ " A | \n",
"
\n",
" \n",
" 2 | \n",
" ACA FP | \n",
- " 12.911215 | \n",
- " 3.946861e+10 | \n",
- " A+ | \n",
- " ACA FP | \n",
- " Aa3 | \n",
- " 13.700000 | \n",
" 17.900000 | \n",
+ " ACA FP | \n",
" CREDIT AGRICOLE | \n",
+ " 4.330626e+10 | \n",
+ " 14.157763 | \n",
+ " 13.700000 | \n",
+ " Aa3 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 3 | \n",
" BAC US | \n",
- " 30.010000 | \n",
- " 2.372537e+11 | \n",
- " A- | \n",
- " BAC US | \n",
- " A1 | \n",
- " 13.600000 | \n",
" 15.400000 | \n",
+ " BAC US | \n",
" BANK OF AMERICA | \n",
+ " 2.645561e+11 | \n",
+ " 33.860001 | \n",
+ " 13.600000 | \n",
+ " A1 | \n",
+ " A- | \n",
"
\n",
" \n",
" 4 | \n",
" BBVA SM | \n",
- " 9.063227 | \n",
- " 5.414058e+10 | \n",
- " A | \n",
- " BBVA SM | \n",
- " A3 | \n",
- " 14.450000 | \n",
" 16.510000 | \n",
+ " BBVA SM | \n",
" BBVA | \n",
+ " 5.424467e+10 | \n",
+ " 9.074981 | \n",
+ " 14.450000 | \n",
+ " A3 | \n",
+ " A | \n",
"
\n",
" \n",
" 5 | \n",
" BNP FP | \n",
- " 62.127838 | \n",
- " 7.159116e+10 | \n",
- " A+ | \n",
- " BNP FP | \n",
- " Aa3 | \n",
- " 15.500000 | \n",
" 17.799999 | \n",
+ " BNP FP | \n",
" BNP PARIBAS | \n",
+ " 7.980755e+10 | \n",
+ " 69.411812 | \n",
+ " 15.550000 | \n",
+ " Aa3 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 6 | \n",
" BNS CN | \n",
- " 44.430687 | \n",
- " 5.364239e+10 | \n",
- " A+ | \n",
+ " 17.200001 | \n",
" BNS CN | \n",
- " A2 | \n",
- " 14.600000 | \n",
- " 16.900000 | \n",
" BANK OF NOVA SCO | \n",
+ " 5.818445e+10 | \n",
+ " 47.749039 | \n",
+ " 14.800000 | \n",
+ " A2 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 7 | \n",
" CBK GR | \n",
- " 12.299781 | \n",
- " 1.511882e+10 | \n",
- " A- | \n",
- " CBK GR | \n",
- " A2 | \n",
- " 16.500000 | \n",
" 19.200001 | \n",
+ " CBK GR | \n",
" COMMERZBANK | \n",
+ " 1.470946e+10 | \n",
+ " 11.836692 | \n",
+ " 16.500000 | \n",
+ " A2 | \n",
+ " A- | \n",
"
\n",
" \n",
" 8 | \n",
" CFR US | \n",
- " 99.370003 | \n",
- " 6.354122e+09 | \n",
- " A- | \n",
- " CFR US | \n",
- " A3 | \n",
- " 13.810000 | \n",
" 15.280000 | \n",
+ " CFR US | \n",
" CULLEN/FROST | \n",
+ " 6.890196e+09 | \n",
+ " 107.989998 | \n",
+ " 13.810000 | \n",
+ " A3 | \n",
+ " A- | \n",
"
\n",
" \n",
" 9 | \n",
" DANSKE DC | \n",
- " 26.030893 | \n",
- " 2.243711e+10 | \n",
- " A+ | \n",
- " DANSKE DC | \n",
- " A3 | \n",
- " 20.600000 | \n",
" 23.200001 | \n",
+ " DANSKE DC | \n",
" DANSKE BANK A/S | \n",
+ " 2.261516e+10 | \n",
+ " 26.175419 | \n",
+ " 20.600000 | \n",
+ " A3 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 10 | \n",
" DBK GR | \n",
- " 12.324938 | \n",
- " 2.518035e+10 | \n",
- " A- | \n",
- " DBK GR | \n",
- " A1 | \n",
- " 16.299999 | \n",
" 18.799999 | \n",
+ " DBK GR | \n",
" DEUTSCHE BANK-RG | \n",
+ " 2.785299e+10 | \n",
+ " 13.624589 | \n",
+ " 16.299999 | \n",
+ " A1 | \n",
+ " A | \n",
"
\n",
" \n",
" 11 | \n",
" JPM US | \n",
- " 153.289993 | \n",
- " 4.418039e+11 | \n",
- " A- | \n",
- " JPM US | \n",
- " A1 | \n",
- " 15.900000 | \n",
" 17.799999 | \n",
+ " JPM US | \n",
" JPMORGAN CHASE | \n",
+ " 4.839548e+11 | \n",
+ " 168.389999 | \n",
+ " 15.900000 | \n",
+ " A1 | \n",
+ " A- | \n",
"
\n",
" \n",
" 12 | \n",
" NA CN | \n",
- " 66.278137 | \n",
- " 2.250676e+10 | \n",
- " A | \n",
+ " 16.799999 | \n",
" NA CN | \n",
- " A3 | \n",
- " 16.100000 | \n",
- " 16.900000 | \n",
" NATL BK CANADA | \n",
+ " 2.560488e+10 | \n",
+ " 75.416634 | \n",
+ " 16.000000 | \n",
+ " A3 | \n",
+ " A | \n",
"
\n",
" \n",
" 13 | \n",
" NAB AU | \n",
- " 18.291357 | \n",
- " 5.732886e+10 | \n",
- " AA- | \n",
- " NAB AU | \n",
- " Aa3 | \n",
- " 14.190000 | \n",
" 19.879999 | \n",
+ " NAB AU | \n",
" NATL AUST BANK | \n",
+ " 6.472474e+10 | \n",
+ " 20.680393 | \n",
+ " 14.190000 | \n",
+ " Aa3 | \n",
+ " AA- | \n",
"
\n",
" \n",
" 14 | \n",
" PNC US | \n",
- " 130.339996 | \n",
- " 5.188792e+10 | \n",
- " A- | \n",
- " PNC US | \n",
- " A3 | \n",
- " 11.500000 | \n",
" 13.400000 | \n",
+ " PNC US | \n",
" PNC FINANCIAL SE | \n",
+ " 6.073507e+10 | \n",
+ " 154.100006 | \n",
+ " 11.500000 | \n",
+ " A3 | \n",
+ " A- | \n",
"
\n",
" \n",
" 15 | \n",
" RY CN | \n",
- " 87.805054 | \n",
- " 1.230937e+11 | \n",
- " AA- | \n",
+ " 17.600000 | \n",
" RY CN | \n",
- " A1 | \n",
- " 15.400000 | \n",
- " 17.299999 | \n",
" ROYAL BANK OF CA | \n",
+ " 1.418815e+11 | \n",
+ " 100.799332 | \n",
+ " 15.700000 | \n",
+ " A1 | \n",
+ " AA- | \n",
"
\n",
" \n",
" 16 | \n",
" SAN SM | \n",
- " 4.084249 | \n",
- " 6.619073e+10 | \n",
- " A+ | \n",
- " SAN SM | \n",
- " A2 | \n",
- " 13.800000 | \n",
" 16.299999 | \n",
+ " SAN SM | \n",
" BANCO SANTANDER | \n",
+ " 6.802634e+10 | \n",
+ " 4.194893 | \n",
+ " 13.800000 | \n",
+ " A2 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 17 | \n",
" SEBA SS | \n",
- " 12.084361 | \n",
- " 2.589788e+10 | \n",
- " A+ | \n",
- " SEBA SS | \n",
- " Aa3 | \n",
- " 20.600000 | \n",
" 21.900000 | \n",
+ " SEBA SS | \n",
" SEB AB-A | \n",
+ " 2.923436e+10 | \n",
+ " 13.637860 | \n",
+ " 20.600000 | \n",
+ " Aa3 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 18 | \n",
" SHBA SS | \n",
- " 9.459072 | \n",
- " 1.885026e+10 | \n",
- " AA- | \n",
- " SHBA SS | \n",
- " Aa2 | \n",
- " 21.200001 | \n",
" 24.500000 | \n",
+ " SHBA SS | \n",
" SVENSKA HAN-A | \n",
+ " 2.148063e+10 | \n",
+ " 10.793521 | \n",
+ " 21.200001 | \n",
+ " Aa2 | \n",
+ " AA- | \n",
"
\n",
" \n",
" 19 | \n",
" SWEDA SS | \n",
- " 17.638960 | \n",
- " 2.001985e+10 | \n",
- " A+ | \n",
- " SWEDA SS | \n",
- " Aa3 | \n",
- " 20.500000 | \n",
" 23.000000 | \n",
+ " SWEDA SS | \n",
" SWEDBANK AB-A | \n",
+ " 2.255931e+10 | \n",
+ " 19.895409 | \n",
+ " 20.500000 | \n",
+ " Aa3 | \n",
+ " A+ | \n",
"
\n",
" \n",
" 20 | \n",
" TD CN | \n",
- " 61.994610 | \n",
- " 1.112967e+11 | \n",
- " AA- | \n",
+ " 18.100000 | \n",
" TD CN | \n",
- " A1 | \n",
- " 17.200001 | \n",
- " 19.600000 | \n",
" TORONTO-DOM BANK | \n",
+ " 1.160988e+11 | \n",
+ " 64.188225 | \n",
+ " 16.200001 | \n",
+ " A1 | \n",
+ " AA- | \n",
"
\n",
" \n",
" 21 | \n",
" TFC US | \n",
- " 32.040001 | \n",
- " 4.263737e+10 | \n",
- " A- | \n",
- " TFC US | \n",
- " A3 | \n",
- " 11.400000 | \n",
" 13.500000 | \n",
+ " TFC US | \n",
" TRUIST FINANCIAL | \n",
+ " 4.902564e+10 | \n",
+ " 37.110001 | \n",
+ " 11.400000 | \n",
+ " A3 | \n",
+ " A- | \n",
"
\n",
" \n",
" 22 | \n",
" USB US | \n",
- " 37.630001 | \n",
- " 5.860595e+10 | \n",
- " A | \n",
- " USB US | \n",
- " A3 | \n",
- " 11.200000 | \n",
" 13.400000 | \n",
+ " USB US | \n",
" US BANCORP | \n",
+ " 6.774561e+10 | \n",
+ " 44.070000 | \n",
+ " 11.200000 | \n",
+ " A3 | \n",
+ " A | \n",
"
\n",
" \n",
" 23 | \n",
" WBC AU | \n",
- " 13.896977 | \n",
- " 4.891449e+10 | \n",
- " AA- | \n",
- " WBC AU | \n",
- " Aa3 | \n",
- " 14.590000 | \n",
" 20.450001 | \n",
+ " WBC AU | \n",
" WESTPAC BANKING | \n",
+ " 5.468451e+10 | \n",
+ " 15.542620 | \n",
+ " 14.590000 | \n",
+ " Aa3 | \n",
+ " AA- | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " security Price:D-1 Market Cap S&P LT FC Iss Cred Rtg Ticker \\\n",
- "0 8331 JP 7.451469 6.089966e+09 A- 8331 JP \n",
- "1 ABN NA 13.956888 1.201920e+10 A ABN NA \n",
- "2 ACA FP 12.911215 3.946861e+10 A+ ACA FP \n",
- "3 BAC US 30.010000 2.372537e+11 A- BAC US \n",
- "4 BBVA SM 9.063227 5.414058e+10 A BBVA SM \n",
- "5 BNP FP 62.127838 7.159116e+10 A+ BNP FP \n",
- "6 BNS CN 44.430687 5.364239e+10 A+ BNS CN \n",
- "7 CBK GR 12.299781 1.511882e+10 A- CBK GR \n",
- "8 CFR US 99.370003 6.354122e+09 A- CFR US \n",
- "9 DANSKE DC 26.030893 2.243711e+10 A+ DANSKE DC \n",
- "10 DBK GR 12.324938 2.518035e+10 A- DBK GR \n",
- "11 JPM US 153.289993 4.418039e+11 A- JPM US \n",
- "12 NA CN 66.278137 2.250676e+10 A NA CN \n",
- "13 NAB AU 18.291357 5.732886e+10 AA- NAB AU \n",
- "14 PNC US 130.339996 5.188792e+10 A- PNC US \n",
- "15 RY CN 87.805054 1.230937e+11 AA- RY CN \n",
- "16 SAN SM 4.084249 6.619073e+10 A+ SAN SM \n",
- "17 SEBA SS 12.084361 2.589788e+10 A+ SEBA SS \n",
- "18 SHBA SS 9.459072 1.885026e+10 AA- SHBA SS \n",
- "19 SWEDA SS 17.638960 2.001985e+10 A+ SWEDA SS \n",
- "20 TD CN 61.994610 1.112967e+11 AA- TD CN \n",
- "21 TFC US 32.040001 4.263737e+10 A- TFC US \n",
- "22 USB US 37.630001 5.860595e+10 A USB US \n",
- "23 WBC AU 13.896977 4.891449e+10 AA- WBC AU \n",
+ " security Tot Rsk Bsd Cap Rt LF Ticker Short Name \\\n",
+ "0 8331 JP 11.580000 8331 JP CHIBA BANK LTD \n",
+ "1 ABN NA 19.799999 ABN NA ABN AMRO BANK-CV \n",
+ "2 ACA FP 17.900000 ACA FP CREDIT AGRICOLE \n",
+ "3 BAC US 15.400000 BAC US BANK OF AMERICA \n",
+ "4 BBVA SM 16.510000 BBVA SM BBVA \n",
+ "5 BNP FP 17.799999 BNP FP BNP PARIBAS \n",
+ "6 BNS CN 17.200001 BNS CN BANK OF NOVA SCO \n",
+ "7 CBK GR 19.200001 CBK GR COMMERZBANK \n",
+ "8 CFR US 15.280000 CFR US CULLEN/FROST \n",
+ "9 DANSKE DC 23.200001 DANSKE DC DANSKE BANK A/S \n",
+ "10 DBK GR 18.799999 DBK GR DEUTSCHE BANK-RG \n",
+ "11 JPM US 17.799999 JPM US JPMORGAN CHASE \n",
+ "12 NA CN 16.799999 NA CN NATL BK CANADA \n",
+ "13 NAB AU 19.879999 NAB AU NATL AUST BANK \n",
+ "14 PNC US 13.400000 PNC US PNC FINANCIAL SE \n",
+ "15 RY CN 17.600000 RY CN ROYAL BANK OF CA \n",
+ "16 SAN SM 16.299999 SAN SM BANCO SANTANDER \n",
+ "17 SEBA SS 21.900000 SEBA SS SEB AB-A \n",
+ "18 SHBA SS 24.500000 SHBA SS SVENSKA HAN-A \n",
+ "19 SWEDA SS 23.000000 SWEDA SS SWEDBANK AB-A \n",
+ "20 TD CN 18.100000 TD CN TORONTO-DOM BANK \n",
+ "21 TFC US 13.500000 TFC US TRUIST FINANCIAL \n",
+ "22 USB US 13.400000 USB US US BANCORP \n",
+ "23 WBC AU 20.450001 WBC AU WESTPAC BANKING \n",
"\n",
- " Moody's Issuer Rtg Tier 1 Cap Rt LF Tot Rsk Bsd Cap Rt LF \\\n",
- "0 A1 11.510000 11.580000 \n",
- "1 A1 16.500000 19.799999 \n",
- "2 Aa3 13.700000 17.900000 \n",
- "3 A1 13.600000 15.400000 \n",
- "4 A3 14.450000 16.510000 \n",
- "5 Aa3 15.500000 17.799999 \n",
- "6 A2 14.600000 16.900000 \n",
- "7 A2 16.500000 19.200001 \n",
- "8 A3 13.810000 15.280000 \n",
- "9 A3 20.600000 23.200001 \n",
- "10 A1 16.299999 18.799999 \n",
- "11 A1 15.900000 17.799999 \n",
- "12 A3 16.100000 16.900000 \n",
- "13 Aa3 14.190000 19.879999 \n",
- "14 A3 11.500000 13.400000 \n",
- "15 A1 15.400000 17.299999 \n",
- "16 A2 13.800000 16.299999 \n",
- "17 Aa3 20.600000 21.900000 \n",
- "18 Aa2 21.200001 24.500000 \n",
- "19 Aa3 20.500000 23.000000 \n",
- "20 A1 17.200001 19.600000 \n",
- "21 A3 11.400000 13.500000 \n",
- "22 A3 11.200000 13.400000 \n",
- "23 Aa3 14.590000 20.450001 \n",
+ " Market Cap Price:D-1 Tier 1 Cap Rt LF Moody's Issuer Rtg \\\n",
+ "0 5.757796e+09 7.071664 11.510000 A1 \n",
+ "1 1.285043e+10 14.816520 16.500000 Aa3 \n",
+ "2 4.330626e+10 14.157763 13.700000 Aa3 \n",
+ "3 2.645561e+11 33.860001 13.600000 A1 \n",
+ "4 5.424467e+10 9.074981 14.450000 A3 \n",
+ "5 7.980755e+10 69.411812 15.550000 Aa3 \n",
+ "6 5.818445e+10 47.749039 14.800000 A2 \n",
+ "7 1.470946e+10 11.836692 16.500000 A2 \n",
+ "8 6.890196e+09 107.989998 13.810000 A3 \n",
+ "9 2.261516e+10 26.175419 20.600000 A3 \n",
+ "10 2.785299e+10 13.624589 16.299999 A1 \n",
+ "11 4.839548e+11 168.389999 15.900000 A1 \n",
+ "12 2.560488e+10 75.416634 16.000000 A3 \n",
+ "13 6.472474e+10 20.680393 14.190000 Aa3 \n",
+ "14 6.073507e+10 154.100006 11.500000 A3 \n",
+ "15 1.418815e+11 100.799332 15.700000 A1 \n",
+ "16 6.802634e+10 4.194893 13.800000 A2 \n",
+ "17 2.923436e+10 13.637860 20.600000 Aa3 \n",
+ "18 2.148063e+10 10.793521 21.200001 Aa2 \n",
+ "19 2.255931e+10 19.895409 20.500000 Aa3 \n",
+ "20 1.160988e+11 64.188225 16.200001 A1 \n",
+ "21 4.902564e+10 37.110001 11.400000 A3 \n",
+ "22 6.774561e+10 44.070000 11.200000 A3 \n",
+ "23 5.468451e+10 15.542620 14.590000 Aa3 \n",
"\n",
- " Short Name \n",
- "0 CHIBA BANK LTD \n",
- "1 ABN AMRO BANK-CV \n",
- "2 CREDIT AGRICOLE \n",
- "3 BANK OF AMERICA \n",
- "4 BBVA \n",
- "5 BNP PARIBAS \n",
- "6 BANK OF NOVA SCO \n",
- "7 COMMERZBANK \n",
- "8 CULLEN/FROST \n",
- "9 DANSKE BANK A/S \n",
- "10 DEUTSCHE BANK-RG \n",
- "11 JPMORGAN CHASE \n",
- "12 NATL BK CANADA \n",
- "13 NATL AUST BANK \n",
- "14 PNC FINANCIAL SE \n",
- "15 ROYAL BANK OF CA \n",
- "16 BANCO SANTANDER \n",
- "17 SEB AB-A \n",
- "18 SVENSKA HAN-A \n",
- "19 SWEDBANK AB-A \n",
- "20 TORONTO-DOM BANK \n",
- "21 TRUIST FINANCIAL \n",
- "22 US BANCORP \n",
- "23 WESTPAC BANKING "
+ " S&P LT FC Iss Cred Rtg \n",
+ "0 A- \n",
+ "1 A \n",
+ "2 A+ \n",
+ "3 A- \n",
+ "4 A \n",
+ "5 A+ \n",
+ "6 A+ \n",
+ "7 A- \n",
+ "8 A- \n",
+ "9 A+ \n",
+ "10 A \n",
+ "11 A- \n",
+ "12 A \n",
+ "13 AA- \n",
+ "14 A- \n",
+ "15 AA- \n",
+ "16 A+ \n",
+ "17 A+ \n",
+ "18 AA- \n",
+ "19 A+ \n",
+ "20 AA- \n",
+ "21 A- \n",
+ "22 A \n",
+ "23 AA- "
]
},
"execution_count": 7,
@@ -1072,7 +1072,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
@@ -1096,65 +1096,49 @@
" \n",
" \n",
" | \n",
- " security | \n",
" field | \n",
- " secondary_name | \n",
- " secondary_value | \n",
+ " id | \n",
" value | \n",
+ " DATE | \n",
+ " CURRENCY | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
- " IBM US Equity | \n",
" px_last | \n",
- " CURRENCY | \n",
+ " IBM US Equity | \n",
+ " 163.210007 | \n",
+ " 2023-12-26T00:00:00Z | \n",
" USD | \n",
- " 154.35 | \n",
"
\n",
" \n",
" 1 | \n",
- " AAPL US Equity | \n",
" px_last | \n",
- " CURRENCY | \n",
- " USD | \n",
- " 191.45 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " IBM US Equity | \n",
- " px_last | \n",
- " DATE | \n",
- " 2023-11-21T00:00:00Z | \n",
- " 154.35 | \n",
- "
\n",
- " \n",
- " 3 | \n",
" AAPL US Equity | \n",
- " px_last | \n",
- " DATE | \n",
- " 2023-11-21T00:00:00Z | \n",
- " 191.45 | \n",
+ " 193.050003 | \n",
+ " 2023-12-26T00:00:00Z | \n",
+ " USD | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " security field secondary_name secondary_value value\n",
- "0 IBM US Equity px_last CURRENCY USD 154.35\n",
- "1 AAPL US Equity px_last CURRENCY USD 191.45\n",
- "2 IBM US Equity px_last DATE 2023-11-21T00:00:00Z 154.35\n",
- "3 AAPL US Equity px_last DATE 2023-11-21T00:00:00Z 191.45"
+ " field id value DATE CURRENCY\n",
+ "0 px_last IBM US Equity 163.210007 2023-12-26T00:00:00Z USD\n",
+ "1 px_last AAPL US Equity 193.050003 2023-12-26T00:00:00Z USD"
]
},
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "bquery.bql(\"get(px_last) for(['IBM US Equity', 'AAPL US Equity'])\")"
+ "result = bquery.bql(\"get(px_last) for(['IBM US Equity', 'AAPL US Equity'])\")\n",
+ "# bquery.bql returns a list of dataframes with one dataframe per field.\n",
+ "result[0]"
]
},
{
@@ -1170,7 +1154,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"outputs": [
{
@@ -1209,9 +1193,9 @@
" \n",
" 0 | \n",
" IBM US Equity | \n",
- " 154.35 | \n",
+ " 163.21 | \n",
" IBM US Equity | \n",
- " 140.7789 | \n",
+ " 147.9558 | \n",
"
\n",
" \n",
"\n",
@@ -1220,10 +1204,10 @@
"text/plain": [
" default override \n",
" security CRNCY_ADJ_PX_LAST security CRNCY_ADJ_PX_LAST\n",
- "0 IBM US Equity 154.35 IBM US Equity 140.7789"
+ "0 IBM US Equity 163.21 IBM US Equity 147.9558"
]
},
- "execution_count": 9,
+ "execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -1243,7 +1227,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 11,
"metadata": {},
"outputs": [
{
@@ -1520,7 +1504,7 @@
"39 ZAL GY -2.424536e-14"
]
},
- "execution_count": 10,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -1542,7 +1526,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 12,
"metadata": {},
"outputs": [
{
@@ -1591,7 +1575,7 @@
"1 TLT US Equity 2971546"
]
},
- "execution_count": 11,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
@@ -1605,7 +1589,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": 13,
"metadata": {},
"outputs": [
{
@@ -1640,98 +1624,98 @@
" 0 | \n",
" 2019-01-02 | \n",
" /sedol1/2840215 | \n",
- " 231.4905 | \n",
+ " 230.5557 | \n",
" 126925199.0 | \n",
" \n",
" \n",
" 1 | \n",
" 2019-01-02 | \n",
" /sedol1/2971546 | \n",
- " 110.0483 | \n",
+ " 109.3493 | \n",
" 19841527.0 | \n",
"
\n",
" \n",
" 2 | \n",
" 2019-01-03 | \n",
" /sedol1/2840215 | \n",
- " 225.9664 | \n",
+ " 225.0540 | \n",
" 144140692.0 | \n",
"
\n",
" \n",
" 3 | \n",
" 2019-01-03 | \n",
" /sedol1/2971546 | \n",
- " 111.3006 | \n",
+ " 110.5936 | \n",
" 21187045.0 | \n",
"
\n",
" \n",
" 4 | \n",
" 2019-01-04 | \n",
" /sedol1/2840215 | \n",
- " 233.5354 | \n",
+ " 232.5924 | \n",
" 142628834.0 | \n",
"
\n",
" \n",
" 5 | \n",
" 2019-01-04 | \n",
" /sedol1/2971546 | \n",
- " 110.0123 | \n",
+ " 109.3135 | \n",
" 12970226.0 | \n",
"
\n",
" \n",
" 6 | \n",
" 2019-01-07 | \n",
" /sedol1/2840215 | \n",
- " 235.3767 | \n",
+ " 234.4263 | \n",
" 103139100.0 | \n",
"
\n",
" \n",
" 7 | \n",
" 2019-01-07 | \n",
" /sedol1/2971546 | \n",
- " 109.6879 | \n",
+ " 108.9912 | \n",
" 8498104.0 | \n",
"
\n",
" \n",
" 8 | \n",
" 2019-01-08 | \n",
" /sedol1/2840215 | \n",
- " 237.5882 | \n",
+ " 236.6288 | \n",
" 102512587.0 | \n",
"
\n",
" \n",
" 9 | \n",
" 2019-01-08 | \n",
" /sedol1/2971546 | \n",
- " 109.3996 | \n",
+ " 108.7048 | \n",
" 7737103.0 | \n",
"
\n",
" \n",
" 10 | \n",
" 2019-01-09 | \n",
" /sedol1/2840215 | \n",
- " 238.6985 | \n",
+ " 237.7347 | \n",
" 95006554.0 | \n",
"
\n",
" \n",
" 11 | \n",
" 2019-01-09 | \n",
" /sedol1/2971546 | \n",
- " 109.2285 | \n",
+ " 108.5347 | \n",
" 9349245.0 | \n",
"
\n",
" \n",
" 12 | \n",
" 2019-01-10 | \n",
" /sedol1/2840215 | \n",
- " 239.5405 | \n",
+ " 238.5733 | \n",
" 96823923.0 | \n",
"
\n",
" \n",
" 13 | \n",
" 2019-01-10 | \n",
" /sedol1/2971546 | \n",
- " 108.5257 | \n",
+ " 107.8364 | \n",
" 8222860.0 | \n",
"
\n",
" \n",
@@ -1740,23 +1724,23 @@
],
"text/plain": [
" date security PX_LAST VOLUME\n",
- "0 2019-01-02 /sedol1/2840215 231.4905 126925199.0\n",
- "1 2019-01-02 /sedol1/2971546 110.0483 19841527.0\n",
- "2 2019-01-03 /sedol1/2840215 225.9664 144140692.0\n",
- "3 2019-01-03 /sedol1/2971546 111.3006 21187045.0\n",
- "4 2019-01-04 /sedol1/2840215 233.5354 142628834.0\n",
- "5 2019-01-04 /sedol1/2971546 110.0123 12970226.0\n",
- "6 2019-01-07 /sedol1/2840215 235.3767 103139100.0\n",
- "7 2019-01-07 /sedol1/2971546 109.6879 8498104.0\n",
- "8 2019-01-08 /sedol1/2840215 237.5882 102512587.0\n",
- "9 2019-01-08 /sedol1/2971546 109.3996 7737103.0\n",
- "10 2019-01-09 /sedol1/2840215 238.6985 95006554.0\n",
- "11 2019-01-09 /sedol1/2971546 109.2285 9349245.0\n",
- "12 2019-01-10 /sedol1/2840215 239.5405 96823923.0\n",
- "13 2019-01-10 /sedol1/2971546 108.5257 8222860.0"
+ "0 2019-01-02 /sedol1/2840215 230.5557 126925199.0\n",
+ "1 2019-01-02 /sedol1/2971546 109.3493 19841527.0\n",
+ "2 2019-01-03 /sedol1/2840215 225.0540 144140692.0\n",
+ "3 2019-01-03 /sedol1/2971546 110.5936 21187045.0\n",
+ "4 2019-01-04 /sedol1/2840215 232.5924 142628834.0\n",
+ "5 2019-01-04 /sedol1/2971546 109.3135 12970226.0\n",
+ "6 2019-01-07 /sedol1/2840215 234.4263 103139100.0\n",
+ "7 2019-01-07 /sedol1/2971546 108.9912 8498104.0\n",
+ "8 2019-01-08 /sedol1/2840215 236.6288 102512587.0\n",
+ "9 2019-01-08 /sedol1/2971546 108.7048 7737103.0\n",
+ "10 2019-01-09 /sedol1/2840215 237.7347 95006554.0\n",
+ "11 2019-01-09 /sedol1/2971546 108.5347 9349245.0\n",
+ "12 2019-01-10 /sedol1/2840215 238.5733 96823923.0\n",
+ "13 2019-01-10 /sedol1/2971546 107.8364 8222860.0"
]
},
- "execution_count": 12,
+ "execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@@ -1806,14 +1790,14 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
- "Response for 'NOT_A_TICKER US Equity' contains securityError {'securityError': {'source': '53646:rsfhdsvc2', 'code': 15, 'category': 'BAD_SEC', 'message': 'Unknown/Invalid securityInvalid Security [nid:53646]', 'subcategory': 'INVALID_SECURITY'}}\n"
+ "Response for 'NOT_A_TICKER US Equity' contains securityError {'securityError': {'source': '53359:rsfhdsvc2', 'code': 15, 'category': 'BAD_SEC', 'message': 'Unknown/Invalid securityInvalid Security [nid:53359]', 'subcategory': 'INVALID_SECURITY'}}\n"
]
},
{
@@ -1848,49 +1832,49 @@
" 0 | \n",
" 2019-01-02 | \n",
" SPY US Equity | \n",
- " 231.4905 | \n",
+ " 230.5557 | \n",
" 126925199.0 | \n",
" \n",
" \n",
" 1 | \n",
" 2019-01-03 | \n",
" SPY US Equity | \n",
- " 225.9664 | \n",
+ " 225.0540 | \n",
" 144140692.0 | \n",
"
\n",
" \n",
" 2 | \n",
" 2019-01-04 | \n",
" SPY US Equity | \n",
- " 233.5354 | \n",
+ " 232.5924 | \n",
" 142628834.0 | \n",
"
\n",
" \n",
" 3 | \n",
" 2019-01-07 | \n",
" SPY US Equity | \n",
- " 235.3767 | \n",
+ " 234.4263 | \n",
" 103139100.0 | \n",
"
\n",
" \n",
" 4 | \n",
" 2019-01-08 | \n",
" SPY US Equity | \n",
- " 237.5882 | \n",
+ " 236.6288 | \n",
" 102512587.0 | \n",
"
\n",
" \n",
" 5 | \n",
" 2019-01-09 | \n",
" SPY US Equity | \n",
- " 238.6985 | \n",
+ " 237.7347 | \n",
" 95006554.0 | \n",
"
\n",
" \n",
" 6 | \n",
" 2019-01-10 | \n",
" SPY US Equity | \n",
- " 239.5405 | \n",
+ " 238.5733 | \n",
" 96823923.0 | \n",
"
\n",
" \n",
@@ -1899,16 +1883,16 @@
],
"text/plain": [
" date security PX_LAST VOLUME\n",
- "0 2019-01-02 SPY US Equity 231.4905 126925199.0\n",
- "1 2019-01-03 SPY US Equity 225.9664 144140692.0\n",
- "2 2019-01-04 SPY US Equity 233.5354 142628834.0\n",
- "3 2019-01-07 SPY US Equity 235.3767 103139100.0\n",
- "4 2019-01-08 SPY US Equity 237.5882 102512587.0\n",
- "5 2019-01-09 SPY US Equity 238.6985 95006554.0\n",
- "6 2019-01-10 SPY US Equity 239.5405 96823923.0"
+ "0 2019-01-02 SPY US Equity 230.5557 126925199.0\n",
+ "1 2019-01-03 SPY US Equity 225.0540 144140692.0\n",
+ "2 2019-01-04 SPY US Equity 232.5924 142628834.0\n",
+ "3 2019-01-07 SPY US Equity 234.4263 103139100.0\n",
+ "4 2019-01-08 SPY US Equity 236.6288 102512587.0\n",
+ "5 2019-01-09 SPY US Equity 237.7347 95006554.0\n",
+ "6 2019-01-10 SPY US Equity 238.5733 96823923.0"
]
},
- "execution_count": 13,
+ "execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@@ -1937,7 +1921,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 15,
"metadata": {},
"outputs": [
{
@@ -1974,7 +1958,7 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
@@ -1998,7 +1982,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 17,
"metadata": {},
"outputs": [
{
@@ -2013,10 +1997,10 @@
" \"message\": {\n",
" \"fragmentType\": 0,\n",
" \"correlationIds\": [\n",
- " 33\n",
+ " 34\n",
" ],\n",
" \"messageType\": \"HistoricalDataResponse\",\n",
- " \"timeReceived\": \"2023-11-21T04:17:39.755538+0000\",\n",
+ " \"timeReceived\": \"2023-12-27T02:21:35.053315+0000\",\n",
" \"element\": {\n",
" \"HistoricalDataResponse\": {\n",
" \"securityData\": {\n",
@@ -2067,7 +2051,7 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 18,
"metadata": {},
"outputs": [
{
@@ -2258,7 +2242,7 @@
"18 2021-01-29 GME US Equity 81.2500 202264220.0"
]
},
- "execution_count": 17,
+ "execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
@@ -2283,7 +2267,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": 19,
"metadata": {},
"outputs": [
{
@@ -2301,143 +2285,149 @@
"output_type": "stream",
"text": [
"{\n",
- " \"fragmentType\": 0,\n",
+ " \"fragmentType\": 1,\n",
" \"correlationIds\": [\n",
" \"USDCAD Curncy\"\n",
" ],\n",
" \"messageType\": \"MarketDataEvents\",\n",
- " \"timeReceived\": \"2023-11-21T04:17:42.131746+0000\",\n",
+ " \"timeReceived\": \"2023-12-27T02:21:44.066568+0000\",\n",
" \"element\": {\n",
" \"MarketDataEvents\": {\n",
" \"MKTDATA_EVENT_TYPE\": \"SUMMARY\",\n",
" \"MKTDATA_EVENT_SUBTYPE\": \"INITPAINT\",\n",
- " \"BID\": 1.3706,\n",
- " \"ASK\": 1.3707,\n",
- " \"BEST_BID\": 1.3706,\n",
- " \"BEST_ASK\": 1.3707,\n",
- " \"BID_ALL_SESSION\": 1.3706,\n",
- " \"ASK_ALL_SESSION\": 1.3707,\n",
+ " \"BID\": 1.3198,\n",
+ " \"ASK\": 1.3199,\n",
+ " \"BEST_BID\": 1.3198,\n",
+ " \"BEST_ASK\": 1.3199,\n",
+ " \"BID_ALL_SESSION\": 1.3198,\n",
+ " \"ASK_ALL_SESSION\": 1.3199,\n",
" \"IND_BID_FLAG\": false,\n",
" \"IND_ASK_FLAG\": false,\n",
- " \"BID_TDY\": 1.3706,\n",
- " \"PRICE_LAST_BID_RT\": 1.3706,\n",
- " \"ASK_TDY\": 1.3707,\n",
- " \"PRICE_LAST_ASK_RT\": 1.3707,\n",
+ " \"BID_TDY\": 1.3198,\n",
+ " \"PRICE_LAST_BID_RT\": 1.3198,\n",
+ " \"ASK_TDY\": 1.3199,\n",
+ " \"PRICE_LAST_ASK_RT\": 1.3199,\n",
" \"BID_DIR\": 1,\n",
- " \"ASK_DIR\": 1,\n",
- " \"BID2\": 1.3706,\n",
- " \"ASK2\": 1.3707,\n",
- " \"BID_ALL_SESSION_TDY_RT\": 1.3706,\n",
- " \"ASK_ALL_SESSION_TDY_RT\": 1.3707,\n",
+ " \"ASK_DIR\": -1,\n",
+ " \"BID2\": 1.3198,\n",
+ " \"ASK2\": 1.3199,\n",
+ " \"BID_ALL_SESSION_TDY_RT\": 1.3198,\n",
+ " \"ASK_ALL_SESSION_TDY_RT\": 1.3199,\n",
" \"CURRENT_SESSION_RT\": 2,\n",
- " \"PX_OPEN_ALL_WITH_SWITCHOVER_RT\": 1.3724546432495117,\n",
- " \"PX_CLOSE_ALL_WITH_SWITCHOVER_RT\": 1.3725,\n",
+ " \"PX_OPEN_ALL_WITH_SWITCHOVER_RT\": 1.3195171356201172,\n",
+ " \"PX_CLOSE_ALL_WITH_SWITCHOVER_RT\": 1.3195,\n",
" \"LAST_PRICE_ALL_SESSION_DIR_RT\": 1,\n",
" \"SIMP_LAST_PX_ALL_SESS_DIR_RT\": 1,\n",
" \"ID_BB_SEC_NUM_SRC\": 12884922137,\n",
- " \"LAST_PRICE\": 1.3707,\n",
- " \"LAST2_TRADE\": 1.3707,\n",
- " \"HIGH\": 1.373,\n",
- " \"LOW\": 1.3705,\n",
- " \"OPEN\": 1.3725,\n",
- " \"OPEN_TDY\": 1.3725,\n",
- " \"PRICE_OPEN_RT\": 1.3725,\n",
- " \"LAST_PRICE_TDY\": 1.3707,\n",
- " \"HIGH_TDY\": 1.373,\n",
- " \"PRICE_HIGH_RT\": 1.373,\n",
- " \"LOW_TDY\": 1.3705,\n",
- " \"PRICE_LOW_RT\": 1.3705,\n",
- " \"MID\": 1.3706,\n",
- " \"MID_TDY\": 1.3706,\n",
+ " \"LAST_PRICE\": 1.3198,\n",
+ " \"LAST2_TRADE\": 1.3198,\n",
+ " \"HIGH\": 1.321,\n",
+ " \"LOW\": 1.3193,\n",
+ " \"OPEN\": 1.3195,\n",
+ " \"OPEN_TDY\": 1.3195,\n",
+ " \"PRICE_OPEN_RT\": 1.3195,\n",
+ " \"LAST_PRICE_TDY\": 1.3198,\n",
+ " \"HIGH_TDY\": 1.321,\n",
+ " \"PRICE_HIGH_RT\": 1.321,\n",
+ " \"LOW_TDY\": 1.3193,\n",
+ " \"PRICE_LOW_RT\": 1.3193,\n",
+ " \"MID\": 1.3198,\n",
+ " \"MID_TDY\": 1.3198,\n",
" \"RT_EXCH_MARKET_STATUS\": \"ACTV\",\n",
- " \"LAST_ALL_SESSIONS\": 1.3707,\n",
- " \"PREV_CLOSE_VALUE_REALTIME\": 1.3725,\n",
- " \"TRADING_DT_REALTIME\": \"2023-11-21T00:00:00.000000\",\n",
- " \"PREV_TRADING_DT_REALTIME\": \"2023-11-20T00:00:00.000000\",\n",
- " \"PRICE_CHANGE_1Y_NET_RT\": 0.02590000070631504,\n",
- " \"PRICE_CHANGE_1Y_PCT_RT\": 1.9221999645233154,\n",
- " \"CLOSING_PRICE_1Y_AGO_RT\": 1.3447999954223633,\n",
+ " \"LAST_ALL_SESSIONS\": 1.3198,\n",
+ " \"PREV_CLOSE_VALUE_REALTIME\": 1.3195,\n",
+ " \"TRADING_DT_REALTIME\": \"2023-12-27T00:00:00.000000\",\n",
+ " \"PREV_TRADING_DT_REALTIME\": \"2023-12-26T00:00:00.000000\",\n",
+ " \"PRICE_CHANGE_1Y_NET_RT\": -0.032499998807907104,\n",
+ " \"PRICE_CHANGE_1Y_PCT_RT\": -2.401700019836426,\n",
+ " \"CLOSING_PRICE_1Y_AGO_RT\": 1.3523000478744507,\n",
" \"ZERO_BID_PRICE_INDICATOR_RT\": true,\n",
" \"ZERO_ASK_PRICE_INDICATOR_RT\": true,\n",
- " \"RT_API_MACHINE\": \"apipubx0@md1p-rr-004\",\n",
- " \"PX_LOW_BID_RT\": 1.3704500198364258,\n",
- " \"PX_HIGH_ASK_RT\": 1.3736000061035156,\n",
- " \"PX_HIGH_BID_RT\": 1.372910499572754,\n",
- " \"PX_LOW_ASK_RT\": 1.3705700635910034,\n",
- " \"ALL_PRICE\": 1.3707,\n",
- " \"MID2\": 1.3706,\n",
+ " \"RT_API_MACHINE\": \"apipubx0@md1p-rr-001\",\n",
+ " \"PX_LOW_BID_RT\": 1.3191900253295898,\n",
+ " \"PX_HIGH_ASK_RT\": 1.321120023727417,\n",
+ " \"PX_HIGH_BID_RT\": 1.3209450244903564,\n",
+ " \"PX_LOW_ASK_RT\": 1.3193902969360352,\n",
+ " \"ALL_PRICE\": 1.3198,\n",
+ " \"MID2\": 1.3198,\n",
" \"MID_DIR\": 1,\n",
" \"RT_PRICING_SOURCE\": \"BGN\",\n",
- " \"ASK_CHANGE\": -0.0019001174926758235,\n",
- " \"BID_CHANGE\": -0.0017002532958985128,\n",
+ " \"ASK_CHANGE\": 0.00018048553466787354,\n",
+ " \"BID_CHANGE\": 0.0004650909423828953,\n",
" \"SPREAD_BA\": 0.0001,\n",
" \"PRICE_52_WEEK_HIGH_RT\": 1.3899,\n",
" \"PRICE_52_WEEK_HIGH_DATE_RT\": \"2023-11-01T00:00:00.000000\",\n",
" \"PRICE_52_WEEK_LOW_RT\": 1.3093,\n",
" \"PRICE_52_WEEK_LOW_DATE_RT\": \"2023-07-14T00:00:00.000000\",\n",
- " \"PRICE_PREVIOUS_CLOSE_RT\": 1.3725,\n",
- " \"PRICE_LAST_RT\": 1.3707,\n",
- " \"PREVIOUS_CLOSE_BID_PRICE_RT\": 1.3723,\n",
- " \"PREVIOUS_CLOSE_ASK_PRICE_RT\": 1.3726,\n",
- " \"LAST_CONTINUOUS_TRADE_PRICE_RT\": 1.3707,\n",
+ " \"PRICE_PREVIOUS_CLOSE_RT\": 1.3195,\n",
+ " \"PRICE_LAST_RT\": 1.3198,\n",
+ " \"15_SECOND_PRICE_CHANGE_RT\": 0.0,\n",
+ " \"1_MINUTE_PRICE_CHANGE_RT\": 0.00019999999494757503,\n",
+ " \"5_MINUTE_PRICE_CHANGE_RT\": 0.00039999998989515007,\n",
+ " \"15_MINUTE_PRICE_CHANGE_RT\": 0.0003000000142492354,\n",
+ " \"10_MINUTE_PRICE_CHANGE_RT\": 0.0003000000142492354,\n",
+ " \"30_MINUTE_PRICE_CHANGE_RT\": 0.00019999999494757503,\n",
+ " \"1_HOUR_PRICE_CHANGE_RT\": 0.0,\n",
+ " \"PREVIOUS_CLOSE_BID_PRICE_RT\": 1.3193,\n",
+ " \"PREVIOUS_CLOSE_ASK_PRICE_RT\": 1.3197,\n",
+ " \"LAST_CONTINUOUS_TRADE_PRICE_RT\": 1.3198,\n",
" \"LAST_TRADE_CANCELED_IND_RT\": false,\n",
- " \"UNADJUSTED_PREV_LAST_PRICE_RT\": 1.3725,\n",
- " \"ADJUSTED_PREV_LAST_PRICE_RT\": 1.3725,\n",
+ " \"UNADJUSTED_PREV_LAST_PRICE_RT\": 1.3195,\n",
+ " \"ADJUSTED_PREV_LAST_PRICE_RT\": 1.3195,\n",
" \"BASE_PRICE_ENABLED_RT\": false,\n",
" \"BB_STANDARD_CC_AVAIL_RT\": false,\n",
" \"NUM_TRADES_RT\": 0,\n",
" \"BLOOMBERG_CLOSE_METHOD_RT\": \"NA\",\n",
" \"LAST_TICK_DIRECTION_RT\": 0,\n",
- " \"CHG_NET_REG_SES_PRV_RG_SES_CL_RT\": -0.0018019676208496094,\n",
- " \"CHG_PCT_REG_SES_PRV_RG_SES_CL_RT\": -0.13129546830859543,\n",
- " \"ALT_BOOK_BEST_ASK_CC_RT\": null,\n",
- " \"ALT_BOOK_NAME_RT\": null,\n",
- " \"ALT_BOOK_BEST_BID_CC_RT\": null,\n",
- " \"MIN_NEGOTIATED_TRADE_SIZE_RT\": null,\n",
- " \"SETTLMNT_PX_ALTRNTVE_NOTTN_RT\": null,\n",
- " \"ALT_BOOK_BEST_BID_NUM_OF_ORDR_RT\": null,\n",
- " \"ALT_BOOK_BEST_ASK_NUM_OF_ORDR_RT\": null,\n",
- " \"SETTLMNT_PX_ALT_NOTTN_METHOD_RT\": null,\n",
- " \"SHORTENED_BID_ASK_RT\": \"1.3706/07\",\n",
+ " \"CHG_NET_REG_SES_PRV_RG_SES_CL_RT\": 0.0003198385238647461,\n",
+ " \"CHG_PCT_REG_SES_PRV_RG_SES_CL_RT\": 0.02423932735550384,\n",
+ " \"SHORTENED_BID_ASK_RT\": \"1.3198/99\",\n",
" \"IS_DELAYED_STREAM\": false,\n",
- " \"CHG_NET_MTD_RT\": -0.0168,\n",
- " \"CHG_PCT_MTD_RT\": -1.2108,\n",
- " \"CHG_NET_QTD_RT\": 0.013,\n",
- " \"CHG_PCT_QTD_RT\": 0.9575,\n",
- " \"CHG_NET_YTD_RT\": 0.0153,\n",
- " \"CHG_PCT_YTD_RT\": 1.1288,\n",
- " \"CHG_NET_1M_RT\": 0.0016,\n",
- " \"CHG_PCT_1M_RT\": 0.1169,\n",
- " \"CHG_NET_3M_RT\": 0.0163,\n",
- " \"CHG_PCT_3M_RT\": 1.2035,\n",
- " \"REALTIME_2_DAY_CHANGE_NET\": -0.0016,\n",
- " \"REALTIME_2_DAY_CHANGE_PERCENT\": -0.1166,\n",
- " \"REALTIME_5_DAY_CHANGE_NET\": 0.0014,\n",
- " \"REALTIME_5_DAY_CHANGE_PERCENT\": 0.1022,\n",
- " \"RT_PX_AS_PCT_INTRADAY_RANGE\": 8.0,\n",
- " \"REALTIME_PERCENT_BID_ASK_SPREAD\": 0.00730000000000075,\n",
- " \"CHG_NET_1D_ALL_FROM_REGULAR_RT\": -0.0018,\n",
- " \"CHG_PCT_1D_ALL_FROM_REGULAR_RT\": -0.1311,\n",
- " \"PX_CHG_NET_1D_ALL_SWITCHOVER_RT\": -0.0018,\n",
- " \"PX_CHG_PCT_1D_ALL_SWITCHOVER_RT\": -0.1311,\n",
+ " \"EXCH_CODE_LAST_ALL_SESSION_RT\": \"\",\n",
+ " \"LOC_SRC_FOR_LST_TRD_ALL_SESS_RT\": \"\",\n",
+ " \"CHG_NET_MTD_RT\": -0.0363,\n",
+ " \"CHG_PCT_MTD_RT\": -2.6768,\n",
+ " \"CHG_NET_QTD_RT\": -0.0379,\n",
+ " \"CHG_PCT_QTD_RT\": -2.7915,\n",
+ " \"CHG_NET_YTD_RT\": -0.0356,\n",
+ " \"CHG_PCT_YTD_RT\": -2.6265,\n",
+ " \"CHG_NET_1M_RT\": -0.0418,\n",
+ " \"CHG_PCT_1M_RT\": -3.0699,\n",
+ " \"CHG_NET_3M_RT\": -0.03,\n",
+ " \"CHG_PCT_3M_RT\": -2.2226,\n",
+ " \"REALTIME_2_DAY_CHANGE_NET\": -0.0059,\n",
+ " \"REALTIME_2_DAY_CHANGE_PERCENT\": -0.445,\n",
+ " \"REALTIME_5_DAY_CHANGE_NET\": -0.0171,\n",
+ " \"REALTIME_5_DAY_CHANGE_PERCENT\": -1.2791,\n",
+ " \"RT_PX_AS_PCT_INTRADAY_RANGE\": 29.4118,\n",
+ " \"REALTIME_PERCENT_BID_ASK_SPREAD\": 0.0075999999999964984,\n",
+ " \"REALTIME_15_SEC_PRICE_PCT_CHG\": 0.0,\n",
+ " \"REALTIME_ONE_MIN_PRICE_PCT_CHG\": 0.0152,\n",
+ " \"REALTIME_FIVE_MIN_PRICE_PCT_CHG\": 0.0303,\n",
+ " \"REALTIME_15_MIN_PRICE_PCT_CHG\": 0.0227,\n",
+ " \"REALTIME_ONE_HOUR_PRICE_PCT_CHG\": 0.0,\n",
+ " \"CHG_NET_1D_ALL_FROM_REGULAR_RT\": 0.0003,\n",
+ " \"CHG_PCT_1D_ALL_FROM_REGULAR_RT\": 0.0227,\n",
+ " \"PX_CHG_NET_1D_ALL_SWITCHOVER_RT\": 0.0003,\n",
+ " \"PX_CHG_PCT_1D_ALL_SWITCHOVER_RT\": 0.0227,\n",
" \"API_RULES_VERSION\": 201411210,\n",
- " \"PREV_SES_LAST_PRICE\": 1.3725,\n",
- " \"RT_PX_CHG_NET_1D\": -0.0018,\n",
- " \"RT_PX_CHG_PCT_1D\": -0.13109999895095825,\n",
- " \"PRICE_CHANGE_ON_DAY_RT\": -0.0018,\n",
- " \"NET_CHANGE_ON_DAY_TODAY_RT\": -0.0018,\n",
- " \"PERCENT_CHANGE_ON_DAY_TODAY_RT\": -0.1311,\n",
- " \"LAST_UPDATE_BID_RT\": \"01:17:40\",\n",
- " \"LAST_UPDATE_ASK_RT\": \"01:17:40\",\n",
- " \"TIME\": \"01:17:40\",\n",
- " \"BID_ASK_TIME\": \"01:17:40\",\n",
+ " \"PREV_SES_LAST_PRICE\": 1.3195,\n",
+ " \"RT_PX_CHG_NET_1D\": 0.0003,\n",
+ " \"RT_PX_CHG_PCT_1D\": 0.022700000554323196,\n",
+ " \"PRICE_CHANGE_ON_DAY_RT\": 0.0003,\n",
+ " \"NET_CHANGE_ON_DAY_TODAY_RT\": 0.0003,\n",
+ " \"PERCENT_CHANGE_ON_DAY_TODAY_RT\": 0.0227,\n",
+ " \"LAST_UPDATE_BID_RT\": \"23:21:51\",\n",
+ " \"LAST_UPDATE_ASK_RT\": \"23:21:51\",\n",
+ " \"TIME\": \"23:21:51\",\n",
+ " \"BID_ASK_TIME\": \"23:21:51\",\n",
" \"SES_START\": \"19:00:00\",\n",
" \"SES_END\": \"18:59:59\",\n",
- " \"PRICE_LAST_TIME_RT\": \"01:17:40\",\n",
- " \"LAST_BID_TIME_TODAY_REALTIME\": \"01:17:40\",\n",
- " \"LAST_ASK_TIME_TODAY_REALTIME\": \"01:17:40\",\n",
- " \"LAST_PRICE_TIME_TODAY_REALTIME\": \"01:17:40\",\n",
- " \"LAST_UPDATE_ALL_SESSIONS_RT\": \"01:17:40\"\n",
+ " \"PRICE_LAST_TIME_RT\": \"23:21:51\",\n",
+ " \"LAST_BID_TIME_TODAY_REALTIME\": \"23:21:51\",\n",
+ " \"LAST_ASK_TIME_TODAY_REALTIME\": \"23:21:51\",\n",
+ " \"LAST_PRICE_TIME_TODAY_REALTIME\": \"23:21:51\",\n",
+ " \"LAST_UPDATE_ALL_SESSIONS_RT\": \"23:21:51\"\n",
" }\n",
" }\n",
"}\n",
@@ -2447,27 +2437,28 @@
" \"USDCAD Curncy\"\n",
" ],\n",
" \"messageType\": \"MarketDataEvents\",\n",
- " \"timeReceived\": \"2023-11-21T04:17:42.131746+0000\",\n",
+ " \"timeReceived\": \"2023-12-27T02:21:44.104816+0000\",\n",
" \"element\": {\n",
" \"MarketDataEvents\": {\n",
" \"MKTDATA_EVENT_TYPE\": \"TRADE\",\n",
" \"MKTDATA_EVENT_SUBTYPE\": \"NEW\",\n",
- " \"LAST_ALL_SESSIONS\": 1.3707,\n",
- " \"LAST2_TRADE\": 1.3707,\n",
- " \"LAST_PRICE\": 1.3707,\n",
- " \"LAST_PRICE_TDY\": 1.3707,\n",
+ " \"LAST_ALL_SESSIONS\": 1.3198,\n",
+ " \"LAST2_TRADE\": 1.3198,\n",
+ " \"LAST_PRICE\": 1.3198,\n",
+ " \"LAST_PRICE_TDY\": 1.3198,\n",
" \"LAST2_DIR\": null,\n",
" \"LAST_TICK_DIRECTION_RT\": 0,\n",
" \"ALL_PRICE_COND_CODE\": null,\n",
- " \"ALL_PRICE\": 1.3707,\n",
+ " \"ALL_PRICE\": 1.3198,\n",
" \"LAST_PRICE_COND_CODE_RT\": null,\n",
- " \"PRICE_CHANGE_1Y_NET_RT\": 0.02590000070631504,\n",
- " \"PRICE_CHANGE_1Y_PCT_RT\": 1.9258999824523926,\n",
- " \"LAST_CONTINUOUS_TRADE_PRICE_RT\": 1.3707,\n",
- " \"PRICE_LAST_RT\": 1.3707,\n",
- " \"EVT_TRADE_PRICE_RT\": 1.3707,\n",
+ " \"PRICE_CHANGE_1Y_NET_RT\": -0.032499998807907104,\n",
+ " \"PRICE_CHANGE_1Y_PCT_RT\": -2.4033000469207764,\n",
+ " \"LAST_CONTINUOUS_TRADE_PRICE_RT\": 1.3198,\n",
+ " \"PRICE_LAST_RT\": 1.3198,\n",
+ " \"EVT_TRADE_PRICE_RT\": 1.3198,\n",
" \"EVT_TRADE_SIZE_RT\": 0,\n",
" \"EVT_TRADE_CONDITION_CODE_RT\": null,\n",
+ " \"EVT_TRADE_LOCAL_EXCH_SOURCE_RT\": null,\n",
" \"EVT_TRADE_SOURCE_TYPE_CODE_RT\": null,\n",
" \"EVT_TRADE_INTEGER_IDENTIFIER_RT\": null,\n",
" \"EVT_TRADE_IDENTIFIER_RT\": null,\n",
@@ -2479,36 +2470,36 @@
" \"CHG_PCT_PREV_DAY_POST_CLS\": null,\n",
" \"CHG_NET_1D_PRE_FROM_REGULAR_RT\": null,\n",
" \"CHG_PCT_1D_PRE_FROM_REGULAR_RT\": null,\n",
- " \"CHG_NET_1D_ALL_FROM_REGULAR_RT\": -0.0018,\n",
- " \"CHG_PCT_1D_ALL_FROM_REGULAR_RT\": -0.1311,\n",
+ " \"CHG_NET_1D_ALL_FROM_REGULAR_RT\": 0.0003,\n",
+ " \"CHG_PCT_1D_ALL_FROM_REGULAR_RT\": 0.0227,\n",
" \"CHG_NET_1D_POST_FROM_REGULAR_RT\": null,\n",
" \"CHG_PCT_1D_POST_FROM_REGULAR_RT\": null,\n",
- " \"PX_CHG_NET_1D_ALL_SWITCHOVER_RT\": -0.0018,\n",
- " \"PX_CHG_PCT_1D_ALL_SWITCHOVER_RT\": -0.1311,\n",
- " \"CHG_NET_REG_SES_PRV_RG_SES_CL_RT\": -0.0018,\n",
- " \"CHG_PCT_REG_SES_PRV_RG_SES_CL_RT\": -0.131148,\n",
- " \"CHG_NET_MTD_RT\": -0.0168,\n",
- " \"CHG_PCT_MTD_RT\": -1.2108,\n",
- " \"CHG_NET_QTD_RT\": 0.013,\n",
- " \"CHG_PCT_QTD_RT\": 0.9575,\n",
- " \"CHG_NET_YTD_RT\": 0.0153,\n",
- " \"CHG_PCT_YTD_RT\": 1.1288,\n",
- " \"CHG_NET_1M_RT\": 0.0016,\n",
- " \"CHG_PCT_1M_RT\": 0.1169,\n",
- " \"CHG_NET_3M_RT\": 0.0163,\n",
- " \"CHG_PCT_3M_RT\": 1.2035,\n",
- " \"REALTIME_2_DAY_CHANGE_NET\": -0.0016,\n",
- " \"REALTIME_2_DAY_CHANGE_PERCENT\": -0.1166,\n",
- " \"REALTIME_5_DAY_CHANGE_NET\": 0.0014,\n",
- " \"REALTIME_5_DAY_CHANGE_PERCENT\": 0.1022,\n",
- " \"RT_PX_AS_PCT_INTRADAY_RANGE\": 8.0,\n",
- " \"REALTIME_PERCENT_BID_ASK_SPREAD\": 0.00730000000000075,\n",
+ " \"PX_CHG_NET_1D_ALL_SWITCHOVER_RT\": 0.0003,\n",
+ " \"PX_CHG_PCT_1D_ALL_SWITCHOVER_RT\": 0.0227,\n",
+ " \"CHG_NET_REG_SES_PRV_RG_SES_CL_RT\": 0.0003,\n",
+ " \"CHG_PCT_REG_SES_PRV_RG_SES_CL_RT\": 0.022736,\n",
+ " \"CHG_NET_MTD_RT\": -0.0363,\n",
+ " \"CHG_PCT_MTD_RT\": -2.6768,\n",
+ " \"CHG_NET_QTD_RT\": -0.0379,\n",
+ " \"CHG_PCT_QTD_RT\": -2.7915,\n",
+ " \"CHG_NET_YTD_RT\": -0.0356,\n",
+ " \"CHG_PCT_YTD_RT\": -2.6265,\n",
+ " \"CHG_NET_1M_RT\": -0.0418,\n",
+ " \"CHG_PCT_1M_RT\": -3.0699,\n",
+ " \"CHG_NET_3M_RT\": -0.03,\n",
+ " \"CHG_PCT_3M_RT\": -2.2226,\n",
+ " \"REALTIME_2_DAY_CHANGE_NET\": -0.0059,\n",
+ " \"REALTIME_2_DAY_CHANGE_PERCENT\": -0.445,\n",
+ " \"REALTIME_5_DAY_CHANGE_NET\": -0.0171,\n",
+ " \"REALTIME_5_DAY_CHANGE_PERCENT\": -1.2791,\n",
+ " \"RT_PX_AS_PCT_INTRADAY_RANGE\": 29.4118,\n",
+ " \"REALTIME_PERCENT_BID_ASK_SPREAD\": 0.0075999999999964984,\n",
" \"RT_THEORETICAL_PCT_CHG_FROM_LAST\": null,\n",
- " \"REALTIME_15_SEC_PRICE_PCT_CHG\": null,\n",
- " \"REALTIME_ONE_MIN_PRICE_PCT_CHG\": null,\n",
- " \"REALTIME_FIVE_MIN_PRICE_PCT_CHG\": null,\n",
- " \"REALTIME_15_MIN_PRICE_PCT_CHG\": null,\n",
- " \"REALTIME_ONE_HOUR_PRICE_PCT_CHG\": null,\n",
+ " \"REALTIME_15_SEC_PRICE_PCT_CHG\": 0.0,\n",
+ " \"REALTIME_ONE_MIN_PRICE_PCT_CHG\": 0.0152,\n",
+ " \"REALTIME_FIVE_MIN_PRICE_PCT_CHG\": 0.0303,\n",
+ " \"REALTIME_15_MIN_PRICE_PCT_CHG\": 0.0227,\n",
+ " \"REALTIME_ONE_HOUR_PRICE_PCT_CHG\": 0.0,\n",
" \"REALTIME_VOLUME_5_DAY_INTERVAL\": null,\n",
" \"DELTA_AVAT_1_DAY_INTERVAL\": null,\n",
" \"DELTA_AVAT_5_DAY_INTERVAL\": null,\n",
@@ -2524,22 +2515,22 @@
" \"DELTA_ATAT_30_DAY_INTERVAL\": null,\n",
" \"DELTA_ATAT_100_DAY_INTERVAL\": null,\n",
" \"DELTA_ATAT_180_DAY_INTERVAL\": null,\n",
- " \"RT_PX_CHG_NET_1D\": -0.0018,\n",
- " \"RT_PX_CHG_PCT_1D\": -0.13109999895095825,\n",
- " \"PRICE_CHANGE_ON_DAY_RT\": -0.0018,\n",
- " \"NET_CHANGE_ON_DAY_TODAY_RT\": -0.0018,\n",
- " \"PERCENT_CHANGE_ON_DAY_TODAY_RT\": -0.1311,\n",
- " \"LAST_UPDATE_CHG_1D_RT\": -0.0017999999690800905,\n",
- " \"EVT_TRADE_TIME_RT\": \"01:17:40\",\n",
- " \"TRADE_UPDATE_STAMP_RT\": \"2023-11-21T01:17:40.000000-0300\",\n",
+ " \"RT_PX_CHG_NET_1D\": 0.0003,\n",
+ " \"RT_PX_CHG_PCT_1D\": 0.022700000554323196,\n",
+ " \"PRICE_CHANGE_ON_DAY_RT\": 0.0003,\n",
+ " \"NET_CHANGE_ON_DAY_TODAY_RT\": 0.0003,\n",
+ " \"PERCENT_CHANGE_ON_DAY_TODAY_RT\": 0.0227,\n",
+ " \"LAST_UPDATE_CHG_1D_RT\": 0.0003000000142492354,\n",
+ " \"EVT_TRADE_TIME_RT\": \"23:21:52\",\n",
+ " \"TRADE_UPDATE_STAMP_RT\": \"2023-12-26T23:21:52.000000-0300\",\n",
" \"IS_DELAYED_STREAM\": false,\n",
" \"EVT_UPDATE_ACTIONS_RT\": 271,\n",
- " \"TIME\": \"01:17:40\",\n",
- " \"PRICE_LAST_TIME_RT\": \"01:17:40\",\n",
- " \"LAST_PRICE_TIME_TODAY_REALTIME\": \"01:17:40\",\n",
- " \"EVENT_TIME\": \"01:17:40\",\n",
- " \"LAST_UPDATE_ALL_SESSIONS_RT\": \"01:17:40\",\n",
- " \"BLOOMBERG_SEND_TIME_RT\": \"2023-11-21T04:17:42.131000+0000\"\n",
+ " \"TIME\": \"23:21:52\",\n",
+ " \"PRICE_LAST_TIME_RT\": \"23:21:52\",\n",
+ " \"LAST_PRICE_TIME_TODAY_REALTIME\": \"23:21:52\",\n",
+ " \"EVENT_TIME\": \"23:21:52\",\n",
+ " \"LAST_UPDATE_ALL_SESSIONS_RT\": \"23:21:52\",\n",
+ " \"BLOOMBERG_SEND_TIME_RT\": \"2023-12-27T02:21:44.104000+0000\"\n",
" }\n",
" }\n",
"}\n"
@@ -2560,9 +2551,9 @@
],
"metadata": {
"kernelspec": {
- "display_name": "myenv",
+ "display_name": "Python 3",
"language": "python",
- "name": "myenv"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
diff --git a/doc/source/quickstart.py b/doc/source/quickstart.py
index cbec393..4aea0cf 100644
--- a/doc/source/quickstart.py
+++ b/doc/source/quickstart.py
@@ -83,7 +83,9 @@
# `bquery.bql` accepts a Bloomberg Query String. For optimal query creation, utilize Excel's BQL Builder in Advanced View. Once your query is ready, click the "Copy" button to copy it, and then paste it into the `bquery.bql` argument.
# %%
-bquery.bql("get(px_last) for(['IBM US Equity', 'AAPL US Equity'])")
+result = bquery.bql("get(px_last) for(['IBM US Equity', 'AAPL US Equity'])")
+# bquery.bql returns a list of dataframes with one dataframe per field.
+result[0]
# %% [markdown]
# # Advanced Query Techniques
diff --git a/doc/source/quickstart.qmd b/doc/source/quickstart.qmd
index 9206e38..64e3c95 100644
--- a/doc/source/quickstart.qmd
+++ b/doc/source/quickstart.qmd
@@ -80,7 +80,9 @@ bquery.beqs(
`bquery.bql` accepts a Bloomberg Query String. For optimal query creation, utilize Excel's BQL Builder in Advanced View. Once your query is ready, click the "Copy" button to copy it, and then paste it into the `bquery.bql` argument.
```{python}
-bquery.bql("get(px_last) for(['IBM US Equity', 'AAPL US Equity'])")
+result = bquery.bql("get(px_last) for(['IBM US Equity', 'AAPL US Equity'])")
+# bquery.bql returns a list of dataframes with one dataframe per field.
+result[0]
```
# Advanced Query Techniques
diff --git a/src/blp/blp.py b/src/blp/blp.py
index fbfc37e..7aebfd7 100644
--- a/src/blp/blp.py
+++ b/src/blp/blp.py
@@ -850,18 +850,17 @@ def bql(
overrides: List of tuples containing the field to override and its value
options: key value pairs to to set in request
- Returns: A pandas.DataFrame with columns ["security", "field", "secondary_name", "secondary_value", "value"]
+ Returns: A list of pandas.DataFrames with columns ["field", "id", "value"], along with additional secondary columns.
Examples:
>>> bquery = blp.BlpQuery().start() # doctest: +SKIP
- >>> bquery.bql(expression="get(px_last()) for(['AAPL US Equity', 'IBM US Equity'])") # doctest: +SKIP
+ >>> result = bquery.bql(expression="get(px_last()) for(['AAPL US Equity', 'IBM US Equity'])") # doctest: +SKIP
+ >>> print(result[0]) # doctest: +SKIP
The resulting DataFrame will look like this:
- security field secondary_name secondary_value value
- 0 AAPL US Equity px_last() CURRENCY USD 192.755005
- 1 IBM US Equity px_last() CURRENCY USD 139.289993
- 2 AAPL US Equity px_last() DATE 2023-07-24T00:00:00Z 192.755005
- 3 IBM US Equity px_last() DATE 2023-07-24T00:00:00Z 139.289993
+ field id value DATE CURRENCY
+ 0 px_last() AAPL US Equity 193.050003 2023-12-26T00:00:00Z USD
+ 1 px_last() IBM US Equity 163.210007 2023-12-26T00:00:00Z USD
"""
query = create_bql_query(expression, overrides, options)
@@ -873,44 +872,13 @@ def bql(
]
)
- df = self.query(query, bql_parser, self.collect_to_bql)
+ list_of_dfs = self.query(query, bql_parser, self.collect_to_bql)
- df = df[["id", "field", "secondary_name", "secondary_value", "value"]]
-
- df = df.rename(columns={"id": "security"})
-
- return df
+ return list_of_dfs
def collect_to_bql(self, responses: Iterable) -> pandas.DataFrame:
"""Collector for bql()."""
- data = []
- fields = {"secondary_name", "secondary_value", "field", "id", "value"}
- for field in responses:
- field_df = pandas.DataFrame(field)
-
- id_vars = ["field", "id", "value"]
- secondary_columns = field_df.columns.difference(id_vars)
-
- if len(secondary_columns) == 0:
- # If we dont have any secondary columns, we just add empty columns
- field_df["secondary_name"] = None
- field_df["secondary_value"] = None
- else:
- # If we have multiple secondary columns, we need to melt the dataframe
- field_df = field_df.melt(
- id_vars=id_vars,
- value_vars=field_df.columns.difference(id_vars),
- var_name="secondary_name",
- value_name="secondary_value",
- )
-
- column_order = ["secondary_name", "secondary_value", "field", "id", "value"]
- field_df = field_df[column_order]
-
- data.append(field_df)
-
- df = pandas.concat(data)
- return self.cast_columns(df, fields)
+ return [pandas.DataFrame(field) for field in responses]
def bdp(
self,