def test(self, genData):
        #runs the NN in a test environment for the purpose of evaluating
        #fitness for training
        marketAPI = trainingMarketAPI(genData);
        marketAPI.start()

        startTime = time.time()
        while marketAPI.end() == False:
            input = marketAPI.getInputData();
            output = self.runNN(input);

            if output == 0:
                if self.lastAction != 0:
                    self.lastAction = 0;
                    marketAPI.openPosition()
            elif output == 1:
                if self.lastAction != 1:
                    self.lastAction = 1;
                    marketAPI.closePosition();
            elif output == 2:
                self.lastAction = 2


        self.results = marketAPI.getResults();
        self.results["id"] = self.id;
        return self.results;
Пример #2
0
    def test(self):
        #runs the NN in a test environment for the purpose of evaluating
        #fitness for training
        marketAPI = trainingMarketAPI()
        marketAPI.start()

        while marketAPI.end() == False:
            input = marketAPI.getInputData()
            output = self.runNN(input)

            if output == 0:
                marketAPI.openPosition()
            elif output == 1:
                marketAPI.closePosition()

        self.results = marketAPI.getResults()
Пример #3
0
def testRun():
    initMarketData()
    marketAPI = trainingMarketAPI()
    marketAPI.start()

    counter = 0
    while marketAPI.end() == False:
        NNinput = marketAPI.getInputData()
        for index in range(len(NNinput)):
            print(str(index) + ": " + str(NNinput[index]))
        random.seed(time.time())
        choice = random.randint(0, 100)
        if choice == 1:
            marketAPI.openPosition()
        elif choice == 2:
            marketAPI.closePosition()

    results = marketAPI.getResults()