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

bdp function returns error for BID_YIELD #148

Closed
hakki13 opened this issue Mar 17, 2016 · 19 comments
Closed

bdp function returns error for BID_YIELD #148

hakki13 opened this issue Mar 17, 2016 · 19 comments

Comments

@hakki13
Copy link

hakki13 commented Mar 17, 2016

bdp("EJ421905 Corp", "BID_YIELD")
Error: Attempt to access value of element 'BID_YIELD'(type: 'Float64') as 'bool' type

trying to understand that error, could someone give insights?

Both of these fields work:
"MTY_YEARS_TDY"
"ASSET_SWAP_SPD_MID"

RQ057 BID_YIELD Bid Yield
is found with fieldSearch(), is it maybe that field is real-time?

maybe correction would be to add additional fields to package, which are not real-time fields:
YLD_YTM_BID
YLD_YTM_MID
YLD_YTM_ASK

-Markku

@eddelbuettel
Copy link
Member

This may just be a vanilla error on the Bloomberg side in that is 'lies' to us about the field type.

Or ... it may just be you being behind the most recent version 0.3.3. The current version works for me:

R> bdp("EJ421905 Corp", "BID_YIELD")
              BID_YIELD
EJ421905 Corp -0.021369
R> 

So I guess we can close this.

@hakki13
Copy link
Author

hakki13 commented Mar 17, 2016

sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Finnish_Finland.1252 LC_CTYPE=Finnish_Finland.1252 LC_MONETARY=Finnish_Finland.1252
[4] LC_NUMERIC=C LC_TIME=Finnish_Finland.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] Rblpapi_0.3.3

loaded via a namespace (and not attached):
[1] tools_3.2.4 Rcpp_0.12.3

I should be running all the latest versions, have to try something different. Could it have something to do that I have finnish settings? or can you post sessioninfo() so I could think some way to modify my session? Sorry if I don't understand what is Vanilla error from bloomberg side, but how could I fix that?

If not I will close this one, as it seems to work for you.

@eddelbuettel
Copy link
Member

That is strange. I actually added a 'verbose' option. I'll send your updated source to win-builder and post the link here once it has built. You can then try bdp("EJ421905 Corp", "BID_YIELD", verbose=TRUE) and we will more closely what we get.

@hakki13
Copy link
Author

hakki13 commented Mar 17, 2016

ok, thanks. Will wait for the link and see what we get then.

@eddelbuettel
Copy link
Member

Here it is:

Dear package maintainer,

this notification has been generated automatically.
Your package Rblpapi_0.3.3.1.tar.gz has been built (if working) and checked for Windows.
Please check the log files and (if working) the binary package at:
http://win-builder.r-project.org/b0s5a14lKEB4
The files will be removed after roughly 72 hours.
Installation time in seconds: 137
Check time in seconds: 154
Status: 2 NOTEs
R version 3.2.4 (2016-03-10)

All the best,
Uwe Ligges
(CRAN maintainer of binary packages for Windows)

This may have something to do with the underlying version / release of the Bloomberg object code. Here is what I get now:

R> bdp("EJ421905 Corp", "BID_YIELD", verbose=TRUE)
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "EJ421905 Corp"
            eidData[] = {
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
                BID_YIELD = -0.015399
            }
        }
    }
}
              BID_YIELD
EJ421905 Corp -0.015399
R> 

@johnlaing
Copy link
Contributor

Weird. Same message, different behavior. On Windows:

> bdp("EJ421905 Corp", "BID_YIELD", verbose=TRUE)
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "EJ421905 Corp"
            eidData[] = {
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
                BID_YIELD = -0.015399
            }
        }
    }
}
Error: Attempt to access value of element 'BID_YIELD'(type: 'Float64') as 'bool' type.

Checking why this is happening:

> fieldInfo("BID_YIELD")
             id  mnemonic datatype ftype
BID_YIELD RQ057 BID_YIELD    Float  Real

but that's the same as we see on LInux

@hakki13
Copy link
Author

