Giter Club home page Giter Club logo

blpdata.jl's Introduction

BLPData.jl

License appveyor travis dev stable

Provides a wrapper for BLPAPI Library to the Julia language.

The BLPAPI is the API Library provided by Bloomberg L.P. to connect to Bloomberg Professional Services.

This package aims to wrap each BLPAPI "Class" into an equivalent Julia type. Using this approach, the user can implement any query that BLPAPI provides and also inspect message schemas to discover what requests and responses are available from the API, without having to use the C API directly.

Requirements

  • Julia v1.4 or newer.

  • Windows, Linux, or macOS.

Installation

From a Julia session, run:

julia> using Pkg

julia> Pkg.add("BLPData")

Documentation

Package documentation is hosted at https://felipenoris.github.io/BLPData.jl/stable.

License

The source code for the package BLPData.jl is licensed under the MIT License.

The BLPData.jl package uses and distributes binary files released by Bloomberg Finance L.P. under the licensing terms included in the file LICENSE.blpapi.

BLOOMBERG, BLOOMBERG PROFESSIONAL and BLOOMBERG TERMINAL are trademarks and service marks of Bloomberg Finance L.P., a Delaware limited partnership, or its subsidiaries. All rights reserved.

blpdata.jl's People

Contributors

felipenoris avatar gyansinha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

blpdata.jl's Issues

WSL2 linux

Will this work in WSL2 and listen on a port exposed on the windows side?

Subscriptions lead to BAD_TOPIC error

When running the subscription example

topic = "//blp/mktdata/ticker/PETR4 BS Equity?fields=BID,ASK"
subscription_list = BLPData.subscribe(session, topic)

I get the following warning

22AUG2024_15:22:12.749 17900:33112 WARN blpapi_subscriptionmanager.cpp:7476 blpapi.session.{1}.clusterservicehandler.subscriptionmanager SubscriptionLost for unknown data set with stream id 1 { ConnectionContext=[0/1] }
1

continuing with the provided example

i = 1 # event counter
evn = BLPData.try_next_event(session)
while evn != nothing
    println("event \$i")
    println(evn)
    i += 1
    sleep(2) # let's wait for events
    evn = BLPData.try_next_event(session)
end

I get the following error

