text: from botlog import BotLog
  
  class BotTrade(object):
  	def __init__(self,currentPrice,startTime,stopLoss=0):
  		self.output = BotLog()
  		self.status = "OPEN"
  		self.entryPrice = currentPrice
  		self.exitPrice = 0.
  		self.startTime = startTime
  		self.exitTime = 0.
  		self.stopLoss = stopLoss
  		self.output.log("Trade opened: "+str(self.entryPrice)+" StopLoss: "+str(self.stopLoss))
  		# if (stopLoss):
  			# self.stopLoss = currentPrice - stopLoss
  
  	def close(self,currentPrice,endTime):
  		self.status = "CLOSED"
  		self.exitPrice = currentPrice
  		self.exitTime = endTime
  		# self.output.log("Trade closed")
  
  	def tick(self, currentPrice,candlestick):
  		if (self.stopLoss != 0 ):
  			if (currentPrice < self.entryPrice - self.stopLoss):
  				print("vendu par stopLoss")
  				self.close(currentPrice,candlestick.startTime)
  
  
  	def showTrade(self):
  		tradeStatus = "Entry Price: "+str(self.entryPrice)+" Status: "+str(self.status)+" Exit Price: "+str(self.exitPrice)
  
  		if (self.status == "CLOSED"):
  			tradeStatus = tradeStatus + " Profit: "
  			if (self.exitPrice > self.entryPrice):
  				tradeStatus = tradeStatus + "\033[92m"
  			else:
  				tradeStatus = tradeStatus + "\033[91m"
  
  			tradeStatus = tradeStatus+str(self.exitPrice - self.entryPrice)+"\033[0m"
  
  		# self.output.log(tradeStatus)
  