Commit abf7797
authored
fix: division by zero in RSI calculation and README formatting (ValueCell-ai#226)
This PR addresses two issues:
1. Critical bug fix: Division by zero in RSI calculation
2. Documentation fix: Missing bullet point in Traditional Chinese README
## Type of Change
Type of Change: Bug Fix / Documentation Update
## Changes Made
### Critical Bug Fix
- **File**: `python/valuecell/agents/auto_trading_agent/market_data.py`
- **Issue**: Division by zero error in RSI calculation when loss is zero
- **Impact**: Application crash during technical analysis when there are
no downward price movements
- **Solution**: Replace zero loss values with infinity, resulting in RSI
= 100 (maximum strength)
- **Why this is correct**: When there are no losses, all movement is
gains, which means maximum relative strength
### Documentation Fix
- **File**: `README.zh_Hant.md`
- **Issue**: Missing bullet point marker before Trading Agents section
- **Solution**: Added `-` marker for consistency with other language
versions
## Testing
- [x] Verified the markdown renders correctly
- [x] Reviewed RSI calculation logic for edge cases
- [x] Confirmed fix prevents ZeroDivisionError
## Checklist
- [x] I have read the Code of Conduct
- [x] I have followed the Contributing Guidelines
- [x] My changes follow the project's coding style1 parent 4573197 commit abf7797
2 files changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
0 commit comments