Fix register-contract/lookup-contract #6
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.
These functions won't consider
{:symbol "AAPL" :exchange "ISLAND"}
and{:symbol "AAPL" :exchange "ISLAND" :currency "USD"}
as the same security. If I request ticks for both, ib-re-actor will have two entries in@id->contract
and make two requests. I am not sure if Interactive Brokers will send the same ticks for both ticker ids (maybe it will ignore one of them?), but even if it did, this is kind of dumb.Not sure if it would be better to go back to having the client track their own ticker-ids (that was how this used to work, and it was kind of a pain,) or forge onward and implement full-blown tracking of contract details.
The following is just kind of brain-stormy. If no one cares, I will probably try to do this sometime in the future.
I think "full-blown" tracking of contract details would involve:
request-market-data
, we already callregister-contract
to see if we already have a ticker-id to use for this. Inside ofregister-contract
, I think it should look for a match with a comparison function instead of using the contract as a key to lookup the ticker id. I think the comparison function could be pretty simple: if both have some subset of symbol, local-symbol, currency, exchange, contract-id, ..., then use those to compare and it's the same security if you have a match.Writing this out has made me realize it's probably too much stuff for a library that is supposed to be a wrapper. On the other hand I hate to have to implement this every time I build an application that uses ib-re-actor.
I have been considering starting a new project to build a host for trading algorithms. I have a couple of poorly designed applications I could replace if I did this, and it would be easier to maintain than several applications. The host could manage security reference data (as mentioned above) and keep that stuff out of the wrapper library. It would also include facilities to schedule things like activating trading programs at certain times and other market schedule driven processing.
Is anyone interested in pursuing a separate project (and revert to request-id based calls inside ib-re-actor) or should we fix the security reference data inside ib-re-actor?