コード例 #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
コード例 #2
0
ファイル: worker.py プロジェクト: tibkiss/pyalgotrade
 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
コード例 #3
0
ファイル: worker.py プロジェクト: Barcelons281/pyalgotrade
	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
コード例 #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()
コード例 #5
0
ファイル: local.py プロジェクト: Barcelons281/pyalgotrade
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()
コード例 #6
0
ファイル: server.py プロジェクト: AlexColson/pyalgotrade
	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
コード例 #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")
コード例 #8
0
ファイル: worker.py プロジェクト: doudoukiss/pyalgotrade
	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")