R-Bloomberg 价格订阅中的实时价格更新

发布于 2024-11-03 10:20:32 字数 1282 浏览 0 评论 0原文

我正在使用 RBloomberg 库来获取实时和历史价格数据,但我想知道变量是否可以连续更新其实时定价。现在:

> library(RBloomberg)
Loading required package: rJava
> conn <- blpConnect()
R version 2.12.2 (2011-02-25) 
rJava Version 0.8-8 
RBloomberg Version 0.4-148 
Java environment initialized successfully.
Looking for most recent blpapi3.jar file...
Adding C:\blp\API\APIv3\JavaAPI\v3.4.1.3\lib\blpapi3.jar to Java classpath
Bloomberg API Version 3.4.1.3 
> bdp(conn, "EURUSD Curncy", "Last Price")
              Last Price
EURUSD Curncy     1.4575

如您所见,我可以轻松获得 EURUSD 汇率。但是,如何使变量订阅 EURUSD Curncy Last_price,以便该变量实时更新自身的当前值,而不是总是重新运行 bdp(conn, "EURUSD Curncy", "最后价格”)?我可以做这样的事情吗?

> eurusd <- bdp(conn, "EURUSD Curncy", "Last Price")
> eurusd
              Last Price
EURUSD Curncy     1.4575

这样,每当我输入 eurusd 时,我都会得到最新汇率,而不是初始化变量时的汇率?现在这似乎不起作用(即使汇率发生变化,它也始终具有相同的值)。

> eurusd
              Last Price
EURUSD Curncy     1.4575
> eurusd
              Last Price
EURUSD Curncy     1.4575
> eurusd <- bdp(conn, "EURUSD Curncy", "Last Price")
> eurusd
              Last Price
EURUSD Curncy     1.4578
> 

基本上,R 可以做 Excel 所做的事情,即拥有一个始终包含 EURUSD 最新值的单元格,而不需要不断运行 bdp 来更新变量吗?

I am using the RBloomberg library for live and historical price data, but I would like to know if it is possible for a variable to update its live pricing continuously. Right now:

> library(RBloomberg)
Loading required package: rJava
> conn <- blpConnect()
R version 2.12.2 (2011-02-25) 
rJava Version 0.8-8 
RBloomberg Version 0.4-148 
Java environment initialized successfully.
Looking for most recent blpapi3.jar file...
Adding C:\blp\API\APIv3\JavaAPI\v3.4.1.3\lib\blpapi3.jar to Java classpath
Bloomberg API Version 3.4.1.3 
> bdp(conn, "EURUSD Curncy", "Last Price")
              Last Price
EURUSD Curncy     1.4575

So as you can see I can get the EURUSD exchange rate easily. But how can I make a variable subscribe to the EURUSD Curncy Last_price so that the variable updates itself in real time for the current value, rather than always re-running bdp(conn, "EURUSD Curncy", "last price")? Could I do something like this?

> eurusd <- bdp(conn, "EURUSD Curncy", "Last Price")
> eurusd
              Last Price
EURUSD Curncy     1.4575

so that whenever I type eurusd I get the latest exchange rate and not the one from when I initialised the variable? Right now this does not seem to work (just has the same value in it all the time even after the exchange rate has changed).

> eurusd
              Last Price
EURUSD Curncy     1.4575
> eurusd
              Last Price
EURUSD Curncy     1.4575
> eurusd <- bdp(conn, "EURUSD Curncy", "Last Price")
> eurusd
              Last Price
EURUSD Curncy     1.4578
> 

Basically, can R do what Excel does, which is to have a cell which always has the latest value of EURUSD in it, without constantly running bdp to update the variable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迎风吟唱 2024-11-10 10:20:32

如果您继续达到他们监控的项目请求限制,最终 BB 会让您获得数据许可证。不幸的是,数据许可证只是静态数据。如果你真的想要更多,那么你必须选择 BPIPE。

Eventually BB will make you get a Data License if you keep hitting the item request limits which they do monitor. Unfortunately the Data License is only static data. If you really want more then you have to go with BPIPE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文