Files
gogo2/tests/test_mexc_account_privte.py
2025-07-03 00:44:31 +03:00

41 lines
1.2 KiB
Python

from NN.exchanges.mexc_interface import MEXCInterface
import logging
# Set up logging to see debug info
logging.basicConfig(level=logging.INFO)
# Create interface with API credentials
mexc = MEXCInterface(
api_key='mx0aBYs33eIilxBWC5',
api_secret='45d0b3c26f2644f19bfb98b07741b2f5',
trading_mode='simulation'
)
print('MEXC Interface created successfully')
# Test signature generation
import time
timestamp = int(time.time() * 1000)
test_params = 'quantity=1&price=11&symbol=BTCUSDT&side=BUY&type=LIMIT&timestamp=' + str(timestamp)
signature = mexc._generate_signature(timestamp, test_params)
print(f'Generated signature: {signature}')
# Test account info
print('Testing account info...')
account_info = mexc.get_account_info()
print(f'Account info result: {account_info}')
# Test ticker data
print('Testing ticker data...')
ticker = mexc.get_ticker('ETH/USDT')
print(f'ETH/USDT ticker: {ticker}')
# Test balance retrieval
print('Testing balance retrieval...')
usdt_balance = mexc.get_balance('USDT')
print(f'USDT balance: {usdt_balance}')
# Test a small order placement (simulation mode)
print('Testing order placement in simulation mode...')
order_result = mexc.place_order('ETH/USDT', 'buy', 'market', 0.001)
print(f'Order result: {order_result}')