76 lines
2.2 KiB
Python
76 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Check ETHUSDC Trading Rules and Precision
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add project root to path
|
|
project_root = Path(__file__).parent
|
|
sys.path.insert(0, str(project_root))
|
|
|
|
from NN.exchanges.mexc_interface import MEXCInterface
|
|
|
|
def check_ethusdc_precision():
|
|
"""Check ETHUSDC trading rules"""
|
|
print("Checking ETHUSDC Trading Rules...")
|
|
print("=" * 50)
|
|
|
|
# Get API credentials
|
|
api_key = os.getenv('MEXC_API_KEY', '')
|
|
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
|
|
|
if not api_key or not api_secret:
|
|
print("❌ No MEXC API credentials found")
|
|
return
|
|
|
|
# Create MEXC interface
|
|
mexc = MEXCInterface(api_key=api_key, api_secret=api_secret, test_mode=False)
|
|
|
|
if not mexc.connect():
|
|
print("❌ Failed to connect to MEXC API")
|
|
return
|
|
|
|
print("✅ Connected to MEXC API")
|
|
|
|
# Check if ETHUSDC is supported
|
|
if mexc.is_symbol_supported("ETH/USDT"): # Will be converted to ETHUSDC
|
|
print("✅ ETHUSDC is supported for trading")
|
|
else:
|
|
print("❌ ETHUSDC is not supported for trading")
|
|
return
|
|
|
|
# Get current ticker to see price
|
|
ticker = mexc.get_ticker("ETH/USDT") # Will query ETHUSDC
|
|
if ticker:
|
|
price = ticker.get('last', 0)
|
|
print(f"Current ETHUSDC Price: ${price:.2f}")
|
|
|
|
# Test different quantities to find minimum
|
|
test_quantities = [
|
|
0.001, # $3 worth
|
|
0.01, # $30 worth
|
|
0.1, # $300 worth
|
|
0.009871, # Our calculated quantity
|
|
]
|
|
|
|
print("\nTesting different quantities:")
|
|
print("-" * 30)
|
|
|
|
for qty in test_quantities:
|
|
rounded_qty = round(qty, 6)
|
|
value_usd = rounded_qty * price if ticker else 0
|
|
print(f"Quantity: {rounded_qty:8.6f} ETH (~${value_usd:.2f})")
|
|
|
|
print(f"\nOur test quantity: 0.009871 ETH")
|
|
print(f"Rounded to 6 decimals: {round(0.009871, 6):.6f} ETH")
|
|
print(f"Value: ~${round(0.009871, 6) * price:.2f}")
|
|
|
|
print("\nNext steps:")
|
|
print("1. Check if minimum order value is $10+ USD")
|
|
print("2. Try with a larger quantity (0.01 ETH = ~$30)")
|
|
|
|
if __name__ == "__main__":
|
|
check_ethusdc_precision() |