該腳本是一個由人工智慧驅動的財務分析師,可以總結公司財務狀況,提供利弊,並根據提供的財務資訊提出建議。它使用 OpenAI API 或 Ollama 的開源模型來產生分析。
大語言模型應用視訊演示
關於使用法學碩士進行財務分析和演算法交易的文章
如需功能齊全的平台,請查看 NexusTrade。 NexusTrade 是一個由人工智慧驅動的自動化交易和投資平台,可讓用戶創建、測試、優化和部署演算法交易策略。它速度快、可配置、易於使用,並且不需要任何程式碼!
NexusTrade 在其 AI 支援的聊天中實現了此功能。它不需要設置,每個人(甚至非開發人員)都可以輕鬆使用。只需建立一個帳戶並嘗試一下。
要執行該腳本,您需要安裝以下軟體包:
您可以透過執行以下命令來安裝這些軟體包:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
在運行腳本之前,您需要設定環境變數。在專案目錄下建立.env
檔案並新增以下變數:
SIMFIN_API_KEY=YOUR_SIMFIN_API_KEY
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
將YOUR_SIMFIN_API_KEY
替換為您的 SimFin API 令牌,將YOUR_OPENAI_API_KEY
替換為您的 OpenAI API 金鑰。
若要使用 Ollama 作為 OpenAI 的替代品,請依照下列步驟操作:
下載 Ollama :造訪 ollama.com/download 並下載適合您作業系統的版本。
下載模型:造訪 ollama.com/library/llama3.1 下載您要使用的模型。
(可選)設定環境變數:如果 Ollama 未在預設連接埠上執行,則必須在.env
檔案中設定下列環境變數:
OLLAMA_SERVICE_URL=http://localhost:11434
若要將 AI Financial Analyst 與 OpenAI 結合使用,請執行以下命令:
python chat.py
若要將其與 Ollama 一起使用,請執行下列命令:
python chat.py --use-ollama
該腳本將根據所提供的財務資訊提供公司財務狀況的摘要。它將分析資產負債表、現金流量、獲利能力指標、流動性指標、償付能力指標、現金流量指標和其他重要指標。該腳本還將根據分析提供建議。
以下是在 Apple 上執行 2023 年第一季腳本的輸出範例:
AI Assistant: Based on the provided financial information, here is a summary of the company's finances:
1. Balance Sheet:
- Total Assets: $346,747,000,000
- Total Liabilities: $290,020,000,000
- Total Equity: $56,727,000,000
The company has a strong balance sheet with a significant amount of assets compared to its liabilities. This indicates a healthy financial position.
2. Cash Flow:
- Net Cash from Operating Activities: $34,005,000,000
- Net Cash from Investing Activities: -$1,445,000,000
- Net Cash from Financing Activities: -$35,563,000,000
- Net Change in Cash: -$3,003,000,000
The company generated positive cash flow from its operating activities, but had negative cash flow from investing and financing activities. As a result, there was a decrease in cash during the period.
3. Profitability Metrics:
- Gross Profit Margin: 42.96%
- Operating Margin: 30.74%
- Net Profit Margin: 25.61%
- Return on Equity: 52.88%
- Return on Assets: 8.65%
- Return on Invested Capital: 15.28%
The company has healthy profitability metrics, indicating efficient operations and good returns on investment.
4. Liquidity Metrics:
- Current Ratio: 1.01
The company has a current ratio slightly above 1, which suggests it has enough current assets to cover its short-term liabilities. However, it is important to note that a current ratio of exactly 1 may indicate limited liquidity.
5. Solvency Metrics:
- Liabilities to Equity Ratio: 5.11
- Debt Ratio: 32.04%
The company has a relatively high liabilities to equity ratio, indicating a significant amount of debt compared to equity. The debt ratio is moderate, suggesting that a significant portion of the company's assets is financed by debt.
6. Cash Flow Metrics:
- Free Cash Flow: $39,273,000,000
- Free Cash Flow to Net Income: 1.31
- Cash Return on Invested Capital: 17.77%
The company has positive free cash flow, indicating its ability to generate cash after accounting for capital expenditures. The free cash flow to net income ratio suggests that the company is efficient in converting its net income into free cash flow. The cash return on invested capital is also positive, indicating good returns on the capital invested.
7. Other Important Metrics:
- Piotroski F-Score: 4
- Net Debt / EBITDA: 1.53
- Dividend Payout Ratio: 12.56%
The Piotroski F-Score of 4 suggests that the company has a moderate financial strength. The net debt to EBITDA ratio indicates the company's ability to repay its debt, with a ratio of 1.53. The dividend payout ratio suggests that the company distributes a portion of its earnings as dividends.
Based on the provided information, the company appears to be in a strong financial position with healthy profitability metrics and positive cash flow. However, it is important to conduct further research and analysis to fully understand the company's financial health and prospects.
該腳本利用 SimFin API 檢索公司財務訊息,並利用 OpenAI API 產生 AI 分析。
請注意,此腳本應用程式為起點,而不是財務建議。在做出任何投資決策之前進行進一步的研究和分析非常重要。