ソースを参照

Version non fonctionel

Remy 6 年 前
コミット
886d2a4e05

+ 78 - 0
Src/Action.py

@@ -0,0 +1,78 @@
+from define import *
+import os.path
+import ast
+
+class Action():
+	
+	def __init__(self,ID):
+
+		self.add = ID.split(";")[1]
+		self.name = ID.split(";")[0]
+		self.path = "/home/remy/Projet/Valeurs/"
+
+		self.Journee = {}
+		
+		self.valeur = 0
+		
+		#nombre d'action
+		self.possedent = 0
+		#Total de l'argent dépenser pour l'achat des actions
+		self.valeurAchat = 0 
+
+		#NBNeurone par action
+		self.Tab = [0]*MulParNeurone
+
+		self.chaleur = 0
+		
+	def MajQuotidient(self,date):
+		name=self.path+self.name+"-"+date
+		F_Journee = open(name,"r")
+		self.Journee = ast.literal_eval(F_Journee.readline())
+		Quoti = ast.literal_eval(F_Journee.readline())
+		self.Tab[0]=float(Quoti["1semaine"][0].strip("%"))
+		self.Tab[1]=float(Quoti["1mois"][0].strip("%"))
+		self.Tab[2]=float(Quoti["3mois"][0].strip("%"))
+		self.Tab[3]=float(Quoti["6mois"][0].strip("%"))
+		self.Tab[4]=float(Quoti["1an"][0].strip("%"))
+		_3ans=Quoti["3ans"][0].strip("%")
+		if (_3ans != '-'):
+			self.Tab[5]=float(_3ans)
+		_5ans=Quoti["5ans"][0].strip("%")
+		if (_5ans != '-'):
+			self.Tab[6]=float(_5ans)
+		_10ans=Quoti["10ans"][0].strip("%")
+		if (_10ans != '-'):
+			self.Tab[7]=float(_10ans)
+		
+		#Plus tard ajout des NM ... 
+		#self.Tab[0]=Quoti["MM20"]
+		#self.Tab[0]=Quoti["MM50"]
+		#self.Tab[0]=Quoti["MM100"]
+		#self.Tab[0]=Quoti["RSI14"]
+		
+	def Maj1min(self,heure):
+		val=self.Journee.get(heure)
+		if (val != None):
+			self.Tab.insert(NBInfoSupplementaire,val)
+			self.Tab=self.Tab[0:-1]
+
+	def getTable(self):
+		return self.Tab
+	
+	def getValue(self):
+		return self.valeur * self.possedent
+		
+	def MAJchaleur(self,pour):
+		self.chaleur = pour
+	
+	def Surveillance(self,Portefeuille,Frais):
+		if (self.chaleur>0.5):
+			print ("Achat " + self.name )
+			self.possedent+=ValeursAchat/self.valeur
+			Portefeuille-=ValeursAchat
+			Frais+=1
+		if (self.chaleur<0.5):
+			print ("Vente " + self.name )
+			Portefeuille+=self.possedent*self.valeur
+			self.possedent=0
+			Frais+=1

+ 0 - 0
Src/Extraction.py → Src/Extraction/Extraction.py


+ 0 - 0
Src/Scan.py → Src/Extraction/Scan.py


+ 0 - 0
Src/recup.py → Src/Extraction/recup.py


+ 130 - 0
Src/RDN.py

