remove emojis from console
This commit is contained in:
@@ -324,10 +324,10 @@ class BybitRestClient:
|
||||
"""
|
||||
try:
|
||||
result = self.get_server_time()
|
||||
logger.info("✅ Bybit REST API connectivity test successful")
|
||||
logger.info(" Bybit REST API connectivity test successful")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Bybit REST API connectivity test failed: {e}")
|
||||
logger.error(f" Bybit REST API connectivity test failed: {e}")
|
||||
return False
|
||||
|
||||
def test_authentication(self) -> bool:
|
||||
@@ -338,8 +338,8 @@ class BybitRestClient:
|
||||
"""
|
||||
try:
|
||||
result = self.get_account_info()
|
||||
logger.info("✅ Bybit REST API authentication test successful")
|
||||
logger.info(" Bybit REST API authentication test successful")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Bybit REST API authentication test failed: {e}")
|
||||
logger.error(f" Bybit REST API authentication test failed: {e}")
|
||||
return False
|
||||
@@ -256,7 +256,7 @@ Each exchange was scored (1-5) across four weighted categories:
|
||||
| Criteria | Deribit | Binance | Bybit | OKX |
|
||||
|-------------------|---------------|---------------|---------------|---------------|
|
||||
| **Max Leverage** | 10× | 75× | 100× | 10× |
|
||||
| **Market Orders** | ✅ | ✅ | ✅ | ✅ |
|
||||
| **Market Orders** | | | | |
|
||||
| **Base Fee** | 0% maker | 0.02% maker | -0.01% maker | 0.02% maker |
|
||||
| **Python SDK** | Official | Robust | Low-latency | Full-featured |
|
||||
| **HFT Suitability**| ★★★★☆ | ★★★★★ | ★★★★☆ | ★★★☆☆ |
|
||||
|
||||
@@ -27,7 +27,7 @@ def test_final_mexc_order():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return
|
||||
|
||||
# Parameters
|
||||
@@ -68,9 +68,9 @@ def test_final_mexc_order():
|
||||
print(f"Response: {response.text}")
|
||||
|
||||
if response.status_code == 200:
|
||||
print("✅ SUCCESS!")
|
||||
print(" SUCCESS!")
|
||||
else:
|
||||
print("❌ FAILED")
|
||||
print(" FAILED")
|
||||
# Try alternative method - sending as query params
|
||||
print("\n--- Trying alternative method ---")
|
||||
test_alternative_method(api_key, api_secret)
|
||||
|
||||
@@ -59,7 +59,7 @@ def test_mexc_order_placement():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return
|
||||
|
||||
# Test parameters - very small order
|
||||
@@ -105,7 +105,7 @@ def test_mexc_order_placement():
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
print("✅ Order placed successfully!")
|
||||
print(" Order placed successfully!")
|
||||
print(f"Order result: {result}")
|
||||
|
||||
# Try to cancel it immediately if we got an order ID
|
||||
@@ -131,11 +131,11 @@ def test_mexc_order_placement():
|
||||
print(f"Cancel response: {cancel_response.status_code} - {cancel_response.text}")
|
||||
|
||||
else:
|
||||
print("❌ Order placement failed")
|
||||
print(" Order placement failed")
|
||||
print(f"Response: {response.text}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Request error: {e}")
|
||||
print(f" Request error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_mexc_order_placement()
|
||||
@@ -59,7 +59,7 @@ def test_mexc_order_v2():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return
|
||||
|
||||
# Order parameters matching MEXC examples
|
||||
@@ -99,19 +99,19 @@ def test_mexc_order_v2():
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
print("✅ Order placed successfully!")
|
||||
print(" Order placed successfully!")
|
||||
print(f"Order result: {result}")
|
||||
|
||||
# Cancel immediately if successful
|
||||
if 'orderId' in result:
|
||||
print(f"\n🔄 Canceling order {result['orderId']}...")
|
||||
print(f"\n Canceling order {result['orderId']}...")
|
||||
cancel_order(api_key, api_secret, 'ETHUSDC', result['orderId'])
|
||||
|
||||
else:
|
||||
print("❌ Order placement failed")
|
||||
print(" Order placement failed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Request error: {e}")
|
||||
print(f" Request error: {e}")
|
||||
|
||||
def cancel_order(api_key: str, secret_key: str, symbol: str, order_id: str):
|
||||
"""Cancel a MEXC order"""
|
||||
|
||||
@@ -42,7 +42,7 @@ def test_mexc_order_v3():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return
|
||||
|
||||
# Order parameters exactly like the examples
|
||||
@@ -92,19 +92,19 @@ def test_mexc_order_v3():
|
||||
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
print("✅ Order placed successfully!")
|
||||
print(" Order placed successfully!")
|
||||
print(f"Order result: {result}")
|
||||
|
||||
# Cancel immediately if successful
|
||||
if 'orderId' in result:
|
||||
print(f"\n🔄 Canceling order {result['orderId']}...")
|
||||
print(f"\n Canceling order {result['orderId']}...")
|
||||
cancel_order_v3(api_key, api_secret, 'ETHUSDC', result['orderId'])
|
||||
|
||||
else:
|
||||
print("❌ Order placement failed")
|
||||
print(" Order placement failed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Request error: {e}")
|
||||
print(f" Request error: {e}")
|
||||
|
||||
def cancel_order_v3(api_key: str, secret_key: str, symbol: str, order_id: str):
|
||||
"""Cancel a MEXC order using V3 method"""
|
||||
|
||||
@@ -26,7 +26,7 @@ def debug_interface():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return False
|
||||
|
||||
from NN.exchanges.mexc_interface import MEXCInterface
|
||||
@@ -98,17 +98,17 @@ def debug_interface():
|
||||
|
||||
# Compare parameters
|
||||
print(f"\n📊 COMPARISON:")
|
||||
print(f"symbol: Interface='{interface_params['symbol']}', Manual='{manual_params['symbol']}' {'✅' if interface_params['symbol'] == manual_params['symbol'] else '❌'}")
|
||||
print(f"side: Interface='{interface_params['side']}', Manual='{manual_params['side']}' {'✅' if interface_params['side'] == manual_params['side'] else '❌'}")
|
||||
print(f"type: Interface='{interface_params['type']}', Manual='{manual_params['type']}' {'✅' if interface_params['type'] == manual_params['type'] else '❌'}")
|
||||
print(f"quantity: Interface='{interface_params['quantity']}', Manual='{manual_params['quantity']}' {'✅' if interface_params['quantity'] == manual_params['quantity'] else '❌'}")
|
||||
print(f"price: Interface='{interface_params['price']}', Manual='{manual_params['price']}' {'✅' if interface_params['price'] == manual_params['price'] else '❌'}")
|
||||
print(f"timestamp: Interface='{interface_params['timestamp']}', Manual='{manual_params['timestamp']}' {'✅' if interface_params['timestamp'] == manual_params['timestamp'] else '❌'}")
|
||||
print(f"recvWindow: Interface='{interface_params['recvWindow']}', Manual='{manual_params['recvWindow']}' {'✅' if interface_params['recvWindow'] == manual_params['recvWindow'] else '❌'}")
|
||||
print(f"symbol: Interface='{interface_params['symbol']}', Manual='{manual_params['symbol']}' {'' if interface_params['symbol'] == manual_params['symbol'] else ''}")
|
||||
print(f"side: Interface='{interface_params['side']}', Manual='{manual_params['side']}' {'' if interface_params['side'] == manual_params['side'] else ''}")
|
||||
print(f"type: Interface='{interface_params['type']}', Manual='{manual_params['type']}' {'' if interface_params['type'] == manual_params['type'] else ''}")
|
||||
print(f"quantity: Interface='{interface_params['quantity']}', Manual='{manual_params['quantity']}' {'' if interface_params['quantity'] == manual_params['quantity'] else ''}")
|
||||
print(f"price: Interface='{interface_params['price']}', Manual='{manual_params['price']}' {'' if interface_params['price'] == manual_params['price'] else ''}")
|
||||
print(f"timestamp: Interface='{interface_params['timestamp']}', Manual='{manual_params['timestamp']}' {'' if interface_params['timestamp'] == manual_params['timestamp'] else ''}")
|
||||
print(f"recvWindow: Interface='{interface_params['recvWindow']}', Manual='{manual_params['recvWindow']}' {'' if interface_params['recvWindow'] == manual_params['recvWindow'] else ''}")
|
||||
|
||||
# Check for timeInForce difference
|
||||
if 'timeInForce' in interface_params:
|
||||
print(f"timeInForce: Interface='{interface_params['timeInForce']}', Manual=None ❌ (EXTRA PARAMETER)")
|
||||
print(f"timeInForce: Interface='{interface_params['timeInForce']}', Manual=None (EXTRA PARAMETER)")
|
||||
|
||||
# Test without timeInForce
|
||||
print(f"\n🔧 TESTING WITHOUT timeInForce:")
|
||||
@@ -119,10 +119,10 @@ def debug_interface():
|
||||
print(f"Interface signature (no timeInForce): {interface_signature_minimal}")
|
||||
|
||||
if interface_signature_minimal == manual_signature:
|
||||
print("✅ Signatures match when timeInForce is removed!")
|
||||
print(" Signatures match when timeInForce is removed!")
|
||||
return True
|
||||
else:
|
||||
print("❌ Still don't match")
|
||||
print(" Still don't match")
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ def test_order_signature():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return False
|
||||
|
||||
# Test order parameters
|
||||
@@ -79,9 +79,9 @@ def test_order_signature():
|
||||
|
||||
# Compare
|
||||
if signature_manual == signature_interface:
|
||||
print("✅ Signatures match!")
|
||||
print(" Signatures match!")
|
||||
else:
|
||||
print("❌ Signatures don't match")
|
||||
print(" Signatures don't match")
|
||||
print("This indicates a problem with the signature generation method")
|
||||
return False
|
||||
|
||||
@@ -106,10 +106,10 @@ def test_order_signature():
|
||||
print(f"Response: {response.text}")
|
||||
|
||||
if response.status_code == 200:
|
||||
print("✅ Manual order method works!")
|
||||
print(" Manual order method works!")
|
||||
return True
|
||||
else:
|
||||
print("❌ Manual order method failed")
|
||||
print(" Manual order method failed")
|
||||
|
||||
# Test 4: Try test order endpoint
|
||||
print("\n4. Testing with test order endpoint:")
|
||||
@@ -119,7 +119,7 @@ def test_order_signature():
|
||||
print(f"Test order response: {response2.status_code} - {response2.text}")
|
||||
|
||||
if response2.status_code == 200:
|
||||
print("✅ Test order works - real order parameters might have issues")
|
||||
print(" Test order works - real order parameters might have issues")
|
||||
|
||||
# Test 5: Try different parameter variations
|
||||
print("\n5. Testing different parameter sets:")
|
||||
|
||||
@@ -28,7 +28,7 @@ def test_different_approaches():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return False
|
||||
|
||||
# Test order parameters
|
||||
@@ -109,13 +109,13 @@ def test_different_approaches():
|
||||
print(f"Response: {response.status_code} - {response.text}")
|
||||
|
||||
if response.status_code == 200:
|
||||
print(f"✅ {method} WORKS!")
|
||||
print(f" {method} WORKS!")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ {method} failed")
|
||||
print(f" {method} failed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ {method} error: {e}")
|
||||
print(f" {method} error: {e}")
|
||||
|
||||
# Try one more approach - use minimal parameters
|
||||
print("\n" + "=" * 60)
|
||||
@@ -149,11 +149,11 @@ def test_different_approaches():
|
||||
print(f"Minimal response: {response.status_code} - {response.text}")
|
||||
|
||||
if response.status_code == 200:
|
||||
print("✅ Minimal parameters work!")
|
||||
print(" Minimal parameters work!")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Minimal parameters error: {e}")
|
||||
print(f" Minimal parameters error: {e}")
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ def test_signature_generation():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
print(" No MEXC API credentials found")
|
||||
return False
|
||||
|
||||
# Import the interface
|
||||
@@ -66,9 +66,9 @@ def test_signature_generation():
|
||||
|
||||
# Compare
|
||||
if signature_manual == signature_interface:
|
||||
print("✅ Signatures match!")
|
||||
print(" Signatures match!")
|
||||
else:
|
||||
print("❌ Signatures don't match")
|
||||
print(" Signatures don't match")
|
||||
print("This indicates a problem with the signature generation method")
|
||||
|
||||
# Test 3: Try account request with manual signature
|
||||
@@ -97,10 +97,10 @@ def test_signature_generation():
|
||||
print(f"Response: {response.text}")
|
||||
|
||||
if response.status_code == 200:
|
||||
print("✅ Manual method works!")
|
||||
print(" Manual method works!")
|
||||
return True
|
||||
else:
|
||||
print("❌ Manual method failed")
|
||||
print(" Manual method failed")
|
||||
|
||||
# Test 4: Try different parameter ordering
|
||||
print("\n4. Testing different parameter orderings:")
|
||||
|
||||
@@ -24,22 +24,22 @@ def test_small_order():
|
||||
api_secret = os.getenv('MEXC_SECRET_KEY', '')
|
||||
|
||||
if not api_key or not api_secret:
|
||||
print("❌ No MEXC API credentials found")
|
||||
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")
|
||||
print(" Failed to connect to MEXC API")
|
||||
return
|
||||
|
||||
print("✅ Connected to MEXC API")
|
||||
print(" Connected to MEXC API")
|
||||
|
||||
# Get current price
|
||||
ticker = mexc.get_ticker("ETH/USDT") # Will be converted to ETHUSDC
|
||||
if not ticker:
|
||||
print("❌ Failed to get ticker")
|
||||
print(" Failed to get ticker")
|
||||
return
|
||||
|
||||
current_price = ticker['last']
|
||||
@@ -63,7 +63,7 @@ def test_small_order():
|
||||
)
|
||||
|
||||
if result:
|
||||
print("✅ Order placed successfully!")
|
||||
print(" Order placed successfully!")
|
||||
print(f"Order result: {result}")
|
||||
|
||||
# Try to cancel it immediately
|
||||
@@ -72,10 +72,10 @@ def test_small_order():
|
||||
cancel_result = mexc.cancel_order("ETH/USDT", result['orderId'])
|
||||
print(f"Cancel result: {cancel_result}")
|
||||
else:
|
||||
print("❌ Order placement failed")
|
||||
print(" Order placement failed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Order error: {e}")
|
||||
print(f" Order error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_small_order()
|
||||
@@ -106,9 +106,9 @@ async def test_live_trading():
|
||||
if user_input.upper() == 'YES':
|
||||
cancelled = executor._cancel_open_orders("ETH/USDT")
|
||||
if cancelled:
|
||||
logger.info("✅ Open orders cancelled successfully")
|
||||
logger.info(" Open orders cancelled successfully")
|
||||
else:
|
||||
logger.warning("⚠️ Some orders may not have been cancelled")
|
||||
logger.warning(" Some orders may not have been cancelled")
|
||||
else:
|
||||
logger.info("No open orders found")
|
||||
except Exception as e:
|
||||
@@ -146,7 +146,7 @@ async def test_live_trading():
|
||||
)
|
||||
|
||||
if success:
|
||||
logger.info("✅ Test BUY order executed successfully!")
|
||||
logger.info(" Test BUY order executed successfully!")
|
||||
|
||||
# Check order status
|
||||
await asyncio.sleep(1)
|
||||
@@ -168,14 +168,14 @@ async def test_live_trading():
|
||||
)
|
||||
|
||||
if success:
|
||||
logger.info("✅ Test SELL order executed successfully!")
|
||||
logger.info("✅ Full test trade cycle completed!")
|
||||
logger.info(" Test SELL order executed successfully!")
|
||||
logger.info(" Full test trade cycle completed!")
|
||||
else:
|
||||
logger.warning("❌ Test SELL order failed")
|
||||
logger.warning(" Test SELL order failed")
|
||||
else:
|
||||
logger.warning("❌ No position found after BUY order")
|
||||
logger.warning(" No position found after BUY order")
|
||||
else:
|
||||
logger.warning("❌ Test BUY order failed")
|
||||
logger.warning(" Test BUY order failed")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error executing test trade: {e}")
|
||||
@@ -205,7 +205,7 @@ async def test_live_trading():
|
||||
try:
|
||||
open_orders = executor.exchange.get_open_orders("ETH/USDT")
|
||||
if open_orders and len(open_orders) > 0:
|
||||
logger.warning(f"⚠️ {len(open_orders)} open orders still pending:")
|
||||
logger.warning(f" {len(open_orders)} open orders still pending:")
|
||||
for order in open_orders:
|
||||
order_id = order.get('orderId', 'N/A')
|
||||
side = order.get('side', 'N/A')
|
||||
@@ -214,7 +214,7 @@ async def test_live_trading():
|
||||
status = order.get('status', 'N/A')
|
||||
logger.info(f" Order {order_id}: {side} {qty} ETH at ${price} - Status: {status}")
|
||||
else:
|
||||
logger.info("✅ No pending orders")
|
||||
logger.info(" No pending orders")
|
||||
except Exception as e:
|
||||
logger.error(f"Error checking final open orders: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user