I’m doing a bot that gives order to buy or sell coins (in MEXC) but I have a problem with giving orders.
I tried this code
import ccxt
api_key = KEY
secret = SECRET
exchange = ccxt.mexc({
'apiKey': api_key,
'secret': secret,
'options': {
'createMarketBuyOrderRequiresPrice': False,
}
})
symbol = 'LBTCUSDT'
amount_in_usd = 10
ticker = exchange.fetch_ticker(symbol)
current_price = ticker['last']
amount_in_btc = amount_in_usd / current_price
order = exchange.create_order(symbol, 'market', 'buy', amount_in_btc)
print(order)
but it gives ccxt.base.errors.InsufficientFunds: mexc {"msg":"Insufficient position","code":30004}
error.
New contributor
can yildiz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.