AI4Finance-Foundation / AI4Finance-Foundation/FinRL
Runtime error: FinRL_PaperTrading_Demo.ipynb; AlpacaPaperTrading.trade(); buy_num_shares is NaN
- Langage dominant
- Jupyter Notebook
- Étoiles
- 16.3k
- Forks
- 3.5k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
File: https://github.com/AI4Finance-Foundation/FinRL/blob/master/tutorials/3-Practical/FinRL_PaperTrading_Demo.ipynb
Part 3: Deploy the agent
Setup Alpaca Paper trading environment
class AlpacaPaperTrading()
def trade(self):
state = self.get_state()
.
.
.
for index in np.where(action > min_action)[0]: # buy_index:
if self.cash < 0:
tmp_cash = 0
else:
tmp_cash = self.cash
buy_num_shares = min(tmp_cash // self.price[index], abs(int(action[index])))
qty = abs(int(buy_num_shares))
.
.
.
RuntimeWarning: invalid value encountered in double_scalars
buy_num_shares = min(tmp_cash // self.price[index], abs(int(action[index])))
Snapshot of variables:
Error: buy_num_shares = NaN
index: 24
tmp_cash: 0
self.price[index]: 0.0
abs(int(action[index]): 22
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.