There’s no single “best” strategy, only strategies that adapt to changing market conditions. Through competition and evolution, better strategies emerge. Melody Invest enables you to create trading strategies by grouping together various trading behaviors. By backtesting these strategies with historical stock data, you can evaluate their performance across different environments. The platform then merges the most successful strategies to evolve and generate new ones, continuously repeating the cycle of competition and evolution.
This platform is for experimental purposes only:
- Backtesting results do not guarantee future success. Predefined conditions and rules can significantly impact backtesting outcomes, and relying solely on this platform’s results may be risky.
- Investment, as well as providing investment advice, requires specific knowledge or certification. Your investment strategy should not be based solely on the results generated by this platform.
- Stock API providers may have data-sharing policies. Be sure to review these policies before publicly hosting this platform.
# Install redis
sudo apt install redis-server
# Install postgres
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt install postgresql-15
# Install node
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g pm2
- Create a PostgreSQL database named "melody-invest".
- Obtain an API key from Tiingo
git clone [email protected]:ValueMelody/melody-invest.git
# Replace frontend env vars if needed
cp ./client/.env.example ./client/.env
# Replace backend env vars, including redis, database, mailer configs
cp ./server/.env.example ./server/.env
npm install
npm run shared
cd server
npm run migrate
cd ../
npm run dev
- Open http://127.0.0.1:3099 in your browser.
- Create a new account.
- Sign in and navigate to the “Profile” page.
- Save your Tiingo API key in the “Profile” page.
- Go to the “Manage Tickers” page
- Create several stock tickers that you want to use for backtesting your trading strategy.
This process should be repeated daily after the initial setup:
cd server
npm run build
# Sync prices for your tickers
npm run syncTickerPrices yyyy-MM-DD
# Calculate price movements based on ticker prices
npm run calcPriceMovements
# Prepare daily ticker price data for final calculation
npm run calcDailyTickers
This process should be repeated weekly after the initial setup:
# Sync financial statements for your tickers
npm run syncTickerFinancials yyyy-MM
# Calculate financial movements based on financial data
npm run calcFinancialMovements
# Prepare daily ticker financial data for final calculation
npm run calcDailyTickers
This process should be repeated monthly after the initial setup.
-
Collect economic indicators from the following sources and store them in your indicator_monthly, indicator_quarterly, and indicator_yearly tables:
- Yearly Inflation: https://www.usinflationcalculator.com/inflation/current-inflation-rates/
- Yearly GDP: https://en.wikipedia.org/wiki/Economy_of_the_United_States
- Quarterly Seasonal GDP: https://fred.stlouisfed.org/series/NA000254Q
- Monthly Funds Rate: https://fred.stlouisfed.org/series/FEDFUNDS
- Monthly 30 Years Treasury Yield: https://fred.stlouisfed.org/series/DGS30
- Monthly 10 Years Treasury Yield: https://fred.stlouisfed.org/series/DGS10
- Monthly CPI: https://www.usinflationcalculator.com/inflation/consumer-price-index-and-annual-percent-changes-from-1913-to-2008/
- Monthly Consumer Sentiment: http://www.sca.isr.umich.edu/
- Monthly Unemployment Rate: https://data.bls.gov/timeseries/LNS14000000
- Monthly Nonfarm Payroll: https://fred.stlouisfed.org/series/PAYNSA
-
Run the following commands to process the collected data:
# Calculate economic indicator movements based on collected data
npm run calcIndicatorMovements
# Prepare daily indicator data for final calculation
npm run calcDailyIndicators
- Open http://127.0.0.1:3099 in your browser.
- Create an environment on the “Dashboard” page.
- Create at least two profiles on the “Dashboard” page.
- Run the following commands to generate reports and evolve new traders:
cd server
# Generate backtesting results for your traders
npm run calcTraderPerformances
# Evolve new traders based on performance
npm run calcTraderDescendants
You can keep triggering these commands over and over again to generate new traders and evaluate their performance