Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
0.4.1: minor kwarg ordering and docstring text changes from new API spec
Browse files Browse the repository at this point in the history
  • Loading branch information
nicelgueta committed Nov 20, 2022
1 parent e922d48 commit 8e70503
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 55 deletions.
30 changes: 19 additions & 11 deletions pyokx/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_positions(
) -> APIReturn:
"""
Get positions
Retrieve information on your positions. When the account is in net mode, net positions will be displayed, and when the account is in long/short mode, long or short positions will be displayed.
Retrieve information on your positions. When the account is in net mode, net positions will be displayed, and when the account is in long/short mode, long or short positions will be displayed. Return in reverse chronological order using ctime.
Rate Limit: 10 requests per 2 seconds
Rate limit rule: UserID
"""
Expand Down Expand Up @@ -227,14 +227,21 @@ def set_leverage(
use_proxy: bool = False,
) -> APIReturn:
"""
Set leverage
The following are the setting leverage cases for an instrument:
Set leverage for isolated MARGIN at pairs level.
Set leverage for cross MARGIN in Single-currency margin at pairs level.
Set leverage for cross MARGIN in Multi-currency margin at currency level.
Set leverage for cross/isolated FUTURES/SWAP at underlying/contract level.
Rate Limit: 20 requests per 2 seconds
Rate limit rule: UserID
Set leverage
There are 9 different scenarios for leverage setting:
1. Set leverage for MARGIN instruments under isolated-margin trade mode at pairs level.
2. Set leverage for MARGIN instruments under cross-margin trade mode and Single-currency margin account mode at pairs level.
3. Set leverage for MARGIN instruments under cross-margin trade mode and Multi-currency margin at currency level.
4. Set leverage for FUTURES instruments under cross-margin trade mode at underlying level.
5. Set leverage for FUTURES instruments under isolated-margin trade mode and buy/sell position mode at contract level.
6. Set leverage for FUTURES instruments under isolated-margin trade mode and long/short position mode at contract and position side level.
7. Set leverage for SWAP instruments under cross-margin trade at contract level.
8. Set leverage for SWAP instruments under isolated-margin trade mode and buy/sell position mode at contract level.
9. Set leverage for SWAP instruments under isolated-margin trade mode and long/short position mode at contract and position side level.
Note that the request parameter posSide is only required when margin mode is isolated in long/short position mode for FUTURES/SWAP instruments (see scenario 6 and 9 above).
Please refer to the request examples on the right side for each case.
Rate Limit: 20 requests per 2 seconds
Rate limit rule: UserID
"""
kwargs = {
k: v
Expand All @@ -253,10 +260,10 @@ def get_maximum_buy_sell_amount_or_open_amount(
self,
instId: str,
tdMode: str,
ccy: str = None,
px: str = None,
leverage: str = None,
unSpotOffset: bool = None,
ccy: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -284,9 +291,9 @@ def get_maximum_available_tradable_amount(
self,
instId: str,
tdMode: str,
ccy: str = None,
reduceOnly: bool = None,
unSpotOffset: bool = None,
ccy: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -610,6 +617,7 @@ def position_builder(
self,
instType: str = None,
inclRealPos: bool = None,
spotOffsetType: str = None,
simPos: list = None,
instId: str = None,
pos: str = None,
Expand Down
5 changes: 3 additions & 2 deletions pyokx/Funding.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def funds_transfer(
amt: str,
from_: str,
to: str,
subAcct: str = None,
type: str = None,
loanTrans: bool = None,
clientId: str = None,
omitPosRisk: str = None,
subAcct: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -107,9 +107,9 @@ def funds_transfer(

def get_funds_transfer_state(
self,
type: str = None,
transId: str = None,
clientId: str = None,
type: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -241,6 +241,7 @@ def withdrawal(
toAddr: str,
fee: str,
chain: str = None,
areaCode: str = None,
clientId: str = None,
use_proxy: bool = False,
) -> APIReturn:
Expand Down
6 changes: 3 additions & 3 deletions pyokx/Gridtrading.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def place_grid_algo_order(
Place grid algo order
Rate Limit: 20 requests per 2 seconds
Derivatives rate limit rule: UserID + (instrumentType + underlying)
Spot & Margin rate limit rule: UserID + (instrumentType + instrumentID)
Spot & Margin rate limit rule: UserID + instrumentID
"""
kwargs = {
k: v
Expand Down Expand Up @@ -75,7 +75,7 @@ def stop_grid_algo_order(
A maximum of 10 orders can be canceled per request.
Rate Limit: 20 requests per 2 seconds
Derivatives rate limit rule: UserID + (instrumentType + underlying)
Spot & Margin rate limit rule: UserID + (instrumentType + instrumentID)
Spot & Margin rate limit rule: UserID + instrumentID
"""
kwargs = {
k: v
Expand Down Expand Up @@ -291,8 +291,8 @@ def get_grid_ai_parameter_public(
self,
algoOrdType: str,
instId: str,
direction: str = None,
duration: str = None,
direction: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down
2 changes: 1 addition & 1 deletion pyokx/Marketdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def get_trades(
"""
Get trades
Retrieve the recent transactions of an instrument.
Rate Limit: 20 requests per 2 seconds
Rate Limit: 100 requests per 2 seconds
Rate limit rule: IP
"""
kwargs = {
Expand Down
26 changes: 13 additions & 13 deletions pyokx/Publicdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class Publicdata(APIComponent):
def get_instruments(
self,
instType: str,
instId: str = None,
uly: str = None,
instFamily: str = None,
instId: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand All @@ -33,11 +33,11 @@ def get_instruments(
def get_delivery_exercise_history(
self,
instType: str,
uly: str = None,
instFamily: str = None,
after: str = None,
before: str = None,
limit: str = None,
uly: str = None,
instFamily: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand All @@ -62,9 +62,9 @@ def get_delivery_exercise_history(
def get_open_interest(
self,
instType: str,
instId: str = None,
uly: str = None,
instFamily: str = None,
instId: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -155,9 +155,9 @@ def get_limit_price(self, instId: str, use_proxy: bool = False) -> APIReturn:

def get_option_market_data(
self,
expTime: str = None,
uly: str = None,
instFamily: str = None,
expTime: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -246,16 +246,16 @@ def get_system_time(self, use_proxy: bool = False) -> APIReturn:
def get_liquidation_orders(
self,
instType: str,
uly: str = None,
instFamily: str = None,
alias: str = None,
mgnMode: str = None,
instId: str = None,
ccy: str = None,
state: str = None,
before: str = None,
after: str = None,
limit: str = None,
uly: str = None,
instFamily: str = None,
alias: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -309,11 +309,11 @@ def get_position_tiers(
self,
instType: str,
tdMode: str,
tier: str = None,
uly: str = None,
instFamily: str = None,
instId: str = None,
ccy: str = None,
tier: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down Expand Up @@ -398,13 +398,13 @@ def get_underlying(self, instType: str, use_proxy: bool = False) -> APIReturn:
def get_insurance_fund(
self,
instType: str,
uly: str = None,
instFamily: str = None,
ccy: str = None,
type: str = None,
before: str = None,
after: str = None,
limit: str = None,
uly: str = None,
instFamily: str = None,
ccy: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand All @@ -430,9 +430,9 @@ def unit_convert(
self,
instId: str,
sz: str,
px: str = None,
type: str = None,
unit: str = None,
px: str = None,
use_proxy: bool = False,
) -> APIReturn:
"""
Expand Down
Loading

0 comments on commit 8e70503

Please sign in to comment.