I have modified the Excel spreadsheet IB provides with their API download to allow futures pair trading (ES/NQ, EMD/TF). It gets quotes(bid, ask, last, size etc.) using DDE - and once the quotes for the legs are in, it's very easy to calculate your spread values. It works reasonably well for me. But what I do not like about it is that when conditions are met, it sends both legs as a market order. It should be possible to write code to work the legs separately and (possibly) get a tick better execution, but I never bothered. Other than that, it works reasonably well. I set it for a target price and if the spread price is met, it sends order automatically to TWS using DDE.
I don't do stocks, but see absolutely no reason why a similar arrangement would not work for stock, option, futures option, whatever.