(self, reqId: int, account: str, modelCode: str)
| 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: |
nothing calls this directly
no test coverage detected