Код: Выделить всё
import os
from blp import blp
import pdblp
import blpapi
import datetime
import xlwings
import pandas as pd
import win32com.client
import pythoncom
import sys
import os
from PIL import ImageGrab
with open(os.path.join(os.getenv("TEMP"), "Bloomberg", "log", "bbcomm.log"),"r") as f:
try:
port = f.read().split("BLOOMBERG COMMUNICATION SERVER READY on Port: ")[-1].split("\n")[0]
except:
port = 8194
con = pdblp.BCon(debug = False, port = 8194, timeout = 10000000)
con.start()
today = datetime.datetime.today()
value_growth = con.bdh(['SVX Index','SGX Index'],'PX_Last',elms=[("periodicitySelection", "WEEKLY")], start_date="20220107",end_date= "20800101")
ten_year = con.bdh(['USGG10YR Index', 'USGG2YR Index'], 'PX_Last',elms=[("periodicitySelection", "WEEKLY")], start_date="20220107",end_date= "20800101" )
spx_drivers = con.bdh(['SPX Index','USGG2YR Index'],'PX_Last',elms=[("periodicitySelection", "WEEKLY")], start_date="20220107",end_date= "20800101" )
bloomberg = con.bdh(['GBTP10YR Index','GDBR10 Index','BICLB10Y Index','VIX Index','USGGT05Y Index','.EUCCBS3M G Index','CSI BARC Index','LP02OAS Index','V2X Index','SPX Index', 'SGX Index','S5INDU Index','RTY Index','CO1 Comdty','HG1 Comdty','USGGBE05 Index','XAU Curncy','XBTUSD Curncy'],'PX_Last', elms=[("periodicitySelection", "WEEKLY")], start_date="20220107",end_date= "20800101")
bloomberg1 = con.bdh('Move index', 'PX_Last',elms=[("periodicitySelection", "WEEKLY")], start_date="20220107",end_date= "20240101")
bloomberg_merged = pd.concat([bloomberg,bloomberg1], axis = 1)
with pd.ExcelWriter(r'FILE PATH', engine='openpyxl', if_sheet_exists='overlay', mode='a') as writer:
value_growth.to_excel(writer, sheet_name='Value_Growth', startcol=0, startrow= 581, header = False)
ten_year.to_excel(writer, sheet_name='10Y_drivers', startcol = 0, startrow = 216, header = False)
spx_drivers.to_excel(writer, sheet_name= 'SPX_Drivers', startcol = 0, startrow = 216, header = False)
bloomberg_merged.to_excel(writer, sheet_name='Bloomberg', startcol=0, startrow=579, header = False)
- Я знаю, что это очень узкоспециализированный вопрос, но удалось ли кому-нибудь успешно выполнить запрос Move Index в Bloomberg через Python?
- Как мне лучше понять, каково фактическое значение Valueerror?
Подробнее здесь: https://stackoverflow.com/questions/790 ... valueerror