I did a bit of looking into this, here is some basic code to start with:
You can change the AD-AMEX & AMEX to AD-NYSE & NYSE
The marketDataType(3) gives me delayed data since I'm not subscribed to that index data. The code below gave the the same numbers as shown for Advancing Issues and Declining Issues as seen in the Market Statistics tab. I'll check on getting the other numbers.
sym = 'AD-AMEX'
ex = 'AMEX'
contract = Contract(secType='IND', symbol=sym, exchange=ex, currency='USD')
ib.qualifyContracts(contract)
ib.reqMarketDataType(3)
data = ib.reqMktData(contract)
ib.sleep(2)
AdvIssuses = data.bid
DecIssuses = data.ask
print(AdvIssuses)
print(DecIssuses)
Cheers,
Mel