Follow these steps to upgrade your OpenAlgo application:
1. Backup the Database
Navigate to your database folder and make a copy of the current database file for safekeeping.
2. Delete the Current Database
Remove the existing database file openalgo.db from the folder /db to ensure a fresh setup.
3. Update the Application Code
Open your terminal and run the following command to pull the latest changes:
gitpull
4. Install Dependencies
Install or update the required Python packages by running:
pipinstall-rrequirements.txt
5. Dependencies Check (Optional)
Ensure all installed dependencies are compatible with the new version:
• Use a virtual environment to avoid conflicts:
python-mvenvvenvsourcevenv/bin/activate# On Windows: venv\Scripts\activatepipinstall-rrequirements.txt
6. Configure the Environment
Create a .env file from the provided .sample.env file. Update the following configurations in the .env file:
• Generate random values for APP_KEY and API_KEY_PEPPER using:
• Update the following parameters:
• BROKER_API_KEY
• BROKER_API_SECRET
• REDIRECT_URL
• Verify and adjust other configurations as needed.
Sample .env template
# Broker ConfigurationBROKER_API_KEY='YOUR_BROKER_API_KEY'BROKER_API_SECRET='YOUR_BROKER_API_SECRET'REDIRECT_URL='http://127.0.0.1:5000/<broker>/callback'# Change if different# Valid Brokers ConfigurationVALID_BROKERS='fivepaisa,aliceblue,angel,dhan,fyers,icici,kotak,shoonya,upstox,zebu,zerodha'# Security Configuration# IMPORTANT: Generate new random values for both keys during setup!# OpenAlgo Application KeyAPP_KEY='GENERATE_A_RANDOM_APP_KEY'# Security Pepper - Used for hashing/encryption of sensitive data# This is used for:# 1. API key hashing# 2. User password hashing# 3. Broker auth token encryptionAPI_KEY_PEPPER='GENERATE_A_RANDOM_PEPPER_KEY'# OpenAlgo Database ConfigurationDATABASE_URL='sqlite:///db/openalgo.db'# OpenAlgo Ngrok ConfigurationNGROK_ALLOW='FALSE'# OpenAlgo Hosted Server (Custom Domain Name) or Ngrok Domain Configuration# Change to your custom domain or Ngrok domainHOST_SERVER='http://127.0.0.1:5000'# OpenAlgo Flask App Host and Port Configuration# For 0.0.0.0 (accessible from other devices on the network)# Flask Environment - development or productionFLASK_HOST_IP='127.0.0.1'FLASK_PORT='5000'FLASK_DEBUG='False'FLASK_ENV='development'# OpenAlgo Flask App Version ManagementFLASK_APP_VERSION='1.0.0.14'# OpenAlgo Rate Limit SettingsLOGIN_RATE_LIMIT_MIN="5 per minute"LOGIN_RATE_LIMIT_HOUR="25 per hour"API_RATE_LIMIT="10 per second"# OpenAlgo API Configuration# Required to give 0.5 second to 1 second delay between multi-legged option strategies# Single legged orders are not affected by this setting.SMART_ORDER_DELAY='0.5'# Session Expiry Time (24-hour format, IST)# All user sessions will automatically expire at this time dailySESSION_EXPIRY_TIME='03:00'