Overview
This prompt aims to guide developers in implementing adaptive check intervals for a trading scheduler. Programmers working on trading systems will benefit from the clear instructions and code snippets provided.
Prompt Overview
Purpose: This implementation aims to enhance trading efficiency by adapting check intervals based on symbol activity.
Audience: This update is intended for developers working on trading systems who need to optimize resource usage.
Distinctive Feature: The use of a constant dictionary allows for easy adjustments of refresh rates per trading symbol.
Outcome: The trading scheduler will now dynamically adjust check intervals, improving performance and reducing unnecessary resource consumption.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Cryptocurrency & Blockchain, Development Tools & DevOps
- Techniques: Role/Persona Prompting, Self-Consistency, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Implement adaptive check intervals in the trading scheduler code to support different refresh timings per symbol.
You will modify two files:
`scheduler_loop.py`
`time_utils.py`
### Requirements:
– Define a constant dictionary `CHECK_INTERVALS` mapping symbols to their interval values (in seconds):
“`python
CHECK_INTERVALS = {
“BTCUSD”: 60,
“XAUUSD”: 180,
“ETHUSD”: 45
}
“`
– Use these intervals to set how frequently each symbol is checked or refreshed in live mode.
– Symbols considered “quiet” (like those with longer intervals) should be polled less frequently to optimize system resources.
– Ensure that this dynamic, symbol-based timing mechanism is correctly integrated and used wherever symbol refreshes occur in live trading mode.
### Steps:
1. Define `CHECK_INTERVALS` in an appropriate shared location.
2. Update time computation functions to accept a symbol and yield the corresponding interval.
3. Modify the scheduler loop to use the symbol-specific interval for deciding when to check that symbol next.
4. Test or verify that each symbol uses its designated refresh rate.
### Output Format:
Provide the updated or added Python code snippets for:
– `CHECK_INTERVALS`
– The time utility functions
– Modified scheduler loop sections
Include clear comments explaining each change and ensure only relevant code fragments are included.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Open your code editor and locate `scheduler_loop.py`.
- Implement the `CHECK_INTERVALS` dictionary as specified.
- Update time functions to utilize symbol-based intervals.
- Modify the scheduler loop for symbol-specific refresh timings.
- Test the implementation to ensure correct functionality.
Tips for Best Results
- Define CHECK_INTERVALS: Create a dictionary mapping symbols to their refresh intervals in seconds.
- Update time functions: Modify time computation functions to accept a symbol and return the corresponding interval from CHECK_INTERVALS.
- Modify scheduler loop: Adjust the scheduler loop to use symbol-specific intervals for determining the next check time.
- Test refresh rates: Verify that each symbol is checked according to its designated refresh rate to ensure optimal performance.
FAQ
- What is the purpose of CHECK_INTERVALS?
CHECK_INTERVALS maps trading symbols to their respective refresh intervals in seconds. - How should the scheduler loop use CHECK_INTERVALS?
The scheduler loop should check each symbol based on its specific interval from CHECK_INTERVALS. - Why optimize polling for quiet symbols?
Optimizing polling for quiet symbols conserves system resources and improves overall efficiency. - What should be tested after implementing changes?
Verify that each trading symbol refreshes at its designated interval as defined in CHECK_INTERVALS.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


