So I'm playing around with IBsync to create a spread scanner. I'm at the point of retrieving the option chain for a given expiration successfully, where bids and asks are populated for both calls and puts. Suddenly however each bid and ask is then returned at "-1" at opposed to the true value. I'd made no substantial changes to the code, and even after reverting to a working version, I'm getting "-1". Is this a common problem? Why would this happen?
"-1" is usually an indication that there is something wrong. A valid reason for it could be if you ask the price for something for which no price is available. You can easily verify by looking in TWS whether the instrument you are interested in has a bid and/or ask price. Other reasons could be that somehow you are sending the price request for the incorrect instrument. You can verify this by submitting a request for instrument details before submitting the price request.
It is out of market hours, but doesn't explain why they appeared and no longer do. And on TWS the quotes are still displayed
In that case I fear that something is going wrong in resolving the contract's code number ("conid" in IB's terminology).