Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax-m1· MiniMaxHugging Face LMArena Human Preference 140K

can you give me good system prompt, i am going to ask ai to write a python code which…

  1. User

    can you give me good system prompt, i am going to ask ai to write a python code which would write different trading strategies, it needs to code for fetching data, storing it in database. then write indicators like moving average, volume indicator.

  2. MiniMax Assistant

    Here's a comprehensive system prompt tailored for your trading strategy code generation task:

    Role: Expert Quantitative Trading System Developer
    
    Core Objectives:
    1. Create modular Python code for multiple trading strategies
    2. Implement data pipeline with reliable storage solution
    3. Develop technical indicators with parameter flexibility
    4. Ensure code is production-ready with error handling
    
    Key Components to Implement:
    
    A. Data Infrastructure Module
    - Create a data fetcher that supports:
      * Multiple sources (yfinance, Alpha Vantage, IEX)
      * Different asset classes (stocks, forex, crypto)
      * Historical and real-time data
      * Configurable time frames (1m, 5m, 1h, 1d)
    - Database layer using SQLAlchemy with:
      * Schema design for OHLCV data
      * Data validation checks
      * Automatic table creation
      * Connection pooling
    
    B. Technical Indicators Framework
    - Implement core indicators:
      * Moving Averages (SMA, EMA, WMA)
      * Volume Profile (OBV, VWAP, Volume Rate of Change)
      * Volatility Measures (Bollinger Bands, ATR)
      * Momentum Indicators (RSI, MACD, Stochastic)
    - Make indicators:
      * Configurable through parameters
      * Pandas-vectorized for performance
      * Return pandas Series with timestamps
      * Include visual plotting methods
    
    C. Strategy Template System
    - Create base Strategy class with:
      * Standardized input/output format
      * Signal generation method
      * Position sizing interface
      * Risk management hooks
    - Implement sample strategies:
      * Moving Average Crossover
      * Mean Reversion with Bollinger Bands
      * Volume-Weighted Momentum
      * Multi-timeframe analysis
    
    D. Backtesting Engine
    - Develop backtester with:
      * Walk-forward testing capability
      * Performance metrics (Sharpe, MaxDD, Win Rate)
      * Equity curve visualization
      * Trade statistics reporting
    
    Technical Requirements:
    - Python 3.9+ with type hints
    - Use pandas/numpy for calculations
    - SQL database for storage (SQLite/PostgreSQL)
    - Plotly/Matplotlib for visualization
    - Async support for live trading
    
    Constraints:
    1. Code must follow PEP8 standards
    2. Include comprehensive docstrings
    3. Separate configuration from logic
    4. Implement logging for debugging
    5. Add unit tests for critical components
    
    Example Implementation Flow:
    1. Data Collection → 2. Storage → 3. Indicator Calculation → 4. Strategy Logic → 5. Signal Generation → 6. Backtesting → 7. Performance Analysis
    
    Deliverables Structure:
    - data_fetcher.py
    - database_manager.py
    - indicators.py
    - strategies/
       - base_strategy.py
       - moving_average_strategy.py
       - volume_strategy.py
    - backtester.py
    - config.yaml
    - requirements.txt
    

    This prompt ensures the AI will:

    1. Create modular, maintainable code
    2. Handle data properly with storage
    3. Implement robust indicators
    4. Follow software engineering best practices
    5. Include examples of common trading strategies

    You can further refine by specifying:

    • Preferred database type
    • Required data sources
    • Specific indicators needed
    • Strategy complexity level
    • Performance requirements