Skip to content

jsuarezb/bbgparser

Repository files navigation

bbgparser

bbgparser aims to parse the .bbg file that Bloomberg provides you as a response for their Data Requests and Historical Requests while using the Bloomberg's Hypermedia API (HAPI).

The content of this file looks something similar to this:

START-OF-FILE
# Required headers
HEADER_KEY_1=header_value_1
HEADER_KEY_2=header_value_2

START-OF-FIELDS
FIELD1
FIELD2
END-OF-FIELDS

TIMESTARTED=Mon Jan 01 00:00:00 GMT 2020
START-OF-DATA
ABC|10|1| | | | |
DEF|20|2| | | | |
END-OF-DATA
TIMEFINISHED=Mon Jan 01 00:00:00 GMT 2020
END-OF-FILE

Installation

pip install bbgparser

Getting started

from bbgparser.parser import parse

result = parse(content)

for k, v in results:
    print(k, v)

When parsing the example above, you'll get the following output:

headers {'HEADER_KEY_1': 'header_value_1', 'HEADER_KEY_2': 'header_value_2'}
fields ['FIELD1', 'FIELD2']
data [['ABC', '10', '1', ' ', ' ', ' ', ' ', ''], ['DEF', '20', '2', ' ', ' ', ' ', ' ', '']]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published