Any clue you can give on which instrument generate it ? At what time ?
How many rows did you look for ?
What did you choose for isSmartDepth ?
I would be very interested to know if you still see updateMktDepth messages arriving after your 317 for the same reqid. This is a sine qua non condition to avoid re-doing a request
I don't see any rationalized method to avoid it as I see this as a message from IB that should be implemented (many errors are to be seen as message).
Nothing I foresee that can be done from client side, but if I have to guess I would say that isSmartDepth? may influence this.
The full message is "Market depth data has been RESET. Please empty deep book contents before applying any new entries."
As I can't reproduce at will, I can only tell you what I implemented as a provision: If I receive a 317 then I do what IB asks:
I purge my bank, and de-facto expect to only receive types 2, or 1 only after I received a first set of new insert (0).? At least I assert that next new message will be an insert.
Note:
I have a counter averaging the number of entries I should expect and restart the algo only once I reach this threshold/2? (to avoid taking decision on too few entries) this of course depend upon your algo.
What I didn't do and probably should, is to call again to update the exch mapping. It may have changed (unlikely that it did change a lot, hence lack of motivation to finish this part, also this require a new request) Anyway at least a mapping to an unknown exchange throw an exception.
Unless mistaken this approach doesn't need to restart a new request (as opposed to error like the 316) hence can stay in same processing thread, but again it's a provision and I have/had no method to QA it