Open creyl opened 7 years ago
Thanks for the thoughtful feedback. I am sidetracked at the moment, but should eventually get to it. Best, C
On Fri, May 12, 2017 at 11:36 AM, Matthew Gilbert notifications@github.com wrote:
@matthewgilbert commented on this pull request.
Great, this looks like useful functionality, thanks Charles. Just a couple of quick comments. Could you run flake8 on your branch to check PEP8 compatibility, e.g. flake8 ./pdblp
In addition, I don't know if the date column makes sense in the context of beqs()? If I run
df = con.beqs('Insider Buyers', 'GLOBAL', 'Popular')
df.head()
ticker field value date 0 JPM US Ticker JPM US 4 1 JPM US Short Name JPMORGAN CHASE 4 2 JPM US Market Cap 3.09662e+11 4 3 JPM US GICS Sector Financials 4 4 JPM US Cntry United States 4
the date columns is just a randomly generated CorrelationID. I understand the use in the context of beqs_hist() but maybe it should be removed from beqs(), thoughts?
In pdblp/tests/test_pdblp.py https://github.com/matthewgilbert/pdblp/pull/9#discussion_r116252959:
@@ -164,3 +164,19 @@ def test_hist_ref_one_ticker_one_field_pivoted_non_numeric(self): ) df_expect.index.names = ["date"] assert_frame_equal(df, df_expect) +
- def test_beqs_current(self):
- df = self.con.beqs('Insider Buyers', 'GLOBAL', 'Popular')
- assert len(df) > 0
- def test_beqs_asof(self):
- asof_date = datetime.datetime(2016, 5, 4)
- df = self.con.beqs('Insider Buyers', 'GLOBAL', 'Popular', asof_date=asof_date)
- assert len(df) == 1145
- def test_beqs_hist(self):
Test is failing for me since I am getting a DataFrame of length 488. Bloombergs exact data returned is not always reliable, a test which just checks the known properties of the returned DataFrame would be better (e.g. a DataFrame with specific columns)
In pdblp/pdblp.py https://github.com/matthewgilbert/pdblp/pull/9#discussion_r116253469:
- for elm in elms:
- data.append([ticker, fld, elm.getValue(), corrID])
- else:
- val = reqFldsData.getElement(fld).getValue()
- data.append([ticker, fld, val, corrID])
- return data
- def _beqs_create_req(self, screen_name, screen_type, group, language_id):
- request = self.refDataService.createRequest('BeqsRequest')
- request.set('screenName', screen_name)
- request.set('screenType', screen_type)
- request.set('Group', group)
- request.set('languageId', language_id)
- return request
- def beqs_hist(self, screen_name, screen_type='PRIVATE', group='General', language_id='ENGLISH',
freq parameter here is unused and should be removed. longdata parameter should be documented.
In pdblp/pdblp.py https://github.com/matthewgilbert/pdblp/pull/9#discussion_r116253726:
- ovrd.setElement("value", dt.strftime('%Y%m%d'))
CorrelationID used to keep track of which response coincides with which request
- cid = blpapi.CorrelationId(dt)
- logging.debug("Sending Request:\n %s" % request)
- self.session.sendRequest(request, correlationId=cid)
- data = []
Process received events
- ev_counter = 0
- while (True):
- ev = self.session.nextEvent(timeout)
- data = self._beqs_parse_event(data, ev)
- if ev.eventType() == blpapi.Event.RESPONSE:
- ev_counter += 1
- if ev_counter == len(asof_dates):
- break
if ev.eventType() == blpapi.Event.TIMEOUT:
This commented out section should be removed
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/matthewgilbert/pdblp/pull/9#pullrequestreview-37864562, or mute the thread https://github.com/notifications/unsubscribe-auth/AHlEN6qkvflefSh3YgcV6ggOk7BnByDdks5r5Hx7gaJpZM4NYptq .
…h the ability to request a screen as of today, as of a date in the past and for an arbitrary set of dates. See section 15.7 of https://data.bloomberglp.com/professional/sites/4/BLPAPI-Core-Developer-Guide.pdf.
Tried to follow your style as closely as possible.
Let me know! Charles