Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cpu util #183

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions alpaca_backtrader_api/alpacastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ class AlpacaStore(with_metaclass(MetaSingleton, object)):

- ``account_tmout`` (default: ``10.0``): refresh period for account
value/cash refresh

- ``order_tmout`` (default: ``0.05``): how often the order creation queue
is checked within _t_create_order
'''

BrokerCls = None # broker class will autoregister
Expand All @@ -203,6 +206,7 @@ class AlpacaStore(with_metaclass(MetaSingleton, object)):
('secret_key', ''),
('paper', False),
('account_tmout', 10.0), # account balance refresh timeout
('order_tmout', 0.05), # order status check timeout
('api_version', None)
)

Expand Down Expand Up @@ -753,9 +757,10 @@ def _check_if_transaction_occurred(order_id):

while True:
try:
if self.q_ordercreate.empty():
try:
msg = self.q_ordercreate.get(timeout=self.p.order_tmout)
except queue.Empty:
continue
msg = self.q_ordercreate.get()
if msg is None:
continue
oref, okwargs = msg
Expand Down