Welcome to the AI Trading App!
It connects to Alpaca to read positions/orders and place trades.
Main features:
- Alpaca integration: paper/live support, positions, orders, market-clock awareness.
- Trading UI: search tickers, buy/sell, portfolio dashboard.
- Composer/defsymphony strategies: import strategies and evaluate them locally into target allocations.
- Automated rebalancing: scheduled portfolio rebalances with logs and cash/position reconciliation.
- Diagnostics: allocation diff/trace endpoint + one-shot rebalance trigger for fixing mismatched holdings.
- Data + analytics: price caching with multi-source fallback (Yahoo/Tiingo/Stooq/Alpaca), equity snapshots/history.
- Optional sentiment/news tooling (work in progress).
Credit for UI: OktarianTB
Backend: NodeJS with Python Scripts, AI: ChatGPT (collaborative strategy feature), Claude & Vertex (AI Fund feature)
Frontend: React, Material 5
Data: MongoDB
Devops: Github, Vercel, Render, Google Cloud Build, Gitguardian
Product Management: Notion
Project Management: Jira
Friday, May 26 2023 - 6:00 PM Anthropic AI Hackathon Build AI Apps with leading AI models! Submitted project
Friday, July 7 2023 - 6:00 PM Google Cloud Vertex AI Hackathon Be the first to build an AI App on Google’s AI models! Submitted project
Make sure you have NodeJS installed. You can check your Node.js version by running the command node -v in your terminal. If your version is older than 14.20.1, you will need to update Node.js. Please make sure that node -v gives you a version after 14.20.1 before doing anything else.
Go to the server folder:
cd serverThen install the required packages for the server with:
npm installGo to the client folder:
cd ..cd clientInstall the required packages for the client with:
npm installThen you have to set up the .env files for the server and the client: Go to the different services, create accounts and get the API keys
In tradingapp/server/config/ you have an example file. Rename it .env and change the keys with yours.
In tradingapp/client/ you have an example file. Rename it .env and change the keys with yours.
Check REACT_APP_BASE_URL_DEV=http://localhost:3000 and make sure it matches your server port.
Please make sure you have created a .env in the server AND in the client or it will not work
To use Vertex you will need to create /tradingapp/server/config/googlecredentials.json with your google credentials
Then you can start the server and the client
Go to the client folder
And run the client with:
npm run startOpen another terminal window and then run the server with:
Go to the server folder
npm run startCode explanation: Video
The server evaluates defsymphony strategies locally. To keep results aligned with Composer, the defaults are:
- RSI: Wilder (
COMPOSER_RSI_METHOD=wilder) - Price adjustment: split (
COMPOSER_DATA_ADJUSTMENT=split) - As-of mode: previous close (
COMPOSER_ASOF_MODE=previous-close) - Price source: Yahoo with Tiingo fallback (
COMPOSER_PRICE_SOURCE=yahoo) - Price refresh: disabled by default (
COMPOSER_PRICE_REFRESH=false) to avoid unexpected allocation changes - Indicators are computed using the prior bar when
previous-closeis used (lookahead-safe, closer to Composer backtests)
If you override these settings (ex: RSI_METHOD=simple or PRICE_DATA_SOURCE=alpaca), the app will still work but allocations can differ from Composer; rebalance logs will include a warning.
These endpoints are helpful when investigating mismatched holdings vs expected allocation:
- Diagnose allocation inputs/trace:
GET /api/strategies/diagnose/:userId/:strategyId - Trigger an immediate rebalance:
POST /api/strategies/rebalance-now/:userId/:strategyId
The front is optimized to be deployed on Vercel. Don't forget to add env variables.
The back is optimized to be deployed on Render. Don't forget to add env variables.
You can edit you API keys in Settings
To buy stocks you can go in Search, search for a stock and buy
You can sell from the dashboard clicking on stocks ticker
You can implement a collaborative strategy that you found online in Strategies, copy paste it and add a name for the strategy. It will buy the stocks. This create a strategy portfolio that will show up on the dashboard
Paper vs live trading depends on which Alpaca credentials are configured.
See tradingapp/docs/collaborative-strategies.md.
- Improve AI Fund signals (news quality, sentiment analysis).
- Add transaction cost displays (slippage/fees) for strategy evaluation.
- Add support for more brokers (ex: DeGiro) and crypto (via Alpaca).
Discord: Discord