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

ENH: Fix formatting #29

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/blp/blp.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import datetime
import itertools
import json
import logging
import queue
import threading
from numbers import Number
from typing import Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Union
import json

import blpapi
import pandas
Expand Down Expand Up @@ -480,7 +480,6 @@ def dict_to_req(request: blpapi.Request, request_data: Dict) -> blpapi.Request:


class BlpQuery(BlpSession):

_SERVICES = {
"HistoricalDataRequest": "//blp/refdata",
"ReferenceDataRequest": "//blp/refdata",
Expand Down Expand Up @@ -569,7 +568,7 @@ def query(
request_data: Dict,
parse: Optional[Callable] = None,
collector: Optional[Callable] = None,
timeout: int = None,
timeout: Optional[int] = None,
):
"""Request and parse Bloomberg data.

Expand Down Expand Up @@ -854,15 +853,15 @@ def bql(
Returns: A pandas.DataFrame with columns ["security", "field", "secondary_name", "secondary_value", "value"]

Examples:
>>> bquery = blp.BlpQuery().start()
>>> bquery.bql(expression="get(px_last()) for(['AAPL US Equity', 'IBM US Equity'])")
>>> bquery = blp.BlpQuery().start() # doctest: +SKIP
>>> bquery.bql(expression="get(px_last()) for(['AAPL US Equity', 'IBM US Equity'])") # doctest: +SKIP

The resulting DataFrame will look like this:
security field secondary_name secondary_value value
0 AAPL US Equity px_last() CURRENCY USD 192.755005
1 IBM US Equity px_last() CURRENCY USD 139.289993
2 AAPL US Equity px_last() DATE 2023-07-24T00:00:00Z 192.755005
3 IBM US Equity px_last() DATE 2023-07-24T00:00:00Z 139.289993
security field secondary_name secondary_value value
0 AAPL US Equity px_last() CURRENCY USD 192.755005
1 IBM US Equity px_last() CURRENCY USD 139.289993
2 AAPL US Equity px_last() DATE 2023-07-24T00:00:00Z 192.755005
3 IBM US Equity px_last() DATE 2023-07-24T00:00:00Z 139.289993
"""
query = create_bql_query(expression, overrides, options)

Expand Down