@@ -0,0 +1,130 @@
+from define import *
+import numpy
+
+def mult(Addresse,Neuronne, poids):
+	print (Addresse[30])
+	1.7159*numpy.tanh(
+	0.66666667*( \
+	Neuronne[Addresse[0]] * \
+	Neuronne[Addresse[1]] * \
+	Neuronne[Addresse[2]] * \
+	Neuronne[Addresse[3]] * \
+	Neuronne[Addresse[4]] * \
+	Neuronne[Addresse[5]] * \
+	Neuronne[Addresse[6]] * \
+	Neuronne[Addresse[7]] * \
+	Neuronne[Addresse[8]] * \
+	Neuronne[Addresse[9]] * \
+	Neuronne[Addresse[10]] * \
+	Neuronne[Addresse[11]] * \
+	Neuronne[Addresse[12]] * \
+	Neuronne[Addresse[13]] * \
+	Neuronne[Addresse[14]] * \
+	Neuronne[Addresse[15]] * \
+	Neuronne[Addresse[16]] * \
+	Neuronne[Addresse[17]] * \
+	Neuronne[Addresse[18]] * \
+	Neuronne[Addresse[19]] * \
+	Neuronne[Addresse[20]] * \
+	Neuronne[Addresse[21]] * \
+	Neuronne[Addresse[22]] * \
+	Neuronne[Addresse[23]] * \
+	Neuronne[Addresse[24]] * \
+	Neuronne[Addresse[25]] * \
+	Neuronne[Addresse[26]] * \
+	Neuronne[Addresse[27]] * \
+	Neuronne[Addresse[28]] * \
+	Neuronne[Addresse[29]] * \
+	Neuronne[Addresse[30]] * \
+	poids))
+
+# Fonction d'initialisation du reseau de neuronne
+class RDN():
+	def __init__(self,ID):
+		
+		self.ID = ID
+		
+		self.C1 = [0]*NBC1		
+		self.C2 = [0]*NBC2
+		self.C3 = [0]*NBC3
+		self.C4 = [0]*NBC4
+		self.C5 = [0]*NBC5
+		#print (self.C1)
+		
+		path = D_file + str(ID) + "/"
+		
+		#changer les addresse des fichier des poids avec l'ID
+		F_add2=open(path + "Addresse2.pos","r")
+		F_add3=open(path + "Addresse3.pos","r")
+		F_add4=open(path + "Addresse4.pos","r")
+		F_add5=open(path + "Addresse5.pos","r")
+		
+		F_Poid2=open(path + "poids2.wei","r")
+		F_Poid3=open(path + "poids3.wei","r")
+		F_Poid4=open(path + "poids4.wei","r")
+		F_Poid5=open(path + "poids5.wei","r")
+		
+		self.add2 = []
+		self.add3 = []
+		self.add4 = []
+		self.add5 = []
+		
+		self.poid2 = []
+		self.poid3 = []
+		self.poid4 = []
+		self.poid5 = []		
+		
+		for i in F_add2:
+			data = i.strip('][\n').split(', ')
+			tmp=[]
+			for j in data:
+				tmp.append(int(j))
+			self.add2.append(tmp)
+			
+		for i in F_add3:
+			data = i.strip('][\n').split(', ')
+			tmp=[]
+			for j in data:
+				tmp.append(int(j))
+			self.add3.append(tmp)
+
+		for i in F_add4:
+			data = i.strip('][\n').split(', ')
+			tmp=[]
+			for j in data:
+				tmp.append(int(j))
+			self.add4.append(tmp)
+
+		for i in F_add5:
+			data = i.strip('][\n').split(', ')
+			tmp=[]
+			for j in data:
+				tmp.append(int(j))
+			self.add5.append(tmp)
+			
+		for i in F_Poid2:
+			self.poid2.append(float(i))
+		for i in F_Poid3:
+			self.poid3.append(float(i))		
+		for i in F_Poid4:
+			self.poid4.append(float(i))
+		for i in F_Poid5:
+			self.poid5.append(float(i))
+		
+	def MiseAJourC1(self,tab):
+		self.C1 = tab
+	
+	def tour(self):
+		for i in range(len(self.C2)):
+			#print (self.C1)
+			self.C2[i]=mult(self.add2[i],self.C1,self.poid2[i])
+			
+		for i in range(len(self.C3)):
+			self.C3[i]=mult(self.add3[i],self.C2,self.poid3[i])
+			
+		for i in range(len(C4)):
+			self.C4[i]=mult(self.add4[i],self.C3,self.poid4[i])
+			
+		for i in range(len(self.C5)):
+			self.C5[i]=mult(self.add5[i],self.C4,self.poid5[i])
+		return self.C5

BIN
Src/__pycache__/Action.cpython-36.pyc


