Does anyone have a sample code for trading on the DEX DYDX exchange?

A certain amount will be in the smart contract, and the purchase of purp. and sale should be made from it. For example, eth (long, short) is a purchase and then a sale. buy - sell