[docs]classPosition:def__init__(self,data:PositionResponse,client:'WTClient',auto_refresh:bool):self._PositionResponse:PositionResponse=data#: raw response data from APIself.client:'WTClient'=client#: the WTClient object that created this instanceself.auto_refresh:bool=auto_refresh#: auto_refresh toggle inherited from WTClientself.number:str=data.number#: Position numberself.status:Literal['OPEN','CLOSED']=data.status#: Position statusself.bot:Bot=data.bot#: Bot objectself.broker_connection:BaseBrokerConnection=data.broker_connection#: Broker connectionself.is_paper:bool=data.is_paper#: If this is a paper positionself.tags:str=data.tags#: Tagsself.symbol:str=data.symbol#: Symbolself.type:str=data.type#: Typeself.entered_at:datetime=data.entered_at#: Entered atself.exited_at:Optional[datetime]=data.exited_at#: Exited atself.entry_bid:float=data.entry_bid#: Entry bidself.entry_ask:float=data.entry_ask#: Entry askself.entry_price:float=data.entry_price#: Entry priceself.exit_bid:Optional[float]=data.exit_bid#: Exit bidself.exit_ask:Optional[float]=data.exit_ask#: Exit askself.exit_price:Optional[float]=data.exit_price#: Exit priceself.broker_fee:Optional[float]=data.broker_fee#: Broker feeself.current_bid:Optional[float]=data.current_bid#: Current bidself.current_mid:Optional[float]=data.current_mid#: Current midself.current_ask:Optional[float]=data.current_ask#: Current askself.current_profit:Optional[float]=data.current_profit#: Current profitself.current_delta:Optional[float]=data.current_delta#: Current deltaself.entry_value:float=data.entry_value#: Entry valueself.exit_value:Optional[float]=data.exit_value#: Exit valueself.max_risk:float=data.max_risk#: Max riskself.profit_dollars:Optional[float]=data.profit_dollars#: Profit dollarsself.starting_balance:float=data.starting_balance#: Starting balanceself.ending_balance:Optional[float]=data.ending_balance#: Ending balanceself.underlying_at_entry:float=data.underlying_at_entry#: Underlying at entryself.underlying_at_exit:Optional[float]=data.underlying_at_exit#: Underlying at exitself.vix_at_entry:float=data.vix_at_entry#: VIX at entryself.vix_at_exit:Optional[float]=data.vix_at_exit#: VIX at exitself.legs:List[PositionLeg]=data.legs#: Legs
[docs]defclose(self):""" Close this specific bot position. This is only valid during market hours and while the bot is set to Enabled or Disable on Close. Auth Required: Write Positions """response=self.client.session.put(f"{self.client.endpoint}bots/positions/{self.number}/close",headers=self.client.headers)response=BaseResponse(**orjson.loads(response.text))ifresponse.success:self.__init__(PositionResponse(**response.data),self.client,self.auto_refresh)returnresponse.messageelse:raiseAPIError(response.message)