python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

"One cancels the other" not in python-binance

Open givenx opened this issue 7 years ago • 8 comments

Hi, I know you mentioned here https://github.com/sammchardy/python-binance/issues/207 that OCO is not possible on Binance, but it seems to be, looking at the readme docs on Tony Ho's package using Java here: https://github.com/tony-ho/binance-oco It is a feature on the exchange too (recently added?) so I am hoping it can be incorporated. Is it possible to add this to the package?

givenx avatar Nov 28 '19 22:11 givenx

please!!!

cesarmassri avatar Jan 03 '20 17:01 cesarmassri

Please!!! (2)

roman-hart avatar Jan 09 '20 14:01 roman-hart

i did it with:

params={'symbol':name,'side':'SELL','quantity':qty,'price':"%.8f"%precio_high,'stopPrice':"%.8f"%precio_sl,'stopLimitPrice':"%.8f"%precio_low,'stopLimitTimeInForce':'GTC'} r = client._post('order/oco',True,data=params)

it worked!!!

cesarmassri avatar Jan 09 '20 19:01 cesarmassri

i did it with:

params={'symbol':name,'side':'SELL','quantity':qty,'price':"%.8f"%precio_high,'stopPrice':"%.8f"%precio_sl,'stopLimitPrice':"%.8f"%precio_low,'stopLimitTimeInForce':'GTC'} r = client._post('order/oco',True,data=params)

it worked!!!

Wow, so simple. Thank you!

roman-hart avatar Jan 09 '20 20:01 roman-hart

@cesarmassri thanks a mill for cracking this one. Any idea if there is a way to get the OCO working on the margin side? I cannot get that side to work. I can get this to work for a straight limit but not OCO: client._request_margin_api('post', 'margin/order', signed=True, data=params)

givenx avatar Feb 04 '20 11:02 givenx

Mmm

I have no idea... I didnt read the documentation...

If I figure it out, i let you know

Kind Regards Cesar

El mar., 4 de feb. de 2020 08:09, givenx [email protected] escribió:

@cesarmassri https://github.com/cesarmassri thanks a mill for cracking this one. Any idea if there is a way to get the OCO working on the margin side? I cannot get that side to work. I can get this to work for a straight limit but not OCO: client._request_margin_api('post', 'margin/order', signed=True, data=params)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sammchardy/python-binance/issues/458?email_source=notifications&email_token=ALG5H2M2X7EPOWYGKFT34ELRBFEFLA5CNFSM4JSZB5T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKXHELI#issuecomment-581857837, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG5H2MGHKMCI55XPGXVEFLRBFEFLANCNFSM4JSZB5TQ .

cesarmassri avatar Feb 04 '20 11:02 cesarmassri

Tx @cesarmassri ! I don't think its part of the main exchange yet: ie it is here: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#new-oco-trade but not here: https://github.com/binance-exchange/binance-official-api-docs/blob/master/margin-api.md I don't know how to request this on the main binance-exchange.

givenx avatar Feb 04 '20 12:02 givenx

Tx @cesarmassri ! I don't think its part of the main exchange yet: ie it is here: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#new-oco-trade but not here: https://github.com/binance-exchange/binance-official-api-docs/blob/master/margin-api.md I don't know how to request this on the main binance-exchange.

It is now: https://binance-docs.github.io/apidocs/spot/en/#margin-account-new-oco-trade

Karlheinzniebuhr avatar Jul 15 '22 20:07 Karlheinzniebuhr