from datetime import datetime, timedelta import ast import os from Processing import * from Global import * def parse_float_array(string): # Séparation du nom et de la liste de flottants parts = string.split(':') nom = parts[0].strip() float_array = ast.literal_eval(parts[1].strip()) return float_array if(1): print("================NEW==============================="+ "\n") Atest = os.listdir("res") # Parcours des fichiers for entest in Atest: Portfeuille = PortefeuilleInit pourc = 0 Action = [0] * 40 print(entest) with open("res/"+entest, "r") as file: weight1 = parse_float_array(file.readline()) weight2 = parse_float_array(file.readline()) weight3 = parse_float_array(file.readline()) weight4 = parse_float_array(file.readline()) couche1 = parse_float_array(file.readline()) couche2 = parse_float_array(file.readline()) couche3 = parse_float_array(file.readline()) couche4 = parse_float_array(file.readline()) with open("dateV.txt", "r") as file: dates = file.readlines() for date in dates: date = date.strip() # ~ print(date) valeurs_ponderees, valeurs_date = lirefichier(date) res = processing(valeurs_ponderees,weight1,weight2,weight3,weight4,couche1,couche2,couche3,couche4) for i in range(0,40): Action[i],Portfeuille=evaluation(res[i], valeurs_date[i], Action[i], Portfeuille) pourc = verification(valeurs_date,Action,Portfeuille) print (pourc) print(" ")