This commit is contained in:
zihao.jiang 2024-12-26 11:31:33 +08:00
parent 6cd392d1a6
commit 9313397381
22 changed files with 24 additions and 27 deletions

View File

@ -5,7 +5,7 @@ from .okxclient import OkxClient
class AccountAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
domain='https://www.okx.com', debug=True, proxy=None):
domain='https://www.okx.com', debug=False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
# Get Positions

View File

@ -3,7 +3,7 @@ from .consts import *
class BlockTradingAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def counterparties(self):

View File

@ -3,7 +3,7 @@ from .consts import *
class ConvertAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True,proxy = None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False,proxy = None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def get_currencies(self):

View File

@ -4,7 +4,7 @@ from .consts import *
class CopyTradingAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='1',
domain='https://www.okx.com', debug=True, proxy=None):
domain='https://www.okx.com', debug=False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug,
proxy=proxy)

View File

@ -3,7 +3,7 @@ from .consts import *
class EarningAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def get_offers(self,productId = '',protocolType = '',ccy = ''):

View File

@ -3,7 +3,7 @@ from .consts import *
class FDBrokerAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def generate_rebate_details_download_link(self, begin ='', end = ''):

View File

@ -5,7 +5,7 @@ from .consts import *
class FundingAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
# Get Non Tradable Assets

View File

@ -3,7 +3,7 @@ from .consts import *
class GridAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def grid_order_algo(self, instId='', algoOrdType='', maxPx='', minPx='', gridNum='', runType='', tpTriggerPx='',

View File

@ -4,7 +4,7 @@ from .consts import *
class MarketAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)

View File

@ -1,7 +1,7 @@
from .okxclient import OkxClient
from .consts import *
class NDBrokerAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
#GET /api/v5/broker/nd/info

View File

@ -4,7 +4,7 @@ from .consts import *
class PublicAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
# Get Instruments

View File

@ -5,7 +5,7 @@ from okx.okxclient import OkxClient
class SimpleEarnFixedAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
domain='https://www.okx.com', debug=True, proxy=None):
domain='https://www.okx.com', debug=False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def get_lending_offers(self, ccy=None, term=None):

View File

@ -4,7 +4,7 @@ from .consts import *
class SpreadTradingAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
# Place Order

View File

@ -3,7 +3,7 @@ from .consts import *
class StatusAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def status(self, state=''):

View File

@ -3,7 +3,7 @@ from .consts import *
class SubAccountAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
def get_account_balance(self, subAcct):

View File

@ -7,7 +7,7 @@ from .consts import *
class TradeAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
domain='https://www.okx.com', debug=True, proxy=None):
domain='https://www.okx.com', debug=False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
# Place Order

View File

@ -4,7 +4,7 @@ from .consts import *
class TradingDataAPI(OkxClient):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = True, proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1', domain = 'https://www.okx.com',debug = False, proxy=None):
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)

View File

@ -2,4 +2,4 @@
Python SDK for the OKX API v5
"""
__version__="0.3.4"
__version__="0.3.5"

View File

@ -13,7 +13,7 @@ from . import consts as c, utils, exceptions
class OkxClient(Client):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',base_api=c.API_URL, debug='True', proxy=None):
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',base_api=c.API_URL, debug=False, proxy=None):
super().__init__(base_url=base_api, http2=True, proxy=proxy)
self.API_KEY = api_key
self.API_SECRET_KEY = api_secret_key

View File

@ -5,8 +5,7 @@ import ssl
import certifi
import websockets
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("WebSocketFactory")
logger = logging.getLogger(__name__)
class WebSocketFactory:

View File

@ -5,8 +5,7 @@ import logging
from okx.websocket import WsUtils
from okx.websocket.WebSocketFactory import WebSocketFactory
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("WsPrivate")
logger = logging.getLogger(__name__)
class WsPrivateAsync:
@ -26,7 +25,7 @@ class WsPrivateAsync:
async def consume(self):
async for message in self.websocket:
logger.info("Received message: {%s}", message)
logger.debug("Received message: {%s}", message)
if self.callback:
self.callback(message)

View File

@ -4,8 +4,7 @@ import logging
from okx.websocket.WebSocketFactory import WebSocketFactory
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("WsPublic")
logger = logging.getLogger(__name__)
class WsPublicAsync:
@ -21,7 +20,7 @@ class WsPublicAsync:
async def consume(self):
async for message in self.websocket:
logger.info("Received message: {%s}", message)
logger.debug("Received message: {%s}", message)
if self.callback:
self.callback(message)