gogo2/crypto/gogo2/test_mexc_api.py
2025-03-12 00:56:32 +02:00

23 lines
664 B
Python

from mexc_api.spot import Spot
def test_mexc_api():
try:
# Initialize client with empty API keys for public endpoints
client = Spot("", "")
# Test server time endpoint
server_time = client.market.server_time()
print(f"Server time: {server_time}")
# Test ticker price endpoint
ticker = client.market.ticker_price("ETHUSDT")
print(f"ETH/USDT price: {ticker}")
print("MEXC API is working correctly!")
return True
except Exception as e:
print(f"Error testing MEXC API: {e}")
return False
if __name__ == "__main__":
test_mexc_api()