Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling multiple prices simultaneously #57

Open
DenymW opened this issue Aug 7, 2017 · 0 comments
Open

Calling multiple prices simultaneously #57

DenymW opened this issue Aug 7, 2017 · 0 comments

Comments

@DenymW
Copy link

DenymW commented Aug 7, 2017

Hi all,
Currently trying to set up a call to get prices for multiple stocks at once. currently the client is being passed an inputArray of [[stockID, stockContract], [etc,etc]] where the stock ID is the tickID to be used for the given contract.

code:
def get_IB_market_data(self, inputArray, seconds = 5)
marketData = []
for tickID, contract in inputArray:
self.cb.init_tickdata(tickID)
self.cb.init_error()

  for tickID, contract in inputArray:
      self.tws.reqMktData(tickID, contract, "", False)
 start_time = time.time
 finished = False
 iserror = False
 while not finished andnot iserror:
       iserror = self.cb.flagh_iserror
       if (time.time() - start_time) > seconds:
            finished = True
       pass
  for tickID, contract in inputArray:
        self.tws.cancelMktData(tickID)
        marketData.append([tickID, self.cb.data_tickdata[tickID]])
  if iserror:
  *standard is error*
  return marketData

currently when it runs the error is the following:
self.tws.reqMktData(tickID, contract, "", False)
TypeError: in method 'EClientSocketBase_reqMktyData', argument 2 of type 'TickerId'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant