Added functionality reqPositionsMulti#25
Open
paramkr2 wants to merge 3 commits intoib-api-reloaded:mainfrom
Open
Added functionality reqPositionsMulti#25paramkr2 wants to merge 3 commits intoib-api-reloaded:mainfrom
paramkr2 wants to merge 3 commits intoib-api-reloaded:mainfrom
Conversation
|
Lol implemented it a long ago. Just fixed it. async def reqTickersAsync(
self,genericTickList='', *contracts: Contract):
s=self._ibsource.ibrem.ib
futures = []
tickers = []
reqIds = []
contracts = set(list(contracts))
for contract in contracts:
reqId = s.client.getReqId()
reqIds.append(reqId)
future = s.wrapper.startReq(reqId, contract)
futures.append(future)
ticker = s.wrapper.startTicker(reqId, contract, "mktData")
tickers.append(ticker)
def kk(reqId,contract,aa):
logging.debug(('called', reqId))
#s.cancelMktData(contract)
s.wrapper._endReq(reqId)
ticker.updateEvent += partial(kk,reqId,contract)
s.client.reqMktData(
reqId, contract,genericTickList=genericTickList,snapshot=False,regulatorySnapshot=False,mktDataOptions=[])
ls=await asyncio.gather(*futures,return_exceptions=True)
logging.debug('gathered')
for w,id in enumerate(ls):
if isinstance(w,Exception):
logging.debug(('error',w,id))
for contract in contracts:
s.cancelMktData(contract)
#s.wrapper.endTicker(ticker, "aa")
logging.debug('ended tickers')
return tickers |
Author
|
@eyalk11 |
|
Hi, I probably didn't understand your use case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.