Set up an AI agent for investment strategy analysis without sharing personal data
Create a local analyzer using open-source models - keep your portfolio private
- 1.Open Ollama (a local platform for running AI models) and install the mistral or llama2 model, which run on your computer without sending data to the cloud.
Ollama runs entirely locally - your data never leaves your computer. Download it from ollama.ai, install it, and run: ollama pull mistral
Ollama ↗About this tool - 2.Open a text editor (Notepad++, VS Code, or plain Notepad) and create a file named investment_prompt.txt.
In this file you will write the instructions for the AI agent without sending any data to third parties.
- 3.Copy the following strategy analysis agent prompt into investment_prompt.txt:
This prompt runs locally in Ollama and analyzes your data without sending it to any third-party service.
PromptYou are an investment strategy analyst. Analyze the following investment strategy and provide: 1) Risk assessment (low/medium/high), 2) Diversification score (1-10), 3) Historical performance estimate based on the strategy type, 4) Recommended adjustments. Strategy: [USER_STRATEGY_DESCRIPTION]. Stocks in portfolio: [TICKER_LIST]. Analysis format: structured bullet points.
What this prompt doesReplace [USER_STRATEGY_DESCRIPTION] with a description of your strategy (e.g., 'long-term growth focused on tech'), and [TICKER_LIST] with comma-separated tickers (e.g., 'AAPL, MSFT, GOOGL'). The analysis runs locally on your computer. - 4.Open a terminal (Command Prompt on Windows or Terminal on macOS/Linux) and start Ollama with: ollama serve
This starts the local AI server on localhost:11434. Keep this window open while it runs.
- 5.Open a second terminal window and create a simple script to send the request to the model. Run: curl http://localhost:11434/api/generate -d '{"model": "mistral", "prompt": "[YOUR_PROMPT_TEXT]", "stream": false}'
Replace [YOUR_PROMPT_TEXT] with the contents of your investment_prompt.txt (the full text with data). The result will appear in the terminal within 1-2 minutes.
Promptcurl http://localhost:11434/api/generate -d '{"model": "mistral", "prompt": "You are an investment strategy analyst. Analyze strategy: [STRATEGY]. Tickers: [TICKERS]. Provide risk level, diversification score 1-10, and recommendations.", "stream": false}'What this prompt doesReplace [STRATEGY] with your strategy description and [TICKERS] with stock tickers. The command runs in the terminal and analyzes data locally without sending it to the internet. - 6.Save the model's response to a file called results.txt by copying the terminal output. Review the analysis: risk assessment, diversification score, and strategy adjustment recommendations.
All data stays on your computer. To re-analyze - update investment_prompt.txt and repeat step 5.
- 7.For convenience: install Open WebUI (a web interface for Ollama) with: docker pull ghcr.io/open-webui/open-webui:latest. Open your browser at localhost:8080 and use the graphical interface instead of the terminal.
Open WebUI requires Docker, but it is optional. You can continue using just the terminal. The graphical interface is more convenient for repeated analyses.
Open WebUI + Docker (optional) ↗
- freeOllamaCompletely free, runs locally on your computer without any cloud services.
- freeOpen WebUI (optional)Free open-source interface, requires Docker to install.
- freeText editor and terminalBuilt into your operating system, no extra costs.
AI services change fast - interfaces and free limits may differ from what's described.