mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-11 23:06:58 +08:00
Refactor unnecessary else / elif when if block has a continue statement
Signed-off-by: shubhendra <withshubh@gmail.com>
This commit is contained in:
@@ -104,10 +104,9 @@ class Account:
|
|||||||
# if suspend, no new price to be updated, profit is 0
|
# if suspend, no new price to be updated, profit is 0
|
||||||
if trader.check_stock_suspended(code, today):
|
if trader.check_stock_suspended(code, today):
|
||||||
continue
|
continue
|
||||||
else:
|
today_close = trader.get_close(code, today)
|
||||||
today_close = trader.get_close(code, today)
|
profit += (today_close - self.current.position[code]["price"]) * self.current.position[code]["amount"]
|
||||||
profit += (today_close - self.current.position[code]["price"]) * self.current.position[code]["amount"]
|
self.current.update_stock_price(stock_id=code, price=today_close)
|
||||||
self.current.update_stock_price(stock_id=code, price=today_close)
|
|
||||||
self.rtn += profit
|
self.rtn += profit
|
||||||
# update holding day count
|
# update holding day count
|
||||||
self.current.add_count_all()
|
self.current.add_count_all()
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ class Exchange:
|
|||||||
deal_amount = self.get_real_deal_amount(current_amount, target_amount, factor)
|
deal_amount = self.get_real_deal_amount(current_amount, target_amount, factor)
|
||||||
if deal_amount == 0:
|
if deal_amount == 0:
|
||||||
continue
|
continue
|
||||||
elif deal_amount > 0:
|
if deal_amount > 0:
|
||||||
# buy stock
|
# buy stock
|
||||||
buy_order_list.append(
|
buy_order_list.append(
|
||||||
Order(
|
Order(
|
||||||
|
|||||||
Reference in New Issue
Block a user