Skip to content

Commit

Permalink
Merge pull request #728 from ricequant/dev-rqsdk-542
Browse files Browse the repository at this point in the history
RQSDK-542
  • Loading branch information
Cuizi7 committed Aug 19, 2022
2 parents da2a05e + c94b96d commit fc28c5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rqalpha/portfolio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,11 @@ def __getitem__(self, item):
def __repr__(self):
keys = []
for account in six.itervalues(self._accounts):
keys += [order_book_id for order_book_id, position in account.positions.items() if position.quantity > 0]
keys += [
order_book_id for order_book_id, position in account.positions.items()
if getattr(position, "quantity", 0) > 0 or
getattr(position, "buy_quantity", 0) + getattr(position, "sell_quantity", 0) > 0
]
return str(sorted(keys))

def __len__(self):
Expand Down

0 comments on commit fc28c5c

Please sign in to comment.