feat(config): execute all json in config/

This commit is contained in:
2025-07-17 22:24:50 +08:00
parent f7b17d4904
commit bfb88af302
6 changed files with 124 additions and 76 deletions

View File

@@ -2,7 +2,6 @@ import requests
import hmac
import hashlib
from urllib.parse import urlencode, quote
import config
# ServerTime、Signature
class TOOL(object):
@@ -42,9 +41,9 @@ class TOOL(object):
# Market Data
class mexc_market(TOOL):
def __init__(self):
def __init__(self, config):
self.api = '/api/v3'
self.hosts = config.mexc_host
self.hosts = config["mexc_host"]
self.method = 'GET'
def get_ping(self):
@@ -129,11 +128,11 @@ class mexc_market(TOOL):
# Spot Trade
class mexc_trade(TOOL):
def __init__(self):
def __init__(self, config):
self.api = '/api/v3'
self.hosts = config.mexc_host
self.mexc_key = config.api_key
self.mexc_secret = config.secret_key
self.hosts = config["mexc_host"]
self.mexc_key = config["api_key"]
self.mexc_secret = config["secret_key"]
def get_selfSymbols(self):
"""get currency information"""
@@ -246,11 +245,11 @@ class mexc_trade(TOOL):
# Wallet
class mexc_wallet(TOOL):
def __init__(self):
def __init__(self, config):
self.api = '/api/v3/capital'
self.hosts = config.mexc_host
self.mexc_key = config.api_key
self.mexc_secret = config.secret_key
self.hosts = config["mexc_host"]
self.mexc_key = config["api_key"]
self.mexc_secret = config["secret_key"]
def get_coinlist(self):
"""get currency information"""
@@ -368,11 +367,11 @@ class mexc_wallet(TOOL):
# Sub-Account
class mexc_subaccount(TOOL):
def __init__(self):
def __init__(self, config):
self.api = '/api/v3'
self.hosts = config.mexc_host
self.mexc_key = config.api_key
self.mexc_secret = config.secret_key
self.hosts = config["mexc_host"]
self.mexc_key = config["api_key"]
self.mexc_secret = config["secret_key"]
def post_virtualSubAccount(self, params):
"""create a sub-account"""
@@ -427,11 +426,11 @@ class mexc_subaccount(TOOL):
# Rebate
class mexc_rebate(TOOL):
def __init__(self):
def __init__(self, config):
self.api = '/api/v3/rebate'
self.hosts = config.mexc_host
self.mexc_key = config.api_key
self.mexc_secret = config.secret_key
self.hosts = config["mexc_host"]
self.mexc_key = config["api_key"]
self.mexc_secret = config["secret_key"]
def get_taxQuery(self, params=None):
"""get the rebate commission record"""
@@ -500,11 +499,11 @@ class mexc_rebate(TOOL):
# WebSocket ListenKey
class mexc_listenkey(TOOL):
def __init__(self):
def __init__(self, config):
self.api = '/api/v3'
self.hosts = config.mexc_host
self.mexc_key = config.api_key
self.mexc_secret = config.secret_key
self.hosts = config["mexc_host"]
self.mexc_key = config["api_key"]
self.mexc_secret = config["secret_key"]
def post_listenKey(self):
""" generate ListenKey """