Event BLPAPI_EVENTTYPE_SUBSCRIPTION_STATUS
Message 1
BLPData.CorrelationId[CorrelationId(5)]
    BLPName("SubscriptionStarted") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("exceptions") <: Element{true, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("streamIds") <: Element{true, BLPAPI_DATATYPE_STRING} = Any["1"]
        BLPName("receivedFrom") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
            BLPName("address") <: Element{false, BLPAPI_DATATYPE_STRING} = 127.0.0.1:8194
        BLPName("reason") <: Element{false, BLPAPI_DATATYPE_STRING} = Subscriber made a subscription
Message 2
BLPData.CorrelationId[CorrelationId(5)]
    BLPName("SubscriptionStreamsActivated") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("streams") <: Element{true, BLPAPI_DATATYPE_SEQUENCE}
            BLPName("streams") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
                BLPName("id") <: Element{false, BLPAPI_DATATYPE_STRING} = 1
                BLPName("endpoint") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
                    BLPName("address") <: Element{false, BLPAPI_DATATYPE_STRING} = 127.0.0.1:8194
        BLPName("reason") <: Element{false, BLPAPI_DATATYPE_STRING} = Subscriber made a subscription


event $i
Event BLPAPI_EVENTTYPE_SUBSCRIPTION_STATUS
Message 1
BLPData.CorrelationId[CorrelationId(5)]
    BLPName("SubscriptionStarted") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("exceptions") <: Element{true, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("streamIds") <: Element{true, BLPAPI_DATATYPE_STRING} = Any["1"]
        BLPName("receivedFrom") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
            BLPName("address") <: Element{false, BLPAPI_DATATYPE_STRING} = 127.0.0.1:8194
        BLPName("reason") <: Element{false, BLPAPI_DATATYPE_STRING} = Subscriber made a subscription
Message 2
BLPData.CorrelationId[CorrelationId(5)]
    BLPName("SubscriptionStreamsActivated") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("streams") <: Element{true, BLPAPI_DATATYPE_SEQUENCE}
            BLPName("streams") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
                BLPName("id") <: Element{false, BLPAPI_DATATYPE_STRING} = 1
                BLPName("endpoint") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
                    BLPName("address") <: Element{false, BLPAPI_DATATYPE_STRING} = 127.0.0.1:8194
        BLPName("reason") <: Element{false, BLPAPI_DATATYPE_STRING} = Subscriber made a subscription

event $i
Event BLPAPI_EVENTTYPE_SUBSCRIPTION_STATUS
Message 1
BLPData.CorrelationId[CorrelationId(5)]
    BLPName("SubscriptionTerminated") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
        BLPName("reason") <: Element{false, BLPAPI_DATATYPE_SEQUENCE}
            BLPName("errorCode") <: Element{false, BLPAPI_DATATYPE_INT32} = 5
            BLPName("description") <: Element{false, BLPAPI_DATATYPE_STRING} = Invalid UTS
            BLPName("category") <: Element{false, BLPAPI_DATATYPE_STRING} = BAD_TOPIC
            BLPName("source") <: Element{false, BLPAPI_DATATYPE_STRING} = apipubx0@md1p-rr-270

Any ideas on what might be causing the problem?

This issue is also reported on stackoverflow by somebody else here

UndefVarError: P not defined

Hi, thanks for this software.

I am getting this error when trying the example of call to BLPData.bdh:

DataFrame( BLPData.bdh(session, "PETR4 BS Equity", ["PX_LAST", "VOLUME"], Date(2020, 1, 2), Date(2020, 1, 10) ))

UndefVarError: P not defined

Stacktrace:
[1] Date(blp_datetime::BLPData.BLPDateTime)
@ BLPData ~/.julia/packages/BLPData/pXEwo/src/datetime.jl:25
...

I could circumvent it by commenting out the line 25, so it avoids that check. But I am sure there could be a better way of fixing that.

Thank you very much.

Bloomberg Anywhere

Hi,

Currently, I have to use Bloomberg anywhere since I am working remotely. Do you know if it is possible to use this package with Bloomberg Anywhere?
I tried, but it is not straightforward as the instructions for using it in a terminal.

BLPData for SVOL Equity has an issue

sDate = Date(2021,5,13)
eDate = Date(2024,4,30)
eDate = Dates.today() - Dates.Day(1)
ticker1 = ["SVOL US Equity"]
ticker2 = ["SVOL"]

raw_data = BLPData.bdh(session, ticker1, "PX_LAST", sDate, eDate, options = BBG_OPT(1))

Bloomberg NYSE holidays options #A

function BBG_OPT(input)
if input == 1
options = Dict(
"periodicityAdjustment" => "CALENDAR",
"periodicitySelection" => "DAILY",
"CDR" => "#A",
"pricingOption" => "PRICING_OPTION_PRICE",
"nonTradingDayFillOption" => "ACTIVE_DAYS_ONLY",
"nonTradingDayFillMethod" => "NIL_VALUE",
"adjustmentFollowDPDF" => false,
"adjustmentNormal" => true,
"adjustmentAbnormal" => true,
"adjustmentSplit" => true
)
else
options = Dict(
"periodicityAdjustment" => "CALENDAR",
"periodicitySelection" => "DAILY",
"CDR" => "5D",
"pricingOption" => "PRICING_OPTION_PRICE",
"nonTradingDayFillOption" => "ACTIVE_DAYS_ONLY",
"nonTradingDayFillMethod" => "NIL_VALUE",
"adjustmentFollowDPDF" => false,
"adjustmentNormal" => true,
"adjustmentAbnormal" => true,
"adjustmentSplit" => true
)
end
return options
end

This code generates wrong price for SVOL. Price was wrong for earlier periods of 2021 and 2022. I tested Python and Excel API, both are correct and only BLPData has wrong price was pulled.
Please help!!!

Retrieving data for multiple securities from Bloomberg

Hello,

I am rather new to Julia so please forgive me if this is asked before.

I used this in order to get a list of members of a specific stock index:

using BLPData, Dates, DataFrames
session=BLPData.Session()
xu030=DataFrame(BLPData.bds(session,"XU030 INDEX","INDX_MEMBERS")) .*" EQUITY"

and I can pull data for 2 stocks using

fields = "LAST_PRICE"; # Retrieve data for closing prices
fromdate = Date(2021, 8, 2); # Start of date range for historical data
todate = Date(2021, 8, 25); # End of date range for historical data

xu030Data=BLPData.bdh(session,["GARAN TI EQUITY","AKBNK TI EQUITY"],[fields], fromdate, todate )

How can I achieve this using xu030 as a multiple list of securities:

xu030Data=BLPData.bdh(session,[xu030],[fields], fromdate, todate )

its very easy ,in matlab:

[d,sec] = history(session,xu030,fields,fromdate,todate,period);

I also could not find an equivalent for this variable:

period = {'daily','non_trading_weekdays','previous_value'};

If there is a compatible way in your wrapper above formula will be like:

xu030Data=BLPData.bdh(session,[xu030],[fields], fromdate, todate ,period)

Thank you!

mac support issue

It was made clear that BLPData is for Bloomberg Professional user.
It also said it supports mac.
However, there is no native version of Bloomberg Professional.
I can see conflicts.

I can use Bloomberg Anywhere and BLPdata session not working.

Anyone has solution for this quandary?

Adding overrides

Adding overrides is possible in the R package Rblpapi. Will it be available soon in this Julia package?. Thank you

options not working for BLPData.bds

BLPData_issue.zip

Hi!

Thanks for a great package.
I got all sample examples to work immediately on my Windows with Bloomberg Terminal.

However, when I got a bit more elaborate and wanted to download constituents from an index for a historical date,
I ran into problems with BLPData.bds. Am I using the options incorrectly or is there a bug in the package?

LoadError: Cannot locate artifact 'blpapi'

Seems like an Apple silicon specific issue? On M1 Max Studio:

Precompiling project... ✗ BLPData 1 dependency successfully precompiled in 1 seconds. 289 already precompiled. 1 dependency errored. To see a full report either run import Pkg; Pkg.precompile()` or load the package

julia> using BLPData
[ Info: Precompiling BLPData [eb622722-88ce-45f2-a8b9-c2f73a5cb263]
ERROR: LoadError: Cannot locate artifact 'blpapi' for aarch64-apple-darwin-libgfortran5-cxx11-julia_version+1.8.2 in '/Users/xxxx/.julia/packages/BLPData/huief/Artifacts.toml'
`

Cannot install

Hi,

Firstly, thank you for creating this package.

Unfortunately, I'm having trouble installing it due to a SHA mismatch:

(@v1.10) pkg> add BLPData
   Resolving package versions...
  Downloaded artifact: blpapi
  Downloaded artifact: blpapi
ERROR: Unable to automatically download/install artifact 'blpapi' from sources listed in 'C:\Users\tseaward\.julia\packages\BLPData\huief\Artifacts.toml'.
Sources attempted:
- https://pkg.julialang.org/artifact/5c366268f16c55e522bad96ae446ba619b904c0c
    Error: RequestError: HTTP/1.1 404 Not Found while requesting https://pkg.julialang.org/artifact/5c366268f16c55e522bad96ae446ba619b904c0c
- https://github.com/felipenoris/BLPData.jl/releases/download/blpapi-3.12.3.1/blpapi_cpp_3.12.3.1-windows-x64.tar.gz
    Error: Tree Hash Mismatch!
  Expected git-tree-sha1:   5c366268f16c55e522bad96ae446ba619b904c0c
  Calculated git-tree-sha1: 57b7ceb6bdb7d7df12f208fbd71d5be13afa2f4e

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.