burakoner / OKEx.Net

Open source .Net API wrapper for the @OKEx V5 Rest API and V5 Websocket API
MIT License
86 stars 48 forks source link

How to use stoploss and take profit? #86

Closed mytran1998 closed 1 year ago

mytran1998 commented 1 year ago

Hey bro, I have a question need support of you.

I want create order have stop loss and take profit. I use PlaceAlgoOrder but it wrong. You can help me a code example? Thanks very much :)

arashreshadi commented 1 year ago

any luck?

mytran1998 commented 1 year ago

No, I dont create it

arashreshadi commented 1 year ago

I have done it with the pure HttpWebRequest, and use the okex.net for subscibing the channels

overstartup commented 1 year ago

it just works in one side. You can use "OkexAlgoOrderType.Conditional" but it just triggers stop lost. it is better to send auto trigger in your code and active the profit.

          StopProfitResult = api.PlaceAlgoOrder(preOrder.Symbol, trademode, orderSide, OkexAlgoOrderType.Conditional,
                      preOrder.Quantity, positionSide: positionSide, slOrderPrice: -1, slTriggerPrice: preOrder.StopLostPrice);