Skip to content

Commit 2734b5c

Browse files
committed
added missing await keywords in AsyncTradeAPI class. changed default behaviour of async classes from demo/debug to live/production mode. updated readme and example script
1 parent 91870d4 commit 2734b5c

23 files changed

+55
-56
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @trepca @nimcon

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ from okx_async.AsyncTrade import AsyncTradeAPI
4141
4242
load_dotenv()
4343
44-
tradeAPI = AsyncTradeAPI(os.getenv("OKX_API_KEY"), os.getenv("OKX_API_SECRET"), os.getenv("OKX_API_PASSPHRASE"), flag="0", debug=False)
44+
tradeAPI = AsyncTradeAPI(os.getenv("OKX_API_KEY"), os.getenv("OKX_API_SECRET"), os.getenv("OKX_API_PASSPHRASE"))
4545
```
46-
The other REST API classes can be instantiated similarly. Note that by default ```flag="1"```, which is the OKX demo environment, and ```debug=True```.
46+
The other REST API classes can be instantiated similarly. Note that async classes are initialized with default arguments ```flag='1'``` and ```debug=True```, i.e. async classes are by default in the OKX production environment and not in debug mode.
4747

4848
For a complete example see the ```example_order_book.py``` file included in the Github repository. The script prints the order book for the XCH-USDT spot market to a depth of 20 levels.
4949

example_order_book.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ async def print_order_book(instId, sz):
1212

1313
marketDataAPI = AsyncMarketAPI(os.getenv("OKX_API_KEY"),
1414
os.getenv("OKX_API_SECRET"),
15-
os.getenv("OKX_API_PASSPHRASE"),
16-
flag="0",
17-
debug=False)
15+
os.getenv("OKX_API_PASSPHRASE"))
1816

1917
order_book = await marketDataAPI.get_orderbook(instId, depth)
2018
pprint(order_book)

okx_async/AsyncAccount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class AsyncAccountAPI(AsyncClient):
66

7-
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):
7+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0', domain=API_URL, debug=False):
88
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
99

1010
# Get Positions

okx_async/AsyncBlockTrading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class AsyncBlockTradingAPI(AsyncClient):
6-
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):
6+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0', domain=API_URL, debug=False):
77
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
88

99
async def counterparties(self):

okx_async/AsyncConvert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class AsyncConvertAPI(AsyncClient):
6-
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):
6+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0', domain=API_URL, debug=False):
77
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
88

99
async def get_currencies(self):

okx_async/AsyncCopyTrading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44

55
class AsyncCopyTradingAPI(AsyncClient):
6-
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='1',
7-
domain='https://www.okx.com', debug=True):
6+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0',
7+
domain=API_URL, debug=False):
88
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
99

1010
# Get existing leading positions

okx_async/AsyncEarning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class AsyncEarningAPI(AsyncClient):
6-
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):
6+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0', domain=API_URL, debug=False):
77
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
88

99
async def get_offers(self,productId = '',protocolType = '',ccy = ''):

okx_async/AsyncFDBroker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class AsyncFDBrokerAPI(AsyncClient):
6-
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):
6+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0', domain=API_URL, debug=False):
77
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
88

99
async def generate_rebate_details_download_link(self, begin ='', end = ''):

okx_async/AsyncFunding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class AsyncFundingAPI(AsyncClient):
66

7-
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):
7+
def __init__(self, api_key='-1', api_secret_key='-1', passphrase='-1', use_server_time=False, flag='0', domain=API_URL, debug=False):
88
AsyncClient.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug)
99

1010
# Get Deposit Address

0 commit comments

Comments
 (0)