LoslegenKostenlos loslegen

Market sentiment

Txs Tools has forecast sales of 500 in January, with an expected increase of 5% per month for the rest of the quarter.

However, this is dependent on the market sentiment. Based on historical trends, the following information has been provided:

  • If the market sentiment drops below 0.6 then the sales will only be realized at an increase of 2% per month.
  • If market sentiment increases above 0.8. then sales are expected to increase by 7%.

Diese Übung ist Teil des Kurses

Financial Forecasting in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Create the computevariance function
def ____(amount, sentiment):
 if (____ < 0.6):
  res = amount + (amount * ____)
 elif (sentiment > 0.8):
  res = ____ + (____ * 0.07)
 else:
  res = amount + (amount * 0.05)
 return res
Code bearbeiten und ausführen