bpsmith / tia

Toolkit for integration and analysis
BSD 3-Clause "New" or "Revised" License
404 stars 165 forks source link

Python 3 #11

Open fsuarezb opened 7 years ago

fsuarezb commented 7 years ago

Hey I am a big fan of this library, does someone know if there is going to be a release for python 3 at some point?

shivaramkrs commented 7 years ago

You can use it with Python 3, you have to make few modifications to few files. I am looking at only BBG data download and for that you need to put braces around print statements in v3api.py. Also change "basestring" to "str".

toasteez commented 7 years ago

I am also interested in this working for Python 3.x can we make a plan going forwards to get this working?

For Python 3.5 you also need to change iteritems to items.

fsuarezb commented 7 years ago

I adapted the code to python 3.4 an works pretty well for Historical data.

dpsugasa commented 7 years ago

how were you able to get BLPAPI to work with Python 3.5?

****scratch that, i got it to work using 3.6

zglin commented 7 years ago

@dpsugasa Is the code on your GH working for 3.6? did you issue a PR?

dpsugasa commented 7 years ago

No the code on my GH is the same as the original. I modified the files on my PC only. I only use the library for BBG access and those files are easy to change; just follow the recommendations in the "issues". From memory you only need to update the files in the bbg folder. Most of the changes are just adding parentheses to print function. One or two items/iteritems changes also.

Let me know if I can help any further.

On Fri, May 19, 2017 at 12:10 AM zglin notifications@github.com wrote:

@dpsugasa https://github.com/dpsugasa Is the code on your GH working for 3.6? did you issue a PR?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bpsmith/tia/issues/11#issuecomment-302565744, or mute the thread https://github.com/notifications/unsubscribe-auth/AZekSOLIJogy8l0JaU0ai8LMBpMXzZYmks5r7M_dgaJpZM4JjFzb .

STguerin commented 7 years ago

@dpsugasa how did you install the blpapi on python 3.6? I spoke with the help desk and they only have a experimental release for 3.5, nothing yet for 3.6. Any help would be appreciated

dpsugasa commented 7 years ago

the blpapi works on 3.6. If the bloomberg installer won't let you install because you have 3.6, I would downgrade to 3.5, install the api, and then re-upgrade to 3.6. bloomberg isn't particularly helpful with their api in my opinion.

On Mon, May 29, 2017 at 3:11 PM STguerin notifications@github.com wrote:

@dpsugasa https://github.com/dpsugasa how did you install the blpapi on python 3.6? I spoke with the help desk and they only have a experimental release for 3.5, nothing yet for 3.6. Any help would be appreciated

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bpsmith/tia/issues/11#issuecomment-304670129, or mute the thread https://github.com/notifications/unsubscribe-auth/AZekSDFTGVpMrdI1qcxP0KMP3l1qw4xwks5r-tIHgaJpZM4JjFzb .

wangjuestam commented 6 years ago

I am working with Python 3.6. After modifications as "put braces around print statements", "basestring" to "str" and " iteritems to items", I still get this error "'dict' object has no attribute 'iteritems'". It shows error in this line "433 overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.items()]))". Any idea?

dpsugasa commented 6 years ago

Make sure you have changed all the files in the BBG portion of the module; there are 3 or 4 files if my memory serves correctly. My repo has all the changes if you need to compare.

On Mon, Jul 24, 2017 at 8:13 PM, wangjuestam notifications@github.com wrote:

I am working with Python 3.6. After modifications as "put braces around print statements", "basestring" to "str" and " iteritems to items", I still get this error "'dict' object has no attribute 'iteritems'". It shows error in this line "433 overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.items()]))". Any idea?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bpsmith/tia/issues/11#issuecomment-317525561, or mute the thread https://github.com/notifications/unsubscribe-auth/AZekSGzBIBDUrryZlYbWKim3-OO4Sm_rks5sROzvgaJpZM4JjFzb .

wangjuestam commented 6 years ago

Thanks! I am able to run tia on python version 3 now.

dpsugasa commented 6 years ago

excellent!

On Tue, Jul 25, 2017 at 3:29 PM wangjuestam notifications@github.com wrote:

Thanks! I am able to run tia on python version 3 now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bpsmith/tia/issues/11#issuecomment-317755824, or mute the thread https://github.com/notifications/unsubscribe-auth/AZekSIcbZPJYHvFRp0lx_qYdS2z_pH-_ks5sRfvWgaJpZM4JjFzb .

citynorman commented 6 years ago

This does the trick nicely

  1. Go to the package directory (/c/Anaconda3/Lib/site-packages/tia/bbg)
  2. Run 2to3 v3api.py -w and 2to3 datamgr.py -w

But one of us nice people should fork and make an update...

PaulMest commented 6 years ago

I've updated the whole project with 2to3 to be Python 3 compliant. It is NOT Python 2 compliant, however.

Python 3 compatible repo:

https://github.com/PaulMest/tia/

Install with

$ pip install git+git://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

or

$ pip install git+https://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

or put one of these into your requirements.txt file

# Using git/SSH
git+git://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia

# Using https
git+https://github.com/PaulMest/tia.git@066549f834791b024c1d8eb595e0d18fa1e3c1c5#egg=tia
pksw2016 commented 4 years ago

hi I am still struggling with tia installation. running on python 3.6.10 I fixed all the print and basestring issues but get this error - any idea whats going on? is it to do with the 3.6.10 version?

Traceback (most recent call last): File "", line 58, in File "", line 48, in BDP File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 94, in getitem return self.get_attributes(flds, self.overrides) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 90, in get_attributes frame = self.mgr.get_attributes(self.sids, flds, overrides) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 148, in get_attributes return self.terminal.get_reference_data(sids, flds, **overrides).as_frame() File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 745, in get_reference_data return self.execute(req) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 711, in execute self.logger.info('executing request: %s' % repr(request)) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 433, in repr overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.iteritems()])) AttributeError: 'dict' object has no attribute 'iteritems'

PaulMest commented 1 year ago

hi I am still struggling with tia installation. running on python 3.6.10 I fixed all the print and basestring issues but get this error - any idea whats going on? is it to do with the 3.6.10 version?

Traceback (most recent call last): File "", line 58, in File "", line 48, in BDP File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 94, in getitem return self.get_attributes(flds, self.overrides) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 90, in get_attributes frame = self.mgr.get_attributes(self.sids, flds, overrides) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\datamgr.py", line 148, in get_attributes return self.terminal.get_reference_data(sids, flds, overrides).as_frame() File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 745, in get_reference_data return self.execute(req) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 711, in execute self.logger.info('executing request: %s' % repr(request)) File "C:\Users\kamathp\Anaconda3\envs\PA36\lib\site-packages\tia\bbg\v3api.py", line 433, in repr** overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.iteritems()])) AttributeError: 'dict' object has no attribute 'iteritems'

@pksw2016 not sure if this is still relevant to you, but .iteritems() was replaced with .items() so you can just write:

overrides=','.join(['%s=%s' % (k, v) for k, v in self.overrides.items()]))