from threading import Thread
from valeurs import *


class AchatVente(Thread):

    def __init__(self, valeur,verrou):
        Thread.__init__(self)
        
    def run(self):
        i=0
        gain =0.0 
        while 1:
			#~ with verrou:
			if valeur[i].getAAnule == 1:
				valeur[i].Anulation()
			if valeur[i].getAVendre == 1:
				gain=gain+valeur[i].Vente()
			if getMise()==0:
				valeur[i].Achat(25)
			
			print ("Gain : "+ str(gain))
			time.sleep(0.4)
			i=i+1
			if i<39:
				i=0
