tedchou12 / webull

Unofficial APIs for Webull.
MIT License
597 stars 183 forks source link

Is there a way to set Stop loss and Profit Target for existing Positions? #276

Closed FunTrade closed 9 months ago

FunTrade commented 2 years ago

Hi I tried using multiple options but was not able to figure out on how to place a Stop Loss / Take Profit order for an existing position.

Example:

image

FunTrade commented 2 years ago

I see they are placing it as newOrder: {newOrders: [{shortSupport: true, orderType: "STP", timeInForce: "GTC", quantity: 14,…},…],…} newOrders: [{shortSupport: true, orderType: "STP", timeInForce: "GTC", quantity: 14,…},…] 0: {shortSupport: true, orderType: "STP", timeInForce: "GTC", quantity: 14,…} action: "SELL" auxPrice: "68.67" comboType: "STOP_LOSS" lmtPrice: null orderType: "STP" outsideRegularTradingHour: false quantity: 14 serialId: "159a6613-f12a-42dd-aa32-542ccb4694e2" shortSupport: true tickerId: 913255097 timeInForce: "GTC" 1: {shortSupport: true, orderType: "LMT", timeInForce: "GTC", quantity: 14,…} action: "SELL" auxPrice: null comboType: "STOP_PROFIT" lmtPrice: "83.93" orderType: "LMT" outsideRegularTradingHour: false quantity: 14 serialId: "31f28dda-2b7d-404b-955e-a5a1a18c959d" shortSupport: true tickerId: 913255097 timeInForce: "GTC" serialId: "84a951fc-8552-4049-adef-3888f11abe4b"

tedchou12 commented 2 years ago

yes~ try setting the stpPrice place_order(self, stock=None, tId=None, price=0, action='BUY', orderType='LMT', enforce='GTC', quant=0, outsideRegularTradingHour=True, stpPrice=None, trial_value=0, trial_type='DOLLAR')

for take profit orders, why don't you just set a limit order?