Ejemplo n.º 1
0
    def __init__(self, multiprocessing_library=None):
        self._pool = None

        if multiprocessing_library is None:
            multiprocessing_library = DataConstants.multiprocessing_library

        self._multiprocessing_library = multiprocessing_library

        if multiprocessing_library == 'multiprocess':
            try:
                import multiprocess
                multiprocess.freeze_support()
            except:
                pass
        elif multiprocessing_library == 'multiprocessing_on_dill':
            try:
                import multiprocessing_on_dill
                multiprocessing_on_dill.freeze_support()
            except:
                pass
        elif multiprocessing_library == 'multiprocessing':
            try:
                import multiprocessing
                multiprocessing.freeze_support()
            except:
                pass
Ejemplo n.º 2
0
    def __init__(self, multiprocessing_library = None):
        self._pool = None

        if multiprocessing_library is None:
            multiprocessing_library = DataConstants().multiprocessing_library

        self._multiprocessing_library = multiprocessing_library
        self._thread_technique = 'na'

        if multiprocessing_library == 'multiprocess':
            try:
                import multiprocess;
                multiprocess.freeze_support()
            except:
                pass
        elif multiprocessing_library == 'multiprocessing_on_dill':
            try:
                import multiprocessing_on_dill;
                multiprocessing_on_dill.freeze_support()
            except:
                pass
        elif multiprocessing_library == 'multiprocessing':
            try:
                import multiprocessing;
                multiprocessing.freeze_support()
            except:
                pass
Ejemplo n.º 3
0
# for logging
from pythalesians.util.loggermanager import LoggerManager

# to download market data
from pythalesians.market.requests.timeseriesrequest import TimeSeriesRequest
from pythalesians.market.loaders.lighttimeseriesfactory import LightTimeSeriesFactory

if __name__ == '__main__':
    # On Windows calling this function is necessary (to prevent repeated respawning of multiprocess functions)
    # On Linux/OSX it does nothing

    # only necessary if you use multiprocessing_on_dill code
    try:
        # the standard multiprocessing library fails in pickling the market data classes
        import multiprocessing_on_dill as multiprocessing
        multiprocessing.freeze_support()
    except:
        pass

    if True:
        logger = LoggerManager().getLogger(__name__)

        import datetime

        # just change "False" to "True" to run any of the below examples

        ###### download daily data from Bloomberg for FX, with different threading techniques
        if False:

            time_series_request = TimeSeriesRequest(
                start_date="01 Jan 1999",  # start date
# for logging
from pythalesians.util.loggermanager import LoggerManager

# to download market data
from pythalesians.market.requests.timeseriesrequest import TimeSeriesRequest
from pythalesians.market.loaders.lighttimeseriesfactory import LightTimeSeriesFactory

if __name__ == '__main__':
    # On Windows calling this function is necessary (to prevent repeated respawning of multiprocess functions)
    # On Linux/OSX it does nothing

    # only necessary if you use multiprocessing_on_dill code
    try:
        # the standard multiprocessing library fails in pickling the market data classes
        import multiprocessing_on_dill as multiprocessing
        multiprocessing.freeze_support()
    except: pass

    if True:
        logger = LoggerManager().getLogger(__name__)

        import datetime

        # just change "False" to "True" to run any of the below examples

        ###### download daily data from Bloomberg for FX, with different threading techniques
        if False:

            time_series_request = TimeSeriesRequest(
                    start_date = "01 Jan 1999",                     # start date
                    finish_date = datetime.date.today(),            # finish date