BIN
Src/__pycache__/RDN.cpython-36.pyc


BIN
Src/__pycache__/define.cpython-36.pyc


BIN
Src/__pycache__/functionMain.cpython-36.pyc


+ 45 - 0
Src/define.py

@@ -0,0 +1,45 @@
+initPortefeuille = 30000
+ValeursAchat = 2000
+
+NBMinuteJour = (8*60)+30
+NBAction = 41 #40 action + cac40
+NBInfoSupplementaire = 8
+
+NBC1 = (NBMinuteJour + NBInfoSupplementaire)*NBAction #NBNEurone par action
+NBC2 = int(NBC1 * 1.2)
+NBC3 = int(NBC2 * 1.2)
+NBC4 = 1500
+NBC5 = 40
+
+minute = [	
+"09h00", "09h01", "09h02", "09h03", "09h04", "09h05", "09h06", "09h07", "09h08", "09h09", "09h10", "09h11", "09h12", "09h13", "09h14", "09h15", "09h16", "09h17", 
+"09h18", "09h19", "09h20", "09h21", "09h22", "09h23", "09h24", "09h25", "09h26", "09h27", "09h28", "09h29", "09h30", "09h31", "09h32", "09h33", "09h34", "09h35",
+"09h36", "09h37", "09h38", "09h39", "09h40", "09h41", "09h42", "09h43", "09h44", "09h45", "09h46", "09h47", "09h48", "09h49", "09h50", "09h51", "09h52", "09h53",
+"09h54", "09h55", "09h56", "09h57", "09h58", "10h00", "10h01", "10h02", "10h03", "10h04", "10h05", "10h06", "10h07", "10h08", "10h09", "10h10", "10h11", "10h12",
+"10h13", "10h14", "10h15", "10h16", "10h17", "10h18", "10h19", "10h20", "10h21", "10h22", "10h23", "10h24", "10h25", "10h26", "10h27", "10h28", "10h29", "10h30",
+"10h31", "10h32", "10h33", "10h34", "10h35", "10h36", "10h37", "10h38", "10h39", "10h40", "10h41", "10h42", "10h43", "10h44", "10h45", "10h46", "10h47", "10h48",
+"10h49", "10h50", "10h51", "10h52", "10h53", "10h54", "10h55", "10h56", "10h57", "10h58", "11h00", "11h01", "11h02", "11h03", "11h04", "11h05", "11h06", "11h07",
+"11h08", "11h09", "11h10", "11h11", "11h12", "11h13", "11h14", "11h15", "11h16", "11h17", "11h18", "11h19", "11h20", "11h21", "11h22", "11h23", "11h24", "11h25",
+"11h26", "11h27", "11h28", "11h29", "11h30", "11h31", "11h32", "11h33", "11h34", "11h35", "11h36", "11h37", "11h38", "11h39", "11h40", "11h41", "11h42", "11h43",
+"11h44", "11h45", "11h46", "11h47", "11h48", "11h49", "11h50", "11h51", "11h52", "11h53", "11h54", "11h55", "11h56", "11h57", "11h58", "12h00", "12h01", "12h02",
+"12h03", "12h04", "12h05", "12h06", "12h07", "12h08", "12h09", "12h10", "12h11", "12h12", "12h13", "12h14", "12h15", "12h16", "12h17", "12h18", "12h19", "12h20",
+"12h21", "12h22", "12h23", "12h24", "12h25", "12h26", "12h27", "12h28", "12h29", "12h30", "12h31", "12h32", "12h33", "12h34", "12h35", "12h36", "12h37", "12h38",
+"12h39", "12h40", "12h41", "12h42", "12h43", "12h44", "12h45", "12h46", "12h47", "12h48", "12h49", "12h50", "12h51", "12h52", "12h53", "12h54", "12h55", "12h56",
+"12h57", "12h58", "13h00", "13h01", "13h02", "13h03", "13h04", "13h05", "13h06", "13h07", "13h08", "13h09", "13h10", "13h11", "13h12", "13h13", "13h14", "13h15",
+"13h16", "13h17", "13h18", "13h19", "13h20", "13h21", "13h22", "13h23", "13h24", "13h25", "13h26", "13h27", "13h28", "13h29", "13h30", "13h31", "13h32", "13h33",
+"13h34", "13h35", "13h36", "13h37", "13h38", "13h39", "13h40", "13h41", "13h42", "13h43", "13h44", "13h45", "13h46", "13h47", "13h48", "13h49", "13h50", "13h51",
+"13h52", "13h53", "13h54", "13h55", "13h56", "13h57", "13h58", "14h00", "14h01", "14h02", "14h03", "14h04", "14h05", "14h06", "14h07", "14h08", "14h09", "14h10",
+"14h11", "14h12", "14h13", "14h14", "14h15", "14h16", "14h17", "14h18", "14h19", "14h20", "14h21", "14h22", "14h23", "14h24", "14h25", "14h26", "14h27", "14h28",
+"14h29", "14h30", "14h31", "14h32", "14h33", "14h34", "14h35", "14h36", "14h37", "14h38", "14h39", "14h40", "14h41", "14h42", "14h43", "14h44", "14h45", "14h46",
+"14h47", "14h48", "14h49", "14h50", "14h51", "14h52", "14h53", "14h54", "14h55", "14h56", "14h57", "14h58", "15h00", "15h01", "15h02", "15h03", "15h04", "15h05",
+"15h06", "15h07", "15h08", "15h09", "15h10", "15h11", "15h12", "15h13", "15h14", "15h15", "15h16", "15h17", "15h18", "15h19", "15h20", "15h21", "15h22", "15h23",
+"15h24", "15h25", "15h26", "15h27", "15h28", "15h29", "15h30", "15h31", "15h32", "15h33", "15h34", "15h35", "15h36", "15h37", "15h38", "15h39", "15h40", "15h41",
+"15h42", "15h43", "15h44", "15h45", "15h46", "15h47", "15h48", "15h49", "15h50", "15h51", "15h52", "15h53", "15h54", "15h55", "15h56", "15h57", "15h58", "16h00",
+"16h01", "16h02", "16h03", "16h04", "16h05", "16h06", "16h07", "16h08", "16h09", "16h10", "16h11", "16h12", "16h13", "16h14", "16h15", "16h16", "16h17", "16h18",
+"16h19", "16h20", "16h21", "16h22", "16h23", "16h24", "16h25", "16h26", "16h27", "16h28", "16h29", "16h30", "16h31", "16h32", "16h33", "16h34", "16h35", "16h36",
+"16h37", "16h38", "16h39", "16h40", "16h41", "16h42", "16h43", "16h44", "16h45", "16h46", "16h47", "16h48", "16h49", "16h50", "16h51", "16h52", "16h53", "16h54",
+"16h55", "16h56", "16h57", "16h58", "17h00", "17h01", "17h02", "17h03", "17h04", "17h05", "17h06", "17h07", "17h08", "17h09", "17h10", "17h11", "17h12", "17h13",
+"17h14", "17h15", "17h16", "17h17", "17h18", "17h19", "17h20", "17h21", "17h22", "17h23", "17h24", "17h25", "17h26", "17h27", "17h28", "17h29", "17h30"]
+MulParNeurone = 31
+
+D_file= "/home/remy/Projet/DonneBourse/" #dossier des files

