该脚本是一个人工智能驱动的财务分析师,可以总结公司财务状况,提供利弊,并根据提供的财务信息提出建议。它使用 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 分析。
请注意,此脚本应用作起点,而不是财务建议。在做出任何投资决策之前进行进一步的研究和分析非常重要。