Giter VIP home page Giter VIP logo

Comments (7)

eddelbuettel avatar eddelbuettel commented on August 30, 2024

In other words, is the format (seen from running print() on the returned message) assumed to be fixed:

$ r -lRblpapi -e'print(head(beqs("Global Oil Companies YTD Return","GLOBAL","ENGLISH","GENERAL","20150930",verbose=TRUE)))'
Sending Request: BeqsRequest = { screenName = "Global Oil Companies YTD Return" screenType = GLOBAL Group = "GENERAL" languageId = ENGLISH overrides[] = { overrides = { fieldId = "PiTDate" value = "20150930" } } \
}
Processing Response
BeqsResponse = {
    data = {
        fieldDisplayUnits = {
            Ticker = ""
            Short Name = ""
            Total Return YTD = ""
            Market Cap = ""
            Price:D-1 = ""
            P/E = ""
            Revenue T12M = ""
            EPS T12M = ""
        }
        securityData[] = {
            securityData = {
                security = "002506 CH"
                fieldExceptions[] = {
                }
                fieldData = {
                    Ticker = "002506 CH"
                    Short Name = "GCL SYSTEM INT-A"
                    Total Return YTD = 1078.202501
                    Market Cap = 2527281408.000000
                    Price:D-1 = 1.001491
                    P/E = 2.211897
                    Revenue T12M = 833422051.073852
                    EPS T12M = 0.408008
                }
            }
            [.... many more deleted ...]

from rblpapi.

csrvermaak avatar csrvermaak commented on August 30, 2024

Agreed, not ideal. The result will always be a mixture of strings and numbers, thus the only usable object in Rcpp (besides building the DF in C++) is the CharacterMatrix. We can convert to DF either in the C++, or in the R wrapper around beqs_impl, and then convert on a per column basis to numberic if possible. Thoughts?

from rblpapi.

csrvermaak avatar csrvermaak commented on August 30, 2024

The order of the columns is not fixed, unfortunately, and the string columns can pop up anywhere in the matrix. The order of the result is determined in EQS (and even then, it is sometimes returned with a different ordering) - thus we cannot make any assumptions about the column type beforehand.

from rblpapi.

eddelbuettel avatar eddelbuettel commented on August 30, 2024

It can be done. In another project I stored it in something like or Boost Any (or maybe
Boost Variant, its been awhile and I do not have that code anymore) and converted each column based on type when constructing the data frame before return.

And of course here @armstrtw also fixed that issue here for bds():

R> res <- bds("GOOG US Equity", "TOP_20_HOLDERS_PUBLIC_FILINGS")
R> head(res, 3)
  Amount Held       Country Filing Date     Holder Name   Institution Type
1    21733002           n/a  2015-09-25 PAGE LAWRENCE E                n/a
2    21202715           n/a  2015-09-30     BRIN SERGEY                n/a
3    16646344 UNITED STATES  2015-06-30       BLACKROCK Investment Advisor
  Latest Change                            Metro Area Percent Outstanding
1        -16670                                   n/a                6.32
2        -16666                                   n/a                6.16
3        155303 New York City/Southern CT/Northern NJ                4.84
  Portfolio Name  Source
1            n/a  Form 4
2            n/a  Form 4
3            n/a ULT-AGG
R> sapply(res, class)
        Amount Held             Country         Filing Date         Holder Name 
          "numeric"         "character"              "Date"         "character" 
   Institution Type       Latest Change          Metro Area Percent Outstanding 
        "character"           "numeric"         "character"           "numeric" 
     Portfolio Name              Source 
        "character"         "character" 
R> 

We wanted to revisit this issue amd code anyway as there may now be better data frame proxies out there. Or maybe not.. In any event, we have not gotten to it yet.

from rblpapi.

eddelbuettel avatar eddelbuettel commented on August 30, 2024

I have something very crude in a branch. Currently covers only character and double:

~/git/rblpapi$ r -lRblpapi -e'print(head(beqs("Global Oil Companies YTD Return")))'
            Ticker       Short.Name Total.Return.YTD Market.Cap  Price.D.1
1 002506 CH Equity GCL SYSTEM INT-A       1078.20250 2520166912  1.0014905
2    S92 GR Equity SMA SOLAR TECHNO        152.22221 1339073024 38.5900002
3    PTG TB Equity   PTG ENERGY PCL        143.23562  591326208  0.3535846
4   ALDW US Equity ALON USA PARTNER        131.71331 1379535744 22.0690269
5    SRS IM Equity        SARAS SPA        127.33814 1803096064  1.8960000
6     ES FP Equity      ESSO S.A.F.         99.59298  819479360 63.7500000
        P.E Revenue.T12M     EPS.T12M
1  2.211897    833422051   0.40800850
2  0.000000    893484992  -4.48400007
3 48.333332   1279731045   0.00696470
4  7.233236   2321284054   2.83934554
5 34.100716   9271717120   0.05560001
6  0.000000  14152000000 -13.02999878
~/git/rblpapi$

from rblpapi.

eddelbuettel avatar eddelbuettel commented on August 30, 2024

I did some more cleanup and now committed the branch.

@csrvermaak That is a good test for your emerging git skills. Do a checkout and then see if you can build in the branch :)

from rblpapi.

csrvermaak avatar csrvermaak commented on August 30, 2024

I'm all over it like a rash :)

from rblpapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.