This commit is contained in:
7LZL
2025-11-22 21:56:38 +08:00
parent 54b46b8252
commit 826c5ac97d
4 changed files with 33 additions and 23 deletions

View File

@@ -309,6 +309,7 @@ ccxt/async_support/luno.py
ccxt/async_support/mercado.py
ccxt/async_support/mexc.py
ccxt/async_support/modetrade.py
ccxt/async_support/mt5.py
ccxt/async_support/myokx.py
ccxt/async_support/ndax.py
ccxt/async_support/novadax.py
@@ -409,6 +410,7 @@ ccxt/pro/lbank.py
ccxt/pro/luno.py
ccxt/pro/mexc.py
ccxt/pro/modetrade.py
ccxt/pro/mt5.py
ccxt/pro/myokx.py
ccxt/pro/ndax.py
ccxt/pro/okx.py
@@ -674,4 +676,9 @@ ccxt/test/__init__.py
ccxt/test/tests_async.py
ccxt/test/tests_helpers.py
ccxt/test/tests_init.py
ccxt/test/tests_sync.py
ccxt/test/tests_sync.py
test/test.py
test/test2.py
test/test3.py
test/test_mt5_tools.py
test/test_mt5_websocket_orders.py

View File

@@ -29,7 +29,7 @@ class mt5(Exchange, ImplicitAPI):
'countries': ['US'],
'version': 'v2025.02.05-05.23',
'rateLimit': 1000,
'hostname': '43.167.188.220:5000',
'hostname': '10.203.0.6:5000',
'pro': True,
'options': {
'host': '18.163.85.196',
@@ -70,11 +70,11 @@ class mt5(Exchange, ImplicitAPI):
'urls': {
'logo': '',
'api': {
'public': 'http://43.167.188.220:5000', # 直接使用具体地址
'private': 'http://43.167.188.220:5000',
'public': 'http://{hostname}', # 直接使用具体地址
'private': 'http://{hostname}',
},
'www': 'http://43.167.188.220:5000',
'doc': ['http://43.167.188.220:5000/index.html'],
'www': 'http://{hostname}',
'doc': ['http://{hostname}/index.html'],
},
'api': {
'public': {

View File

@@ -35,7 +35,7 @@ class mt5(Exchange, ImplicitAPI):
'countries': ['US'],
'version': 'v2025.02.05-05.23',
'rateLimit': 1000,
'hostname': '43.167.188.220:5000',
'hostname': '10.203.0.6:5000',
'pro': True,
'options': {
'host': '18.163.85.196',
@@ -76,11 +76,11 @@ class mt5(Exchange, ImplicitAPI):
'urls': {
'logo': '',
'api': {
'public': 'http://43.167.188.220:5000',
'private': 'http://43.167.188.220:5000',
'public': 'http://{hostname}',
'private': 'http://{hostname}',
},
'www': 'http://43.167.188.220:5000',
'doc': ['http://43.167.188.220:5000/index.html'],
'www': 'http://{hostname}',
'doc': ['http://{hostname}/index.html'],
},
'api': {
'public': {
@@ -775,7 +775,8 @@ class mt5(Exchange, ImplicitAPI):
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
"""签名请求"""
url = self.urls['api'][api] + '/' + path
base_url = self.implode_hostname(self.urls['api'][api])
url = base_url + '/' + path
query = self.omit(params, self.extract_params(path))
if method == 'GET' and query:

View File

@@ -22,7 +22,7 @@ class mt5(mt5Parent):
},
'urls': {
'api': {
'ws': 'ws://43.167.188.220:5000',
'ws': 'ws://{hostname}',
},
},
'options': {
@@ -49,8 +49,8 @@ class mt5(mt5Parent):
if self.verbose:
print(f"连接检查失败,重新连接: {e}")
await self.get_token()
url = self.urls['api']['ws'] + '/OnOrderUpdate?id=' + self.token
ws_url = self.implode_hostname(self.urls['api']['ws'])
url = ws_url + '/OnOrderUpdate?id=' + self.token
message_hash = 'all_data'
return await self.watch(url, message_hash)
@@ -58,8 +58,8 @@ class mt5(mt5Parent):
"""监听余额变化"""
if not hasattr(self, 'token') or not self.token:
await self.get_token()
url = self.urls['api']['ws'] + '/OnOrderUpdate?id=' + self.token
ws_url = self.implode_hostname(self.urls['api']['ws'])
url = ws_url + '/OnOrderUpdate?id=' + self.token
message_hash = 'balance'
return await self.watch(url, message_hash)
@@ -67,8 +67,8 @@ class mt5(mt5Parent):
"""监听订单变化"""
if not hasattr(self, 'token') or not self.token:
await self.get_token()
url = self.urls['api']['ws'] + '/OnOrderUpdate?id=' + self.token
ws_url = self.implode_hostname(self.urls['api']['ws'])
url = ws_url + '/OnOrderUpdate?id=' + self.token
message_hash = 'orders'
if symbol is not None:
symbol = self.symbol(symbol)
@@ -92,8 +92,8 @@ class mt5(mt5Parent):
"""监听持仓变化"""
if not hasattr(self, 'token') or not self.token:
await self.get_token()
url = self.urls['api']['ws'] + '/OnOrderUpdate?id=' + self.token
ws_url = self.implode_hostname(self.urls['api']['ws'])
url = ws_url + '/OnOrderUpdate?id=' + self.token
message_hash = 'positions'
if symbols is not None:
symbols = [self.symbol(symbol) for symbol in symbols]
@@ -119,7 +119,8 @@ class mt5(mt5Parent):
await self.get_token()
# WebSocket 监听地址
url = self.urls['api']['ws'] + '/OnQuote?id=' + self.token
ws_url = self.implode_hostname(self.urls['api']['ws'])
url = ws_url + '/OnQuote?id=' + self.token
# 订阅参数
request = {
@@ -169,7 +170,8 @@ class mt5(mt5Parent):
await self.get_token()
# WebSocket 监听地址
url = self.urls['api']['ws'] + '/OnOhlc?id=' + self.token
ws_url = self.implode_hostname(self.urls['api']['ws'])
url = ws_url + '/OnOhlc?id=' + self.token
# 订阅参数
request = {