CGPT5 proposed enhancements
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
### Enhancement description
1. Silent order cancellations → add warning with equity & margin context in _Broker._process_orders().
2. Contingent SL/TP validation missing → ensure SL < entry < TP (or reverse for shorts) when trade is not None.
3. Same-bar SL/TP ambiguity → replace deferred execution with deterministic rule (e.g., pessimistic fill).
4. Division by zero in PL% → guard denominators (entry_price, total_invested) against 0 or NaN.
5. Tiny Trade.close() overshoot → rounding to 1 unit may overshoot; document quantization behavior.
6. Bankruptcy leaves open orders → clear self.orders when equity <= 0.
7. Recursive reprocessing risk → replace _process_orders() recursion with while loop.
8. Canceled proportional order warning → include timestamp, equity, and margin context in the warning.
9. OHLC sanity checks → optionally assert High >= max(Open,Close) and Low <= min(Open,Close).
10. Numeric index misdetection → improve timestamp inference (detect seconds vs. milliseconds).
11. Equity backfill perf → replace pandas backfill with NumPy for large datasets.
12. Commission config → expose risk_free_rate param and commission timing option ('entry'|'exit'|'both').
13. Better Strategy param errors → fix spacing and suggest close matches using difflib.get_close_matches.
14. Strategy.I() Series support → accept pandas Series; refine transpose logic.
15. SL/TP helper methods → add move_sl_to_break_even() and trail_sl() convenience APIs.
16. Commission impact option → allow open-trade P/L to include entry commission.
17. Minor typos → fix “the the”, “leverge”, and clarify bullet in Strategy.sell.
18. Type hints polish → tighten annotations for Trade, Order, Backtest.optimize.
19. Order.__repr__ verbosity → omit falsy booleans (e.g., contingent=False).
20. Deprecation message spacing → add missing space before “Backtesting 0.2.0.”
Contributor guide
Research direction
Split the 20 requested enhancements into separate work items before starting. Begin with _Broker._process_orders(), then trace the Trade, Order, and Strategy APIs named in the issue; identify the relevant existing tests and define completion separately for order processing, validation, numeric handling, performance, configuration, and documentation changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- backend-api-design, fintech-quant
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100