70 lines
1.4 KiB
Python
70 lines
1.4 KiB
Python
from core.exchanges import BaseExchange, common
|
|
from core.util import logs
|
|
|
|
from pymexc import spot, futures
|
|
|
|
log = logs.get_logger("mexc")
|
|
|
|
|
|
class MEXCExchange(BaseExchange):
|
|
def call_method(self, request):
|
|
...
|
|
|
|
def connect(self):
|
|
self.client = spot.HTTP(
|
|
api_key=self.account.api_key,
|
|
api_secret=self.account.api_key
|
|
)
|
|
|
|
def get_account(self):
|
|
r = self.client.account_information()
|
|
print("ACC INFO", r)
|
|
|
|
def get_instruments(self):
|
|
...
|
|
|
|
def get_currencies(self, currencies):
|
|
...
|
|
|
|
def get_supported_assets(self, response=None):
|
|
...
|
|
|
|
def get_balance(self, return_usd=False):
|
|
...
|
|
|
|
def get_market_value(self, symbol):
|
|
raise NotImplementedError
|
|
|
|
def post_trade(self, trade):
|
|
...
|
|
|
|
def get_trade_precision(self, symbol):
|
|
...
|
|
|
|
def close_trade(self, trade_id, units=None, symbol=None):
|
|
...
|
|
|
|
def get_trade(self, trade_id):
|
|
...
|
|
|
|
def update_trade(self, trade_id, take_profit_price, stop_loss_price):
|
|
...
|
|
|
|
def cancel_trade(self, trade_id):
|
|
...
|
|
|
|
def get_position_info(self, symbol):
|
|
...
|
|
|
|
def get_all_positions(self):
|
|
...
|
|
|
|
def get_all_open_trades(self):
|
|
...
|
|
|
|
def close_position(self, side, symbol):
|
|
...
|
|
|
|
def close_all_positions(self):
|
|
...
|