I'd like to place a trade in either TD Ameritrade or Interactive Brokers via their API that has two parts. It's an OTO trade (one triggers the other). The first is a purchase order at market price, and the second is a trailing stop loss attached to that market order calculated from the average true range (ATR). If possible, I'd like this to be written in Python. Please let me know if you require any additional information other than the account login info, the ticker and the parameters for the ATR.