How do I reverse a position via API?

There is not a function to reverse a position either via the TWS API or the Web API. However, by requesting position data, and then placing an order, you can mimic this functionality. For relevant documentation links:

TWS API:

Web API:

Powered by IBot
How do I obtain historical data via API?
Do you offer tick-by-tick data via the API?
What order types are supported in the TWS API?
How to pause orders using the TWS API?