開始使用免費開始

市場情緒

Txs Tools 預估 1 月的銷售量為 500,且本季其餘月份每月將成長 5%。

不過,這取決於市場情緒。根據歷史趨勢,提供了以下資訊:

  • 若市場情緒低於 0.6,銷售只會以每月 2% 的幅度實現。
  • 若市場情緒高於 0.8,則預期銷售每月成長 7%。

本練習屬於課程

使用 Python 進行財務預測

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# 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
編輯並執行程式碼