alpacahq / alpacahq/alpaca-py

Support REST requests timeout, especially with StockHistoricalDataClient

Đang mở
#415 0 bình luận 1 reaction 1 người được giao Được @hiohiohio nhận Xem trên GitHub
Ngôn ngữ chính
Python
Star
1.5k
Fork
398
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
6

Mô tả

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe.

Currently when getting `StockBarsRequest`, I cannot specify a `requests` timeout. Sometimes it takes too long to return, as much as 7 seconds.

### Describe the solution you'd like.

The `requests` package supports a `timeout` argument. It should be possible for me to optionally provide this argument when I initialize `StockHistoricalDataClient`. I would then use two instances of this client, one without a timeout, and one with a timeout when I need it.

In this way, I can myself easily then retry the request if it takes longer than say 2 seconds instead of waiting for 7 seconds. Usually it returns very quickly.

The default behavior should continue to remain as it is now.

### Describe an alternate solution.

_No response_

### Anything else? (Additional Context)

Without this feature I have to use `requests` myself which may be undesirable. [[example](https://github.com/alpacahq/alpaca-py/issues/192#issuecomment-1512156469)]

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

Mở hướng dẫn đóng góp

Đá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.