Beispiel #1
0
    def __init__(self, address, port, autoStop=True):
        SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(
            self, (address, port),
            requestHandler=RequestHandler,
            logRequests=False,
            allow_none=True)

        self.__instrumentsAndBars = None  # Pickle'd instruments and bars for faster retrieval.
        self.__activeJobs = {}
        self.__activeJobsLock = threading.Lock()
        self.__parametersLock = threading.Lock()
        self.__bestJob = None
        self.__parametersIterator = None
        self.__logger = optimizer.get_logger("server")
        if autoStop:
            self.__autoStopThread = AutoStopThread(self)
        else:
            self.__autoStopThread = None

        self.register_introspection_functions()
        self.register_function(self.getInstrumentsAndBars,
                               'getInstrumentsAndBars')
        self.register_function(self.getNextJob, 'getNextJob')
        self.register_function(self.pushJobResults, 'pushJobResults')
        self.__forcedStop = False
Beispiel #2
0
 def __init__(self, address, port, workerName=None):
     url = "http://%s:%s/PyAlgoTradeRPC" % (address, port)
     self.__server = xmlrpclib.ServerProxy(url, allow_none=True)
     self.__logger = optimizer.get_logger("server")
     if workerName == None:
         self.__workerName=socket.gethostname()
     else:
         self.__workerName=workerName
Beispiel #3
0
	def __init__(self, address, port, workerName=None):
		url = "http://%s:%s/PyAlgoTradeRPC" % (address, port)
		self.__server = xmlrpclib.ServerProxy(url, allow_none=True)
		self.__logger = optimizer.get_logger("server")
		if workerName == None:
			self.__workerName=socket.gethostname()
		else:
			self.__workerName=workerName
Beispiel #4
0
def worker_process(strategyClass, port):
    class Worker(worker.Worker):
        def runStrategy(self, barFeed, *parameters):
            strat = strategyClass(barFeed, *parameters)
            strat.run()
            return strat.getResult()

    # Create a worker and run it.
    w = Worker("localhost", port)
    w.setLogger(optimizer.get_logger("worker", logging.ERROR))
    w.run()
Beispiel #5
0
def worker_process(strategyClass, port):
	class Worker(worker.Worker):
		def runStrategy(self, barFeed, *parameters):
			strat = strategyClass(barFeed, *parameters)
			strat.run()
			return strat.getResult()

	# Create a worker and run it.
	w = Worker("localhost", port, None)
	w.setLogger(optimizer.get_logger("worker", logging.ERROR))
	w.run()
Beispiel #6
0
	def __init__(self, address, port, autoStop = True):
		SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, (address, port), requestHandler=RequestHandler, logRequests=False, allow_none=True)

		self.__instrumentsAndBars = None # Pickle'd instruments and bars for faster retrieval.
		self.__activeJobs = {}
		self.__activeJobsLock = threading.Lock()
		self.__parametersLock = threading.Lock()
		self.__bestJob = None
		self.__parametersIterator = None
		self.__logger = optimizer.get_logger("server")
		if autoStop:
			self.__autoStopThread = AutoStopThread(self)
		else:
			self.__autoStopThread = None

		self.register_introspection_functions()
		self.register_function(self.getInstrumentsAndBars, 'getInstrumentsAndBars')
		self.register_function(self.getNextJob, 'getNextJob')
		self.register_function(self.pushJobResults, 'pushJobResults')
		self.__forcedStop = False
Beispiel #7
0
 def __init__(self, address, port):
     url = "http://%s:%s/PyAlgoTradeRPC" % (address, port)
     self.__server = xmlrpclib.ServerProxy(url, allow_none=True)
     self.__logger = optimizer.get_logger("server")
Beispiel #8
0
	def __init__(self, address, port):
		url = "http://%s:%s/PyAlgoTradeRPC" % (address, port)
		self.__server = xmlrpclib.ServerProxy(url, allow_none=True)
		self.__logger = optimizer.get_logger("server")