# Set leverage to be 5x for all cross-margin BTC-USDT SWAP positions, # by providing the SWAP instId result = accountAPI.set_leverage( instId = "BTC-USDT-SWAP", lever = "5", mgnMode = "cross" ) print(result) # In buy/sell position mode, set leverage to be 5x # for all isolated-margin BTC-USDT SWAP positions # by providing the SWAP instId result = accountAPI.set_leverage( instId = "BTC-USDT-SWAP", lever = "5", mgnMode = "isolated" ) print(result) # In long/short position mode, set leverage to be 5x # for an isolated-margin BTC-USDT-SWAP long position; # This does NOT affect the leverage of the BTC-USDT-SWAP # short positions result = accountAPI.set_leverage( instId = "BTC-USDT-SWAP", lever = "5", posSide = "long", mgnMode = "isolated" ) print(result)