blpapi

Crates.ioblpapi
lib.rsblpapi
version0.0.1
sourcesrc
created_at2019-11-07 06:54:48.409672
updated_at2019-11-07 06:54:48.409672
descriptionSafe wrapper to bloomberg blpapi library
homepage
repositoryhttps://github.com/tafia/blpapi-rs
max_upload_size
id178923
size55,522
Johann Tuffe (tafia)

documentation

https://docs.rs/blpapi

README

blpapi

A rust wrapper for Bloomberg blpapi.

This is a Work In Progress, I do not plan on getting to parity with the C++ API. On the other hand, I very welcome any contribution!

Tested on Windows only (DesktopApi). Compiles on Linux. Tested version: 3.12.3.1

Installation

  1. Install C/C++ BLPAPI. (Download and extract the file from https://www.bloomberg.com/professional/support/api-library/)
  2. Set BLPAPI_LIB environment variable a. On windows: \lib b. On linux: /Linux

Examples

# Cargo.toml
[dependencies]
blpapi = { version = "0.0.1", features = [ "derive", "dates" ] }

Reference data

use blpapi::{RefData, session::SessionSync};

// use the derive feature to automatically convert field names into bloomberg fields
#[derive(Default, RefData)]
struct EquityData {
    ticker: String,
    crncy: String,
    market_status: Option<String>,
}

let mut session = SessionSync::new().unwrap();
let securities: &[&str] = &[ /* list of security tickers */ ];

let maybe_equities = session.ref_data::<_, EquityData>(securities);

Historical data

use blpapi::{RefData, session::{SessionSync, HistOptions}};

// use the **derive** feature to automatically convert field names into bloomberg fields
#[derive(Default, RefData)]
struct Price {
    px_last: f64,
}

let mut session = SessionSync::new().unwrap();
let securities: &[&str] = &[ /* list of security tickers */ ];

let options = HistOptions::new("20190101", "20191231");
let prices = session.hist_data::<_, Price>(securities, options);
Commit count: 40

cargo fmt