Closed JonasSteur closed 3 years ago
i was able to work around this using the regular .sell with limit function and adding the stop and stop_price args as follows:
response = auth_client.sell(price=str(LIMIT_PRICE),
size=str(QTY),
order_type='limit',
stop='loss',
stop_price=str(LIMIT_PRICE),
product_id=str(SYMBOLUSD))
This looks great! Just one minor thing - in the assert r['stop_price]'
line in the test, I'm getting '100' back from the sandbox, not '100.00000000'. Perhaps this behavior has changed since your PR? Is this what you get now as well? I'd like to merge this with a passing test. Thanks!
@jacov - So you set the 'price' and 'stop_price' to the desired Stop loss price? Since the Stop_Loss prices is typically below the current price, this will not be a problem with this Limit price?
Since you used the 'LIMIT_PRICE' for both 'price and 'stop_price' I was concerned.
Made a few minor changes to get the merge in. Thanks again.
Related issue: https://github.com/danpaquin/coinbasepro-python/issues/368
A 'stop' isn't an actual order type but is actually a special flavour of a limit order. The 'stop' and 'stop_price' params need to be set.
There are 2 stop types:
Modified existing test and added new test to check for invalid combinations.