cuemacro / finmarketpy

Python library for backtesting trading strategies & analyzing financial markets (formerly pythalesians)
http://www.cuemacro.com
Apache License 2.0
3.41k stars 490 forks source link

error when calling LightTimeSeriesFactor with Bloomberg #5

Open toimfortes opened 8 years ago

toimfortes commented 8 years ago

df = ltsf.harvest_time_series(time_series_request) Traceback (most recent call last): File "", line 1, in File "C:\Anaconda2\lib\site-packages\pythalesians-0.1a0-py2.7.egg\pythalesians\market\loaders\lighttimeseriesfactory.py", line 126, in harvest_time_series loader = self.get_loader(time_series_request.data_source) File "C:\Anaconda2\lib\site-packages\pythalesians-0.1a0-py2.7.egg\pythalesians\market\loaders\lighttimeseriesfactory.py", line 93, in get_loader loader = LoaderBBGOpen() File "C:\Anaconda2\lib\site-packages\pythalesians-0.1a0-py2.7.egg\pythalesians\market\loaders\lowlevel\bbg\loaderbbgopen.py", line 41, in init super(LoaderBBGOpen, self).init() TypeError: must be type, not classobj

saeedamen commented 8 years ago

Hi @toimfortes, thanks for flagging this. First, I'd recommend downloading the newest dev version of PyThalesians from GitHub, as opposed to the last release (which is now quite old). Also, the library is built for Python 3, so it is unlikely to be compatible with Python 2 (I suspect this is the problem you are having looking at the code). Regards Saeed

Heavy-Sauria commented 8 years ago

Hi, I am getting the same error, therefore I switched to Python3 however the Bloomberg Python SDK is not compatible with Python3.

#!/usr/bin/env python

"""
setup.py file for Bloomberg Python SDK
"""

from distutils.core import setup, Extension
import os
import platform as plat
from sys import version
from sys import platform

if version < '2.6':
    raise Exception(
        "Python versions before 2.6 are not supported (current version is " +
    version + ")")
if version >= '3.0':
    raise Exception(
        "Python 3 is not supported (current version is " + version +
        ")")

Regards, Robert

saeedamen commented 8 years ago

Hi @csango - I think you have an old version of the Bloomberg Python API from the look of it. The newer versions are compatible with Python 3. You can download these from http://www.bloomberglabs.com/api/libraries/ - if you have Python 3.5, you'll need to compile it however (I've got a precompiled version though, if you have trouble :-). For all other Python versions, Bloomberg have provided easy to install binaries. Regards Saeed