+ 62 - 0
Src/functionMain.py

@@ -0,0 +1,62 @@
+import os.path
+import random
+from define import *
+#define
+
+def fileWrite(NBneurone,NBneuroneMoins1,N,path):
+	weight=[]
+	add=[]
+	for i in range(NBneurone):
+		weight.append(random.uniform(-1.0, 1))
+		tmp=[]
+		for j in range(MulParNeurone):
+			tmp.append(random.randrange(0,NBneuroneMoins1))
+		add.append(tmp)
+	F_weight = open(path + "poids"+str(N)+".wei","w")	
+	F_AddPos = open(path + "Addresse"+str(N)+".pos","w")
+	
+	for i in weight : 
+		F_weight.write(str(i)+"\n")
+		
+	for i in add :
+		F_AddPos.write(str(i)+"\n")
+	
+	F_AddPos.close()
+	F_weight.close()
+	
+def GenerateFile():
+	F_resume = open("resume.txt","r")
+	file_lines = F_resume.readlines()
+	F_resume.close ()
+	last_line = file_lines [ len ( file_lines ) -1]
+	ID=int(last_line.split(":")[0])+1
+	
+	path = D_file + str(ID) + "/"
+	
+	os.mkdir(path)
+	
+	fileWrite(NBC2,NBC1,2,path)
+	fileWrite(NBC3,NBC2,3,path)
+	fileWrite(NBC4,NBC3,4,path)
+	fileWrite(NBC5,NBC4,5,path)
+	
+	return int(ID)
+	
+def CalculPourcentage(Portefeuille,Actions,Frais):
+	val = Portefeuille
+	for act in Actions:
+		val+=act.getValue()
+	val-=(Frais*3.9)
+	return (val/initPortefeuille)
+
+def MAJQuotidient(jou,Actions):
+	for act in Actions:
+		act.MajQuotidient(jou)
+
+def MAJ1min(minu,Actions):
+	tab=[]
+	for act in Actions:
+		act.Maj1min(minu)
+		tab.append(act.getTable())
+	return tab
+	

