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
33.38k stars 7.57k forks source link

Error opening trade: binance {"code":-4131,"msg":"The counterparty's best price does not meet the PERCENT_PRICE filter limit. #21792

Open kAgotsi opened 8 months ago

kAgotsi commented 8 months ago

Operating System

linux

Programming Languages

Python

CCXT Version

4.1.68

Description

I got issue :

Error opening trade: binance {"code":-4131,"msg":"The counterparty's best price does not meet the PERCENT_PRICE filter limit. when creating order buy or sell, how can, I fix that?

Code

    order = binance.create_market_buy_order(symbol, 1) if type_action == 'buy' else binance.create_market_sell_order(symbol, 1)

#symbol can be SOL/USDT:USDT
kAgotsi commented 8 months ago

Sometimes it's working

sc0Vu commented 8 months ago

@kAgotsi could you provide verbose log?

kAgotsi commented 8 months ago

@sc0Vu, thanks you for your comment, Here is verbose log :


fetch Request: binance POST https://testnet.binancefuture.com/fapi/v1/order RequestHeaders: {'X-MBX-APIKEY': '5a377', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'python-requests/2.31.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'} RequestBody: timestamp=1710867157298&symbol=SOLUSDT&side=BUY&newClientOrderId=x-xcKt4bc48&newOrderRespType=RESULT&type=MARKET&quantity=1&recvWindow=10000&signature=29b869279d3d6bc3d37

fetch Response: binance POST https://testnet.binancefuture.com/fapi/v1/order 400 ResponseHeaders: {'Content-Type': 'application/json', 'Content-Length': '98', 'Connection': 'keep-alive', 'Date': 'Tue, 19 Mar 2024 16:52:37 GMT', 'Server': 'Bengine', 'x-mbx-used-weight-1m': '-1', 'x-mbx-order-count-10s': '2', 'x-mbx-order-count-1m': '2', 'x-response-time': '36ms', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 ec0e2f034bee82259de23281111aa344.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'CDG50-C1', 'X-Amz-Cf-Id': 'rpJ_P1DJt0M-g2BzS6JxCXh_3z1v5yAHXJ5EKns18BR2UUdBUhq1dA=='} ResponseBody: {"code":-4131,"msg":"The counterparty's best price does not meet the PERCENT_PRICE filter limit."}
Error opening trade: binance {"code":-4131,"msg":"The counterparty's best price does not meet the PERCENT_PRICE filter limit."}
127.0.0.1 - - [19/Mar/2024 17:52:38] "POST / HTTP/1.1" 200 -
1amLeonII commented 4 months ago

I've been getting this error since July 22nd... Who knows how to fix it? ( Screenshot of script - https://joxi.ru/823VdXQiKbEMRm.png

{'code': -1013, 'msg': 'Invalid price.'}

carlosmiei commented 4 months ago

@1amLeonII I can't open that image, which market and price are you using? binance has some rules and you can't place orders using a price too low or too high compared to the current price.

1amLeonII commented 4 months ago

[https://joxi.ru/823VdXQiKbEMRm.png] copy+past this plz..

I only have 58 euros and I put up exactly 58... I even put up 55 euros before, I thought okay, let it be like that... but it still doesn’t work ((

Thank you for answering me quickly)) This gives me optimism...

carlosmiei commented 4 months ago

@1amLeonII First let's avoid images please, hard to read and parse. Second the image shows the code but not the values used at run time. Can you enable the verbose mode and post the log

await exchange.load_markets()
exchange.verbose = True
# createOrder call here
1amLeonII commented 4 months ago

https://pastebin.com/Rzk5Da0z#YcU4usa8 i use this python code ... and the log... binance.log

carlosmiei commented 4 months ago

@1amLeonII the log does not contain the order placement request. Nonetheless, check if your price is inside the values allowed by binance for that market.