alpacahq / alpacahq/Momentum-Trading-Example
Infinite while loop
- Lingua principale
- Python
- Stelle
- 714
- Fork
- 221
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
If the condition in this while loop ever evaluates to ```True```, it will always be ```True```.
current_dt and market_open never change wthin the while loop, which means that since_market_open will never change within the while loop. This means
```python
since_market_open.seconds // 60 <= 14
```
will never evaluate to ```False``` if it is intially ```True```
https://github.com/alpacahq/Momentum-Trading-Example/blob/be4352838eebdd2d124eedd341e31fbae8774f3d/algo.py#L392-L394
I believe it should be:
```python
while since_market_open.seconds // 60 <= 14:
time.sleep(1)
current_dt = datetime.today().astimezone(nyc)
since_market_open = current_dt - market_open
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.