MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / reqPnL

Method reqPnL

packages/ibkr/ref/source/pythonclient/ibapi/client.py:3795–3828  ·  view source on GitHub ↗
(self, reqId: int, account: str, modelCode: str)

Source from the content-addressed store, hash-verified

3793 #########################################################################
3794
3795 def reqPnL(self, reqId: int, account: str, modelCode: str):
3796 if self.useProtoBuf(OUT.REQ_PNL):
3797 self.reqPnLProtoBuf(createPnLRequestProto(reqId, account, modelCode))
3798 return
3799
3800 self.logRequest(current_fn_name(), vars())
3801
3802 if not self.isConnected():
3803 self.wrapper.error(NO_VALID_ID, currentTimeMillis(), NOT_CONNECTED.code(), NOT_CONNECTED.msg())
3804 return
3805
3806 if self.serverVersion() < MIN_SERVER_VER_PNL:
3807 self.wrapper.error(
3808 NO_VALID_ID,
3809 currentTimeMillis(),
3810 UPDATE_TWS.code(),
3811 UPDATE_TWS.msg() + " It does not support PnL request.",
3812 )
3813 return
3814
3815 try:
3816 msg = (
3817 make_field(reqId)
3818 + make_field(account)
3819 + make_field(modelCode)
3820 )
3821 self.sendMsg(OUT.REQ_PNL, msg)
3822
3823 except ClientException as ex:
3824 self.wrapper.error(reqId, currentTimeMillis(), ex.code, ex.msg + ex.text)
3825 return
3826 except Exception as ex:
3827 self.wrapper.error(reqId, currentTimeMillis(), FAIL_SEND_REQPNL.code(), FAIL_SEND_REQPNL.msg() + str(ex))
3828 return
3829
3830 def reqPnLProtoBuf(self, pnlRequestProto: PnLRequestProto):
3831 if pnlRequestProto is None:

Callers

nothing calls this directly

Calls 13

useProtoBufMethod · 0.95
reqPnLProtoBufMethod · 0.95
logRequestMethod · 0.95
isConnectedMethod · 0.95
serverVersionMethod · 0.95
sendMsgMethod · 0.95
createPnLRequestProtoFunction · 0.90
current_fn_nameFunction · 0.90
currentTimeMillisFunction · 0.90
make_fieldFunction · 0.90
errorMethod · 0.65
codeMethod · 0.45

Tested by

no test coverage detected