hakki13 commented Mar 17, 2016

bdp("EJ421905 Corp", "BID_YIELD", verbose=TRUE)
ReferenceDataResponse = {
securityData[] = {
securityData = {
security = "EJ421905 Corp"
eidData[] = {
}
fieldExceptions[] = {
}
sequenceNumber = 0
fieldData = {
BID_YIELD = -0.015399
}
}
}
}
Error: Attempt to access value of element 'BID_YIELD'(type: 'Float64') as 'bool' type.

Here is what I got. Not sure if I'm doing everything correctly, but installed 0.3.3.1 from the link and then run the code. (First time ever handeling something like this). So seems it is giving similar response, but just don't go all the way (my two cents). just saw answer above, I'm fairly new to R but at least I'm not totally crazy.

@eddelbuettel
Copy link
Member

That makes it a valid bug report. Let us mull this over.

@hakki13
Copy link
Author

hakki13 commented Mar 17, 2016

Thank you and really enjoy the package, so thanks for doing stuff for us.

@eddelbuettel
Copy link
Member

I think we have 3.8.8.1 everywhere. I'll try adding a function which emits the API version -- that is usually available in a header somewhere.

@johnlaing
Copy link
Contributor

OK, here we are. So, this seems like it's working on Linux:

> (x <- bdp("EJ421905 Corp", "BID_YIELD"))
              BID_YIELD
EJ421905 Corp -0.015399

Looks good. But is it?

> x$BID_YIELD
[1] "-0.015399"

Wait! That's a string. Hmmmm. Bloomberg tells us this is a Float, but we actually don't handle Float! From Rblpapi_types.h we have:

const std::map<std::string, DatatypeT> stringToDatatypeT {
  {"Bool",DatatypeT::Bool},{"Datetime",DatatypeT::Datetime},{"Double",DatatypeT::Double},{"Int32",DatatypeT::Int32},{"Int64",DatatypeT::Int64},{"String",DatatypeT::String}
};

We do a find into this map. I would expect to get a pointer to end() which we check for. Unclear why this isn't working.

johnlaing added a commit that referenced this issue Mar 18, 2016
@hakki13
Copy link
Author

hakki13 commented Mar 18, 2016

Same thing could be happening with COUPON_RT.

bdp("EJ421905 Corp", "COUPON_RT")
Error: Attempt to access value of element 'COUPON_RT'(type: 'Float64') as 'bool' type.

@hakki13
Copy link
Author

hakki13 commented Mar 18, 2016

Thank You. Now maybe a stupid question but this correction will be available in next package update? or how does it work? Maybe I learn something of package development at the same time.

@eddelbuettel
Copy link
Member

I already submitted a new build request to win-builder to have a Windows binary -- with the new code -- produced you can test.

And yes, this will be in 0.3.4 (or whatever number the next release gets) but we don't yet know when we will release that.

@eddelbuettel
Copy link
Member

Please try this link for a windows build off the current (and hopefully fixed) sources.

@hakki13
Copy link
Author

hakki13 commented Mar 18, 2016

Yeah, works with package from that Link, and thanks for info.

@hakki13
Copy link
Author

hakki13 commented Mar 18, 2016

Is there possibility to contribute/help constructing this package? I'm fairly new to R but maybe I could learn some simple task? For example, I feel like there is some fields missing that I use in Fixed Income. I could try to help, if adding fields is easy?

@eddelbuettel
Copy link
Member

Yes it is!

This thread is in a so-called 'issue' ticket. You can browse existing ones, both open (which includes some that need work) and closed (both work that has been done as well as things that were discussed but rejected). Generally you would make a copy of the project ("fork it"), work out your changes and then submit a pull request. We generally prefer an issue ticket discussion prior to an unsolicited pull request.

And documentation, tests, .... are welcome too. Maybe start by locally rebuilding the package.

@hakki13
Copy link
Author

hakki13 commented Mar 18, 2016

Ok, will try to expand my knowledge. Thanks.

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

No branches or pull requests

3 participants