86 lines
3.6 KiB
Python
86 lines
3.6 KiB
Python
import requests
|
|
|
|
# Check ETHUSDC precision requirements on MEXC
|
|
try:
|
|
# Get symbol information from MEXC
|
|
resp = requests.get('https://api.mexc.com/api/v3/exchangeInfo')
|
|
data = resp.json()
|
|
|
|
print('=== ETHUSDC SYMBOL INFORMATION ===')
|
|
|
|
# Find ETHUSDC symbol
|
|
ethusdc_info = None
|
|
for symbol_info in data.get('symbols', []):
|
|
if symbol_info['symbol'] == 'ETHUSDC':
|
|
ethusdc_info = symbol_info
|
|
break
|
|
|
|
if ethusdc_info:
|
|
print(f'Symbol: {ethusdc_info["symbol"]}')
|
|
print(f'Status: {ethusdc_info["status"]}')
|
|
print(f'Base Asset: {ethusdc_info["baseAsset"]}')
|
|
print(f'Quote Asset: {ethusdc_info["quoteAsset"]}')
|
|
print(f'Base Asset Precision: {ethusdc_info["baseAssetPrecision"]}')
|
|
print(f'Quote Asset Precision: {ethusdc_info["quoteAssetPrecision"]}')
|
|
|
|
# Check order types
|
|
order_types = ethusdc_info.get('orderTypes', [])
|
|
print(f'Allowed Order Types: {order_types}')
|
|
|
|
# Check filters for quantity and price precision
|
|
print('\nFilters:')
|
|
for filter_info in ethusdc_info.get('filters', []):
|
|
filter_type = filter_info['filterType']
|
|
print(f' {filter_type}:')
|
|
for key, value in filter_info.items():
|
|
if key != 'filterType':
|
|
print(f' {key}: {value}')
|
|
|
|
# Calculate proper quantity precision
|
|
print('\n=== QUANTITY FORMATTING RECOMMENDATIONS ===')
|
|
|
|
# Find LOT_SIZE filter for minimum order size
|
|
lot_size_filter = None
|
|
min_notional_filter = None
|
|
for filter_info in ethusdc_info.get('filters', []):
|
|
if filter_info['filterType'] == 'LOT_SIZE':
|
|
lot_size_filter = filter_info
|
|
elif filter_info['filterType'] == 'MIN_NOTIONAL':
|
|
min_notional_filter = filter_info
|
|
|
|
if lot_size_filter:
|
|
step_size = lot_size_filter['stepSize']
|
|
min_qty = lot_size_filter['minQty']
|
|
max_qty = lot_size_filter['maxQty']
|
|
print(f'Min Quantity: {min_qty}')
|
|
print(f'Max Quantity: {max_qty}')
|
|
print(f'Step Size: {step_size}')
|
|
|
|
# Count decimal places in step size to determine precision
|
|
decimal_places = len(step_size.split('.')[-1].rstrip('0')) if '.' in step_size else 0
|
|
print(f'Required decimal places: {decimal_places}')
|
|
|
|
# Test formatting our problematic quantity
|
|
test_quantity = 0.0028169119884018344
|
|
formatted_quantity = round(test_quantity, decimal_places)
|
|
print(f'Original quantity: {test_quantity}')
|
|
print(f'Formatted quantity: {formatted_quantity}')
|
|
print(f'String format: {formatted_quantity:.{decimal_places}f}')
|
|
|
|
# Check if our quantity meets minimum
|
|
if formatted_quantity < float(min_qty):
|
|
print(f'❌ Quantity {formatted_quantity} is below minimum {min_qty}')
|
|
min_value_needed = float(min_qty) * 2665 # Approximate ETH price
|
|
print(f'💡 Need at least ${min_value_needed:.2f} to place minimum order')
|
|
else:
|
|
print(f'✅ Quantity {formatted_quantity} meets minimum requirement')
|
|
|
|
if min_notional_filter:
|
|
min_notional = min_notional_filter['minNotional']
|
|
print(f'Minimum Notional Value: ${min_notional}')
|
|
|
|
else:
|
|
print('❌ ETHUSDC symbol not found in exchange info')
|
|
|
|
except Exception as e:
|
|
print(f'Error: {e}') |