upgrade
This commit is contained in:
parent
6cd392d1a6
commit
9313397381
|
|
@ -5,7 +5,7 @@ from .okxclient import OkxClient
|
||||||
class AccountAPI(OkxClient):
|
class AccountAPI(OkxClient):
|
||||||
|
|
||||||
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
# Get Positions
|
# Get Positions
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class BlockTradingAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
def counterparties(self):
|
def counterparties(self):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class ConvertAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
def get_currencies(self):
|
def get_currencies(self):
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from .consts import *
|
||||||
|
|
||||||
class CopyTradingAPI(OkxClient):
|
class CopyTradingAPI(OkxClient):
|
||||||
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='1',
|
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,
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug,
|
||||||
proxy=proxy)
|
proxy=proxy)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class EarningAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
def get_offers(self,productId = '',protocolType = '',ccy = ''):
|
def get_offers(self,productId = '',protocolType = '',ccy = ''):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class FDBrokerAPI(OkxClient):
|
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)
|
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 = ''):
|
def generate_rebate_details_download_link(self, begin ='', end = ''):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from .consts import *
|
||||||
class FundingAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
# Get Non Tradable Assets
|
# Get Non Tradable Assets
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class GridAPI(OkxClient):
|
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)
|
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='',
|
def grid_order_algo(self, instId='', algoOrdType='', maxPx='', minPx='', gridNum='', runType='', tpTriggerPx='',
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from .consts import *
|
||||||
|
|
||||||
class MarketAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from .okxclient import OkxClient
|
from .okxclient import OkxClient
|
||||||
from .consts import *
|
from .consts import *
|
||||||
class NDBrokerAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
#GET /api/v5/broker/nd/info
|
#GET /api/v5/broker/nd/info
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from .consts import *
|
||||||
|
|
||||||
class PublicAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
# Get Instruments
|
# Get Instruments
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from okx.okxclient import OkxClient
|
||||||
|
|
||||||
class SimpleEarnFixedAPI(OkxClient):
|
class SimpleEarnFixedAPI(OkxClient):
|
||||||
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
|
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)
|
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):
|
def get_lending_offers(self, ccy=None, term=None):
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from .consts import *
|
||||||
|
|
||||||
class SpreadTradingAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
# Place Order
|
# Place Order
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class StatusAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
def status(self, state=''):
|
def status(self, state=''):
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from .consts import *
|
||||||
|
|
||||||
|
|
||||||
class SubAccountAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
def get_account_balance(self, subAcct):
|
def get_account_balance(self, subAcct):
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from .consts import *
|
||||||
class TradeAPI(OkxClient):
|
class TradeAPI(OkxClient):
|
||||||
|
|
||||||
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=None, flag='1',
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
# Place Order
|
# Place Order
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from .consts import *
|
||||||
|
|
||||||
class TradingDataAPI(OkxClient):
|
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)
|
OkxClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug, proxy)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
Python SDK for the OKX API v5
|
Python SDK for the OKX API v5
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__version__="0.3.4"
|
__version__="0.3.5"
|
||||||
|
|
@ -13,7 +13,7 @@ from . import consts as c, utils, exceptions
|
||||||
|
|
||||||
class OkxClient(Client):
|
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)
|
super().__init__(base_url=base_api, http2=True, proxy=proxy)
|
||||||
self.API_KEY = api_key
|
self.API_KEY = api_key
|
||||||
self.API_SECRET_KEY = api_secret_key
|
self.API_SECRET_KEY = api_secret_key
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ import ssl
|
||||||
import certifi
|
import certifi
|
||||||
import websockets
|
import websockets
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logger = logging.getLogger(__name__)
|
||||||
logger = logging.getLogger("WebSocketFactory")
|
|
||||||
|
|
||||||
|
|
||||||
class WebSocketFactory:
|
class WebSocketFactory:
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ import logging
|
||||||
from okx.websocket import WsUtils
|
from okx.websocket import WsUtils
|
||||||
from okx.websocket.WebSocketFactory import WebSocketFactory
|
from okx.websocket.WebSocketFactory import WebSocketFactory
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logger = logging.getLogger(__name__)
|
||||||
logger = logging.getLogger("WsPrivate")
|
|
||||||
|
|
||||||
|
|
||||||
class WsPrivateAsync:
|
class WsPrivateAsync:
|
||||||
|
|
@ -26,7 +25,7 @@ class WsPrivateAsync:
|
||||||
|
|
||||||
async def consume(self):
|
async def consume(self):
|
||||||
async for message in self.websocket:
|
async for message in self.websocket:
|
||||||
logger.info("Received message: {%s}", message)
|
logger.debug("Received message: {%s}", message)
|
||||||
if self.callback:
|
if self.callback:
|
||||||
self.callback(message)
|
self.callback(message)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ import logging
|
||||||
|
|
||||||
from okx.websocket.WebSocketFactory import WebSocketFactory
|
from okx.websocket.WebSocketFactory import WebSocketFactory
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logger = logging.getLogger(__name__)
|
||||||
logger = logging.getLogger("WsPublic")
|
|
||||||
|
|
||||||
|
|
||||||
class WsPublicAsync:
|
class WsPublicAsync:
|
||||||
|
|
@ -21,7 +20,7 @@ class WsPublicAsync:
|
||||||
|
|
||||||
async def consume(self):
|
async def consume(self):
|
||||||
async for message in self.websocket:
|
async for message in self.websocket:
|
||||||
logger.info("Received message: {%s}", message)
|
logger.debug("Received message: {%s}", message)
|
||||||
if self.callback:
|
if self.callback:
|
||||||
self.callback(message)
|
self.callback(message)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue