matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
240 stars 69 forks source link

Timeout on #99

Open rjbr19 opened 2 years ago

rjbr19 commented 2 years ago

Hi Mathew , great library! I am trying to upgrade the version here and am getting the timeout message even if I increase to 500000. The code is: con = pdblp.BCon(timeout=500000,debug=True, port=8194) con.start() with pdblp.bopen(port=8194) as bb: for i in lspot:

    a='df'+ i
    if i.startswith('USDCOP'):
        a = bb.bdh(i, f1,Data1, Data2
            , elms=[('periodicityAdjustment','CALENDAR'),('periodicitySelection',P),('calendarCodeOverride','CO')])    
    else:
        a = bb.bdh(i, f1,Data1, Data2
            , elms=[('periodicityAdjustment','CALENDAR'),('periodicitySelection',P)])

    a.columns=['Open','High','Low','Close']

    b=[i[0:3]+'IR Curncy',i[3:6]+'IR Curncy']

    if i.startswith('USDCOP'):
        c=bb.bdh(b, f2,Data1, Data2, elms=[('periodicityAdjustment','CALENDAR'),('periodicitySelection',P)
                                           ,('calendarCodeOverride','CO')])    
    else:
        c=bb.bdh(b, f2,Data1, Data2, elms=[('periodicityAdjustment','CALENDAR'),('periodicitySelection',P)

I get the following message:

pdblp.pdblp:INFO:Event Type: 'SESSION_STATUS' pdblp.pdblp:INFO:Message Received: SessionConnectionUp = { server = "localhost:8194" encryptionStatus = "Clear" compressionStatus = "Uncompressed" }

pdblp.pdblp:INFO:Event Type: 'SESSION_STATUS' pdblp.pdblp:INFO:Message Received: SessionStarted = { initialEndpoints[] = { initialEndpoints = { address = "localhost:8194" } } }

pdblp.pdblp:INFO:Event Type: 'SERVICE_STATUS' pdblp.pdblp:INFO:Message Received: CID: {[ valueType=AUTOGEN classId=0 value=118 ]} RequestId: 9f5980da-f035-448e-9a09-55d1b065dbb0 ServiceOpened = { serviceName = "//blp/refdata" }

pdblp.pdblp:INFO:Event Type: 'SERVICE_STATUS' pdblp.pdblp:INFO:Message Received: CID: {[ valueType=AUTOGEN classId=0 value=120 ]} RequestId: 07c38e2c-0d38-4c2c-8bfc-f5d59e7db228 ServiceOpened = { serviceName = "//blp/exrsvc" }

pdblp.pdblp:WARNING:Unexpected Event Type: 'TIMEOUT'

RuntimeError Traceback (most recent call last) Input In [15], in <cell line: 30>() 33 a='df'+ i 34 if i.startswith('USDCOP'): ---> 35 a = bb.bdh(i, f1,Data1, Data2 36 , elms=[('periodicityAdjustment','CALENDAR'),('periodicitySelection',P),('calendarCodeOverride','CO')])
37 else: 38 a = bb.bdh(i, f1,Data1, Data2 39 , elms=[('periodicityAdjustment','CALENDAR'),('periodicitySelection',P)])

File ~\Anaconda3\envs\Vectorbt\lib\site-packages\pdblp\pdblp.py:274, in BCon.bdh(self, tickers, flds, start_date, end_date, elms, ovrds, longdata) 270 elms = [] if not elms else elms 272 elms = list(elms) --> 274 data = self._bdh_list(tickers, flds, start_date, end_date, 275 elms, ovrds) 277 df = pd.DataFrame(data, columns=['date', 'ticker', 'field', 'value']) 278 df.loc[:, 'date'] = pd.to_datetime(df.loc[:, 'date'])

File ~\Anaconda3\envs\Vectorbt\lib\site-packages\pdblp\pdblp.py:305, in BCon._bdh_list(self, tickers, flds, start_date, end_date, elms, ovrds) 303 data = [] 304 # Process received events --> 305 for msg in self._receive_events(): 306 d = msg['element']['HistoricalDataResponse'] 307 has_security_error = 'securityError' in d['securityData']

File ~\Anaconda3\envs\Vectorbt\lib\site-packages\pdblp\pdblp.py:234, in BCon._receive_events(self, sent_events, to_dict) 232 logger.warning('Message Received:\n{}'.format(msg)) 233 if ev.eventType() == blpapi.Event.TIMEOUT: --> 234 raise RuntimeError('Timeout, increase BCon.timeout ' 235 'attribute') 236 else: 237 raise RuntimeError('Unexpected Event Type: {!r}' 238 .format(ev_name))

RuntimeError: Timeout, increase BCon.timeout attribute