Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit price parameter for stop loss orders #451

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions cbpro/authenticated_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ def place_market_order(self, product_id, side, size=None, funds=None,

return self.place_order(**params)

def place_stop_order(self, product_id, stop_type, price, size=None, funds=None,
def place_stop_order(self, product_id, stop_type, price, limit_price=None,
size=None, funds=None,
client_oid=None,
stp=None,
overdraft_enabled=None,
Expand All @@ -432,6 +433,7 @@ def place_stop_order(self, product_id, stop_type, price, size=None, funds=None,
loss: Triggers when the last trade price changes to a value at or below the stop_price.
entry: Triggers when the last trade price changes to a value at or above the stop_price
price (Decimal): Desired price at which the stop order triggers.
limit_price (Decimal): Limit price when stop order is triggered (defaults to stop price)
size (Optional[Decimal]): Desired amount in crypto. Specify this or
`funds`.
funds (Optional[Decimal]): Desired amount of quote currency to use.
Expand Down Expand Up @@ -460,7 +462,7 @@ def place_stop_order(self, product_id, stop_type, price, size=None, funds=None,

params = {'product_id': product_id,
'side': side,
'price': price,
'price': price if limit_price is None else limit_price,
'order_type': None,
'stop': stop_type,
'stop_price': price,
Expand Down