Python Bloomberg API pdblp 日内请求 [英] Python Bloomberg API pdblp intraday request

查看:32
本文介绍了Python Bloomberg API pdblp 日内请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pdblp 通过以下方式允许彭博社的每日历史请求:

pdblp allows daily historical Bloomberg requests via:

con = pdblp.BCon(debug=False)
con = start()
df = con.bdh(['SPY Equity'], 'PX_LAST', '20150103', '20150619')

如何提出日内价格/成交量/持仓量等请求?

How can intraday price/volume/open interest etc requests be made?

类似于以下的期望行为,以 15 分钟为间隔的价格.

Desired behavior resembling as below, the price on 15 minute intervals.

df = con.bdh(['SPY Equity'], 'PX_Last', ... , periodSelection = 'MINUTE', period=15)

推荐答案

开始时间和结束时间必须在 UTC 时区.因此,应该进行一些转换 - 并且还需要考虑夏令时.

Start time and end time must be in UTC timezone. So a bit of conversions should be made - and need to account for daylight savings as well.

改用xbbg要容易得多:

Using xbbg instead is much easier:

In [1]: from xbbg import blp

In [2]: blp.bdib(ticker='SPY US Equity', dt='2018-11-20').tail()
Out[2]:
ticker                    SPY US Equity
field                              open   high    low  close   volume num_trds
2018-11-20 15:57:00-05:00        264.42 264.49 264.35 264.41   590775     2590
2018-11-20 15:58:00-05:00        264.42 264.42 264.26 264.27  1005241     3688
2018-11-20 15:59:00-05:00        264.26 264.48 264.12 264.15  4227150     7886
2018-11-20 16:09:00-05:00        264.12 264.12 264.12 264.12        0        1
2018-11-20 16:15:00-05:00        264.12 264.12 264.12 264.12        0        1

这里需要完整的股票代码才能找到交易所的时区.

Need the full equity ticker here to find the timezone of exchange.

这篇关于Python Bloomberg API pdblp 日内请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