Investbrain
Smart LLM-enabled investment tracker that consolidates and monitors market performance across your different brokerages
Install / Use
/learn @investbrainapp/InvestbrainREADME
About Investbrain
Investbrain is a smart open-source investment tracker that helps you manage, track, and make informed decisions about your investments.
<p align="center"><a href="https://investbra.in" target="_blank"><img src="https://raw.githubusercontent.com/investbrainapp/investbrain/main/screenshot.png" width="100%" alt="Investbrain Screenshot"></a></p>Table of contents
- Under the hood
- Install (self hosting)
- Chat with your holdings
- Market data providers
- Import / Export
- Configuration
- Updating
- Command line utilities
- Troubleshooting
- Testing
Under the hood
Investbrain is a Laravel PHP web application that has an extensible market data provider interface. Out of the box, we feature many market data providers. But intrepid developers can create their own providers! We also offer integrations with OpenAI and Ollama for our "chat with your holdings" capability. Finally, of course we have robust support for i18n, a11y, and dark mode.
Self hosting
For ease of installation, we highly recommend installing Investbrain using the provided Docker Compose file, which uses the official Investbrain Docker image and includes all the necessary dependencies to seamlessly build everything you need to get started quickly!
Before getting started, you should already have Docker Engine installed on your machine.
Ready? Let's get started!
1. Download copy of Docker Compose file
Grab a copy of the docker-compose.yml using wget, curl or similar:
curl -O https://raw.githubusercontent.com/investbrainapp/investbrain/main/docker-compose.yml
2. Set your environment
Adjust the environment properties in the compose file to your preferences.
3. Run docker compose up
It might take a few minutes to pull the Docker images. But assuming everything worked as expected, you should now be able to access Investbrain in the browser by visiting:
http://localhost:8000/register
Congrats! You've just installed Investbrain!
Chat with your holdings
Investbrain offers an AI powered chat assistant that is grounded on your investments. This enables you to use AI as a thought partner when making investment decisions.
Most of the major labs are currently supported (OpenAI, Anthropic, Gemini, xAI, etc). You'll need to obtain API keys from your selected provider and configure that in your .env file using the appropriate keys.
Investbrain is also compatible with Ollama (and other OpenAI compatible APIs). If you are self-hosting your own large language models ("LLMs") that exposes an OpenAI compatible API (e.g. Ollama), you'll need to configure your local endpoint in your .env file.
See available options below.
Always keep in mind the limitations of LLMs. When in doubt, consult a licensed investment advisor.
Market data providers
Investbrain includes an extensible market data provider interface that allows you to retrieve stock market data from multiple providers, such as Yahoo Finance, Twelve Data, Finnhub, Alpaca, and Alpha Vantage. The interface includes a built-in fallback mechanism to ensure reliable data access, even if a provider fails.
Market Data Configuration
You can specify the market data provider you want to use in your environment variables:
MARKET_DATA_PROVIDER=yahoo
You can also use Investbrain's built-in fallback mechanism to ensure reliable data access. If any provider fails, Investbrain will automatically attempt to retrieve data from the next available provider, continuing through your configured providers until one returns successfully.
Your selected providers should be listed in your environment variables. Each should be separated by a comma:
MARKET_DATA_PROVIDER=yahoo,alphavantage
In the above example, Yahoo Finance will be attempted first. If Yahoo Finance fails to retrieve market data, the application will automatically try Alpha Vantage.
Custom providers
If you wish to create your own market data provider, you can create your own implementation of the MarketDataInterface. You can refer to any existing market data implementation as an example.
Once you've created your market data implementation, be sure add your custom provider to the Investbrain configuration file, under the interfaces section:
'interfaces' => [
// * * *
'custom_provider' => \App\Services\CustomProviderMarketData::class,
// * * *
],
And add your custom provider to your .env file:
MARKET_DATA_PROVIDER=yahoo,alphavantage,custom_provider
Feel free to submit a PR with any custom providers you create.
Import / Export
Investbrain includes a convenient feature which allows you to maintain the portability of your portfolios and transaction data.
Import
Imports are "upserted" to the database. If the record does not already exist in the database, the record will be created. However, when a portfolio or transaction exists (i.e. the record's ID matches an existing record), the record will be updated. This way, you can simultaneously create new records, but also bulk update records.
Export
Exporting your portfolios and transactions is a convenient way to back-up your Investbrain data. It is also a convenient way to maintain portability of your data.
Configuration
There are several optional configurations available when installing using the recommended Docker method. These options are configurable using an environment file. Configurations can be added to your .env file or to the environment property in the docker-compose.yml file.
| Option | Description | Default |
| ------------- | ------------- | ------------- |
| APP_URL | The URL where your Investbrain installation will be accessible | http://localhost |
| APP_PORT | The HTTP port exposed by the NGINX container | 8000 |
| APP_KEY | Encryption key for various security-related functions | Set automatically during install |
| MARKET_DATA_PROVIDER | The market data provider to use (either yahoo, twelvedata, alphavantage, alpaca, or finnhub) | yahoo |
| ALPHAVANTAGE_API_KEY | If using the Alpha Vantage provider | null |
| FINNHUB_API_KEY | If using the Finnhub provider | null |
| ALPACA_API_KEY | If using the Alpaca provider | null |
| ALPACA_API_SECRET | If using the Alpaca provider | null |
| TWELVEDATA_API_SECRET | If using the Twelve Data provider | null |
| MARKET_DATA_REFRESH | Cadence to refresh market data in minutes | 30 |
| APP_TIMEZONE | Timezone for the application, including daily change captures | UTC |
| AI_CHAT_ENABLED | Whether to enable AI chat features | false |
| CHAT_PROVIDER | Which chat provider to use (one of openai, anthropic, gemini, azure, groq, xai, deepseek, mistral, ollama) | openai |
| CHAT_MODEL | The selected LLM used for AI chat | defaults to current smartest model from lab |
| ANTHROPIC_API_KEY | If using Anthropic for chat | null |
| OPENAI_API_KEY | If using OpenAI for chat | null |
| OLLAMA_BASE_URL | If using Ollama for chat | http://localhost:11434 |
| OLLAMA_API_KEY | May be required if using Ollama for chat | null |
| DAILY_CHANGE_TIME | The time of day to capture daily change | 23:00 |
| REGISTRATION_ENABLED | Whether to enable registration of new users | true |
Note: These options affect the docker-compose.yml file and are cached during run-time. If change any environment configurations, you'll have to restart the container before your changes take effect.
Updating
To update Investbrain using the recommended Docker installation method, you just need to stop the running containers:
docker compose stop
Then pull the latest Docker image:
docker image pull investbrainapp/investbrain:latest
Finally bring the containers back up!
docker compose up
Easy as that!
