Skip to content

Commit

Permalink
Merge pull request #43 from alpacahq/fix14
Browse files Browse the repository at this point in the history
Cover edge case
  • Loading branch information
umitanuki authored Nov 1, 2018
2 parents e2e0f09 + 3a0a0b4 commit 292c1b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pylivetrader/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def get_open_orders(self, asset=None):

if asset is None:
return omap
return omap[asset]
return omap.get(asset, [])

@api_method
def get_order(self, order_id):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,6 @@ def test_open_orders():
orders = algo.get_open_orders(a1)
assert len(orders) == 2
assert orders[0].id == 'o01'

a0 = algo.symbol('ASSET0')
assert len(algo.get_open_orders(a0)) == 0

0 comments on commit 292c1b7

Please sign in to comment.