Skip to content

Commit

Permalink
Fix ERROR:ibapi.wrapper:ERROR 25 200 No security definition has been …
Browse files Browse the repository at this point in the history
…found for the request (#36)

* Fix contract details error when subscribing to a portfolio.  Resolves #33.
  • Loading branch information
chipkent authored Mar 2, 2022
1 parent 483bdbc commit 172f2ec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/deephaven_ib/_tws/tws_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,14 @@ def accountSummary(self, reqId: int, account: str, tag: str, value: str, currenc

def positionMulti(self, reqId: int, account: str, modelCode: str, contract: Contract, pos: float, avgCost: float):
EWrapper.positionMulti(self, reqId, account, modelCode, contract, pos, avgCost)

# The returned contract seems to be inconsistent with IB's API to request contract details.
# This hack is to work around the problem.
# See https://github.com/deephaven-examples/deephaven-ib/issues/33

if contract.secType == "STK":
contract.exchange = "SMART"

self._table_writers["accounts_positions"].write_row(
[reqId, account, modelCode, *logger_contract.vals(contract), pos, avgCost])

Expand Down

0 comments on commit 172f2ec

Please sign in to comment.