Good day to everyone. I do not face any problem when creating margin long order and paying loan back. But when I try to create a short order, I get an error. First, the borrowing function from the system works, but when creating a margin order I am getting APIError(code=-1013): Filter failure: LOT_SIZE. I tried multiplication by 0.99 but it didn't work. I've searched before on many different pages to see if there is an article about it. Please do not redirect to a different page.
class ShortOrderEntry(Order):
def __init__(self):
self.acc = Account.getInstance()
def Execute(self):
try:
self.GetBtcLoan()
order = self.acc.client.create_margin_order(symbol="BTCUSDT", side=SIDE_SELL, isIsolated='TRUE',
type=ORDER_TYPE_MARKET,
quantity=self.acc.FloorPrecisionFix(
self.MaxBTCAmount() / 100 * 99, 6))
print(order)
except Exception as e:
print("Something Went Wrong While Entering Short Enter Position", e)
def GetBtcLoan(self):
try:
self.acc.client.create_margin_loan(asset="BTC", amount=self.MaxBTCAmount(), symbol="BTCUSDT",
isIsolated='TRUE')
except Exception as e:
print("Something Went Wrong While taking short entry loan", e)
def MaxBTCAmount(self):
return self.acc.FloorPrecisionFix(self.acc.GetMaxMarginAmount("BTC") / 100 * 99, 6)