ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.44k stars 7.46k forks source link

MEXC Futures broke? #14293

Closed KindSpidey closed 2 years ago

KindSpidey commented 2 years ago

Hey guys! Everything was perfect, my code worked for one month without error. But today it brings me error with all coins. Is it something with my code, MEXC or ccxt?

error mexc {"success":false,"code":1002,"message":"Contract not allow place order!"}

my code

mexc_futures = ccxt.mexc({
        "apiKey": config.MEXC_API_KEY,
        "secret": config.MEXC_SECRET_KEY,
        "options": {'defaultType': 'swap' }
    })
balance = float(exchange.fetch_balance()["USDT"]["free"]) - float(exchange.fetch_balance()["USDT"]["free"]) / 100 * 5
leverage = 0
contractSize = 0
markets = exchange.fetch_markets()
for elem in markets:
    if elem["symbol"] == coin+self.usdt + ":USDT":
        contractSize = elem["contractSize"]
        leverage = int(elem["info"]["maxLeverage"])*self.mexc_leverage
        break
price = float(exchange.fetch_ticker(coin+self.usdt+":USDT")["last"])
amount = float((balance * int(leverage) / price) / contractSize)*0.95
params = {'openType': 1, 'positionType': 1, "leverage": leverage, "type": 5}
exchange.set_leverage(1, coin+self.usdt+":USDT",params)
exchange.create_swap_order(coin + self.usdt + ":USDT", 1, 1, amount, price, params)
kroitor commented 2 years ago

@KindSpidey Let us know if this does not answer your question:

[MEXC]MEXC to Disable The API Trading Function of 10 Perpetual Futures Trading Pairs Dear User: MEXC will be disabling the API trading function of the following 10 futures trading pairs on July 4, 2022, 06:00(UTC). SANDUSDT SHIBUSDT MANAUSDT XRPUSDT ATOMUSDT KNCUSDT DOGEUSDT FITFIUSDT LINKUSDT STEPNUSDT Please Note: After disabling, users will no longer be able to use the API trading function to place orders for the above trading pairs. Any originally held positions can still be operated via web and MEXC App. After disabling, users may still operate any active API orders of the trading pairs mentioned above via web and MEXC App. We strongly advise all users to manage or close any relevant positions in time before the function is disabled to avoid unneccessary losses. Thank you for trading with MEXC Futures! The MEXC Team 03 July 2022


Screenshot 2022-07-10 at 13 11 53
KindSpidey commented 2 years ago

Thanks man, i've tested it on this coins

rsooo commented 2 years ago

I have got same error in "SOL_USDT" which is not disabled. Is it working now ?