Artificial Intelligence, Sentiment Analysis, Finance, Stock Market, Python.
Check if we are in the market if not self.position: # If the sentiment score is over 0.6, we buy if self.datasentiment[0] > 0.6: self.log('BUY CREATE, %.2f' % self.dataclose[0]) # Keep track of the created order to avoid a 2nd order self.order = self.buy(size=1000) else: # Already in the market, we