+ 17 - 0
Src/jour.txt

@@ -0,0 +1,17 @@
+1-4-2020
+2-4-2020
+3-4-2020
+6-4-2020
+7-4-2020
+8-4-2020
+9-4-2020
+10-4-2020
+14-4-2020
+15-4-2020
+16-4-2020
+17-4-2020
+20-4-2020
+21-4-2020
+22-4-2020
+23-4-2020
+24-4-2020

+ 40 - 0
Src/main.py

@@ -0,0 +1,40 @@
+from functionMain import *
+from RDN import *
+from Action import *
+
+Portefeuille = initPortefeuille
+FraisBancaire = 0
+
+
+ID = GenerateFile()
+
+RDN=RDN(ID)
+
+F_resume=open("resume.txt",'a')
+F_cac=open("cac.txt","r")
+F_jour = open("jour.txt","r")
+
+F_resume.write(str(ID)+": null\n")
+F_resume.close()
+Actions = []
+
+for i in F_cac:
+	Actions.append(Action(i))
+
+for jou in F_jour:
+	print (jou)
+	jou = jou.strip('\n')
+	MAJQuotidient(jou,Actions)
+	for minu in minute:
+		RDN.MiseAJourC1(MAJ1min(minu,Actions))
+		print("A")
+		res = RDN.tour()
+		print("B")
+		i = 0
+		for act in Actions:
+			act.MAJchaleur(res[i])
+			act.Surveillance(Portefeuille,FraisBancaire)
+			i+=1
+
+CalculPourcentage(Portefeuille,Actions,FraisBancaire)
+

+ 3 - 0
Src/resume.txt

@@ -0,0 +1,3 @@
+1: +3%
+2: null
+3: null

+ 3 - 0
Src/test.py

@@ -0,0 +1,3 @@
+for i in range(9,18):
+	for j in range(59):
+		print(str(i)+"h"+str(j))

+ 27 - 7
TestPerf/TestPerf.py

@@ -1,9 +1,29 @@
-nb = 4696091*20
-A = 51
-B = 22
-C = 0.20
+jour = 20
+minute = 8*60+30
 
-for i in range(nb):
-	res=A*B*C
+nbAction = 41
 
-print (res)
+C1 = (20 + minute) * nbAction
+C2 = C1 * 1.25
+C3 = C2 * 1.25
+C4 = 1500
+C5 = 40
+
+nb = int(C2 + C3 + C4 + C5)
+
+
+def mult():
+	#res = 1
+	#for i in range (32):
+	#	res *= 1.25
+	res =  1.25 * 1.25 * 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25* 1.25 *1.25
+
+def tour():
+	for i in range(nb ):
+		mult()
+
+for jou in range(jour):
+	print (jou)
+	for min in range(minute) :
+		tour()
+