Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBars - return value traded #89

Closed
joel23888 opened this issue Nov 10, 2015 · 10 comments
Closed

getBars - return value traded #89

joel23888 opened this issue Nov 10, 2015 · 10 comments
Labels

Comments

@joel23888
Copy link
Contributor

@joel23888 joel23888 commented Nov 10, 2015

Could getBars support returning the value traded in the bar? It seems from the BBG API Developer's guide and looking in BBG's Excel tools that 'value' is supported.

Ref: BBG API Developer's guide, http://www.bloomberglabs.com/content/uploads/sites/2/2014/07/blpapi-developers-guide-2.54.pdf (see p. 177)

@eddelbuettel
Copy link
Member

@eddelbuettel eddelbuettel commented Nov 10, 2015

Could you expand on what you want, what you get, why you think that is wrong and what you think we need to change?

Sorry, but we are busy too and a random link doesn't quite get me to read pages of documentation especially when the function has so far worked just fine.

@joel23888
Copy link
Contributor Author

@joel23888 joel23888 commented Nov 10, 2015

Here is an example of what I currently get:

tmp <- getBars("7203 JT Equity")
tmp
times open high low close numEvents volume
1 2015-11-10 09:00:00 7588 7638 7576 7606 4534 2458100
2 2015-11-10 10:00:00 7608 7616 7586 7603 2135 876200
3 2015-11-10 11:00:00 7605 7610 7601 7602 364 125400

BBG's document which I linked before says there is an additional column called 'value' returned when using the C++ API. Could you pass that back in the result of getBars as an additional column called 'value'?

So I would want something like:

tmp <- getBars("7203 JT Equity")
tmp
times open high low close numEvents volume value
1 2015-11-10 09:00:00 7588 7638 7576 7606 4534 2458100 [value for row 1]
2 2015-11-10 10:00:00 7608 7616 7586 7603 2135 876200 [value for row 2]
3 2015-11-10 11:00:00 7605 7610 7601 7602 364 125400 [value for row 3]

You can't derive the 'value' column from existing columns.

@eddelbuettel
Copy link
Member

@eddelbuettel eddelbuettel commented Nov 10, 2015

You'd have to work out how to do that by experimenting with the code and/or options to the call.

I have no idea whether this is feasible -- sorry.

@eddelbuettel eddelbuettel removed the wontfix label Nov 10, 2015
@eddelbuettel
Copy link
Member

@eddelbuettel eddelbuettel commented Nov 10, 2015

On second look, maybe the 'value' component is in the bar returned in which case we could get it. If I (or somebody else ...) has time to test it ...

@eddelbuettel
Copy link
Member

@eddelbuettel eddelbuettel commented Nov 10, 2015

Ok, that was easy. When I first wrote getBars() I followed an existing example which did not have a value column. As you point out, it is there and now we return it:

R> getBars("ES1 Index")
                       open    high     low   close numEvents volume       value
2015-11-09 14:58:00 2073.75 2075.00 2071.50 2072.00      7828 131827 273358112.0
2015-11-09 15:58:00 2072.00 2072.50 2071.75 2072.25        82    218    451734.5
2015-11-09 17:00:00 2072.25 2073.25 2069.75 2072.75      1159   4878  10104549.0
2015-11-09 18:00:00 2072.75 2075.00 2072.25 2073.25      1888   5910  12257721.0
2015-11-09 19:00:00 2073.25 2075.75 2071.00 2074.75      2008   7829  16231860.0
2015-11-09 20:00:00 2074.50 2075.75 2073.50 2075.50      1154   3834   7954627.0
R> 

I'll update the manual page and will then commit this.

Thanks for the suggestion, and overall rather focused pointer to documentation -- appreciate it.

@joel23888
Copy link
Contributor Author

@joel23888 joel23888 commented Nov 10, 2015

Thank you, yes I also saw that misleading example somewhere.

@eddelbuettel
Copy link
Member

@eddelbuettel eddelbuettel commented Nov 10, 2015

It is not misleading as simply incomplete / behind the full set of features are you discovered by reading the documentation. Yet these examples were highly valuable to get going.

johnlaing added a commit that referenced this issue Nov 10, 2015
return value traded in getBars (closes #89)
@joel23888
Copy link
Contributor Author

@joel23888 joel23888 commented Nov 10, 2015

@eddelbuettel I tried to install_github from the feature/bars-return-value branch and also master but received an error. Seems like the install script cannot find ../win/i386/blpHeaders.tar.gz. install_github is working for me for other repositories, so can I show you the error I am receiving? If so, let me know where to post this.

@eddelbuettel
Copy link
Member

@eddelbuettel eddelbuettel commented Nov 10, 2015

Do you have a git client? If you, just git pull and create a tarball via R CMD build.

I rebuilt from the repo multiple times on multiple machines in the last few days... If that does not work for you I could push a tarball into one of the drat repos.

@joel23888
Copy link
Contributor Author

@joel23888 joel23888 commented Nov 13, 2015

Thanks for the quick enhancement @eddelbuettel. Seems I just needed to have curl installed and now it works as expected from install_github. Last time I installed from github was before it needed to grab the files from Rblp/blp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.