pilwon / node-ib

Interactive Brokers TWS API client library for Node.js
380 stars 133 forks source link

can’t get quote for MSFT #153

Open vw550 opened 4 years ago

vw550 commented 4 years ago

I can get historical quotes for most stocks, but for MSFT I get the error: “The contract specified for MSFT is ambiguous”. Reading on IB forum it looks like I need to set the “primary exchange” in order to remove the ambiguity, which I gather is ISLAND??.
With node-in, I don’t see how this is possible?? Any help in resolving this error greatly appreciated!! Thanks!

tredondo commented 4 years ago

It's the weekend and IB's servers are hosed as usual, but what happens when you pass the exchange to ib.contrack.stock('MSFT', 'ISLAND', 'USD')? How about when passing 'SMART'?

https://github.com/pilwon/node-ib/blob/master/lib/contract/stock.js

The primary exchange is returned by reqContractDetails, rather than something you supply.

vw550 commented 4 years ago

I’ve tried with just ‘SMART’ and just ‘ISLAND’ and tried to combine as in ‘SMART/ISLAND’ and got the same error each time of “ambiguous”. But my code works fine for GOOG, TSLA, etc. it seems I need a setContractDetails function...