Skip to content

Commit c022ae6

Browse files
committed
handle async-req exception
1 parent f95cdfa commit c022ae6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

flyerbots/strategy.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@ def wrapper(*args, **kargs):
313313

314314
def async_result(f_result, last):
315315
if f_result is not None and f_result.done():
316-
return None, f_result.result()
316+
try:
317+
return None, f_result.result()
318+
except Exception as e:
319+
self.logger.warning(type(e).__name__ + ": {0}".format(e))
320+
f_result = None
317321
return f_result, last
318322

319323
self.hft = self.settings.interval < 3
@@ -400,9 +404,11 @@ def async_result(f_result, last):
400404
# 価格データ取得
401405
ticker = dotdict(self.ep.get_ticker())
402406
ohlcv = executions = None
407+
403408
# インターバルが0の場合、約定履歴の到着を待つ
404409
if self.settings.interval==0:
405410
self.ep.wait_any(['executions'], timeout=0.5)
411+
406412
# OHLCVを作成しない場合、約定履歴を渡す
407413
if self.settings.disable_create_ohlcv:
408414
executions = self.ep.get_executions()

0 commit comments

Comments
 (0)