Right now im encontering issue such as
binance.exceptions.BinanceAPIException: APIError(code=0): Invalid JSON error message from Binance: <bound method ClientResponse.text of <ClientResponse(https://testnet.binance.vision/api/v3/ping) [502 Bad Gateway]>
<CIMultiDictProxy('Content-Type': 'text/html; charset=utf-8', 'Content-Length': '552', 'Connection': 'keep-alive', 'Date': 'Wed, 07 Feb 2024 12:55:03 GMT', 'Server': 'nginx', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains', 'X-Frame-Options': 'SAMEORIGIN', 'X-Xss-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "default-src 'self'", 'X-Content-Security-Policy': "default-src 'self'", 'X-WebKit-CSP': "default-src 'self'", 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 c693f726984a8df599aa5d0995d1697c.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'WAW51-P4', 'X-Amz-Cf-Id': 'QW7Nnawj9gRZkBmqV3ZGUXR33IGoYoBb6DUi8QpfCKEVmd-4H4Pncg==')>
with this code
async def place_limit_order(
api_key,
api_secret,
symbol,
quantity,
price,
# stop_price,
side,
order_type,
testnet=True,
):
client = await AsyncClient.create(api_key, api_secret, testnet=testnet)
try:
order_params = {
"symbol": symbol,
"side": side,
"type": order_type,
"positionSide": "BOTH",
"quantity": quantity,
}
if order_type == "LIMIT":
order_params.update(
{
"timeInForce": "GTC",
"price": price,
"priceProtect": True,
}
)
elif order_type == "MARKET":
order_params.update(
{
"type": "MARKET",
}
)
# For TP and SL orders, add stopPrice and workingType
order_params.update(
{
# "stopPrice": stop_price,
"workingType": "MARK_PRICE",
# "closePosition": True,
"priceProtect": True,
}
)
# Place the order
order = await client.futures_create_order(**order_params)
logger.info(f"{order_type} order placed successfully: {order}")
Yesterday everything worked fine, but today I get the same error as above