okx-sdk


Nameokx-sdk JSON
Version 1.3.5 PyPI version JSON
download
home_pagehttps://github.com/burakoner/okx-sdk
SummaryUp-to-date, most-complete, well-organized, well-documented, easy-to-use OKX Exchange Rest and Websocket API SDK for Python
upload_time2024-04-30 13:43:42
maintainerNone
docs_urlNone
authorBurak Öner
requires_pythonNone
licenseNone
keywords okx crypto exchange api sdk stream websocket ws python bitcoin btc spot futures trade
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OKX V5 API Python SDK

## Overview

**okx-sdk** is up-to-date, most-complete, well-organized, well-documented, easy-to-use OKX Exchange Rest and Websocket API SDK for Python.

### Links

Documentation: [https://www.okx.com/docs-v5/en](https://www.okx.com/docs-v5/en)  
Github: [https://github.com/burakoner/okx-sdk](https://github.com/burakoner/okx-sdk)  
PyPI: [https://pypi.org/project/okx-sdk](https://pypi.org/project/okx-sdk)  

### Features

- Implementation of all Rest API endpoints.
- Private and Public Websocket implementation
- Testnet Support
- Websocket handling with reconnection and multiplexed connections

### Quick Start

#### Prerequisites

```python
python version>=3.9
```

#### Installation

Use your terminal to install okx-sdk

```python
pip install okx-sdk
```

#### Using Rest API

Import library as below

```python
from okx import *
# or
from okx import OkxRestClient
# or
from okx import OkxRestClient, OkxSocketClient
```

Build your API Client. You can use OKX API public endpoints without credentials. If you need to use private endpoints you need to provide credentials as below.

```python
api = OkxRestClient()
# or
api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
```

Call your request method

```python
api.public.get_tickers(instType="SPOT")
```

Here is a complete code example:

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
tickers = api.public.get_tickers(instType="SPOT")
print(tickers)

balances = api.account.get_account_balance()
print(balances)
```

There are 17 sections and hundreds of methods in Rest API Client. Please refer to all methods signatures list below for more information.

```python
api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.account.*       # Trading Account Client
api.funding.*       # Funding Account Client
api.subaccount.*    # Sub-Account Client
api.public.*        # Single Client for both "Public Data" and "Market Data"
api.market.*        # Alias of "public". You can use both sections "api.public.*" and "api.market.*"
api.trade.*         # Order Book Trading → Trade Client
api.algotrade.*     # Order Book Trading → Algo Trading Client
api.copytrade.*     # Order Book Trading → Copy Trading Client
api.gridtrade.*     # Order Book Trading → Grid Trading Client
api.recurringbuy.*  # Order Book Trading → Recuring Buy Client
api.signaltrade.*   # Order Book Trading → Signal Bot Trading Client
api.blocktrade.*    # Block Trading Client
api.spreadtrade.*   # Spread Trading Client
api.finance.*       # Financial Products Client
api.rubik.*         # Trading Statistics Client
api.ndbroker.*      # Non-Disclosed Broker Client
api.fdbroker.*      # Fully-Disclosed Broker Client
```

#### Using WebSocket API

Import library as below

```python
from okx import *
# or
from okx import OkxSocketClient
# or
from okx import OkxRestClient, OkxSocketClient
```

You can define WebScoket API Client as below

```python
ws = OkxSocketClient()
# or
ws = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
```

There are 3 sections "public", "private" and "business" as described in [https://www.okx.com/docs-v5/en/#overview-production-trading-services](https://www.okx.com/docs-v5/en/#overview-production-trading-services). Every section has different streams. So you have to be sure that you are connecting right section.

```python
api = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.public.*        # Public WebSocket Client
api.private.*       # Private WebSocket Client
api.business.*      # Business WebSocket Client
```

Prepare your callback method and subscribe

```python
ws = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
await ws.public.start()
await ws.public.subscribe([{'channel': "tickers", 'instId': "BTC-USDT"}], callback=ws_handler)
```

Here is a fully working OKX WebSocket API Demo

```python
import asyncio
import json
from okx import *

def ws_handler(s):
    data = json.loads(s)
    
    if("event" in data):
        if(data["event"] == "subscribe"):
            print("Subscribed")
            return
        if(data["event"] == "unsubscribe"):
            print("Unsubscribed")
            return
    
    if("arg" in data and "channel" in data["arg"]):
        channel = data["arg"]["channel"]
        symbol = data["arg"]["instId"]
        if(channel == "tickers"):
            ticker = data["data"][0]
            print("[TICKER] Symbol:"+ ticker["instId"] +" Open:"+ ticker["open24h"] +" High:"+ ticker["high24h"] +" Low:"+ ticker["low24h"] +" Last:"+ ticker["last"] +" Volume:"+ ticker["vol24h"])
        elif(channel == "trades"):
            trade = data["data"][0]
            print("[TRADE] Symbol:"+ trade["instId"] +" Price:"+ trade["px"] + " Quantity:"+ trade["sz"])
        elif(channel.startswith("candle")):
            candle = data["data"][0]
            print("[CANDLE] Symbol:"+ symbol +" Open:"+ candle[1] +" High:"+ candle[2] +" Low:"+ candle[3] +" Close:"+ candle[4] +" Volume:"+ candle[5])
        else:
            print(f"[UNKNOWN] {text}")

async def tickers():
    ws = OkxSocketClient()
    await ws.public.start()
    await ws.public.subscribe([{'channel': "tickers", 'instId': "BTC-USDT"}], callback=ws_handler)

async def trades():
    ws = OkxSocketClient()
    await ws.public.start()
    await ws.public.subscribe([{'channel': "trades", 'instId': "BTC-USDT"}], callback=ws_handler)

async def multiple():
    ws = OkxSocketClient()
    await ws.public.start()
    await ws.public.subscribe([{'channel': "tickers", 'instId': "BTC-USDT"}, {'channel': "trades", 'instId': "BTC-USDT"}], callback=ws_handler)

async def candles():
    ws = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
    await ws.business.start()
    await ws.business.subscribe([{'channel': "candle1H", 'instId': "BTC-USDT"}], callback=ws_handler)

asyncio.run(tickers())
# asyncio.run(trades())
# asyncio.run(candles())
# asyncio.run(multiple())
```

### All Rest API Method Signatures

#### Trading Account Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.account.get_account_balance(ccy='')
api.account.get_positions(instType='', instId='')
api.account.get_positions_history(instType='', instId='', mgnMode='', type='', posId='', after='', before='', limit='')
api.account.get_position_risk(instType='')
api.account.get_account_bills(instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='', limit='')
api.account.get_account_bills_archive(instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='', limit='')
api.account.get_account_config()
api.account.set_position_mode(posMode)
api.account.set_leverage(lever, mgnMode, instId='', ccy='', posSide='')
api.account.get_max_order_size(instId, tdMode, ccy='', px='')
api.account.get_max_avail_size(instId, tdMode, ccy='', reduceOnly='', unSpotOffset='', quickMgnType='')
api.account.adjust_margin(instId, posSide, type, amt, loanTrans='')
api.account.get_leverage(instId, mgnMode)
api.account.get_leverage_estimated_info(instType, mgnMode, lever, instId='', ccy='', posSide='')
api.account.get_max_loan(instId, mgnMode, mgnCcy)
api.account.get_fee_rates(instType, instId='', uly='', category='', instFamily='')
api.account.get_interest_accrued(instId='', ccy='', mgnMode='', after='', before='', limit='')
api.account.get_interest_rate(ccy='')
api.account.set_greeks(greeksType)
api.account.set_isolated_mode(isoMode, type)
api.account.get_max_withdrawal(ccy='')
api.account.get_account_position_risk()
api.account.quick_margin_borrow_repay(instId, ccy, side, amt)
api.account.get_quick_margin_borrow_repay_history(instId='', ccy='', side='', after='', before='', begin='', end='', limit='')
api.account.borrow_repay(ccy='', side='', amt='', ordId='')
api.account.get_borrow_repay_history(ccy='', after='', before='', limit='')
api.account.get_VIP_interest_accrued_data(ccy='', ordId='', after='', before='', limit='')
api.account.get_vip_interest_deducted_data(ccy='', ordId='', after='', before='', limit='')
api.account.get_vip_loan_order_list(ordId='', state='', ccy='', after='', before='', limit='')
api.account.get_vip_loan_order_detail(ccy='', ordId='', after='', before='', limit='')
api.account.get_interest_limits(type='', ccy='')
api.account.simulated_margin(instType='', inclRealPos=True, spotOffsetType='', simPos=[])
api.account.position_builder(inclRealPosAndEq=True, spotOffsetType='', simPos=[])
api.account.get_greeks(ccy='')
api.account.get_account_position_tiers(instType='', uly='', instFamily='')
api.account.set_risk_offset_typel(type='')
api.account.activate_option()
api.account.set_auto_loan(autoLoan='')
api.account.set_account_mode(acctLv)
api.account.reset_mmp_status(instFamily, instType='')
api.account.set_mmp_config(instFamily, timeInterval, frozenInterval, qtyLimit)
api.account.get_mmp_config(instFamily='')
api.account.get_the_invitee_details(uid='')
api.account.get_the_user_affiliate_rebate_information(apiKey='')
```

#### Funding Account Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.funding.get_currencies(ccy='')
api.funding.get_balances(ccy='')
api.funding.get_non_tradable_assets(ccy='')
api.funding.get_asset_valuation(ccy='')
api.funding.funds_transfer(ccy, amt, from_, to, type='0', subAcct='', instId='', toInstId='', loanTrans='')
api.funding.transfer_state(transId, type='')
api.funding.get_bills(ccy='', type='', after='', before='', limit='')
api.funding.get_deposit_lightning(ccy, amt, to="")
api.funding.get_deposit_address(ccy)
api.funding.get_deposit_history(ccy='', state='', after='', before='', limit='', txId='', depId='', fromWdId='')
api.funding.withdrawal(ccy, amt, dest, toAddr, fee, chain='', areaCode='', clientId='')
api.funding.withdrawal_lightning(ccy, invoice, memo='')
api.funding.cancel_withdrawal(wdId='')
api.funding.get_withdrawal_history(ccy='', wdId='', state='', after='', before='', limit='', txId='')
api.funding.get_deposit_withdraw_status(wdId='', txId='', ccy='', to='', chain='')
api.funding.convert_dust_assets(ccy=[])
api.funding.get_exchange_list()
api.funding.apply_monthly_statement(month)
api.funding.get_monthly_statement(month)
api.funding.get_convert_currencies()
api.funding.get_convert_currency_pair(fromCcy='', toCcy='')
api.funding.estimate_quote(baseCcy='', quoteCcy='', side='', rfqSz='', rfqSzCcy='', clQReqId='')
api.funding.convert_trade(quoteId='', baseCcy='', quoteCcy='', side='', sz='', szCcy='', clTReqId='')
api.funding.get_convert_history(after='', before='', limit='', tag='')
```

#### Sub-Account Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.subaccount.get_subaccount_list(enable='', subAcct='', after='', before='', limit='')
api.subaccount.reset_subaccount_apikey(subAcct, apiKey, label='', perm='', ip='')
api.subaccount.get_trading_balance(subAcct)
api.subaccount.get_funding_balance(subAcct='', ccy='')
api.subaccount.get_max_withdrawal(subAcct, ccy='')
api.subaccount.get_transfer_history(ccy='', type='', subAcct='', after='', before='', limit='')
api.subaccount.get_managed_transfer_history(ccy='', type='', subAcct='', subUid='', after='', before='', limit='')
api.subaccount.transfer_between_sub_accounts(ccy, amt, froms, to, fromSubAccount, toSubAccount, loanTrans='false', omitPosRisk='false')
api.subaccount.set_permission_transfer_out(subAcct='', canTransOut='')
api.subaccount.get_entrust_subaccount_list(subAcct='')
api.subaccount.set_sub_accounts_VIP_loan(enable='', alloc=[])
api.subaccount.get_sub_account_borrow_interest_and_limit(subAcct='', ccy='')
```

#### Public Data and Market Data Client Methods

OKX-SDK merges Public and Market Data sections into one client only. You can use both "**api.public**" or "**api.market**" section for your requests.

```python
from okx import OkxRestClient

api = OkxRestClient()
api.public.get_system_time()
api.public.status(state='')
api.public.get_instruments(instType, uly='', instId='', instFamily='')
api.public.get_delivery_exercise_history(instType, uly='', after='', before='', limit='', instFamily='')
api.public.get_open_interest(instType, uly='', instId='', instFamily='')
api.public.get_funding_rate(instId)
api.public.funding_rate_history(instId, after='', before='', limit='')
api.public.get_price_limit(instId)
api.public.get_opt_summary(uly='', expTime='', instFamily='')
api.public.get_estimated_price(instId)
api.public.discount_interest_free_quota(ccy='')
api.public.get_mark_price(instType, uly='', instId='', instFamily='')
api.public.get_position_tiers(instType, tdMode, uly='', instFamily='', instId='', ccy='', tier='')
api.public.get_interest_rate_loan_quota()
api.public.get_vip_interest_rate_loan_quota()
api.public.get_underlying(instType='')
api.public.get_insurance_fund(instType='', type='', uly='', ccy='', before='', after='', limit='', instFamily='')
api.public.unit_convert(type='', instId='', sz='', px='', unit='')
api.public.get_option_tickBands(instType='', instFamily='')
api.public.get_index_tickers(quoteCcy='', instId='')
api.public.get_index_candlesticks(instId, after='', before='', bar='', limit='')
api.public.get_index_candlesticks_history(instId, after='', before='', bar='', limit='')
api.public.get_mark_price_candlesticks(instId, after='', before='', bar='', limit='')
api.public.get_mark_price_candlesticks_history(instId, after='', before='', bar='', limit='')
api.public.get_oracle()
api.public.get_exchange_rate()
api.public.get_index_components(index='')
api.public.get_block_tickers(instType='', uly='', instFamily='')
api.public.get_block_ticker(instId='')
api.public.get_block_trades(instId='')
api.public.get_economic_calendar(region='', importance='', before='', after='', limit='')
api.public.get_tickers(instType, uly='', instFamily='')
api.public.get_ticker(instId)
api.public.get_orderbook(instId, sz='')
api.public.get_full_orderbook(instId, sz='')
api.public.get_candlesticks(instId, after='', before='', bar='', limit='')
api.public.get_history_candlesticks(instId, after='', before='', bar='', limit='')
api.public.get_trades(instId, limit='')
api.public.get_history_trades(instId='', type='', after='', before='', limit='')
api.public.get_option_trades_by_family(instFamily='')
api.public.get_option_trades(instId='', instFamily='', optType='')
api.public.get_volume()
```

```python
from okx import OkxRestClient

api = OkxRestClient()
api.market.get_system_time()
api.market.status(state='')
api.market.get_instruments(instType, uly='', instId='', instFamily='')
api.market.get_delivery_exercise_history(instType, uly='', after='', before='', limit='', instFamily='')
api.market.get_open_interest(instType, uly='', instId='', instFamily='')
api.market.get_funding_rate(instId)
api.market.funding_rate_history(instId, after='', before='', limit='')
api.market.get_price_limit(instId)
api.market.get_opt_summary(uly='', expTime='', instFamily='')
api.market.get_estimated_price(instId)
api.market.discount_interest_free_quota(ccy='')
api.market.get_mark_price(instType, uly='', instId='', instFamily='')
api.market.get_position_tiers(instType, tdMode, uly='', instFamily='', instId='', ccy='', tier='')
api.market.get_interest_rate_loan_quota()
api.market.get_vip_interest_rate_loan_quota()
api.market.get_underlying(instType='')
api.market.get_insurance_fund(instType='', type='', uly='', ccy='', before='', after='', limit='', instFamily='')
api.market.unit_convert(type='', instId='', sz='', px='', unit='')
api.market.get_option_tickBands(instType='', instFamily='')
api.market.get_index_tickers(quoteCcy='', instId='')
api.market.get_index_candlesticks(instId, after='', before='', bar='', limit='')
api.market.get_index_candlesticks_history(instId, after='', before='', bar='', limit='')
api.market.get_mark_price_candlesticks(instId, after='', before='', bar='', limit='')
api.market.get_mark_price_candlesticks_history(instId, after='', before='', bar='', limit='')
api.market.get_oracle()
api.market.get_exchange_rate()
api.market.get_index_components(index='')
api.market.get_block_tickers(instType='', uly='', instFamily='')
api.market.get_block_ticker(instId='')
api.market.get_block_trades(instId='')
api.market.get_economic_calendar(region='', importance='', before='', after='', limit='')
api.market.get_tickers(instType, uly='', instFamily='')
api.market.get_ticker(instId)
api.market.get_orderbook(instId, sz='')
api.market.get_full_orderbook(instId, sz='')
api.market.get_candlesticks(instId, after='', before='', bar='', limit='')
api.market.get_history_candlesticks(instId, after='', before='', bar='', limit='')
api.market.get_trades(instId, limit='')
api.market.get_history_trades(instId='', type='', after='', before='', limit='')
api.market.get_option_trades_by_family(instFamily='')
api.market.get_option_trades(instId='', instFamily='', optType='')
api.market.get_volume()
```

#### Order Book Trading → Trade Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.trade.place_order(instId, tdMode, side, ordType, sz, 
    ccy='', clOrdId='', posSide='', px='', reduceOnly='', 
    tgtCcy='', tpTriggerPx='', tpOrdPx='', slTriggerPx='', slOrdPx='', tpTriggerPxType='', slTriggerPxType='', quickMgnType='', stpId='', stpMode='',
    attachAlgoOrds=None)
api.trade.place_multiple_orders(orders_data)
api.trade.cancel_order(instId, ordId='', clOrdId='')
api.trade.cancel_multiple_orders(orders_data)
api.trade.amend_order(instId, cxlOnFail='', ordId='', clOrdId='', reqId='', 
    newSz='', newPx='', newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', 
    newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='', attachAlgoOrds='')
api.trade.amend_multiple_orders(orders_data)
api.trade.close_positions(instId, mgnMode, posSide='', ccy='', autoCxl='', clOrdId='')
api.trade.get_order(instId, ordId='', clOrdId='')
api.trade.get_order_list(instType='', uly='', instId='', ordType='', state='', after='', before='', limit='', instFamily='')
api.trade.get_orders_history(instType, uly='', instId='', ordType='', state='', after='', before='', begin='', end='', limit='', instFamily='')
api.trade.get_orders_history_archive(instType, uly='', instId='', ordType='', state='', after='', before='', begin='', end='', limit='', instFamily='')
api.trade.get_fills(instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='')
api.trade.get_fills_history(instType, uly='', instId='', ordId='', after='', before='', limit='', instFamily='')
api.trade.apply_fills_archive(year, quarter)
api.trade.get_fills_archive(year, quarter)
api.trade.get_easy_convert_currency_list()
api.trade.easy_convert(fromCcy=[], toCcy='')
api.trade.get_easy_convert_history(before='', after='', limit='')
api.trade.get_oneclick_repay_list(debtType='')
api.trade.oneclick_repay(debtCcy=[], repayCcy='')
api.trade.oneclick_repay_history(after='', before='', limit='')
api.trade.cancel_all_orders(instType, instFamily)
api.trade.cancel_all_after(timeOut)
api.trade.get_account_rate_limit()
```

#### Order Book Trading → Algo Trading Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.algotrade.place_algo_order(instId='', tdMode='', side='', ordType='', sz='', 
    ccy='', posSide='', reduceOnly='', tpTriggerPx='', tpOrdPx='', 
    slTriggerPx='', slOrdPx='', triggerPx='', orderPx='', tgtCcy='', 
    pxVar='', pxSpread='', szLimit='', pxLimit='', timeInterval='', 
    tpTriggerPxType='', slTriggerPxType='', callbackRatio='', callbackSpread='', activePx='', triggerPxType='', closeFraction='', quickMgnType='', algoClOrdId='')
api.algotrade.cancel_algo_order(params)
api.algotrade.amend_algo_order(instId='', algoId='', algoClOrdId='', cxlOnFail='', reqId='',
    newSz='', newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='')
api.algotrade.cancel_advance_algos(params)
api.algotrade.get_algo_order_details(algoId='', algoClOrdId='')
api.algotrade.order_algos_list(ordType='', algoId='', instType='', instId='', after='', before='', limit='', algoClOrdId='')
api.algotrade.order_algos_history(ordType, state='', algoId='', instType='', instId='', after='', before='', limit='')
```

#### Order Book Trading → Copy Trading Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.copytrade.get_existing_leading_positions(instId='')
api.copytrade.get_leading_position_history(instId='', after='', before='', limit='')
api.copytrade.place_leading_stop_order(subPosId='', tpTriggerPx='', slTriggerPx='', tpTriggerPxType='', slTriggerPxType='')
api.copytrade.close_leading_position(subPosId='')
api.copytrade.get_leading_instruments()
api.copytrade.amend_leading_instruments(instId='')
api.copytrade.get_profit_sharing_details(after='', before='', limit='')
api.copytrade.get_total_profit_sharing()
api.copytrade.get_unrealized_profit_sharing_details()
```

#### Order Book Trading → Grid Trading Client Methods

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.gridtrade.place_order(instId, algoOrdType, maxPx, minPx, gridNum, runType='', tpTriggerPx='', slTriggerPx='', quoteSz='', baseSz='', sz='', direction='', lever='', basePos='')
api.gridtrade.amend_order(algoId, instId, slTriggerPx='', tpTriggerPx='')
api.gridtrade.stop_order(algoId, instId, algoOrdType, stopType)
api.gridtrade.close_position(algoId, mktClose, sz='', px='')
api.gridtrade.cancel_close_position_order(algoId, ordId)
api.gridtrade.get_pending_orders(algoOrdType='', algoId='', instId='', instType='', after='', before='', limit='', instFamily='')
api.gridtrade.get_orders_history(algoOrdType='', algoId='', instId='', instType='', after='', before='', limit='', instFamily='')
api.gridtrade.get_orders_details(algoOrdType='', algoId='')
api.gridtrade.get_sub_orders(algoId='', algoOrdType='', type='', groupId='', after='', before='', limit='')
api.gridtrade.get_positions(algoOrdType='', algoId='')
api.gridtrade.withdraw_income(algoId='')
api.gridtrade.compute_margin_balance(algoId='', type='', amt='')
api.gridtrade.adjust_margin_balance(algoId='', type='', amt='', percent='')
api.gridtrade.get_ai_param(algoOrdType='', instId='', direction='', duration='')
api.gridtrade.compute_min_investment(instId, algoOrdType, maxPx, minPx, gridNum, runType, direction='', lever='', basePos='', investmentData=[])
api.gridtrade.get_rsi_back_testing(instId, timeframe, thold, timePeriod, triggerCond='', duration='')
```

#### Order Book Trading → Recuring Buy Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.recurringbuy.place_recurring_buy_order(stgyName='', recurringList=[], period='', recurringDay='', recurringTime='', timeZone='', amt='', investmentCcy='', tdMode='', algoClOrdId='')
api.recurringbuy.amend_recurring_buy_order(algoId='', stgyName='')
api.recurringbuy.stop_recurring_buy_order(orders_data)
api.recurringbuy.get_recurring_buy_order_list(algoId='', after='', before='', limit='')
api.recurringbuy.get_recurring_buy_order_history(algoId='', after='', before='', limit='')
api.recurringbuy.get_recurring_buy_order_details(algoId='')
api.recurringbuy.get_recurring_buy_sub_orders(algoId='', ordId='', after='', before='', limit='')
```

#### Order Book Trading → Signal Bot Trading Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.signaltrade.create_signal(signalChanName, signalChanDesc='')
api.signaltrade.get_signals(signalSourceType, signalChanId='', after='', before='', limit='')
api.signaltrade.create(signalChanId, lever, investAmt, subOrdType, includeAll='', instIds='', ratio='', entrySettingParam={},exitSettingParam={})
api.signaltrade.cancel(algoId)
api.signaltrade.adjust_margin_balance(algoId, type, amt, allowReinvest=False)
api.signaltrade.amend_tpsl(algoId, exitSettingParam={})
api.signaltrade.set_instruments(algoId, instIds=[], includeAll=False)
api.signaltrade.get_order(algoOrdType, algoId)
api.signaltrade.get_active(algoOrdType, algoId, after='', before='', limit='')
api.signaltrade.get_history(algoOrdType, algoId, after='', before='', limit='')
api.signaltrade.get_positions(algoOrdType, algoId)
api.signaltrade.get_position_history(algoId='', instId='', after='', before='', limit='')
api.signaltrade.close_position(algoId, instId)
api.signaltrade.place_sub_order(algoId, instId, side, ordType, sz, px='', reduceOnly=False)
api.signaltrade.cancel_sub_order(algoId, instId, signalOrdId)
api.signaltrade.get_sub_orders(algoId, algoOrdType, type='', clOrdId='', state='', signalOrdId='', after='', before='', begin='', end='', limit='')
api.signaltrade.get_bot_events(algoId, after='', before='', limit='')
```

#### Block Trading Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.blocktrade.counterparties()
api.blocktrade.create_rfq(counterparties=[], anonymous='false', clRfqId='', allowPartialExecution='false', legs=[])
api.blocktrade.cancel_rfq(rfqId='', clRfqId='')
api.blocktrade.cancel_batch_rfqs(rfqIds=[], clRfqIds=[])
api.blocktrade.cancel_all_rfqs()
api.blocktrade.execute_quote(rfqId='', quoteId='', legs=[])
api.blocktrade.get_quote_products()
api.blocktrade.set_marker_instrument(params=[])
api.blocktrade.reset_mmp()
api.blocktrade.set_mmp_config(timeInterval, frozenInterval, countLimit)
api.blocktrade.get_mmp_config(timeInterval='', frozenInterval='', countLimit='', mmpFrozen='', mmpFrozenUntil='')
api.blocktrade.create_quote(rfqId='', clQuoteId='', quoteSide='', legs=[], anonymous=False, expiresIn='')
api.blocktrade.cancel_quote(quoteId='', clQuoteId='')
api.blocktrade.cancel_batch_quotes(quoteIds='', clQuoteIds='')
api.blocktrade.cancel_all_quotes()
api.blocktrade.get_rfqs(rfqId='', clRfqId='', state='', beginId='', endId='', limit='')
api.blocktrade.get_quotes(rfqId='', clRfqId='', quoteId='', clQuoteId='', state='', beginId='', endId='', limit='')
api.blocktrade.get_trades(rfqId='', clRfqId='', quoteId='', clQuoteId='', state='', beginId='', endId='', beginTs='', endTs='', limit='')
api.blocktrade.get_public_trades(beginId='', endId='', limit='')
api.blocktrade.get_block_tickers(instType='', uly='', instFamily='')
api.blocktrade.get_block_ticker(instId='')
api.blocktrade.get_block_trades(instId='')
```

#### Spread Trading Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.spreadtrade.place_order(sprdId='', clOrdId='', side='', ordType='', sz='', px='')
api.spreadtrade.cancel_order(ordId='', clOrdId='')
api.spreadtrade.cancel_all_orders(sprdId='')
api.spreadtrade.amend_order(ordId='', clOrdId='', reqId='', newSz='', newPx='')
api.spreadtrade.get_order_details(ordId='', clOrdId='')
api.spreadtrade.get_active_orders(sprdId='', ordType='', state='', beginId='', endId='', limit='')
api.spreadtrade.get_orders_history(sprdId='', ordType='', state='', beginId='', endId='', begin='', end='', limit='')
api.spreadtrade.get_orders_archive(sprdId='', ordType='', state='', instType='', instFamily='', beginId='', endId='', begin='', end='', limit='')
api.spreadtrade.get_trades(sprdId='', tradeId='', ordId='', beginId='', endId='', begin='', end='', limit='')
api.spreadtrade.get_spreads(baseCcy='', instId='', sprdId='', state='')
api.spreadtrade.get_order_book(sprdId='', sz='')
api.spreadtrade.get_ticker(sprdId='')
api.spreadtrade.get_public_trades(sprdId='')
```

#### Financial Products Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.finance.earn_get_offers(productId='', protocolType='', ccy='')
api.finance.earn_purchase(productId='', investData=[], term='')
api.finance.earn_redeem(ordId='', protocolType='', allowEarlyRedeem='')
api.finance.earn_cancel(ordId='', protocolType='')
api.finance.earn_get_active_orders(productId='', protocolType='', ccy='', state='')
api.finance.earn_get_orders_history(productId='', protocolType='', ccy='', after='', before='', limit='')
api.finance.eth_purchase(amt)
api.finance.eth_redeem(amt)
api.finance.eth_get_balance()
api.finance.eth_get_purchase_redeem_history(type, status='', after='', before='', limit='')
api.finance.eth_apy_history(days)
api.finance.savings_get_saving_balance(ccy='')
api.finance.savings_purchase_redemption(ccy='', amt='', side='', rate='')
api.finance.savings_set_lending_rate(ccy='', rate='')
api.finance.savings_get_lending_history(ccy='', after='', before='', limit='')
api.finance.savings_get_public_borrow_info(ccy='')
api.finance.savings_get_public_borrow_history(ccy='', after='', before='', limit='')
```

#### Trading Statistics Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.rubik.get_support_coin()
api.rubik.get_taker_volume(ccy, instType, begin='', end='', period='')
api.rubik.get_margin_lending_ratio(ccy, begin='', end='', period='')
api.rubik.get_long_short_ratio(ccy, begin='', end='', period='')
api.rubik.get_contracts_interest_volume(ccy, begin='', end='', period='')
api.rubik.get_options_interest_volume(ccy, period='')
api.rubik.get_put_call_ratio(ccy, period='')
api.rubik.get_interest_volume_expiry(ccy, period='')
api.rubik.get_interest_volume_strike(ccy, expTime, period='')
api.rubik.get_taker_block_volume(ccy, period='')
```

#### Non-Disclosed Broker Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.ndbroker.get_broker_info()
api.ndbroker.create_subaccount(subAcct='', label='')
api.ndbroker.delete_subaccount(subAcct='')
api.ndbroker.get_subaccount_info(subAcct='', page='', limit='')
api.ndbroker.create_subaccount_apikey(subAcct='', label='', passphrase='', ip='', perm='')
api.ndbroker.get_subaccount_apikey(subAcct='', apiKey='')
api.ndbroker.reset_subaccount_apikey(subAcct='', apiKey='', label='', perm='', ip='')
api.ndbroker.delete_subaccount_apikey(subAcct='', apiKey='')
api.ndbroker.set_subaccount_level(subAcct='', acctLv='')
api.ndbroker.set_subaccount_fee_rate(subAcct='', instType='', chgType='', chgTaker='', chgMaker='', effDate='')
api.ndbroker.create_subaccount_deposit_address(subAcct='', ccy='', chain='', addrType='', to='')
api.ndbroker.reset_subaccount_deposit_address(subAcct='', ccy='', chain='', addr='', to='')
api.ndbroker.get_subaccount_deposit_address(subAcct='', ccy='')
api.ndbroker.get_subaccount_deposit_history(subAcct='', ccy='', txId='', state='', after='', before='', limit='')
api.ndbroker.get_subaccount_withdrawal_history(subAcct='', ccy='', wdId='', clientId='', txId='', type='', state='', before='', limit='')
api.ndbroker.get_rebate_daily(subAcct='', begin='', end='', page='', limit='')
api.ndbroker.get_rebate_details_download_link(type='', begin='', end='')
api.ndbroker.generate_rebate_details_download_link(begin='', end='')
api.ndbroker.get_dcd_products(ccy, alternativeCcy, optType, tag)
api.ndbroker.request_dcd_quote(notional, notionalCcy, productId, tag, markUp='', clReqId='')
api.ndbroker.exec_dcd_order(quoteId, clReqId='')
api.ndbroker.get_dcd_order(ordId='', clReqId='')
api.ndbroker.get_dcd_orders(productId='', uly='', state='', beginId='', endId='', begin='', end='', limit='')
api.ndbroker.set_subaccount_asset(subAcct, ccy)
api.ndbroker.report_subaccount_ip(subAcct, clientIP)
api.ndbroker.get_rebate_info(apiKey='', uid='', subAcct='')
```

#### Fully-Disclosed Broker Client

```python
from okx import OkxRestClient

api = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')
api.fdbroker.get_rebate_details_download_link(type='', begin='', end='')
api.fdbroker.generate_rebate_details_download_link(begin='', end='')
api.fdbroker.get_users_broker_rebate_information(apiKey, brokerType)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/burakoner/okx-sdk",
    "name": "okx-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "okx, crypto, exchange, api, sdk, stream, websocket, ws, python, bitcoin, btc, spot, futures, trade",
    "author": "Burak \u00d6ner",
    "author_email": "info@burakoner.com",
    "download_url": "https://files.pythonhosted.org/packages/2e/54/84e145ccb505c0709f3fa31f2c0144b6c31d7fc0a0df4478d501ccc87a47/okx-sdk-1.3.5.tar.gz",
    "platform": null,
    "description": "# OKX V5 API Python SDK\r\n\r\n## Overview\r\n\r\n**okx-sdk** is up-to-date, most-complete, well-organized, well-documented, easy-to-use OKX Exchange Rest and Websocket API SDK for Python.\r\n\r\n### Links\r\n\r\nDocumentation: [https://www.okx.com/docs-v5/en](https://www.okx.com/docs-v5/en)  \r\nGithub: [https://github.com/burakoner/okx-sdk](https://github.com/burakoner/okx-sdk)  \r\nPyPI: [https://pypi.org/project/okx-sdk](https://pypi.org/project/okx-sdk)  \r\n\r\n### Features\r\n\r\n- Implementation of all Rest API endpoints.\r\n- Private and Public Websocket implementation\r\n- Testnet Support\r\n- Websocket handling with reconnection and multiplexed connections\r\n\r\n### Quick Start\r\n\r\n#### Prerequisites\r\n\r\n```python\r\npython version>=3.9\r\n```\r\n\r\n#### Installation\r\n\r\nUse your terminal to install okx-sdk\r\n\r\n```python\r\npip install okx-sdk\r\n```\r\n\r\n#### Using Rest API\r\n\r\nImport library as below\r\n\r\n```python\r\nfrom okx import *\r\n# or\r\nfrom okx import OkxRestClient\r\n# or\r\nfrom okx import OkxRestClient, OkxSocketClient\r\n```\r\n\r\nBuild your API Client. You can use OKX API public endpoints without credentials. If you need to use private endpoints you need to provide credentials as below.\r\n\r\n```python\r\napi = OkxRestClient()\r\n# or\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\n```\r\n\r\nCall your request method\r\n\r\n```python\r\napi.public.get_tickers(instType=\"SPOT\")\r\n```\r\n\r\nHere is a complete code example:\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\ntickers = api.public.get_tickers(instType=\"SPOT\")\r\nprint(tickers)\r\n\r\nbalances = api.account.get_account_balance()\r\nprint(balances)\r\n```\r\n\r\nThere are 17 sections and hundreds of methods in Rest API Client. Please refer to all methods signatures list below for more information.\r\n\r\n```python\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.account.*       # Trading Account Client\r\napi.funding.*       # Funding Account Client\r\napi.subaccount.*    # Sub-Account Client\r\napi.public.*        # Single Client for both \"Public Data\" and \"Market Data\"\r\napi.market.*        # Alias of \"public\". You can use both sections \"api.public.*\" and \"api.market.*\"\r\napi.trade.*         # Order Book Trading \u2192 Trade Client\r\napi.algotrade.*     # Order Book Trading \u2192 Algo Trading Client\r\napi.copytrade.*     # Order Book Trading \u2192 Copy Trading Client\r\napi.gridtrade.*     # Order Book Trading \u2192 Grid Trading Client\r\napi.recurringbuy.*  # Order Book Trading \u2192 Recuring Buy Client\r\napi.signaltrade.*   # Order Book Trading \u2192 Signal Bot Trading Client\r\napi.blocktrade.*    # Block Trading Client\r\napi.spreadtrade.*   # Spread Trading Client\r\napi.finance.*       # Financial Products Client\r\napi.rubik.*         # Trading Statistics Client\r\napi.ndbroker.*      # Non-Disclosed Broker Client\r\napi.fdbroker.*      # Fully-Disclosed Broker Client\r\n```\r\n\r\n#### Using WebSocket API\r\n\r\nImport library as below\r\n\r\n```python\r\nfrom okx import *\r\n# or\r\nfrom okx import OkxSocketClient\r\n# or\r\nfrom okx import OkxRestClient, OkxSocketClient\r\n```\r\n\r\nYou can define WebScoket API Client as below\r\n\r\n```python\r\nws = OkxSocketClient()\r\n# or\r\nws = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\n```\r\n\r\nThere are 3 sections \"public\", \"private\" and \"business\" as described in [https://www.okx.com/docs-v5/en/#overview-production-trading-services](https://www.okx.com/docs-v5/en/#overview-production-trading-services). Every section has different streams. So you have to be sure that you are connecting right section.\r\n\r\n```python\r\napi = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.public.*        # Public WebSocket Client\r\napi.private.*       # Private WebSocket Client\r\napi.business.*      # Business WebSocket Client\r\n```\r\n\r\nPrepare your callback method and subscribe\r\n\r\n```python\r\nws = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\nawait ws.public.start()\r\nawait ws.public.subscribe([{'channel': \"tickers\", 'instId': \"BTC-USDT\"}], callback=ws_handler)\r\n```\r\n\r\nHere is a fully working OKX WebSocket API Demo\r\n\r\n```python\r\nimport asyncio\r\nimport json\r\nfrom okx import *\r\n\r\ndef ws_handler(s):\r\n    data = json.loads(s)\r\n    \r\n    if(\"event\" in data):\r\n        if(data[\"event\"] == \"subscribe\"):\r\n            print(\"Subscribed\")\r\n            return\r\n        if(data[\"event\"] == \"unsubscribe\"):\r\n            print(\"Unsubscribed\")\r\n            return\r\n    \r\n    if(\"arg\" in data and \"channel\" in data[\"arg\"]):\r\n        channel = data[\"arg\"][\"channel\"]\r\n        symbol = data[\"arg\"][\"instId\"]\r\n        if(channel == \"tickers\"):\r\n            ticker = data[\"data\"][0]\r\n            print(\"[TICKER] Symbol:\"+ ticker[\"instId\"] +\" Open:\"+ ticker[\"open24h\"] +\" High:\"+ ticker[\"high24h\"] +\" Low:\"+ ticker[\"low24h\"] +\" Last:\"+ ticker[\"last\"] +\" Volume:\"+ ticker[\"vol24h\"])\r\n        elif(channel == \"trades\"):\r\n            trade = data[\"data\"][0]\r\n            print(\"[TRADE] Symbol:\"+ trade[\"instId\"] +\" Price:\"+ trade[\"px\"] + \" Quantity:\"+ trade[\"sz\"])\r\n        elif(channel.startswith(\"candle\")):\r\n            candle = data[\"data\"][0]\r\n            print(\"[CANDLE] Symbol:\"+ symbol +\" Open:\"+ candle[1] +\" High:\"+ candle[2] +\" Low:\"+ candle[3] +\" Close:\"+ candle[4] +\" Volume:\"+ candle[5])\r\n        else:\r\n            print(f\"[UNKNOWN] {text}\")\r\n\r\nasync def tickers():\r\n    ws = OkxSocketClient()\r\n    await ws.public.start()\r\n    await ws.public.subscribe([{'channel': \"tickers\", 'instId': \"BTC-USDT\"}], callback=ws_handler)\r\n\r\nasync def trades():\r\n    ws = OkxSocketClient()\r\n    await ws.public.start()\r\n    await ws.public.subscribe([{'channel': \"trades\", 'instId': \"BTC-USDT\"}], callback=ws_handler)\r\n\r\nasync def multiple():\r\n    ws = OkxSocketClient()\r\n    await ws.public.start()\r\n    await ws.public.subscribe([{'channel': \"tickers\", 'instId': \"BTC-USDT\"}, {'channel': \"trades\", 'instId': \"BTC-USDT\"}], callback=ws_handler)\r\n\r\nasync def candles():\r\n    ws = OkxSocketClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\n    await ws.business.start()\r\n    await ws.business.subscribe([{'channel': \"candle1H\", 'instId': \"BTC-USDT\"}], callback=ws_handler)\r\n\r\nasyncio.run(tickers())\r\n# asyncio.run(trades())\r\n# asyncio.run(candles())\r\n# asyncio.run(multiple())\r\n```\r\n\r\n### All Rest API Method Signatures\r\n\r\n#### Trading Account Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.account.get_account_balance(ccy='')\r\napi.account.get_positions(instType='', instId='')\r\napi.account.get_positions_history(instType='', instId='', mgnMode='', type='', posId='', after='', before='', limit='')\r\napi.account.get_position_risk(instType='')\r\napi.account.get_account_bills(instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='', limit='')\r\napi.account.get_account_bills_archive(instType='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='', limit='')\r\napi.account.get_account_config()\r\napi.account.set_position_mode(posMode)\r\napi.account.set_leverage(lever, mgnMode, instId='', ccy='', posSide='')\r\napi.account.get_max_order_size(instId, tdMode, ccy='', px='')\r\napi.account.get_max_avail_size(instId, tdMode, ccy='', reduceOnly='', unSpotOffset='', quickMgnType='')\r\napi.account.adjust_margin(instId, posSide, type, amt, loanTrans='')\r\napi.account.get_leverage(instId, mgnMode)\r\napi.account.get_leverage_estimated_info(instType, mgnMode, lever, instId='', ccy='', posSide='')\r\napi.account.get_max_loan(instId, mgnMode, mgnCcy)\r\napi.account.get_fee_rates(instType, instId='', uly='', category='', instFamily='')\r\napi.account.get_interest_accrued(instId='', ccy='', mgnMode='', after='', before='', limit='')\r\napi.account.get_interest_rate(ccy='')\r\napi.account.set_greeks(greeksType)\r\napi.account.set_isolated_mode(isoMode, type)\r\napi.account.get_max_withdrawal(ccy='')\r\napi.account.get_account_position_risk()\r\napi.account.quick_margin_borrow_repay(instId, ccy, side, amt)\r\napi.account.get_quick_margin_borrow_repay_history(instId='', ccy='', side='', after='', before='', begin='', end='', limit='')\r\napi.account.borrow_repay(ccy='', side='', amt='', ordId='')\r\napi.account.get_borrow_repay_history(ccy='', after='', before='', limit='')\r\napi.account.get_VIP_interest_accrued_data(ccy='', ordId='', after='', before='', limit='')\r\napi.account.get_vip_interest_deducted_data(ccy='', ordId='', after='', before='', limit='')\r\napi.account.get_vip_loan_order_list(ordId='', state='', ccy='', after='', before='', limit='')\r\napi.account.get_vip_loan_order_detail(ccy='', ordId='', after='', before='', limit='')\r\napi.account.get_interest_limits(type='', ccy='')\r\napi.account.simulated_margin(instType='', inclRealPos=True, spotOffsetType='', simPos=[])\r\napi.account.position_builder(inclRealPosAndEq=True, spotOffsetType='', simPos=[])\r\napi.account.get_greeks(ccy='')\r\napi.account.get_account_position_tiers(instType='', uly='', instFamily='')\r\napi.account.set_risk_offset_typel(type='')\r\napi.account.activate_option()\r\napi.account.set_auto_loan(autoLoan='')\r\napi.account.set_account_mode(acctLv)\r\napi.account.reset_mmp_status(instFamily, instType='')\r\napi.account.set_mmp_config(instFamily, timeInterval, frozenInterval, qtyLimit)\r\napi.account.get_mmp_config(instFamily='')\r\napi.account.get_the_invitee_details(uid='')\r\napi.account.get_the_user_affiliate_rebate_information(apiKey='')\r\n```\r\n\r\n#### Funding Account Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.funding.get_currencies(ccy='')\r\napi.funding.get_balances(ccy='')\r\napi.funding.get_non_tradable_assets(ccy='')\r\napi.funding.get_asset_valuation(ccy='')\r\napi.funding.funds_transfer(ccy, amt, from_, to, type='0', subAcct='', instId='', toInstId='', loanTrans='')\r\napi.funding.transfer_state(transId, type='')\r\napi.funding.get_bills(ccy='', type='', after='', before='', limit='')\r\napi.funding.get_deposit_lightning(ccy, amt, to=\"\")\r\napi.funding.get_deposit_address(ccy)\r\napi.funding.get_deposit_history(ccy='', state='', after='', before='', limit='', txId='', depId='', fromWdId='')\r\napi.funding.withdrawal(ccy, amt, dest, toAddr, fee, chain='', areaCode='', clientId='')\r\napi.funding.withdrawal_lightning(ccy, invoice, memo='')\r\napi.funding.cancel_withdrawal(wdId='')\r\napi.funding.get_withdrawal_history(ccy='', wdId='', state='', after='', before='', limit='', txId='')\r\napi.funding.get_deposit_withdraw_status(wdId='', txId='', ccy='', to='', chain='')\r\napi.funding.convert_dust_assets(ccy=[])\r\napi.funding.get_exchange_list()\r\napi.funding.apply_monthly_statement(month)\r\napi.funding.get_monthly_statement(month)\r\napi.funding.get_convert_currencies()\r\napi.funding.get_convert_currency_pair(fromCcy='', toCcy='')\r\napi.funding.estimate_quote(baseCcy='', quoteCcy='', side='', rfqSz='', rfqSzCcy='', clQReqId='')\r\napi.funding.convert_trade(quoteId='', baseCcy='', quoteCcy='', side='', sz='', szCcy='', clTReqId='')\r\napi.funding.get_convert_history(after='', before='', limit='', tag='')\r\n```\r\n\r\n#### Sub-Account Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.subaccount.get_subaccount_list(enable='', subAcct='', after='', before='', limit='')\r\napi.subaccount.reset_subaccount_apikey(subAcct, apiKey, label='', perm='', ip='')\r\napi.subaccount.get_trading_balance(subAcct)\r\napi.subaccount.get_funding_balance(subAcct='', ccy='')\r\napi.subaccount.get_max_withdrawal(subAcct, ccy='')\r\napi.subaccount.get_transfer_history(ccy='', type='', subAcct='', after='', before='', limit='')\r\napi.subaccount.get_managed_transfer_history(ccy='', type='', subAcct='', subUid='', after='', before='', limit='')\r\napi.subaccount.transfer_between_sub_accounts(ccy, amt, froms, to, fromSubAccount, toSubAccount, loanTrans='false', omitPosRisk='false')\r\napi.subaccount.set_permission_transfer_out(subAcct='', canTransOut='')\r\napi.subaccount.get_entrust_subaccount_list(subAcct='')\r\napi.subaccount.set_sub_accounts_VIP_loan(enable='', alloc=[])\r\napi.subaccount.get_sub_account_borrow_interest_and_limit(subAcct='', ccy='')\r\n```\r\n\r\n#### Public Data and Market Data Client Methods\r\n\r\nOKX-SDK merges Public and Market Data sections into one client only. You can use both \"**api.public**\" or \"**api.market**\" section for your requests.\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient()\r\napi.public.get_system_time()\r\napi.public.status(state='')\r\napi.public.get_instruments(instType, uly='', instId='', instFamily='')\r\napi.public.get_delivery_exercise_history(instType, uly='', after='', before='', limit='', instFamily='')\r\napi.public.get_open_interest(instType, uly='', instId='', instFamily='')\r\napi.public.get_funding_rate(instId)\r\napi.public.funding_rate_history(instId, after='', before='', limit='')\r\napi.public.get_price_limit(instId)\r\napi.public.get_opt_summary(uly='', expTime='', instFamily='')\r\napi.public.get_estimated_price(instId)\r\napi.public.discount_interest_free_quota(ccy='')\r\napi.public.get_mark_price(instType, uly='', instId='', instFamily='')\r\napi.public.get_position_tiers(instType, tdMode, uly='', instFamily='', instId='', ccy='', tier='')\r\napi.public.get_interest_rate_loan_quota()\r\napi.public.get_vip_interest_rate_loan_quota()\r\napi.public.get_underlying(instType='')\r\napi.public.get_insurance_fund(instType='', type='', uly='', ccy='', before='', after='', limit='', instFamily='')\r\napi.public.unit_convert(type='', instId='', sz='', px='', unit='')\r\napi.public.get_option_tickBands(instType='', instFamily='')\r\napi.public.get_index_tickers(quoteCcy='', instId='')\r\napi.public.get_index_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.public.get_index_candlesticks_history(instId, after='', before='', bar='', limit='')\r\napi.public.get_mark_price_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.public.get_mark_price_candlesticks_history(instId, after='', before='', bar='', limit='')\r\napi.public.get_oracle()\r\napi.public.get_exchange_rate()\r\napi.public.get_index_components(index='')\r\napi.public.get_block_tickers(instType='', uly='', instFamily='')\r\napi.public.get_block_ticker(instId='')\r\napi.public.get_block_trades(instId='')\r\napi.public.get_economic_calendar(region='', importance='', before='', after='', limit='')\r\napi.public.get_tickers(instType, uly='', instFamily='')\r\napi.public.get_ticker(instId)\r\napi.public.get_orderbook(instId, sz='')\r\napi.public.get_full_orderbook(instId, sz='')\r\napi.public.get_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.public.get_history_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.public.get_trades(instId, limit='')\r\napi.public.get_history_trades(instId='', type='', after='', before='', limit='')\r\napi.public.get_option_trades_by_family(instFamily='')\r\napi.public.get_option_trades(instId='', instFamily='', optType='')\r\napi.public.get_volume()\r\n```\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient()\r\napi.market.get_system_time()\r\napi.market.status(state='')\r\napi.market.get_instruments(instType, uly='', instId='', instFamily='')\r\napi.market.get_delivery_exercise_history(instType, uly='', after='', before='', limit='', instFamily='')\r\napi.market.get_open_interest(instType, uly='', instId='', instFamily='')\r\napi.market.get_funding_rate(instId)\r\napi.market.funding_rate_history(instId, after='', before='', limit='')\r\napi.market.get_price_limit(instId)\r\napi.market.get_opt_summary(uly='', expTime='', instFamily='')\r\napi.market.get_estimated_price(instId)\r\napi.market.discount_interest_free_quota(ccy='')\r\napi.market.get_mark_price(instType, uly='', instId='', instFamily='')\r\napi.market.get_position_tiers(instType, tdMode, uly='', instFamily='', instId='', ccy='', tier='')\r\napi.market.get_interest_rate_loan_quota()\r\napi.market.get_vip_interest_rate_loan_quota()\r\napi.market.get_underlying(instType='')\r\napi.market.get_insurance_fund(instType='', type='', uly='', ccy='', before='', after='', limit='', instFamily='')\r\napi.market.unit_convert(type='', instId='', sz='', px='', unit='')\r\napi.market.get_option_tickBands(instType='', instFamily='')\r\napi.market.get_index_tickers(quoteCcy='', instId='')\r\napi.market.get_index_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.market.get_index_candlesticks_history(instId, after='', before='', bar='', limit='')\r\napi.market.get_mark_price_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.market.get_mark_price_candlesticks_history(instId, after='', before='', bar='', limit='')\r\napi.market.get_oracle()\r\napi.market.get_exchange_rate()\r\napi.market.get_index_components(index='')\r\napi.market.get_block_tickers(instType='', uly='', instFamily='')\r\napi.market.get_block_ticker(instId='')\r\napi.market.get_block_trades(instId='')\r\napi.market.get_economic_calendar(region='', importance='', before='', after='', limit='')\r\napi.market.get_tickers(instType, uly='', instFamily='')\r\napi.market.get_ticker(instId)\r\napi.market.get_orderbook(instId, sz='')\r\napi.market.get_full_orderbook(instId, sz='')\r\napi.market.get_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.market.get_history_candlesticks(instId, after='', before='', bar='', limit='')\r\napi.market.get_trades(instId, limit='')\r\napi.market.get_history_trades(instId='', type='', after='', before='', limit='')\r\napi.market.get_option_trades_by_family(instFamily='')\r\napi.market.get_option_trades(instId='', instFamily='', optType='')\r\napi.market.get_volume()\r\n```\r\n\r\n#### Order Book Trading \u2192 Trade Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.trade.place_order(instId, tdMode, side, ordType, sz, \r\n    ccy='', clOrdId='', posSide='', px='', reduceOnly='', \r\n    tgtCcy='', tpTriggerPx='', tpOrdPx='', slTriggerPx='', slOrdPx='', tpTriggerPxType='', slTriggerPxType='', quickMgnType='', stpId='', stpMode='',\r\n    attachAlgoOrds=None)\r\napi.trade.place_multiple_orders(orders_data)\r\napi.trade.cancel_order(instId, ordId='', clOrdId='')\r\napi.trade.cancel_multiple_orders(orders_data)\r\napi.trade.amend_order(instId, cxlOnFail='', ordId='', clOrdId='', reqId='', \r\n    newSz='', newPx='', newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', \r\n    newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='', attachAlgoOrds='')\r\napi.trade.amend_multiple_orders(orders_data)\r\napi.trade.close_positions(instId, mgnMode, posSide='', ccy='', autoCxl='', clOrdId='')\r\napi.trade.get_order(instId, ordId='', clOrdId='')\r\napi.trade.get_order_list(instType='', uly='', instId='', ordType='', state='', after='', before='', limit='', instFamily='')\r\napi.trade.get_orders_history(instType, uly='', instId='', ordType='', state='', after='', before='', begin='', end='', limit='', instFamily='')\r\napi.trade.get_orders_history_archive(instType, uly='', instId='', ordType='', state='', after='', before='', begin='', end='', limit='', instFamily='')\r\napi.trade.get_fills(instType='', uly='', instId='', ordId='', after='', before='', limit='', instFamily='')\r\napi.trade.get_fills_history(instType, uly='', instId='', ordId='', after='', before='', limit='', instFamily='')\r\napi.trade.apply_fills_archive(year, quarter)\r\napi.trade.get_fills_archive(year, quarter)\r\napi.trade.get_easy_convert_currency_list()\r\napi.trade.easy_convert(fromCcy=[], toCcy='')\r\napi.trade.get_easy_convert_history(before='', after='', limit='')\r\napi.trade.get_oneclick_repay_list(debtType='')\r\napi.trade.oneclick_repay(debtCcy=[], repayCcy='')\r\napi.trade.oneclick_repay_history(after='', before='', limit='')\r\napi.trade.cancel_all_orders(instType, instFamily)\r\napi.trade.cancel_all_after(timeOut)\r\napi.trade.get_account_rate_limit()\r\n```\r\n\r\n#### Order Book Trading \u2192 Algo Trading Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.algotrade.place_algo_order(instId='', tdMode='', side='', ordType='', sz='', \r\n    ccy='', posSide='', reduceOnly='', tpTriggerPx='', tpOrdPx='', \r\n    slTriggerPx='', slOrdPx='', triggerPx='', orderPx='', tgtCcy='', \r\n    pxVar='', pxSpread='', szLimit='', pxLimit='', timeInterval='', \r\n    tpTriggerPxType='', slTriggerPxType='', callbackRatio='', callbackSpread='', activePx='', triggerPxType='', closeFraction='', quickMgnType='', algoClOrdId='')\r\napi.algotrade.cancel_algo_order(params)\r\napi.algotrade.amend_algo_order(instId='', algoId='', algoClOrdId='', cxlOnFail='', reqId='',\r\n    newSz='', newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType='')\r\napi.algotrade.cancel_advance_algos(params)\r\napi.algotrade.get_algo_order_details(algoId='', algoClOrdId='')\r\napi.algotrade.order_algos_list(ordType='', algoId='', instType='', instId='', after='', before='', limit='', algoClOrdId='')\r\napi.algotrade.order_algos_history(ordType, state='', algoId='', instType='', instId='', after='', before='', limit='')\r\n```\r\n\r\n#### Order Book Trading \u2192 Copy Trading Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.copytrade.get_existing_leading_positions(instId='')\r\napi.copytrade.get_leading_position_history(instId='', after='', before='', limit='')\r\napi.copytrade.place_leading_stop_order(subPosId='', tpTriggerPx='', slTriggerPx='', tpTriggerPxType='', slTriggerPxType='')\r\napi.copytrade.close_leading_position(subPosId='')\r\napi.copytrade.get_leading_instruments()\r\napi.copytrade.amend_leading_instruments(instId='')\r\napi.copytrade.get_profit_sharing_details(after='', before='', limit='')\r\napi.copytrade.get_total_profit_sharing()\r\napi.copytrade.get_unrealized_profit_sharing_details()\r\n```\r\n\r\n#### Order Book Trading \u2192 Grid Trading Client Methods\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.gridtrade.place_order(instId, algoOrdType, maxPx, minPx, gridNum, runType='', tpTriggerPx='', slTriggerPx='', quoteSz='', baseSz='', sz='', direction='', lever='', basePos='')\r\napi.gridtrade.amend_order(algoId, instId, slTriggerPx='', tpTriggerPx='')\r\napi.gridtrade.stop_order(algoId, instId, algoOrdType, stopType)\r\napi.gridtrade.close_position(algoId, mktClose, sz='', px='')\r\napi.gridtrade.cancel_close_position_order(algoId, ordId)\r\napi.gridtrade.get_pending_orders(algoOrdType='', algoId='', instId='', instType='', after='', before='', limit='', instFamily='')\r\napi.gridtrade.get_orders_history(algoOrdType='', algoId='', instId='', instType='', after='', before='', limit='', instFamily='')\r\napi.gridtrade.get_orders_details(algoOrdType='', algoId='')\r\napi.gridtrade.get_sub_orders(algoId='', algoOrdType='', type='', groupId='', after='', before='', limit='')\r\napi.gridtrade.get_positions(algoOrdType='', algoId='')\r\napi.gridtrade.withdraw_income(algoId='')\r\napi.gridtrade.compute_margin_balance(algoId='', type='', amt='')\r\napi.gridtrade.adjust_margin_balance(algoId='', type='', amt='', percent='')\r\napi.gridtrade.get_ai_param(algoOrdType='', instId='', direction='', duration='')\r\napi.gridtrade.compute_min_investment(instId, algoOrdType, maxPx, minPx, gridNum, runType, direction='', lever='', basePos='', investmentData=[])\r\napi.gridtrade.get_rsi_back_testing(instId, timeframe, thold, timePeriod, triggerCond='', duration='')\r\n```\r\n\r\n#### Order Book Trading \u2192 Recuring Buy Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.recurringbuy.place_recurring_buy_order(stgyName='', recurringList=[], period='', recurringDay='', recurringTime='', timeZone='', amt='', investmentCcy='', tdMode='', algoClOrdId='')\r\napi.recurringbuy.amend_recurring_buy_order(algoId='', stgyName='')\r\napi.recurringbuy.stop_recurring_buy_order(orders_data)\r\napi.recurringbuy.get_recurring_buy_order_list(algoId='', after='', before='', limit='')\r\napi.recurringbuy.get_recurring_buy_order_history(algoId='', after='', before='', limit='')\r\napi.recurringbuy.get_recurring_buy_order_details(algoId='')\r\napi.recurringbuy.get_recurring_buy_sub_orders(algoId='', ordId='', after='', before='', limit='')\r\n```\r\n\r\n#### Order Book Trading \u2192 Signal Bot Trading Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.signaltrade.create_signal(signalChanName, signalChanDesc='')\r\napi.signaltrade.get_signals(signalSourceType, signalChanId='', after='', before='', limit='')\r\napi.signaltrade.create(signalChanId, lever, investAmt, subOrdType, includeAll='', instIds='', ratio='', entrySettingParam={},exitSettingParam={})\r\napi.signaltrade.cancel(algoId)\r\napi.signaltrade.adjust_margin_balance(algoId, type, amt, allowReinvest=False)\r\napi.signaltrade.amend_tpsl(algoId, exitSettingParam={})\r\napi.signaltrade.set_instruments(algoId, instIds=[], includeAll=False)\r\napi.signaltrade.get_order(algoOrdType, algoId)\r\napi.signaltrade.get_active(algoOrdType, algoId, after='', before='', limit='')\r\napi.signaltrade.get_history(algoOrdType, algoId, after='', before='', limit='')\r\napi.signaltrade.get_positions(algoOrdType, algoId)\r\napi.signaltrade.get_position_history(algoId='', instId='', after='', before='', limit='')\r\napi.signaltrade.close_position(algoId, instId)\r\napi.signaltrade.place_sub_order(algoId, instId, side, ordType, sz, px='', reduceOnly=False)\r\napi.signaltrade.cancel_sub_order(algoId, instId, signalOrdId)\r\napi.signaltrade.get_sub_orders(algoId, algoOrdType, type='', clOrdId='', state='', signalOrdId='', after='', before='', begin='', end='', limit='')\r\napi.signaltrade.get_bot_events(algoId, after='', before='', limit='')\r\n```\r\n\r\n#### Block Trading Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.blocktrade.counterparties()\r\napi.blocktrade.create_rfq(counterparties=[], anonymous='false', clRfqId='', allowPartialExecution='false', legs=[])\r\napi.blocktrade.cancel_rfq(rfqId='', clRfqId='')\r\napi.blocktrade.cancel_batch_rfqs(rfqIds=[], clRfqIds=[])\r\napi.blocktrade.cancel_all_rfqs()\r\napi.blocktrade.execute_quote(rfqId='', quoteId='', legs=[])\r\napi.blocktrade.get_quote_products()\r\napi.blocktrade.set_marker_instrument(params=[])\r\napi.blocktrade.reset_mmp()\r\napi.blocktrade.set_mmp_config(timeInterval, frozenInterval, countLimit)\r\napi.blocktrade.get_mmp_config(timeInterval='', frozenInterval='', countLimit='', mmpFrozen='', mmpFrozenUntil='')\r\napi.blocktrade.create_quote(rfqId='', clQuoteId='', quoteSide='', legs=[], anonymous=False, expiresIn='')\r\napi.blocktrade.cancel_quote(quoteId='', clQuoteId='')\r\napi.blocktrade.cancel_batch_quotes(quoteIds='', clQuoteIds='')\r\napi.blocktrade.cancel_all_quotes()\r\napi.blocktrade.get_rfqs(rfqId='', clRfqId='', state='', beginId='', endId='', limit='')\r\napi.blocktrade.get_quotes(rfqId='', clRfqId='', quoteId='', clQuoteId='', state='', beginId='', endId='', limit='')\r\napi.blocktrade.get_trades(rfqId='', clRfqId='', quoteId='', clQuoteId='', state='', beginId='', endId='', beginTs='', endTs='', limit='')\r\napi.blocktrade.get_public_trades(beginId='', endId='', limit='')\r\napi.blocktrade.get_block_tickers(instType='', uly='', instFamily='')\r\napi.blocktrade.get_block_ticker(instId='')\r\napi.blocktrade.get_block_trades(instId='')\r\n```\r\n\r\n#### Spread Trading Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.spreadtrade.place_order(sprdId='', clOrdId='', side='', ordType='', sz='', px='')\r\napi.spreadtrade.cancel_order(ordId='', clOrdId='')\r\napi.spreadtrade.cancel_all_orders(sprdId='')\r\napi.spreadtrade.amend_order(ordId='', clOrdId='', reqId='', newSz='', newPx='')\r\napi.spreadtrade.get_order_details(ordId='', clOrdId='')\r\napi.spreadtrade.get_active_orders(sprdId='', ordType='', state='', beginId='', endId='', limit='')\r\napi.spreadtrade.get_orders_history(sprdId='', ordType='', state='', beginId='', endId='', begin='', end='', limit='')\r\napi.spreadtrade.get_orders_archive(sprdId='', ordType='', state='', instType='', instFamily='', beginId='', endId='', begin='', end='', limit='')\r\napi.spreadtrade.get_trades(sprdId='', tradeId='', ordId='', beginId='', endId='', begin='', end='', limit='')\r\napi.spreadtrade.get_spreads(baseCcy='', instId='', sprdId='', state='')\r\napi.spreadtrade.get_order_book(sprdId='', sz='')\r\napi.spreadtrade.get_ticker(sprdId='')\r\napi.spreadtrade.get_public_trades(sprdId='')\r\n```\r\n\r\n#### Financial Products Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.finance.earn_get_offers(productId='', protocolType='', ccy='')\r\napi.finance.earn_purchase(productId='', investData=[], term='')\r\napi.finance.earn_redeem(ordId='', protocolType='', allowEarlyRedeem='')\r\napi.finance.earn_cancel(ordId='', protocolType='')\r\napi.finance.earn_get_active_orders(productId='', protocolType='', ccy='', state='')\r\napi.finance.earn_get_orders_history(productId='', protocolType='', ccy='', after='', before='', limit='')\r\napi.finance.eth_purchase(amt)\r\napi.finance.eth_redeem(amt)\r\napi.finance.eth_get_balance()\r\napi.finance.eth_get_purchase_redeem_history(type, status='', after='', before='', limit='')\r\napi.finance.eth_apy_history(days)\r\napi.finance.savings_get_saving_balance(ccy='')\r\napi.finance.savings_purchase_redemption(ccy='', amt='', side='', rate='')\r\napi.finance.savings_set_lending_rate(ccy='', rate='')\r\napi.finance.savings_get_lending_history(ccy='', after='', before='', limit='')\r\napi.finance.savings_get_public_borrow_info(ccy='')\r\napi.finance.savings_get_public_borrow_history(ccy='', after='', before='', limit='')\r\n```\r\n\r\n#### Trading Statistics Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.rubik.get_support_coin()\r\napi.rubik.get_taker_volume(ccy, instType, begin='', end='', period='')\r\napi.rubik.get_margin_lending_ratio(ccy, begin='', end='', period='')\r\napi.rubik.get_long_short_ratio(ccy, begin='', end='', period='')\r\napi.rubik.get_contracts_interest_volume(ccy, begin='', end='', period='')\r\napi.rubik.get_options_interest_volume(ccy, period='')\r\napi.rubik.get_put_call_ratio(ccy, period='')\r\napi.rubik.get_interest_volume_expiry(ccy, period='')\r\napi.rubik.get_interest_volume_strike(ccy, expTime, period='')\r\napi.rubik.get_taker_block_volume(ccy, period='')\r\n```\r\n\r\n#### Non-Disclosed Broker Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.ndbroker.get_broker_info()\r\napi.ndbroker.create_subaccount(subAcct='', label='')\r\napi.ndbroker.delete_subaccount(subAcct='')\r\napi.ndbroker.get_subaccount_info(subAcct='', page='', limit='')\r\napi.ndbroker.create_subaccount_apikey(subAcct='', label='', passphrase='', ip='', perm='')\r\napi.ndbroker.get_subaccount_apikey(subAcct='', apiKey='')\r\napi.ndbroker.reset_subaccount_apikey(subAcct='', apiKey='', label='', perm='', ip='')\r\napi.ndbroker.delete_subaccount_apikey(subAcct='', apiKey='')\r\napi.ndbroker.set_subaccount_level(subAcct='', acctLv='')\r\napi.ndbroker.set_subaccount_fee_rate(subAcct='', instType='', chgType='', chgTaker='', chgMaker='', effDate='')\r\napi.ndbroker.create_subaccount_deposit_address(subAcct='', ccy='', chain='', addrType='', to='')\r\napi.ndbroker.reset_subaccount_deposit_address(subAcct='', ccy='', chain='', addr='', to='')\r\napi.ndbroker.get_subaccount_deposit_address(subAcct='', ccy='')\r\napi.ndbroker.get_subaccount_deposit_history(subAcct='', ccy='', txId='', state='', after='', before='', limit='')\r\napi.ndbroker.get_subaccount_withdrawal_history(subAcct='', ccy='', wdId='', clientId='', txId='', type='', state='', before='', limit='')\r\napi.ndbroker.get_rebate_daily(subAcct='', begin='', end='', page='', limit='')\r\napi.ndbroker.get_rebate_details_download_link(type='', begin='', end='')\r\napi.ndbroker.generate_rebate_details_download_link(begin='', end='')\r\napi.ndbroker.get_dcd_products(ccy, alternativeCcy, optType, tag)\r\napi.ndbroker.request_dcd_quote(notional, notionalCcy, productId, tag, markUp='', clReqId='')\r\napi.ndbroker.exec_dcd_order(quoteId, clReqId='')\r\napi.ndbroker.get_dcd_order(ordId='', clReqId='')\r\napi.ndbroker.get_dcd_orders(productId='', uly='', state='', beginId='', endId='', begin='', end='', limit='')\r\napi.ndbroker.set_subaccount_asset(subAcct, ccy)\r\napi.ndbroker.report_subaccount_ip(subAcct, clientIP)\r\napi.ndbroker.get_rebate_info(apiKey='', uid='', subAcct='')\r\n```\r\n\r\n#### Fully-Disclosed Broker Client\r\n\r\n```python\r\nfrom okx import OkxRestClient\r\n\r\napi = OkxRestClient('---API-KEY---', '---API-SECRET---', '---PASS-PHRASE---')\r\napi.fdbroker.get_rebate_details_download_link(type='', begin='', end='')\r\napi.fdbroker.generate_rebate_details_download_link(begin='', end='')\r\napi.fdbroker.get_users_broker_rebate_information(apiKey, brokerType)\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Up-to-date, most-complete, well-organized, well-documented, easy-to-use OKX Exchange Rest and Websocket API SDK for Python",
    "version": "1.3.5",
    "project_urls": {
        "Homepage": "https://github.com/burakoner/okx-sdk"
    },
    "split_keywords": [
        "okx",
        " crypto",
        " exchange",
        " api",
        " sdk",
        " stream",
        " websocket",
        " ws",
        " python",
        " bitcoin",
        " btc",
        " spot",
        " futures",
        " trade"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eed0697d6e240448978235b1cff3d983d3023e3737d3b16cb7546b09f7ec8862",
                "md5": "5e3021be37b919b627a1ef731168831c",
                "sha256": "886a457ead5f1ec44fc9ace1bb89e7e100661f8b70a17339d69969a3a61a69a6"
            },
            "downloads": -1,
            "filename": "okx_sdk-1.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e3021be37b919b627a1ef731168831c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 44648,
            "upload_time": "2024-04-30T13:43:41",
            "upload_time_iso_8601": "2024-04-30T13:43:41.365902Z",
            "url": "https://files.pythonhosted.org/packages/ee/d0/697d6e240448978235b1cff3d983d3023e3737d3b16cb7546b09f7ec8862/okx_sdk-1.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e5484e145ccb505c0709f3fa31f2c0144b6c31d7fc0a0df4478d501ccc87a47",
                "md5": "57d30954027dcedd6b234611c25c4d8a",
                "sha256": "57c1da333970aba06d7d2aaf1ed041c35131a568ae7ca1ba33bff3710220ea3c"
            },
            "downloads": -1,
            "filename": "okx-sdk-1.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "57d30954027dcedd6b234611c25c4d8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 47514,
            "upload_time": "2024-04-30T13:43:42",
            "upload_time_iso_8601": "2024-04-30T13:43:42.909692Z",
            "url": "https://files.pythonhosted.org/packages/2e/54/84e145ccb505c0709f3fa31f2c0144b6c31d7fc0a0df4478d501ccc87a47/okx-sdk-1.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 13:43:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "burakoner",
    "github_project": "okx-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "okx-sdk"
}
        
Elapsed time: 0.33659s