Skip to content

Commit

Permalink
make sure bracket legs are checked for type FLOAT
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomiku committed Jul 1, 2020
1 parent 37d3443 commit c59cad9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions alpaca_trade_api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,14 @@ def submit_order(self,
if order_class is not None:
params['order_class'] = order_class
if take_profit is not None:
if 'limit_price' in take_profit:
take_profit['limit_price'] = FLOAT(take_profit['limit_price'])
params['take_profit'] = take_profit
if stop_loss is not None:
if 'limit_price' in stop_loss:
stop_loss['limit_price'] = FLOAT(stop_loss['limit_price'])
if 'stop_price' in stop_loss:
stop_loss['stop_price'] = FLOAT(stop_loss['stop_price'])
params['stop_loss'] = stop_loss
resp = self.post('/orders', params)
return Order(resp)
Expand Down

0 comments on commit c59cad9

Please sign in to comment.