alpacahq / alpacahq/pylivetrader

ValueError: invalid literal for int() with base 10 (backend/alpaca.py: `int(pos.qty)` should be `float` ?)

Đang mở
#259 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
685
Fork
198
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

using `context.portfolio.positions` gives
> ValueError: invalid literal for int() with base 10: '418.8667'

from https://github.com/alpacahq/pylivetrader/blob/master/pylivetrader/backend/alpaca.py#L244
```
File "alpaca_short_bsf46.py", line 145, in close_previous_day
for sec in context.portfolio.positions:
File "/usr/local/lib/python3.6/site-packages/pylivetrader/algorithm.py", line 512, in portfolio
self._portfolio = self._backend.portfolio
File "/usr/local/lib/python3.6/site-packages/pylivetrader/backend/alpaca.py", line 268, in portfolio
z_portfolio.positions = self.positions
File "/usr/local/lib/python3.6/site-packages/pylivetrader/backend/alpaca.py", line 244, in positions
z_position.amount = int(pos.qty)
ValueError: invalid literal for int() with base 10: '418.8667'
```

changing `int(pos.qty)` to `float` in `backend/alpaca.py` gets past this error

```
pip show pylivetrader
Name: pylivetrader
Version: 0.7.1
Summary: simple live trading framework
Home-page: https://github.com/alpacahq/pylivetrader.git
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.