From ceadad72106da2aa2c0dd24caef2f6351e52574b Mon Sep 17 00:00:00 2001 From: "zihao.jiang" Date: Fri, 16 Jun 2023 16:24:23 +0800 Subject: [PATCH] jzh --- .DS_Store | Bin 6148 -> 6148 bytes example/get_started_en.ipynb | 416 +++----------- okx/.DS_Store | Bin 0 -> 6148 bytes okx/Account.py | 47 +- okx/BlockTrading.py | 28 +- okx/CopyTrading.py | 71 +++ okx/Earning.py | 59 +- okx/Funding.py | 32 +- okx/Grid.py | 54 ++ okx/MarketData.py | 14 + okx/PublicData.py | 23 +- okx/SubAccount.py | 20 + okx/Trade.py | 58 +- okx/__init__.py | 2 +- okx/__pycache__/Account.cpython-310.pyc | Bin 0 -> 7981 bytes okx/__pycache__/BlockTrading.cpython-310.pyc | Bin 0 -> 4542 bytes okx/__pycache__/CopyTrading.cpython-310.pyc | Bin 0 -> 2932 bytes okx/__pycache__/Earning.cpython-310.pyc | Bin 0 -> 3458 bytes okx/__pycache__/Funding.cpython-310.pyc | Bin 0 -> 5878 bytes okx/__pycache__/Grid.cpython-310.pyc | Bin 0 -> 5740 bytes okx/__pycache__/MarketData.cpython-310.pyc | Bin 0 -> 4521 bytes okx/__pycache__/NDBroker.cpython-310.pyc | Bin 0 -> 4835 bytes okx/__pycache__/PublicData.cpython-310.pyc | Bin 0 -> 5214 bytes okx/__pycache__/Status.cpython-310.pyc | Bin 0 -> 853 bytes okx/__pycache__/SubAccount.cpython-310.pyc | Bin 0 -> 3506 bytes okx/__pycache__/Trade.cpython-310.pyc | Bin 0 -> 8198 bytes okx/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 220 bytes okx/__pycache__/client.cpython-310.pyc | Bin 0 -> 2151 bytes okx/__pycache__/consts.cpython-310.pyc | Bin 0 -> 13704 bytes okx/__pycache__/exceptions.cpython-310.pyc | Bin 0 -> 1708 bytes okx/__pycache__/utils.cpython-310.pyc | Bin 0 -> 2114 bytes okx/client.py | 2 - okx/consts.py | 44 ++ .../WsClientFactory.cpython-310.pyc | Bin 0 -> 2513 bytes .../WsClientProtocol.cpython-310.pyc | Bin 0 -> 2373 bytes .../WsConnectManager.cpython-310.pyc | Bin 0 -> 4760 bytes .../__pycache__/WsPrivate.cpython-310.pyc | Bin 0 -> 1360 bytes .../__pycache__/WsPublic.cpython-310.pyc | Bin 0 -> 1087 bytes .../__pycache__/WsUtils.cpython-310.pyc | Bin 0 -> 2353 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 160 bytes test/.DS_Store | Bin 0 -> 6148 bytes test/AccountTest.py | 40 +- test/BlockTradingTest.py | 53 +- test/CopyTradingTest.py | 40 ++ test/EarningTest.py | 45 ++ test/FundingTest.py | 34 +- test/GridTest.py | 42 +- test/MarketTest.py | 6 +- test/PublicDataTest.py | 18 +- test/StackingTest.py | 11 +- test/SubAccountTest.py | 18 +- test/TradeTest.py | 82 ++- test/WsPublicTest.py | 3 +- test/__pycache__/AccountTest.cpython-310.pyc | Bin 0 -> 972 bytes .../BlockTradingTest.cpython-310.pyc | Bin 0 -> 1044 bytes test/__pycache__/BrokerTest.cpython-310.pyc | Bin 0 -> 1122 bytes test/__pycache__/ConvertTest.cpython-310.pyc | Bin 0 -> 756 bytes .../CopyTradingTest.cpython-310.pyc | Bin 0 -> 1046 bytes test/__pycache__/EarningTest.cpython-310.pyc | Bin 0 -> 973 bytes test/__pycache__/FundingTest.cpython-310.pyc | Bin 0 -> 1001 bytes test/__pycache__/GridTest.cpython-310.pyc | Bin 0 -> 1002 bytes test/__pycache__/MarketTest.cpython-310.pyc | Bin 0 -> 994 bytes .../PublicDataTest.cpython-310.pyc | Bin 0 -> 1000 bytes test/__pycache__/StackingTest.cpython-310.pyc | Bin 0 -> 952 bytes .../SubAccountTest.cpython-310.pyc | Bin 0 -> 1085 bytes test/__pycache__/TradeTest.cpython-310.pyc | Bin 0 -> 949 bytes .../TradingDataTest.cpython-310.pyc | Bin 0 -> 986 bytes test/ws_org.py | 542 ++++++++++++++++++ 68 files changed, 1352 insertions(+), 452 deletions(-) create mode 100644 okx/.DS_Store create mode 100644 okx/CopyTrading.py create mode 100644 okx/__pycache__/Account.cpython-310.pyc create mode 100644 okx/__pycache__/BlockTrading.cpython-310.pyc create mode 100644 okx/__pycache__/CopyTrading.cpython-310.pyc create mode 100644 okx/__pycache__/Earning.cpython-310.pyc create mode 100644 okx/__pycache__/Funding.cpython-310.pyc create mode 100644 okx/__pycache__/Grid.cpython-310.pyc create mode 100644 okx/__pycache__/MarketData.cpython-310.pyc create mode 100644 okx/__pycache__/NDBroker.cpython-310.pyc create mode 100644 okx/__pycache__/PublicData.cpython-310.pyc create mode 100644 okx/__pycache__/Status.cpython-310.pyc create mode 100644 okx/__pycache__/SubAccount.cpython-310.pyc create mode 100644 okx/__pycache__/Trade.cpython-310.pyc create mode 100644 okx/__pycache__/__init__.cpython-310.pyc create mode 100644 okx/__pycache__/client.cpython-310.pyc create mode 100644 okx/__pycache__/consts.cpython-310.pyc create mode 100644 okx/__pycache__/exceptions.cpython-310.pyc create mode 100644 okx/__pycache__/utils.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/WsClientFactory.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/WsClientProtocol.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/WsConnectManager.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/WsPrivate.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/WsPublic.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/WsUtils.cpython-310.pyc create mode 100644 okx/websocket/__pycache__/__init__.cpython-310.pyc create mode 100644 test/.DS_Store create mode 100644 test/CopyTradingTest.py create mode 100644 test/EarningTest.py create mode 100644 test/__pycache__/AccountTest.cpython-310.pyc create mode 100644 test/__pycache__/BlockTradingTest.cpython-310.pyc create mode 100644 test/__pycache__/BrokerTest.cpython-310.pyc create mode 100644 test/__pycache__/ConvertTest.cpython-310.pyc create mode 100644 test/__pycache__/CopyTradingTest.cpython-310.pyc create mode 100644 test/__pycache__/EarningTest.cpython-310.pyc create mode 100644 test/__pycache__/FundingTest.cpython-310.pyc create mode 100644 test/__pycache__/GridTest.cpython-310.pyc create mode 100644 test/__pycache__/MarketTest.cpython-310.pyc create mode 100644 test/__pycache__/PublicDataTest.cpython-310.pyc create mode 100644 test/__pycache__/StackingTest.cpython-310.pyc create mode 100644 test/__pycache__/SubAccountTest.cpython-310.pyc create mode 100644 test/__pycache__/TradeTest.cpython-310.pyc create mode 100644 test/__pycache__/TradingDataTest.cpython-310.pyc create mode 100644 test/ws_org.py diff --git a/.DS_Store b/.DS_Store index d3c415a6e72f62e5f95fade774264c9ed008e684..aedefaf23a2704dabba5e2aefd43a6d341980e46 100644 GIT binary patch literal 6148 zcmeHK%Wl&^6upzU#HB(+0;Fz`EU_&iX;D$dCQZ`?3pO=^1)yNprnTyNqS$VVqDWrD z$FSu`;9pq5nMW$yp(~{D(A;R|jA!m+=FBTYL~M`;J)$-d*+>Gdo5+44qFtmVY3Q2U zKqh?z&tiV;$J}4iH5G;d!@%FifY`fh|niycS$W{=Z_Z}hd%IiC<8F7p<;?cByD0DM&gZs$@4=&| zN29a&JmDV|-3(`wlv^4X@Ck*|h%Veo67%E)wZg)p0GyHQ`nSL3Pi(V~zp$)j@`W2J;uR%pM*N=-XRk7FOR4=rjEr!%^&I$&Zl%Cu^& zg`t>{JBa*&GCGBWght8@bbQAObG%MRbcp^A={c~2@zhp*L#%*u zS8S|;5OH(F?}$EBBhcrXz6ITIdF8PC*Xfl937u7m-WT@9ssfrgh5^ICKf{1H9~>ls zeT{`ed2}F?PXM5WYAGm-w}h~9H1;(X3ef^#$`q(fnSNq0WsZ7B>-9Aj3Y9rA{rF%y zGSe>K+}&{UsoasMA)|NgHUnJ>eDVc@@FfLTL#IKYtf-MTb5 xao0LX?~sHDy+WZhL8h-`SrAw8CXy7iIidjUYb+F^24emQNE%FL7+5I-KLOXp{W1Um delta 206 zcmZoMXfc=|#>B`mu~2NHo}wrV0|Nsi1A_nqgAqeKLn=cBLn1@&#KPsOAPE7642BXQ zEI^h7@^XL*^?-Ec=J~L$htgp@{^Nt z@{_3RRbV6z~H7|X^6cBakj9Q+(WR{{mTGf(Chu>?90>`*2s&9XT{WDPR_ D)e$V; diff --git a/example/get_started_en.ipynb b/example/get_started_en.ipynb index 706e409..d75dcb6 100644 --- a/example/get_started_en.ipynb +++ b/example/get_started_en.ipynb @@ -2,37 +2,29 @@ "cells": [ { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, "source": [ "# Get Started\n", "## Install python package\n", "You can install `python-okx` from PyPi server." - ] + ], + "metadata": { + "collapsed": false + } }, { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, "outputs": [], "source": [ "! pip install python-okx --upgrade" - ] + ], + "metadata": { + "collapsed": false + } }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Sign up as an OKX user\n", "Please refer to [Create account](https://www.okx.com/account/register)" @@ -40,11 +32,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Create API Key\n", "Please refer to [Create API Key](https://www.okx.com/account/my-api)" @@ -52,11 +40,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Import API modules\n", "The following modules are available\n", @@ -80,7 +64,7 @@ "execution_count": null, "metadata": { "pycharm": { - "name": "#%%\n" + "is_executing": true } }, "outputs": [], @@ -90,11 +74,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Fill in your API key details" ] @@ -102,11 +82,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "api_key = \"xxxxx\"\n", @@ -116,11 +92,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Get available funds" ] @@ -130,7 +102,7 @@ "execution_count": null, "metadata": { "pycharm": { - "name": "#%%\n" + "is_executing": true } }, "outputs": [], @@ -147,11 +119,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Get market data" ] @@ -161,7 +129,7 @@ "execution_count": null, "metadata": { "pycharm": { - "name": "#%%\n" + "is_executing": true } }, "outputs": [], @@ -178,22 +146,14 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Handle errors" ] }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "You will the error code `51000` when. you run the following code. More details about the error code can be found in `msg`.\n", "Please refer to [error code](https://www.okx.com/docs-v5/en/#error-code) for addtional information." @@ -203,10 +163,10 @@ "cell_type": "code", "execution_count": null, "metadata": { + "scrolled": true, "pycharm": { - "name": "#%%\n" - }, - "scrolled": true + "is_executing": true + } }, "outputs": [], "source": [ @@ -222,11 +182,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "# Prepare for trading\n", "- Make sure you understand the basic trading rules. Please refer to [Basic Trading Rules](https://www.okx.com/support/hc/en-us/sections/360011507312)\n", @@ -235,11 +191,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Get account balance. Please refer to [Get balance](https://www.okx.com/docs-v5/en/#rest-api-account-get-balance)." ] @@ -248,9 +200,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "pycharm": { - "name": "#%%\n" - }, "scrolled": true }, "outputs": [], @@ -266,11 +215,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Get available trading pairs from [Get instruments](https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments)." ] @@ -279,9 +224,6 @@ "cell_type": "code", "execution_count": null, "metadata": { - "pycharm": { - "name": "#%%\n" - }, "scrolled": true }, "outputs": [], @@ -300,11 +242,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Make sure you have enough funds to trade a certain pair. Please refer to [Get maximum tradable amount](https://www.okx.com/docs-v5/en/#rest-api-account-get-maximum-available-tradable-amount)" ] @@ -312,11 +250,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "import okx.Account as Account\n", @@ -335,11 +269,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "import okx.Account as Account\n", @@ -357,22 +287,14 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## In unified account, you can trade Spot under simple, single currency, multi currency and portfolio margin account mode. Please refer to [Introduction on Unified Account](https://www.okx.com/support/hc/en-us/articles/360054690791-1-统一交易账户介绍)" ] }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Get the current account configuration from the `acctLv` parameter in [Get account configuration](https://www.okx.com/docs-v5/en/#rest-api-account-get-account-configuration)." ] @@ -380,11 +302,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "import okx.Account as Account\n", @@ -409,22 +327,14 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "# Start Spot Trading" ] }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### Spot trading under simple/single-currency margin mode" ] @@ -432,11 +342,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "import okx.Trade as Trade\n", @@ -448,11 +354,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "#### place a limit order" ] @@ -460,11 +362,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "# limit order\n", @@ -486,11 +384,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "#### place a market order" ] @@ -498,11 +392,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "# market order\n", @@ -518,11 +408,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "#### place an order with tgtCcy=quote_ccy (only applicable to spot)" ] @@ -530,11 +416,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "# market order\n", @@ -551,11 +433,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "#### place an order with your own clOrdId" ] @@ -563,11 +441,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "# market order\n", @@ -584,11 +458,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### Spot trading under multi-currency/porfolio margin mode" ] @@ -596,11 +466,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "# cross-margin spot trading\n", @@ -622,11 +488,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### For additional information on the place order endpoint,please refer to [Place order](https://www.okx.com/docs-v5/en/#rest-api-trade-place-order)\n", "\n", @@ -636,11 +498,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "place_orders = [\n", @@ -654,11 +512,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To amend pending orders,please refer to [Amend order](https://www.okx.com/docs-v5/en/#rest-api-trade-amend-order)" ] @@ -666,11 +520,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.amend_order(\n", @@ -683,11 +533,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To amend orders in a batch, please refer to [Amend multiple orders](https://www.okx.com/docs-v5/en/#rest-api-trade-amend-multiple-orders)" ] @@ -695,11 +541,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "amend_orders = [\n", @@ -713,11 +555,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To cancel pending orders,please refer to [Cancel order](https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-order)" ] @@ -725,11 +563,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.cancel_order(instId=\"BTC-USDT\", ordId = \"489093931993509888\")\n", @@ -738,11 +572,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To cancel orders in a batch,please refer to [Cancel multiple orders](https://www.okx.com/docs-v5/zh/#rest-api-trade-cancel-multiple-orders)" ] @@ -750,11 +580,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "cancel_orders = [\n", @@ -768,11 +594,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## Get details of a certain order, please refer to [Get order details](https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-details)" ] @@ -780,11 +602,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_order(instId=\"BTC-USDT\", clOrdId=\"002\")\n", @@ -794,11 +612,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_order(instId=\"BTC-USDT\", ordId=\"497819823594909696\")\n", @@ -807,11 +621,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## To get the list of open orders,please refer to [Get order List](https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-list)" ] @@ -819,11 +629,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_order_list()\n", @@ -832,11 +638,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To get past orders,please refer to [Get order history (last 7 days)](https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-7-days) and [Get order history (last 3 months)](https://www.okx.com/docs-v5/en/#rest-api-trade-get-order-history-last-3-months)" ] @@ -844,11 +646,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_orders_history(\n", @@ -860,11 +658,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_orders_history_archive(\n", @@ -875,11 +669,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To get past trades,please refer to [Get transaction details (last 3 days)](https://www.okx.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-days) and [Get transaction details (last 3 months) ](https://www.okx.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-months)" ] @@ -887,11 +677,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_fills(\n", @@ -903,11 +689,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.get_fills_history(\n", @@ -918,11 +700,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### If you wish to place orders when the price reaches a certain level, you can place an algo order" ] @@ -930,11 +708,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.place_algo_order(\n", @@ -952,11 +726,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "## You can also use Stop Loss or Take Profit order to sell the currencies in your account" ] @@ -964,11 +734,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.place_algo_order(\n", @@ -986,22 +752,14 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### For additional information, please refer to [Place algo order](https://www.okx.com/docs-v5/en/#rest-api-trade-place-algo-order)" ] }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### Cancel pending algo orders (not including Iceberg order, TWAP order, Trailing Stop order),please refer to [Cancel algo order](https://www.okx.com/docs-v5/en/#rest-api-trade-cancel-algo-order)" ] @@ -1009,11 +767,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "algo_orders = [\n", @@ -1026,11 +780,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To get list of currently pending algo orders,please refer to [Get algo order list](https://www.okx.com/docs-v5/en/#rest-api-trade-get-algo-order-list)" ] @@ -1038,11 +788,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.order_algos_list(\n", @@ -1053,11 +799,7 @@ }, { "cell_type": "markdown", - "metadata": { - "pycharm": { - "name": "#%% md\n" - } - }, + "metadata": {}, "source": [ "### To get the past algo orders (last three months),please refer to [Get algo order history](https://www.okx.com/docs-v5/en/#rest-api-trade-get-algo-order-history)" ] @@ -1065,11 +807,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "pycharm": { - "name": "#%%\n" - } - }, + "metadata": {}, "outputs": [], "source": [ "result = tradeAPI.order_algos_history(\n", diff --git a/okx/.DS_Store b/okx/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..38734ca2de71d90578b12a191d5ff30a57f26d5c GIT binary patch literal 6148 zcmeHKJ8Hu~5S@u#2;8`IxmU;y7U7)02atb(6aoc8igc=cE+5TrJ{W}TCXgn)ftj~E znx|!7q0xwlw%_Mhk+q04a6`FRn43K}pV>=h6bQ#VPI7>M$h&m2>c}_IdtuEgkdX>d0V;4;z`hR!Zden?K>u_g_y_=8 zBJGB?&l13531Cee1CfDgP=P_!95FQL$d|0EiDO{UMRWMjJXv!>Q9m8;FJ3NM0~x6R z6__fpi0#_?{~P?t{68geM+KA!1r*gxx&q`b_#;GW1zQV hY^)t`yeR65t?|4jj)6``-swR8445u7D)83|+yF)|6_)@2 literal 0 HcmV?d00001 diff --git a/okx/Account.py b/okx/Account.py index 2a087c8..e0a6d27 100644 --- a/okx/Account.py +++ b/okx/Account.py @@ -7,7 +7,6 @@ class AccountAPI(Client): 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): Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain,debug) - # Get Positions def get_position_risk(self, instType=''): params = {} @@ -61,8 +60,9 @@ class AccountAPI(Client): return self._request_with_params(GET, MAX_TRADE_SIZE, params) # Get Maximum Available Tradable Amount - def get_max_avail_size(self, instId, tdMode, ccy='', reduceOnly=''): - params = {'instId': instId, 'tdMode': tdMode, 'ccy': ccy, 'reduceOnly': reduceOnly} + def get_max_avail_size(self, instId, tdMode, ccy='', reduceOnly='', unSpotOffset='', quickMgnType=''): + params = {'instId': instId, 'tdMode': tdMode, 'ccy': ccy, 'reduceOnly': reduceOnly, + 'unSpotOffset': unSpotOffset, 'quickMgnType': quickMgnType} return self._request_with_params(GET, MAX_AVAIL_SIZE, params) # Increase / Decrease margin @@ -111,8 +111,8 @@ class AccountAPI(Client): return self._request_with_params(GET, MAX_WITHDRAWAL, params) # Get borrow repay - def borrow_repay(self, ccy='', side='', amt=''): - params = {'ccy': ccy, 'side': side, 'amt': amt} + def borrow_repay(self, ccy='', side='', amt='', ordId=''): + params = {'ccy': ccy, 'side': side, 'amt': amt, 'ordId': ordId} return self._request_with_params(POST, BORROW_REPAY, params) # Get borrow repay history @@ -126,8 +126,8 @@ class AccountAPI(Client): return self._request_with_params(GET, INTEREST_LIMITS, params) # Get Simulated Margin - def get_simulated_margin(self, instType ='',inclRealPos=True,instId='',pos=''): - params = {'instType': instType, 'inclRealPos': inclRealPos,'instId': instId,'pos': pos,} + def get_simulated_margin(self, instType='', inclRealPos=True, spotOffsetType='', simPos=[]): + params = {'instType': instType, 'inclRealPos': inclRealPos, 'spotOffsetType': spotOffsetType, 'simPos': simPos} return self._request_with_params(POST, SIMULATED_MARGIN, params) # Get Greeks @@ -162,5 +162,38 @@ class AccountAPI(Client): } return self._request_with_params(GET,GET_PM_LIMIT,params) + #- Get VIP interest accrued data + def get_VIP_interest_accrued_data(self, ccy='', ordId='', after='', before='', limit=''): + params = {'ccy': ccy, 'ordId': ordId, 'after': after, 'before': before, 'limit': limit} + return self._request_with_params(GET, GET_VIP_INTEREST_ACCRUED_DATA, params) + #- Get VIP interest deducted data + def get_VIP_interest_deducted_data(self, ccy='', ordId='', after='', before='', limit=''): + params = {'ccy': ccy, 'ordId': ordId, 'after': after, 'before': before, 'limit': limit} + return self._request_with_params(GET, GET_VIP_INTEREST_DEDUCTED_DATA, params) + # - Get VIP loan order list + def get_VIP_loan_order_list(self, ordId='',state='', ccy='', after='', before='', limit=''): + params = {'ordId': ordId, 'state': state, 'ccy': ccy,'after': after, 'before': before, 'limit': limit} + return self._request_with_params(GET, GET_VIP_LOAN_ORDER_LIST, params) + + #- Get VIP loan order detail + def get_VIP_loan_order_detail(self, ccy='', ordId='', after='', before='', limit=''): + params = {'ccy': ccy, 'ordId': ordId, 'after': after, 'before': before, 'limit': limit} + return self._request_with_params(GET, GET_VIP_LOAN_ORDER_DETAIL, params) + + #- Set risk offset type + def set_risk_offset_typel(self, type=''): + params = {'type': type} + return self._request_with_params(POST, SET_RISK_OFFSET_TYPE,params) + + # - Set auto loan + def set_auto_loan(self, autoLoan=''): + params = { + 'autoLoan': autoLoan + } + return self._request_with_params(POST, SET_AUTO_LOAN, params) + + #- Activate option + def activate_option(self): + return self._request_without_params(POST, ACTIVSTE_OPTION) diff --git a/okx/BlockTrading.py b/okx/BlockTrading.py index 0275555..4ff22a1 100644 --- a/okx/BlockTrading.py +++ b/okx/BlockTrading.py @@ -10,8 +10,10 @@ class BlockTradingAPI(Client): params = {} return self._request_with_params(GET, COUNTERPARTIES, params) - def create_rfq(self, counterparties=[], anonymous='false', clRfqId='', legs = []): - params = {'counterparties': counterparties, 'anonymous': anonymous, 'clRfqId': clRfqId, 'legs': legs} + def create_rfq(self, counterparties=[], anonymous='false', clRfqId='', tag='', allowPartialExecution='false', + legs=[]): + params = {'counterparties': counterparties, 'anonymous': anonymous, 'clRfqId': clRfqId, 'tag': tag, + 'allowPartialExecution': allowPartialExecution, 'legs': legs} return self._request_with_params(POST, CREATE_RFQ, params) def cancel_rfq(self, rfqId = '', clRfqId = ''): @@ -26,13 +28,13 @@ class BlockTradingAPI(Client): params = {} return self._request_with_params(POST, CANCEL_ALL_RSQS, params) - def execute_quote(self, rfqId='', quoteId=''): - params = {'rfqId': rfqId, 'quoteId': quoteId} + def execute_quote(self, rfqId='', quoteId='', legs=[]): + params = {'rfqId': rfqId, 'quoteId': quoteId, 'legs': legs} return self._request_with_params(POST, EXECUTE_QUOTE, params) - def create_quote(self, rfqId='', clQuoteId='', quoteSide = '', legs = [],anonymous=False,expiresIn=''): - params = {'rfqId': rfqId, 'clQuoteId': clQuoteId, 'quoteSide': quoteSide, 'legs': legs, - 'anonymous':anonymous,'expiresIn':expiresIn} + def create_quote(self, rfqId='', clQuoteId='', tag='', quoteSide='', legs=[], anonymous=False, expiresIn=''): + params = {'rfqId': rfqId, 'clQuoteId': clQuoteId, 'tag': tag, 'quoteSide': quoteSide, 'legs': legs, + 'anonymous': anonymous, 'expiresIn': expiresIn} return self._request_with_params(POST, CREATE_QUOTE, params) def cancel_quote(self, quoteId = '', clQuoteId = ''): @@ -55,8 +57,10 @@ class BlockTradingAPI(Client): params = {'rfqId': rfqId, 'clRfqId': clRfqId, 'quoteId':quoteId,'clQuoteId':clQuoteId, 'state': state, 'beginId': beginId, 'endId': endId, 'limit':limit} return self._request_with_params(GET, GET_QUOTES, params) - def get_trades(self, rfqId = '', clRfqId = '', quoteId = '', clQuoteId = '', state = '', beginId = '', endId = '', limit = ''): - params = {'rfqId': rfqId, 'clRfqId': clRfqId, 'quoteId':quoteId,'clQuoteId':clQuoteId, 'state': state, 'beginId': beginId, 'endId': endId, 'limit':limit} + def get_trades(self, rfqId='', clRfqId='', quoteId='', clQuoteId='', state='', beginId='', endId='', beginTs='', + endTs='', limit=''): + params = {'rfqId': rfqId, 'clRfqId': clRfqId, 'quoteId': quoteId, 'clQuoteId': clQuoteId, 'state': state, + 'beginId': beginId, 'endId': endId, 'beginTs': beginTs, 'endTs': endTs, 'limit': limit} return self._request_with_params(GET, GET_RFQ_TRADES, params) def get_public_trades(self, beginId = '', endId = '', limit = ''): @@ -68,4 +72,8 @@ class BlockTradingAPI(Client): def set_marker_instrument(self,params = []): - return self._request_with_params(POST, MARKER_INSTRUMENT_SETTING, params) \ No newline at end of file + return self._request_with_params(POST, MARKER_INSTRUMENT_SETTING, params) + + #Get Quote products + def get_quote_products(self): + return self._request_without_params(GET, MARKER_INSTRUMENT_SETTING) diff --git a/okx/CopyTrading.py b/okx/CopyTrading.py new file mode 100644 index 0000000..0f41254 --- /dev/null +++ b/okx/CopyTrading.py @@ -0,0 +1,71 @@ +from .client import Client +from .consts import * + + +class CopyTradingAPI(Client): + 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): + Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag, domain, debug) + + # Get existing leading positions + def get_existing_leading_positions(self, instId=''): + params = { + 'instId': instId + } + return self._request_with_params(GET, GET_EXISTING_LEADING_POSITIONS, params) + + # Get leading position history + def get_leading_position_history(self, instId='', after='', before='', limit=''): + params = { + 'instId': instId, + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_LEADING_POSITIONS_HISTORY, params) + + # Place leading stop order + def place_leading_stop_order(self, subPosId='', tpTriggerPx='', slTriggerPx='', tpTriggerPxType='', slTriggerPxType=''): + params = { + 'subPosId': subPosId, + 'tpTriggerPx': tpTriggerPx, + 'slTriggerPx': slTriggerPx, + 'tpTriggerPxType': tpTriggerPxType, + 'slTriggerPxType': slTriggerPxType + } + return self._request_with_params(POST, PLACE_LEADING_STOP_ORDER, params) + + # Close leading position + def close_leading_position(self, subPosId=''): + params = { + 'subPosId': subPosId + } + return self._request_with_params(POST, CLOSE_LEADING_POSITIONS, params) + + # Get leading instruments + def get_leading_instruments(self): + return self._request_without_params(GET, GET_LEADING_POSITIONS) + + # Amend leading instruments + def amend_leading_instruments(self, instId=''): + params = { + 'instId': instId + } + return self._request_with_params(POST, AMEND_EXISTING_LEADING_POSITIONS, params) + + # Get profit sharing details + def get_profit_sharing_details(self, after='', before='', limit=''): + params = { + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_PROFIT_SHARING_DETAILS, params) + + # Get total profit sharing + def get_total_profit_sharing(self): + return self._request_without_params(GET, GET_TOTAL_PROFIT_SHARING) + + # Get unrealized profit sharing details + def get_unrealized_profit_sharing_details(self): + return self._request_without_params(GET, GET_UNREALIZED_PROFIT_SHARING_DETAILS) diff --git a/okx/Earning.py b/okx/Earning.py index 0ecb256..44e3363 100644 --- a/okx/Earning.py +++ b/okx/Earning.py @@ -14,15 +14,17 @@ class EarningAPI(Client): } return self._request_with_params(GET,STACK_DEFI_OFFERS,params) - def purchase(self,productId = '',investData = [],term = ''): + def purchase(self, productId='', investData=[], term='', tag=''): params = { - 'productId':productId, - 'investData':investData + 'productId': productId, + 'investData': investData } if term != '': params['term'] = term - return self._request_with_params(POST,STACK_DEFI_PURCHASE,params) + if tag != '': + params['tag'] = tag + return self._request_with_params(POST, STACK_DEFI_PURCHASE, params) def redeem(self,ordId = '',protocolType = '',allowEarlyRedeem = ''): params = { @@ -59,6 +61,55 @@ class EarningAPI(Client): } return self._request_with_params(GET,STACK_DEFI_ORDERS_HISTORY,params) + # - Get saving balance + def get_saving_balance(self, ccy=''): + params = { + 'ccy': ccy + } + return self._request_with_params(GET, GET_SAVING_BALANCE, params) + # - Savings purchase/redemption + def savings_purchase_redemption(self, ccy='', amt='', side='', rate=''): + params = { + 'ccy': ccy, + 'amt': amt, + 'side': side, + 'rate': rate + } + return self._request_with_params(POST, SAVING_PURCHASE_REDEMPTION, params) + # - Set lending rate + def set_lending_rate(self, ccy='', rate=''): + params = { + 'ccy': ccy, + 'rate': rate + } + return self._request_with_params(POST, SET_LENDING_RATE, params) + + # - Get lending history + def get_lending_history(self, ccy='', after='', before='', limit=''): + params = { + 'ccy': ccy, + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_LENDING_HISTORY, params) + + # - Get public borrow info (public) + def get_public_borrow_info(self, ccy=''): + params = { + 'ccy': ccy + } + return self._request_with_params(GET, GET_PUBLIC_BORROW_INFO, params) + + # - Get public borrow history (public) + def get_public_borrow_history(self, ccy='', after='', before='', limit=''): + params = { + 'ccy': ccy, + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_PUBLIC_BORROW_HISTORY, params) diff --git a/okx/Funding.py b/okx/Funding.py index 56b4a76..31cd36d 100644 --- a/okx/Funding.py +++ b/okx/Funding.py @@ -30,13 +30,15 @@ class FundingAPI(Client): return self._request_with_params(POST, FUNDS_TRANSFER, params) # Withdrawal - def withdrawal(self, ccy, amt, dest, toAddr, fee,chain = '', clientId = ''): - params = {'ccy': ccy, 'amt': amt, 'dest': dest, 'toAddr': toAddr, 'fee': fee,'chain':chain,'clientId':clientId} + def withdrawal(self, ccy, amt, dest, toAddr, fee, chain='', areaCode='', clientId=''): + params = {'ccy': ccy, 'amt': amt, 'dest': dest, 'toAddr': toAddr, 'fee': fee, 'chain': chain, + 'areaCode': areaCode, 'clientId': clientId} return self._request_with_params(POST, WITHDRAWAL_COIN, params) # Get Deposit History - def get_deposit_history(self, ccy='', state='', after='', before='', limit='',txId='',depId=''): - params = {'ccy': ccy, 'state': state, 'after': after, 'before': before, 'limit': limit,'txId':txId,'depId':depId} + def get_deposit_history(self, ccy='', state='', after='', before='', limit='', txId='', depId='', fromWdId=''): + params = {'ccy': ccy, 'state': state, 'after': after, 'before': before, 'limit': limit, 'txId': txId, + 'depId': depId, 'fromWdId': fromWdId} return self._request_with_params(GET, DEPOSIT_HISTORIY, params) # Get Withdrawal History @@ -72,25 +74,21 @@ class FundingAPI(Client): params = {'ccy':ccy, 'invoice':invoice, 'memo':memo} return self._request_with_params(POST, WITHDRAWAL_LIGHTNING, params) - # POST SET LENDING RATE def set_lending_rate(self, ccy, rate): params = {'ccy': ccy, 'rate': rate} return self._request_with_params(POST, SET_LENDING_RATE, params) - # GET LENDING HISTORY def get_lending_history(self, ccy='', before='', after='', limit='' ): params = {'ccy': ccy, 'after': after, 'before': before, 'limit': limit } return self._request_with_params(GET, LENDING_HISTORY, params) - # GET LENDING RATE HISTORY def get_lending_rate_history(self, ccy='',after = '',before = '',limit = '' ): params = {'ccy': ccy,'after':after,'before':before,'limit':limit} return self._request_with_params(GET, LENDING_RATE_HISTORY, params) - # GET LENDING RATE SUMMARY def get_lending_rate_summary(self, ccy=''): params = {'ccy': ccy} @@ -124,3 +122,21 @@ class FundingAPI(Client): 'ccy':ccy } return self._request_with_params(GET, GET_SAVING_BALANCE, params) + + #Get non-tradable assets + def get_non_tradable_assets(self, ccy=''): + params = { + 'ccy': ccy + } + return self._request_with_params(GET, GET_NON_TRADABLE_ASSETS, params) + + #Get deposit withdraw status + def get_deposit_withdraw_status(self, wdId='', txId='', ccy='', to='', chain=''): + params = {'wdId': wdId, 'txId': txId, 'ccy': ccy, 'to': to, 'chain': chain} + return self._request_with_params(GET, GET_DEPOSIT_WITHDrAW_STATUS, params) + + #Get withdrawal history + def get_withdrawal_history(self, ccy='', wdId='', clientId='', txId='', type='', state='', after='', before ='', limit=''): + params = {'ccy': ccy, 'wdId': wdId, 'clientId': clientId, 'txId': txId, 'type': type, 'state': state, 'after': after, 'before': before, 'limit': limit} + return self._request_with_params(GET, GET_WITHDRAWAL_HISTORY, params) + diff --git a/okx/Grid.py b/okx/Grid.py index 6cf4991..0e4ea9d 100644 --- a/okx/Grid.py +++ b/okx/Grid.py @@ -76,3 +76,57 @@ class GridAPI(Client): 'duration':duration } return self._request_with_params(GET, GRID_AI_PARAM, params) + + # - Place recurring buy order + def place_recurring_buy_order(self, stgyName='', recurringList=[], period='', recurringDay='', recurringTime='', + timeZone='', amt='', investmentCcy='', tdMode='', algoClOrdId='', tag=''): + params = {'stgyName': stgyName, 'recurringList': recurringList, 'period': period, 'recurringDay': recurringDay, + 'recurringTime': recurringTime, + 'timeZone': timeZone, 'amt': amt, 'investmentCcy': investmentCcy, 'tdMode': tdMode, + 'algoClOrdId': algoClOrdId, 'tag': tag} + return self._request_with_params(POST, PLACE_RECURRING_BUY_ORDER, params) + + # - Amend recurring buy order + def amend_recurring_buy_order(self, algoId='', stgyName=''): + params = {'algoId': algoId, 'stgyName': stgyName} + return self._request_with_params(POST, AMEND_RECURRING_BUY_ORDER, params) + + # - Stop recurring buy order + def stop_recurring_buy_order(self, orders_data): + return self._request_with_params(POST, STOP_RECURRING_BUY_ORDER, orders_data) + + # - Get recurring buy order list + def get_recurring_buy_order_list(self, algoId='', after='', before='', limit=''): + params = { + 'algoId': algoId, + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_RECURRING_BUY_ORDER_LIST, params) + + # - Get recurring buy order history + def get_recurring_buy_order_history(self, algoId='', after='', before='', limit=''): + params = { + 'algoId': algoId, + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_RECURRING_BUY_ORDER_HISTORY, params) + + # - Get recurring buy order details + def get_recurring_buy_order_details(self, algoId=''): + params = {'algoId': algoId} + return self._request_with_params(GET, GET_RECURRING_BUY_ORDER_DETAILS, params) + + # - Get recurring buy sub orders + def get_recurring_buy_sub_orders(self, algoId='', ordId='', after='', before='', limit=''): + params = { + 'algoId': algoId, + 'ordId': ordId, + 'after': after, + 'before': before, + 'limit': limit + } + return self._request_with_params(GET, GET_RECURRING_BUY_SUB_ORDERS, params) diff --git a/okx/MarketData.py b/okx/MarketData.py index 1dc2bdf..da4691b 100644 --- a/okx/MarketData.py +++ b/okx/MarketData.py @@ -115,6 +115,20 @@ class MarketAPI(Client): } return self._request_with_params(GET, BLOCK_TRADES, params) + #- Get order lite book + def get_order_lite_book(self,instId = ''): + params = { + 'instId':instId + } + return self._request_with_params(GET, GET_ORDER_LITE_BOOK, params) + + #- Get option trades + def get_option_trades(self,instFamily = ''): + params = { + 'instFamily':instFamily + } + return self._request_with_params(GET, GET_OPTION_TRADES, params) + diff --git a/okx/PublicData.py b/okx/PublicData.py index 10438eb..8f915c0 100644 --- a/okx/PublicData.py +++ b/okx/PublicData.py @@ -56,13 +56,6 @@ class PublicAPI(Client): def get_system_time(self): return self._request_without_params(GET, SYSTEM_TIME) - # Get Liquidation Orders - def get_liquidation_orders(self, instType, mgnMode='', instId='', ccy='', uly='', alias='', state='', before='', - after='', limit='',instFamily =''): - params = {'instType': instType, 'mgnMode': mgnMode, 'instId': instId, 'ccy': ccy, 'uly': uly, - 'alias': alias, 'state': state, 'before': before, 'after': after, 'limit': limit,'instFamily':instFamily} - return self._request_with_params(GET, LIQUIDATION_ORDERS, params) - # Get Mark Price def get_mark_price(self, instType, uly='', instId='',instFamily = ''): params = {'instType': instType, 'uly': uly, 'instId': instId,'instFamily':instFamily} @@ -113,5 +106,19 @@ class PublicAPI(Client): } return self._request_with_params(GET, CONVERT_CONTRACT_COIN, params) + # Get option tickBands + def get_option_tickBands(self, instType='', instFamily=''): + params = { + 'instType': instType, + 'instFamily': instFamily + } + return self._request_with_params(GET, GET_OPTION_TICKBANDS, params) - + # Get option trades + def get_option_trades(self, instId='', instFamily='', optType=''): + params = { + 'instId': instId, + 'instFamily': instFamily, + 'optType': optType + } + return self._request_with_params(GET, GET_OPTION_TRADES, params) diff --git a/okx/SubAccount.py b/okx/SubAccount.py index ea0428b..09fce2f 100644 --- a/okx/SubAccount.py +++ b/okx/SubAccount.py @@ -59,5 +59,25 @@ class SubAccountAPI(Client): } return self._request_with_params(GET, GET_ASSET_SUBACCOUNT_BALANCE, params) + # - Get the user's affiliate rebate information + def get_the_user_affiliate_rebate_information(self, apiKey=''): + params = { + 'apiKey': apiKey + } + return self._request_with_params(GET, GET_THE_USER_AFFILIATE_REBATE, params) + # - Set sub_accounts VIP loan% + def set_sub_accounts_VIP_loan(self, enable='', alloc=[]): + params = { + 'enable': enable, + 'alloc': alloc + } + return self._request_with_params(POST, SET_SUB_ACCOUNTS_VIP_LOAN, params) + # - Get sub_account borrow interest and limit + def get_sub_account_borrow_interest_and_limit(self, subAcct='', ccy=''): + params = { + 'subAcct': subAcct, + 'ccy': ccy + } + return self._request_with_params(GET, GET_SUB_ACCOUNT_BORROW_INTEREST_AND_LIMIT, params) diff --git a/okx/Trade.py b/okx/Trade.py index 2db2e83..3df71fc 100644 --- a/okx/Trade.py +++ b/okx/Trade.py @@ -9,10 +9,13 @@ class TradeAPI(Client): # Place Order def place_order(self, instId, tdMode, side, ordType, sz, ccy='', clOrdId='', tag='', posSide='', px='', - reduceOnly='', tgtCcy=''): + reduceOnly='', tgtCcy='', tpTriggerPx='', tpOrdPx='', slTriggerPx='', slOrdPx='', + tpTriggerPxType='', slTriggerPxType='', quickMgnType='', stpId='', stpMode=''): params = {'instId': instId, 'tdMode': tdMode, 'side': side, 'ordType': ordType, 'sz': sz, 'ccy': ccy, 'clOrdId': clOrdId, 'tag': tag, 'posSide': posSide, 'px': px, 'reduceOnly': reduceOnly, - 'tgtCcy': tgtCcy} + 'tgtCcy': tgtCcy, 'tpTriggerPx': tpTriggerPx, 'tpOrdPx': tpOrdPx, 'slTriggerPx': slTriggerPx, + 'slOrdPx': slOrdPx, 'tpTriggerPxType': tpTriggerPxType, 'slTriggerPxType': slTriggerPxType, + 'quickMgnType': quickMgnType, 'stpId': stpId, 'stpMode': stpMode} return self._request_with_params(POST, PLACR_ORDER, params) # Place Multiple Orders @@ -29,10 +32,12 @@ class TradeAPI(Client): return self._request_with_params(POST, CANAEL_BATCH_ORDERS, orders_data) # Amend Order - def amend_order(self, instId, cxlOnFail='', ordId='', clOrdId='', reqId='', newSz='', newPx=''): + def amend_order(self, instId, cxlOnFail='', ordId='', clOrdId='', reqId='', newSz='', newPx='', newTpTriggerPx='', + newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', newSlTriggerPxType=''): params = {'instId': instId, 'cxlOnFailc': cxlOnFail, 'ordId': ordId, 'clOrdId': clOrdId, 'reqId': reqId, - 'newSz': newSz, - 'newPx': newPx} + 'newSz': newSz, 'newPx': newPx, 'newTpTriggerPx': newTpTriggerPx, 'newTpOrdPx': newTpOrdPx, + 'newSlTriggerPx': newSlTriggerPx, 'newSlOrdPx': newSlOrdPx, 'newTpTriggerPxType': newTpTriggerPxType, + 'newSlTriggerPxType': newSlTriggerPxType} return self._request_with_params(POST, AMEND_ORDER, params) # Amend Multiple Orders @@ -40,8 +45,9 @@ class TradeAPI(Client): return self._request_with_params(POST, AMEND_BATCH_ORDER, orders_data) # Close Positions - def close_positions(self, instId, mgnMode, posSide='', ccy='',autoCxl=''): - params = {'instId': instId, 'mgnMode': mgnMode, 'posSide': posSide, 'ccy': ccy,'autoCxl':autoCxl} + def close_positions(self, instId, mgnMode, posSide='', ccy='', autoCxl='', clOrdId='', tag=''): + params = {'instId': instId, 'mgnMode': mgnMode, 'posSide': posSide, 'ccy': ccy, 'autoCxl': autoCxl, + 'clOrdId': clOrdId, 'tag': tag} return self._request_with_params(POST, CLOSE_POSITION, params) # Get Order Details @@ -56,15 +62,19 @@ class TradeAPI(Client): return self._request_with_params(GET, ORDERS_PENDING, params) # Get Order History (last 7 days) - def get_orders_history(self, instType, uly='', instId='', ordType='', state='', after='', before='', limit='',instFamily = ''): + def get_orders_history(self, instType, uly='', instId='', ordType='', state='', after='', before='', begin='', + end='', limit='', instFamily=''): params = {'instType': instType, 'uly': uly, 'instId': instId, 'ordType': ordType, 'state': state, - 'after': after, 'before': before, 'limit': limit,'instFamily':instFamily} + 'after': after, 'before': before, 'begin': begin, 'end': end, 'limit': limit, + 'instFamily': instFamily} return self._request_with_params(GET, ORDERS_HISTORY, params) # Get Order History (last 3 months) - def get_orders_history_archive(self, instType, uly='', instId='', ordType='', state='', after='', before='', limit='',instFamily = ''): + def get_orders_history_archive(self, instType, uly='', instId='', ordType='', state='', after='', before='', + begin='', end='', limit='', instFamily=''): params = {'instType': instType, 'uly': uly, 'instId': instId, 'ordType': ordType, 'state': state, - 'after': after, 'before': before, 'limit': limit,'instFamily':instFamily} + 'after': after, 'before': before, 'begin': begin, 'end': end, 'limit': limit, + 'instFamily': instFamily} return self._request_with_params(GET, ORDERS_HISTORY_ARCHIVE, params) # Get Transaction Details @@ -80,7 +90,8 @@ class TradeAPI(Client): triggerPx='', orderPx='', tgtCcy='', pxVar='', pxSpread='', szLimit='', pxLimit='', timeInterval='', tpTriggerPxType='', slTriggerPxType='', - callbackRatio='',callbackSpread='',activePx='',tag='',triggerPxType=''): + callbackRatio='',callbackSpread='',activePx='',tag='',triggerPxType='',closeFraction='' + ,quickMgnType='',algoClOrdId=''): params = {'instId': instId, 'tdMode': tdMode, 'side': side, 'ordType': ordType, 'sz': sz, 'ccy': ccy, 'posSide': posSide, 'reduceOnly': reduceOnly, 'tpTriggerPx': tpTriggerPx, 'tpOrdPx': tpOrdPx, 'slTriggerPx': slTriggerPx, 'slOrdPx': slOrdPx, 'triggerPx': triggerPx, 'orderPx': orderPx, @@ -88,11 +99,9 @@ class TradeAPI(Client): 'timeInterval': timeInterval, 'pxSpread': pxSpread, 'tpTriggerPxType': tpTriggerPxType, 'slTriggerPxType': slTriggerPxType, 'callbackRatio' : callbackRatio, 'callbackSpread':callbackSpread,'activePx':activePx, - 'tag':tag,'triggerPxType':triggerPxType,} + 'tag':tag,'triggerPxType':triggerPxType,'closeFraction':closeFraction,'quickMgnType':quickMgnType,'algoClOrdId':algoClOrdId} return self._request_with_params(POST, PLACE_ALGO_ORDER, params) - - # Cancel Algo Order def cancel_algo_order(self, params): return self._request_with_params(POST, CANCEL_ALGOS, params) @@ -102,9 +111,9 @@ class TradeAPI(Client): return self._request_with_params(POST, Cancel_Advance_Algos, params) # Get Algo Order List - def order_algos_list(self, ordType ='', algoId='', instType='', instId='', after='', before='', limit=''): + def order_algos_list(self, ordType='', algoId='', instType='', instId='', after='', before='', limit='',algoClOrdId=''): params = {'ordType': ordType, 'algoId': algoId, 'instType': instType, 'instId': instId, 'after': after, - 'before': before, 'limit': limit} + 'before': before, 'limit': limit, 'algoClOrdId': algoClOrdId} return self._request_with_params(GET, ORDERS_ALGO_OENDING, params) # Get Algo Order History @@ -157,3 +166,18 @@ class TradeAPI(Client): 'limit':limit } return self._request_with_params(GET,ONE_CLICK_REPAY_HISTORY,params) + + # Get algo order details + def get_algo_order_details(self, algoId='', algoClOrdId=''): + params = {'algoId': algoId, 'algoClOrdId': algoClOrdId} + return self._request_with_params(GET, GET_ALGO_ORDER_DETAILS, params) + + # Amend algo order + def amend_algo_order(self, instId='', algoId='', algoClOrdId='', cxlOnFail='', reqId='', newSz='', + newTpTriggerPx='', newTpOrdPx='', newSlTriggerPx='', newSlOrdPx='', newTpTriggerPxType='', + newSlTriggerPxType=''): + params = {'instId': instId, 'algoId': algoId, 'algoClOrdId': algoClOrdId, 'cxlOnFail': cxlOnFail, + 'reqId': reqId, 'newSz': newSz, 'newTpTriggerPx': newTpTriggerPx, 'newTpOrdPx': newTpOrdPx, + 'newSlTriggerPx': newSlTriggerPx, 'newSlOrdPx': newSlOrdPx, + 'newTpTriggerPxType': newTpTriggerPxType, 'newSlTriggerPxType': newSlTriggerPxType} + return self._request_with_params(POST, AMEND_ALGO_ORDER, params) diff --git a/okx/__init__.py b/okx/__init__.py index 8dd9460..6d04186 100644 --- a/okx/__init__.py +++ b/okx/__init__.py @@ -2,4 +2,4 @@ Python SDK for the OKX API v5 """ -__version__="0.1.9" \ No newline at end of file +__version__="0.2.0" \ No newline at end of file diff --git a/okx/__pycache__/Account.cpython-310.pyc b/okx/__pycache__/Account.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2e117d9e98d8894cf65a5c4f96bc8b155df2224 GIT binary patch literal 7981 zcmb7JOLN=S6(;xuX-c*%IkFwU;zwdSu@&c?)J{T+l+0KX6%vwT^?|~;kc5aYUx2oy zp%$HHy6K{SAe|yN;;tFFE2WTumz?}7jU2vi+#cz6IDT%7N`?zxxU ziHSmjj>~_t+1)FN#J_M7JkoUXIeo3`L|B4JtwdYekRnxu`yhQtyZNw&hWEccB>Bh^`+6^Kg{ zcZ?N@%dk~8!6u2z=H;iF<>>|5F^2gb0>@xkHAek%dD&3i43cJQ$C+;Lkzrn5( zH_b}y21(7ZH`!bCdy4MdWVh(fEA-qPdz-jf;%>8dh&xShewV#R+!-db43oDKn`!nw z`+%;Tr6)gR9})K|`}Tu_T{%y>-({Z?cY&?5&)Db0T_mo|?h$v1^qOZC z;$EX`RklFfWg2af-6!q}aW(b@aaY*`wnXDzW6R{7hfbla>)n3GF0a;pNZ!1?;7GTB znBKPSp7qJx+_PuTZgqE_-_pBnMVA8}1CMB#r>}L6h@JRO8YBkNAUQ}4(u2$(JIH-6 zBQ~0e18Jp{20ZyhA~NqWZ*cjwkf)SBz=7<{f`SUYyN zH`m*>x4WI27TdY0cYC|uIe{a&=W|0N-0JP}JdKf~uLXtANqf^H1KskpcM>}8dPjPq&ta0;=6<`*~vlj`xIF{x#GxX$Fh~(o>59UGb%Tp^bN~a zpPBZy+S9n!ww%;rRoR$Wtv72*t-hi*YRw0w6o=9ID@2^EDeRsP$OEOkz`|i-C)eKUEO(jVWOWfxPTHoha&lJx zG2+X~Xq&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7&P?0+XSd)Fc`;-5Ua5j-F)8Fwis%6Yg-hESacs`c6` z?b(IfD78{n$_K-Rub3lZhKdDz9)K~VUz7*~S}B!jw)SU&>o$njBS^2qOICu7;vpSb=y!d0^# zEUYusdZSWpP%t(Xui+K`=|WNAuJA~)o|^SQV+Ar?)3<1H{3`}oC$e`r25m(6r+Vj1 z3=DVAG1f7nP9ih{uVsc!>+QcmOR?05?$yPLA3bwW`inNwOAayF&7coP1y}0}3*ePU ztNtdJC}?pr+$nUE*l}08VkbhiY5%qLcW5hSm|&rb75%@OIkh&94vAm|# z-IeIDbGPu~I6WuuattI)`wtScvP9C!^pBIN(B^eW@Fz@#!idMq^Ga>KsZ`baD*nQV zoehs`x@|tCEKs{W{A2M?C@to|vw;YV2w`snONbF!;6T8!t)!GBj=6$19Ps1v`4RsT z92wVt)O|i3x!_*S#$6p-f{GqqPlHbqXrhGW{0#qN+aWYc2PV z_}7Y`1>TDwmqBiUV4s!02l6qs0a&g8rRZ9;8hE%$caL-kS^p3xnw3O6@EWtHJt4v- literal 0 HcmV?d00001 diff --git a/okx/__pycache__/BlockTrading.cpython-310.pyc b/okx/__pycache__/BlockTrading.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..386d74b9abee39b049b68c382bddd88f5e865d25 GIT binary patch literal 4542 zcmb7INpssq7RE*rfGEn^yp0#xjuXR)#n_oOlVnWGw8M!_%Oq4a!wU*RLljCNL3e{A zOGTZ=KVuH@(SHfonaiAg^Ck0MVRpg1CGWtvvAq=g6cs@%r7`ZsU{m;Ni1KeE8|oVHghB zx7F(L@$q&rJn@|V_P#%KO-F_3qz~$tupRiZYal}5XK^Hq#E~?TN6M%$DvnC;RZLG? z_#ie7iArD2fp2niX`aSUOy@jcYoOZAka0KyS0|tsJA~z z6oVWUV;k;XEY`8R;snEf=u&tadM-oLkH`~6tca&KreWueqr!phLu3U9t3Q1ZA-1^} zTcAuPl!*T-o|Q76O6ZdzHH{*@0+x|x_k;dPFBr0@Fu(6#8nn+m*P=#wfbV)2)Xbb56rDw(k(gJJq$7_)TZEEos~fOIBj0g%%G zNKpYMYY+}G@rd4mkHDc?bEp1-JEX)8eGdJxFZ03MeaH0?{012Ebn2MSS>T!BLg4f+ z41pPvq9O;#A~nfO8u%FIY69~~&D{AB!M2SAt$}FoqnL+w)rmpu+o5xam>IXa2ll78 zW+FXpyO2K=T~FA;%Ogg)lAx@;fPl7Nx9KG`o67!50tsr41H!e5UPVAR7XV5v9n5+9 zVD7X0tpJ%~TBFjNVGz1d2w0rCLRhZhJSHJ*r94kz`ZRc36vaDSuMG0}Yg%GTtlz(UwNqSC(G_4=@Z72H0-Kfc%V z!n7(b!iOCd_Um}5Om?bl5c(}f?awH_L-9R|dF8Bj;i!YF=I_9Q;qtSFw4OO|q-GAX zIDK%p$2Mm)av{&?kqVqv&$NuwTFPmab2{FF##KBAbIx5I-A&3#pCB>cm49`ZxvuNz zQ=H5{0e0^E#ku?3*w9%5%k(LOf^F_TR_L_*BWuQzy(vq&Jy;^~#? zg)Xyl&?0?MPY(#J0*w@4?yNsPy+l`D)>=Q+TUMjlHd}iy>rK-FXlA4NeD0#R$)VX4 z?l5p;Vj&&&;Qsnon26!jaFo3}4Rr1o3!_S(!Z7I}tByJ@YqWvl8H%ZBtz|^C1~ec; zCuFbC>_-r%x2Lhp8aIs+#ej{)Gg`zp-ZxCRAM%qL3b;^Y`aBJ;2EY1#{MOLN`gt{= zLwLTd;!Je*A`C8{^vwF2?i=6knqF3PlygZ&Bb{PydJl z7e4v}ioc+Ef`StU%aLNL=}#!eiQpPu{U~w+qsbnDPz6bpMEw_4(G~ow7b}XYTu?46 zdO-(G$NuDvs+8q&fq&mLl&I+N{}rkV D5>&}D literal 0 HcmV?d00001 diff --git a/okx/__pycache__/CopyTrading.cpython-310.pyc b/okx/__pycache__/CopyTrading.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4880b283f1943fe46358936e7b4408a0f20e067 GIT binary patch literal 2932 zcmb7G&vVm86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{og9m!(e9%7?a=t|urhMwsw5TVdG#N7 CU&NjO literal 0 HcmV?d00001 diff --git a/okx/__pycache__/Earning.cpython-310.pyc b/okx/__pycache__/Earning.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f961a09a571ad9109cd8cd776e58a6acaaa0990a GIT binary patch literal 3458 zcmaJ^TT|Oc6xPkMP{84y5ON{+I4!v8y=juEV@%>Hu^HP*C+>qrXxE@Yww#rKm@!Yy zZ|GBJnmqEC^xCJs@O{|C_>XIXsg=YehiSkY$3Kf5oD>8|dgrxen2pp1W zeG7&LuI}Ey!!Q*pA`vPQxj|GCe<#9DH^~^$K~spfB@m5hRfU`*<1i9~xe1a0O(nO; zc`^xFoZKc;WEwP$+#xe$7PK*Pm&}oQ&~%u+KrVuI4puCXOQ4Oz*dnp#^{S|lT?TY2r%9hrL z4s~QU1Gje>gfF}oTS7~0NiDghv|=r_75|_ikMI^TpOlycR)J<1cHQ<3BdG<7N1bXA zHygIGLz_VY6^~ks`utgMn4Z_zW~N7j^Sd5}Ikrcc;oCJDC{@SY3RL3OOuHV$2;JP> zIuh6vyyN(B>Lr+ZDR+mm)GGCMe7BKmH2rP2zU+~mWy@_eqh|mIc5hQ15>^^bhR{^F zJ#_f8creo=XeIJK5G;&tbj3iy8`)@I0uk~+#6RRir6s% z>{@<~1mmFkuH`!AW`hQ@Wi?@b)?oC_F7fKRR2xH4(9sM z_AD(#7hOnBgx32W9uO^Hl@4PqnMgY_n}8gM5&4nOQuy;6W&}~-IpQM5xrkw2pxc3N z*Y^PKs_C0-1_u7x~CWp;WHS^ugbFSceGURL)wg>|oa~a7I9))1ibR2gd_;i{@ zN+_*$kgz2%ABbZyyPD0uh~jtyro%YiL~R%XmGKQZR;<2*slKpZgP<;B;s+GSAwG zGU_gnYYODrU@k#jDJM%H=J}>iBM=L)Mdeao{uGL@z^haY8$|a)OkQz-XO?-8Z^0mAmPS9ucu6+Tx+q zWkNzGj-)(qeFHeBp=lbW^s8L{nejBej(K||hXAonj>h4cd+=E_Hcbc9Hx0IJ?0kx( z{FjhVc|T}9GLP9k*aBOH5;kestoiUEvh&9g#{L zDR(Uj%o0phCQA^Q^=y6>BU4P5vr#wUm_{O*^q}e-S|=DBq^ty+vAZA+7W-X3VRd#y zAagnqVS{NNdCYsq45m`#ai>_0I^Q1d^x)c|f#6Lea=%j}zaoOq5W&etal&w9QLry? ziw7VE9G*vqH(own&t;6Kg<`Sri;>H(71)<(jUT_hbHO~;Zew@Tu`OfMWz5}&lUmiK zX!SLSgX?|l4!1pbT=ij@h6n9YEN0CDD6$(6hu^&)8Lh%^I6BND3cFAMW34kBgH9;43 zd0NxQbxn`!WAHz&p95V_#JMF@L!esxw+%nHS5(Wbd%njfhwUF|k3uw0@RyN?Y>o?> HI4l1Tm&)qU literal 0 HcmV?d00001 diff --git a/okx/__pycache__/Funding.cpython-310.pyc b/okx/__pycache__/Funding.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88fd90d0a49d7496d5cb2370a09db63d0ec4e5ab GIT binary patch literal 5878 zcmb7IOLN=S6$S|KDT;bg4_kgaaZD$Y>?F>^u^rJOC9$O`m87hSGaU?s3rVO*g1#5D zEDbeX)YC=#7rIE6-t-4y+f|ntZ8F}Z=Unnq00k;zXn1r09N?bsyf5t0(S!uYhhP3l z{xd5{|HTvUp~A^B{MdaUL?UusYRENNMm|&zRi!nFC`5fH5!ICcuGAC~u1J~4|6~x) z$Zlk%ZkbI7IQfAAmwbl;XUp(ozXCC(noOixhGNxk~2YZAtQ+TqD=v z$|&5sL2d$<0`3;M4cr*HL+*mqIQfx$LOz8n6Tsagp8+=sQuj#)xGCTskk5fj?@N0! z`GPC}KMhwG$r5lgz&#|7fSU#GOY#+PbFl8$i3(_&ASmX3~&7VY-2Wi%Ie>us}Y#K2hMKpy?K0zY;Qh$HaZhQZ|L?>X456_miK$I=n zhbCRhne5Q9TT88D=fG|*FmkwH*sWu6ZXdn{xwlI_LoBwADMG^^Lxr!&CsXG}S`^w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Vr7S>99xEY4CCEofKSWt{N)8?pa4cB;9wewJ zn<57Ab9a6Bksq-2LTVy4F=l=PJD|Tp5nU#hkA6b7`+I)q+DL1g(U6yX8b*`xc;rmq z(l7DZUxA2hJkP=k&YyClyi=*uU*M=I&gEHj^eo%NQ_V&O(_exZo{z*rI6%jZ-CtT0;x zhU#vkq;3~$<;`+MeN@~kR@O^}!~`rxmQ7eBmK~RvKLAy)?-*)Fqb;+m?rCkUs~exe zBpb7}APD}!ofzJXxG8?#%#)4YfyJcu<-Al$VD$A^>A2z6(AUr>u^^vdL3OpK8eX03b`( zIR>y;R;$HYal0^r7M)7BWYHeks( z-2cq6k-UsKI!tVN=!BHvkunrdn+S$wR*%L(5SZ_pnNcxBG)J30LY7%^8MA*C9>d-R zC(rj;gHI1)EH_6*4_I&$odk%`pS%*D+ zgll28dbe$lDn`2TzifL{_#NS##~_Ap-F8qaqJ@K&1O@vnwO#>boLV8BCXVGWHsm0k zCRn6<3E=$cm0=9uCd$O*#G#L&@Giw+4C%)8p9_oF7|y`~2}k6Q`Q-2v3XUgN3Q3Br z8;i#j?LyH&jlvvVz|Q|gK%~a31FwrQSL3chstrfNu0wsMR^Zt!;9_(v)LqdF<8EOI zzoc~`pQ@^tR@IJ0`fb#+s`|XIwf#HnlNP;=mcdh*eux6gF!}|GuTeZiQAANf@dU-M zQEa1lisJVuo}u_7ia(+FGm5{U7+2&>!>=|pcyqI{s8`?>Ne~4-{c~DLOM--&AhW)l zmeL9MNpL5XPG@mUO2I48@(H#MWKK`k*;icl39%{bQ0Y51yBYU%Px;z6$2a&5*hZFQ JIfY*k{|mfl4SxUt literal 0 HcmV?d00001 diff --git a/okx/__pycache__/MarketData.cpython-310.pyc b/okx/__pycache__/MarketData.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa48a463dbeef0e3a41d635da738616ba09a18c7 GIT binary patch literal 4521 zcmbVQOIO=Q6xQ2DV25W&^CW4~#(Cg8`bheO7?ZewO>L(qWupqs1ay!s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HO@i*uprf@Ur`K zKLW->h``E_luHq?7s;}EyC0Ito=}7^xH$U#U?ypJrflE9vFoq^wuo+M_@dmy+^^{2 z2tgd02kWJk<;Pi}$CqiB_ zVJlvNMo}tlnB{V+1%8YuKSA;-lFyK2fu1?p#RzS=9-P|H2I_f_P?cBQY%(!kt9M%9 zEH*Vz@Ri)w6y}+3JNe(xKYu0k=@U((2e}m^znw(>IR+vtE9)DNje$gwbC2AG<=Fy~MI^kN z^*!wLbJb4G^If*zf)zaM`N@KZlK-SAGrEZfZ(`T#`yJHbWqq+XACh8ykE?7N7Qj79hNwad zXR#$I%O^3VyVgI1&z|*-lDScavjqR}`3jAQ6*CQ=P8v>qFx|6=yVtC{HnHlp=I#%; z#x)=ZsVaS)+G(mZwk(1ael(nf(>(;Cw?Ar0$-lU1Fra1cq7+y<9KSQ$9xtC?@q6kH8m#jPl2Z0pq3Tn zEvw;@b{+X4%lfWu*TX0L%bZQ3v6qlsL2?zzO(e5O=8zPT%p>^-$sHtLAo&tW3CTSq zD@br3PaNg=p$@;@7=Dq-aCvx^)rGvMD|sca<<-2N&%-ZXT7D3IksHeA3wf@yW++wF j;eQ_S|2tsf!hy!)53}AB=yyWEUx@fR49$?Bixc91k%B(o literal 0 HcmV?d00001 diff --git a/okx/__pycache__/PublicData.cpython-310.pyc b/okx/__pycache__/PublicData.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1171ce5efea90049cbe6a3de6d371c2ee70b9cb3 GIT binary patch literal 5214 zcmb7I&3D_z5yuxnkfJC{mL-44juI!f>BLf;INxb%T7(?b5-F2VUZo2PV<8DoBth?j zvB*aq`szQUhxn*JskrvkvoC$_Yn+*dK@t+EHsIrMu$W!U$8Tn5=}%AR1-R%xT4ZBE z5dMibss9o|yd;L| zTGMme0dV472Zj=t40jLV%R(TouqzT_SIWt`4EcPf?)jlUVk_S#956BcL0GENW zX;K7EB{Ss0OJO$)BeP@|yMlO*B7|D}Gav4UZ$QR@axe6l%a*Zs($aGH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>`((8sv6*@IqY2UKL(zDzzB# z41hC2m)dP;L9pfd3#`QEfk=`BIWYRD|1ReHr?MeA)j=1=7oHmMo_hylF!B!gC3CC} z{i4Qx$xv*Q}SC@*1; zkxPTY6~wONx8b0`e*&P%KzHk?g`!j~64c!0^ zkdEb{1LW8N5(mcFVmA**LJJx*+?Y&b?a8BZwbFo&nfDhQtL%<#{1s12@_jRdJmSu_Fay4M${wB!u#;-n+V(NxDEAkMQ_CICB{1{ z(tkoOEl}^yNs$%QCNBFci1Ph13XuBWV&?3LX-pmgf^is;b&Bw$h*J|ZMaYi`=$0H9 z-IheoL;6jUnD_wBwEyQE_%~%JS-OmWsOC;YR`5wt1kvv3FM)C+r1<8*{3?#TcjvZn6)`bUI z8pE7DfIE$6P5x~@10PibI{HeAB*GI7##BwoEBS1`n4c>k5#Gy7ctOy_dHFX8fMOf~ literal 0 HcmV?d00001 diff --git a/okx/__pycache__/Status.cpython-310.pyc b/okx/__pycache__/Status.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8f1b727159ba7aadf45b5221014ff46e639b0c2 GIT binary patch literal 853 zcmY*XO>Yx15ViL!n~(-*Be?Xykwt1&Js}~4S`}JxiIB3r>;Y?8yUi;5RohFNYB|xr zz`Z^4YqPPMZ$Kwv-mpXo1*&~JU%HU|zz;Nm3!MHJ_# zz%j-;wsI>%XNcO=xkc1r_`4n3)SaQg`vY7kz{)$xGgeB7@T(NA{xcg+N8sWG07EgR zD7NU3dbD?ofoX^K=>Q^!J_62>>d#~%8*%*ULRzK7d4bxJ4~)t=4Xx)@{AEckgRK@Ccp;7Pp{E`GjO;CJ70AO_co&J)4Z<3=#Z@vn>%nH5Yq7kP52JX#e=Rw|dWFU{po z#Gk?&>(}8ql!~xgFdn{VVj-(KtXFbgl?Q?@HX-POlIyUOKdDz-i}JvQZgn5u?Eag~ zWYe}nsZMT8&)NkyV|WGu#VyY8H>*W=NMdQV*1Zh_u%^ltFlH9m@tAOS)i5E+GLv&s zCp;;Hvd=z5u{Vp3qw`r{^FDC#F@W;A0wb-1U30DJ8lmfi-XuNS2_R^{pQkdixiQzQL{I^{L@AR@8x*@0=+kXMGL&moN literal 0 HcmV?d00001 diff --git a/okx/__pycache__/SubAccount.cpython-310.pyc b/okx/__pycache__/SubAccount.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..06dd8acfb948e9be5aa92f5a7c178bfd6499ccae GIT binary patch literal 3506 zcma)9-Ba5}5Z8w#3j+=f1VVs(e<__n)33Bin#K^5cuEapn`Fi>H?mF!4YK6i$t5u6 zshR#2eMlZN)4%9m`_$*W<)Q8F+42W5OpejAC#_Dm`}^(gIhvfzC@}7{8}zS9Mfn>i zgChl#CvfrGAgDssKxwE|RYhG3w2Jafp*l^yQE19jf7h!zHOh)@{-c7qtqOB3@Vzhw zO}*p7t)ZdA>Oc z#c{if>fvnvF+^!O*}jX9lY#geaA7b$%z~h5TlLi=t*yLOVl~#<+B?0hyw{2%&1KMI zTNg8gd9PX?kIB9t?~{v)2JK`+fp5B3Y zIUO8H%?X^)_3$N*jJDLQdU$2ng%S2banoR(42%KJCAgPC8HAOpf0{?>o@Z(F%+`vw zDRkF85UKc}>2)@2IQ7_L!mN4qh#*js7gBBIGa&l0rwbC{ra;FWe{whgN7>1-0| zOZ7)e8!{f|=YY~CHDI2S^Ccj-Nlln1_?j{bX{31vE8y}k-T}k!2+eP@1yqc{sd<4& zL4X?FIEd8NX1P)|O8IiWVyF9Xv#an1yN==pifbrF#bAzk92fw+N=N|ThI~SD@F@@( z)zU0A`O9jDH-;m0!uy}Z3}Yx6fxz?`0g*Exa>J1TJ{ZFELZ=pV$Z!nJAr_3iDCA#~ zjY7E>fZOne&nAIPfC2XdpT|fWnE+EKB)~CyVbq-fY7Zt(GO)biT>6Ya^nJ$S*0#WN z>u9X!`B;((7DFZr-D$*7r&!bwS{#WiYW>KIi8vaVjRlbtR+tlVF&;shY(>1}^SvZa zH(|l*ba{IsJBAuhdW7w zx{nd~0mP{0b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k=HdKd4~S706TBJd6`Qp7}~jx;eMgzrmY$^K?P339{C`~`G71fd<%FvVf~XgFgW ztm+Y08Xh`U>GQ)3`Jw5rVEtEMeQ=01p7IdN<{~5PNpn(ypN|guu1i=95v7vvGql2jP7at12_szncZx# z9I}3B%6R4WfN$&rLkC$G(cSM1%eSitW0T&YQmAyzg-X}&H^EpfPI{+J13mtOcoZjP zN>rg85uM23q-;tOa6Tr^^n}98VDD69Fq44Dv zzy^rAu!q(z;J1L^0e%no1Td(FL~9z){G!GBn0gAG^vE$}T=k)nR%1#WJ@t{2Qe$dD zjmru2WCf@y=!O5(uay}kCMXk1JQr1ys*+0(rsO#2au3C975W7(LAjBBUl+f~))Q2Y aS+*r!j^oi)-tqK`-`l+mnu#dVZ1jJ?O7wXE literal 0 HcmV?d00001 diff --git a/okx/__pycache__/__init__.cpython-310.pyc b/okx/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9f23e77b9baf00edff4d53d428071cfc95b01b5f GIT binary patch literal 220 zcmd1j<>g`kf+pqc6e}S87{oyaj6jY95Et_Ri4=w?h7`sq#uTPt22JKF1+IX~l8pR3 zgKTW1v?D6p_`N{F|x47fu%TkMq zGxPJ}<5w~iF$0YS6Td9=LyLhD`uW+ZMfxtO#n~nK1^NYG3v`Q9vSG~p>f*p7@iq_uCv*s>6WCeC@LJlKpR>>LRD2YD%%!8LzLYj;fuA|ag+VDJL82U z@*YroLh66W9((1Exbhq3%Bg2=6$hTzn@y9dW6kUNcxL8#=Y3u~U0e(p%3pu{F8}ly z`-eKGi;d1*RQ(N%WRee9G<)-iOCha+7+R4%bRuWyMlNR$n6#zyoJl9~o>`GEd6R|i zE39UluQ+UI8Ml*;bgqpv&btF`f@HswWO)~Z9m1V19y)hX^?jIx;Y=0@$;$_)Csxmv z_7hJ!(tXY&M|#qK&LUS zqyzs?3bo1id#L&jOu-8lvqHe~!h#ir4Qmw+tX;UUPT|42x!3ax7YxM*4lBvtgFTSf&&8 z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*^H_p?uOnd>kY8a5P3L`;eRx(s0tHLqc(y zWQ@W*jFJjWTxP)vC8vN`BrO%77=(s6V`@GQ2{j674lrAVoGWAq5z8<(2)Z<6wT1XR zz6bFz%r*&w*kJuH_B?M_G=nA}S?X<8WvP$Iu;%RyM&zTk#^I^Foi6$WVFsli=0T#H z70smbPYogTwK;V!eHKa1KFa|}R3m~=+fy}ws;5N&>b!ccMo}R|9ST{=C&5fSvFgX_ zhhWEHq<)NH2-?GSVY}^RpF$|N8_6IWFt=N!Hc5FcLFW~V6;hXi4UX^;g2l4x(gd!u z8aXm;8ezHRr3?;mK&%Q2@B|0b++GoZAfSh%)fR`S+B=9*{ux*!=4mpg*n=`RjJ077 zkhPwwEPs|W9jTKm7j-zsq4beDna&PB2J4k_3>@d!uz^b8eh$l+f6E#18^~2?oU9^3bW^;bH(@#+=VZJNq8lNkpu;Kk;0IbY?Sa@F& zL@^GB#IPYT5l3Dd2f>$!VA(>Hqs;devpi)`ADW?1C4r?^4>Meq2FXH#0s3(CA3tkAuDmhQ5a>6?N9uE>w{o%}5Op_fcS zCpghw-`H~py~FA@+`HKSgA;7f@15IsoOXUeDA=dyDQ&;BUE(sxHJfqSk>tN;`~L%}0ps`p literal 0 HcmV?d00001 diff --git a/okx/__pycache__/exceptions.cpython-310.pyc b/okx/__pycache__/exceptions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..22ea9dc856c1f690000bbad4be211d7551e4823c GIT binary patch literal 1708 zcma)5OK%e~5VpOW-E9aW1SlzwvVf`*B#4kW@lp{W1cww+0U`&iRqT{D$!@SWkc4oe zXKq|kd+cBGl@sUQxWJ6lBz>Xam1k$hp4T_yIN?kpVelWk+}`q~zDYa^GSgEy3Qo07Q~16{N}p6>Ni4 z9pMNU{@@2}J#%8Y(S7*h*^_Qfw$rsFuA%X0Ilu(4AHmk&fCxGuob7%E)#nqgBszX zJ$Ulr?+?&hkj@OK@C5(^QdSU1KdAhIq)319S^P0-u8HvZ%5o)?N+l|6Nv)$*8P-+O z3Zck5;pZ>LttCPlr=?eoTS;Qs&#m-yDqBMv<16{0BXwFjrm!!@UDru$vah3NM?OKX z#;Yf)6{W^aWj8hcZV=-(WKWx8I*rnf<~B&6q;4m%md0O|pihZWC1i#qYc2S6V7vP8w2`A4}axlXkh?OW!B)4J{fYHfeO>O1CUWZPPc~Jri)g z7O$n8d*DiA^F7LF4!#0qe~L~PIFETWfL);d;(^xR9GTZBn2r|mI0tqH^1$E>tV7?{ zX`Rht7g(h~4c7Wk+uR!$`0KnqFhBzR9Ff~kk z9*xmUmi8|k5%J&M+827*tx=y4(SxaDgA_(nXOK*wvM3>Zmr)-A>7PHs9ugULMV-Za z6MM^9C+Fb+$8l#2wWCls73u=Sdl9LqrKcmUFoL>>#8z_&xk)xQ5d?M-^&t>j%>nPz zQB{Zr&iw4*+@?c$eH{GUVe|h$@+#ObppPp^P^y$%Gc!iVPO!z+9`31s+zk`l8@`tZ OIL~(a^G?2adgd=RU~SX@ literal 0 HcmV?d00001 diff --git a/okx/__pycache__/utils.cpython-310.pyc b/okx/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e0e8fc0b18840199d5fbb6f30ea0587e938f573d GIT binary patch literal 2114 zcmZ8iU2{`K7~b9Uk&}>?LXiR@R-Dm^QmYJBMp3DyqXkJjCSH(1GpE_pB;@0S-Hp(C zGUH6~l1uN?%l@Uk^@_jH8-3mlO`)4P?|JtxkkAuuRpkuD-Dzg#&aSKG}*n_enQq4it6xM971^2`R?yC%^#oP4(7cC3??TQ905Sy0u>Hjv6$@Z}6LY{~V@Wn<0mDF3YZp~ok0--RjaCHsy z1_gFJC{k)g7sq2LhV8RaX!sM6k@W7cj5*DR#+?@2VJ6JP{$!Se-E;N`nxBP|;~hwW zY}_z;iEosREUd6Yzq~j9d`Y)^!)|O6xnxvK%~9QpT1hMug>)3GFWU`cdBe`FZf*U% zv9?;>*euuYS2oMGxVBlYu9vIz>Z7f7JG1$qzPh%yUa8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PA>oe literal 0 HcmV?d00001 diff --git a/okx/websocket/__pycache__/WsConnectManager.cpython-310.pyc b/okx/websocket/__pycache__/WsConnectManager.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6286ff1148b7c1aad776fd3cc652e64a0c53af4d GIT binary patch literal 4760 zcmb7I%W@mX744okKma5qQW9;&h1hW{I5t^H%84V(iEPWXBiW2%SXP3n6f#6N$pHs5 zP|rXz;bF>UsVXb|ffwLXKafwzNAxx;FS5(Z8|T~}fDcevWKezQ_G7wl-#+)zNbB_~ z!*lH)xmaFh>|azl{Wz%HM9FqQ1QR@Fo$}2)9Ca(U26o5h)Mm%d!0ot(cVchgcYN@! z@Zw-l=~N8w$JNi-M@$5w@`Qa9mi)h@P2kLkKzn0f4xU@oqlXoZlYx0fJjEW z=vaaa3+vm$md=hP9N|83I_|XQ2_H4Dl)2+iWer44Rxq|M8tAQxMY(|5l2}HqCN7AJ zWdKDMb|f=hiL$#YdKl(XyB|K3N#0rNPESUPuA~-ik5sH(YRz=e z3*&e@?ConmPIq@{{>rY*KLIZlEs=x+i6uPhm8xZHCzJ7xTEgyB1LPS~SMd7&?#8`L zs%#_Omulmd%=YtixG_A)_tNCeOzgkeONR%udb{I(Nn2v1}0Y+o(2dmE+RVipbzi@A`>G;KR?gy&` zjh4HmT^n#P8uK_2RT*B>yxVYJb|Gu99%o zVTpK%tgDH9G+Wd!&EmiSv?OaZeh~^P#Va>J_|1L_;&6vIcnvhbo8VT(yUJGpI199j zxAUKI^BnZ%Cj8&n(^%#Iz}`JzkM(WU1lk;fHZQRX7Z@}s1m><8+_;6e#t4ahufVu9 zc7*|9RuN3md=uXTMTEr%t9j6`2)o3iaK5#KCETahq$)h1xsoqn#adAj{!34xU{~o`54wL7m?~#+3J;Wb}Dv~TGF9lz?#vUW|^sR#5K%&rQs)A0q7W$xc z2+QD}S*5|6ZJ*tkx`zIbP%`@D3Ln38PP8+&e?}}4i9DKd)O%nkKK2=azC_|p5dGnb z`4N7UyR=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Aw zU8S!BS}yJ+Ne;#z$Sk9O3QhzwGEtoUJ55YLZ{YHXSF522^6DobofpDUo^FSG$$I_> zN|9py__}QTtzMe7Vs3{D;N+J(org9Af&Mi;d04g`)GT*t(BM< z*%;cf|58?_&TK5@z4WekAmPZLKKnh}pFh78&1S%`efQtVAA+%;G+1s94xVB+j}Ro2 zkg*|z08DZzGCmZcsJN3kLnm~Ayq1%ADo$*nFJU&` zGrKm;42C*;W~<0^mDpEt9)D0ep*72`Qi>DiErMbpNEUJlN=S}fV0WeZ&ad{rD-wNS=k&L)mQq9(r?nCdY-sTiiwkfXe=}D5iC1{DV#%_nazsx zB`%h@LtNjLtj{bzVV}g*ks$du4r~fj7CBRnSept&cUnWNQ*Kx6yy-&dr}HaxJxv0_ zW@>f{`z(v|LEq}KX2v6>OD~GjJhf4z>zJfH0-s<7q3f28QQ5)2F?xk6;Q~rOijoYy ziJ}Ykd%L%5ls3I$pmc9rnSm`vz0tA#SmY0k9L#AkIKq^p-l5tzMKVyfcVqa&(Xnpg z_N2jVAlw5E?o|N%%HbVwt1p1b>SD$G2BkZSbv!f)c|C8$>H1sPe{~S1?2P>5=jbE( zbpbnQSKEyDO`_9%)vp9y2;IVDy@pVFNt|W-aWc@iXs&`)3ivmxDDM|X=)h!cA?+sq zUrqWpZMlwsDsGMQn-$kOG+FTPu`5eyRs0SnP1YC3F2xi2%jS(Zy)c!zub z@lZuk8AQ>rkmHPaBZ@wc<7^fY#_FmRN+(N^Z{mjfE&-iUHfMF0s4T(^b literal 0 HcmV?d00001 diff --git a/okx/websocket/__pycache__/WsPublic.cpython-310.pyc b/okx/websocket/__pycache__/WsPublic.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9c2b20412376651c2759a7ef75d790dcf411add5 GIT binary patch literal 1087 zcmZ`%J#Q015S`sS+h@m495B$+SpxhA5Q-E86;Y%JMY@93d3OVc*LP<3jwF`5SV~1n zpOpSf*HWb=9ThWY`#6wTX-Bg=U+>LK+Us=y&-eB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*DI*J W#bJ}1pHiBWY6mjBm=h6bQ#VPI7>M$h&m2>c}_IdtuEgkdX>d0V;4;z`hR!Zden?K>u_g_y_=8 zBJGB?&l13531Cee1CfDgP=P_!95FQL$d|0EiDO{UMRWMjJXv!>Q9m8;FJ3NM0~x6R z6__fpi0#_?{~P?t{68geM+KA!1r*gxx&q`b_#;GW1zQV hY^)t`yeR65t?|4jj)6``-swR8445u7D)83|+yF)|6_)@2 literal 0 HcmV?d00001 diff --git a/test/AccountTest.py b/test/AccountTest.py index 2d08848..0a4c922 100644 --- a/test/AccountTest.py +++ b/test/AccountTest.py @@ -1,12 +1,12 @@ import unittest -from ..okx import Account +from okx import Account class AccountTest(unittest.TestCase): def setUp(self): - api_key = 'ef06bf27-6a01-4797-b801-e3897031e45d' - api_secret_key = 'D3620B2660203350EEE80FDF5BE0C960' - passphrase = 'Beijing123' + api_key = 'e2ea07df-15ca-405c-9e23-addb4aca8a42' + api_secret_key = 'DE69BED90FF154085B56020A88B2638A' + passphrase = '12345678aA.' self.AccountAPI = Account.AccountAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='1') ''' POSITIONS_HISTORY = '/api/v5/account/positions-history' #need add @@ -73,8 +73,36 @@ class AccountTest(unittest.TestCase): def test_get_greeks(self): print(self.AccountAPI.get_greeks()) ''' - def test_simulated_margin(self): - print(self.AccountAPI.get_simulated_margin()) + # def test_simulated_margin(self): + # print(self.AccountAPI.get_simulated_margin()) + # def test_get_VIP_interest_accrued_data(self): + # print(self.AccountAPI.get_VIP_interest_accrued_data()) + + # def test_get_VIP_interest_deducted_data(self): + # print(self.AccountAPI.get_VIP_interest_deducted_data()) + + # def test_get_VIP_loan_order_list(self): + # print(self.AccountAPI.get_VIP_loan_order_list()) + + # def test_get_VIP_loan_order_detail(self): + # print(self.AccountAPI.get_VIP_loan_order_detail(ordId='1')) + + # def test_set_risk_offset_typel(self): + # print(self.AccountAPI.set_risk_offset_typel(type='1')) + # + # def test_set_auto_loan(self): + # print(self.AccountAPI.set_auto_loan()) + # + # def test_activate_option(self): + # print(self.AccountAPI.activate_option()) + + # def test_get_max_avaliable_size(self): + # print(self.AccountAPI.get_max_avail_size(instId="BTC-USDT",tdMode="cash",quickMgnType='manual')) + # def test_borrow_repay(self): + # print(self.AccountAPI.borrow_repay("BTC", "borrow", "1.0")) + + def test_simulated_margin(self): + print(self.AccountAPI.get_simulated_margin(spotOffsetType='3')) if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/test/BlockTradingTest.py b/test/BlockTradingTest.py index 8d86974..4d062a9 100644 --- a/test/BlockTradingTest.py +++ b/test/BlockTradingTest.py @@ -1,12 +1,12 @@ import unittest -from ..okx import BlockTrading +from okx import BlockTrading class BlockTradingTest(unittest.TestCase): def setUp(self): - api_key = 'ef06bf27-6a01-4797-b801-e3897031e45d' - api_secret_key = 'D3620B2660203350EEE80FDF5BE0C960' - passphrase = 'Beijing123' - self.BlockTradingAPI = BlockTrading.BlockTradingAPI(use_server_time=False, flag='1') + api_key = 'a6f1e378-1c03-472d-ada0-710f4d51eebf' + api_secret_key = '74A6E1E03700D5EFCC2BBB7782170189' + passphrase = 'Qa131415!' + self.BlockTradingAPI = BlockTrading.BlockTradingAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='1') """ def test_get_counter_parties(self): @@ -42,7 +42,46 @@ class BlockTradingTest(unittest.TestCase): """ - def test_get_public_trades(self): - print(self.BlockTradingAPI.get_public_trades()) + # def test_get_public_trades(self): + # print(self.BlockTradingAPI.get_public_trades()) + + # def test_get_quote_products(self): + # print(self.BlockTradingAPI.get_quote_products()) + + def test_create_rfqs(self): + counterparties=['8924'] + legs =[{ + 'instId':"BTC-USDT", + 'sz':'25', + 'side':'buy', + 'posSide':'net', + 'tdMode':'cross', + 'ccy':'USDT' + }] + print(self.BlockTradingAPI.create_rfq(counterparties,allowPartialExecution='true',tag='1234',legs = legs)) + + # def test_execute_quotes(self): + # legs = [{ + # 'instId':"BTC-USDT", + # 'sz':'0.0001', + # }] + # print(self.BlockTradingAPI.execute_quote("3IR9E68","3IR9E80",legs)) + + # def test_create_quotes(self): + # legs = [{ + # 'instId': "BTC-USDT", + # 'sz': '25', + # 'side': 'buy', + # 'posSide': 'net', + # 'tdMode': 'cross', + # 'ccy': 'USDT' + # }] + # print(self.BlockTradingAPI.create_quote(rfqId='3IR9BT8',quoteSide='buy',legs=legs)) + + # def test_get_trade(self): + # print(self.BlockTradingAPI.get_trades()) + + + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/test/CopyTradingTest.py b/test/CopyTradingTest.py new file mode 100644 index 0000000..dd76a43 --- /dev/null +++ b/test/CopyTradingTest.py @@ -0,0 +1,40 @@ +import unittest +from okx import CopyTrading + +class CopyTradingTest(unittest.TestCase): + def setUp(self): + api_key = 'd4ee8839-1142-41c0-add5-e2e82a91efd2' + api_secret_key = '57E5BEFAB7BD024A91647819E9BCA285' + passphrase = '123456aA.' + self.StackingAPI = CopyTrading.CopyTradingAPI(api_key, api_secret_key, passphrase, use_server_time=False, + flag='0') + + # def test_get_existing_leading_positions(self): + # print(self.StackingAPI.get_existing_leading_positions(instId='DOGE-USDT-SWAP')) + + # def test_get_leading_position_history(self): + # print(self.StackingAPI.get_leading_position_history()) + + # def test_place_leading_stop_order(self): + # print(self.StackingAPI.place_leading_stop_order(subPosId='581247467976732672',tpTriggerPx='1')) + # + # def test_close_leading_position(self): + # print(self.StackingAPI.close_leading_position(subPosId='581247467976732672')) + + # def test_get_leading_instruments(self): + # print(self.StackingAPI.get_leading_instruments()) + + # def test_amend_leading_instruments(self): + # print(self.StackingAPI.amend_leading_instruments(instId='AAVE-USDT-SWAP')) + # + # def test_get_profit_sharing_details(self): + # print(self.StackingAPI.get_profit_sharing_details()) + # + # def test_get_total_profit_sharing(self): + # print(self.StackingAPI.get_total_profit_sharing()) + # + def test_get_unrealized_profit_sharing_details(self): + print(self.StackingAPI.get_unrealized_profit_sharing_details()) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/test/EarningTest.py b/test/EarningTest.py new file mode 100644 index 0000000..f81dd76 --- /dev/null +++ b/test/EarningTest.py @@ -0,0 +1,45 @@ +import unittest +from okx import Earning + +class EarningTest(unittest.TestCase): + def setUp(self): + api_key = 'cfa1017d-940a-445f-af52-b340cbd6b0e0' + api_secret_key = '6C50A4E980230A4BBE7046411DED0276' + passphrase = '123456aA.' + self.StackingAPI = Earning.EarningAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='0') + + + def test_get_saving_balance(self): + print(self.StackingAPI.get_saving_balance(ccy='USDT')) + + # def test_savings_purchase_redemption(self): + # print(self.StackingAPI.savings_purchase_redemption(ccy='USDT',amt="0.1",side="redempt",rate="1")) + + # def test_set_lending_rate(self): + # print(self.StackingAPI.set_lending_rate(ccy='USDT',rate="1")) + + # def test_get_lending_history(self): + # print(self.StackingAPI.get_lending_history(ccy='USDT')) + + + # def test_get_public_borrow_info(self): + # print(self.StackingAPI.get_public_borrow_info(ccy='USDT')) + + # def test_get_public_borrow_history(self): + # print(self.StackingAPI.get_public_borrow_history(ccy='USDT')) + + + # def setUp(self): + # api_key = 'da097c9c-2f77-4dea-be18-2bfa77d0e394' + # api_secret_key = '56CC6C72D6B8A46EC993D48C83142A25' + # passphrase = '123456aA.' + # self.StackingAPI = Earning.EarningAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='1') + # def test_purcase(self): + # investData = [{ + # 'ccy': 'USDT', + # 'amt': '50' + # }] + # print(self.StackingAPI.purchase(productId='1456', investData=investData,term='100',tag='dfg')) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/test/FundingTest.py b/test/FundingTest.py index 2cce1e1..ea8e872 100644 --- a/test/FundingTest.py +++ b/test/FundingTest.py @@ -1,13 +1,13 @@ import unittest -from ..okx import Funding +from okx import Funding class FundingTest(unittest.TestCase): def setUp(self): - api_key = 'ef06bf27-6a01-4797-b801-e3897031e45d' - api_secret_key = 'D3620B2660203350EEE80FDF5BE0C960' - passphrase = 'Beijing123' - self.FundingAPI = Funding.FundingAPI(use_server_time=False, flag='0') + api_key = 'cfa1017d-940a-445f-af52-b340cbd6b0e0' + api_secret_key = '6C50A4E980230A4BBE7046411DED0276' + passphrase = '123456aA.' + self.FundingAPI = Funding.FundingAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='0') """ CANCEL_WITHDRAWAL = '/api/v5/asset/cancel-withdrawal' #need add CONVERT_DUST_ASSETS = '/api/v5/asset/convert-dust-assets' #need add @@ -58,9 +58,25 @@ class FundingTest(unittest.TestCase): print(self.FundingAPI.get_lending_rate_summary('BTC')) """ - def test_get_lending_summary(self): - print(self.FundingAPI.get_lending_rate_summary('BTC')) - def test_get_lending_rate_history(self): - print(self.FundingAPI.get_lending_rate_history()) + # def test_get_lending_summary(self): + # print(self.FundingAPI.get_lending_rate_summary('BTC')) + # def test_get_lending_rate_history(self): + # print(self.FundingAPI.get_lending_rate_history()) + + # def test_get_non_tradable_assets(self): + # print(self.FundingAPI.get_non_tradable_assets()) + + def test_get_deposit_withdraw_status(self): + print(self.FundingAPI.get_deposit_withdraw_status(wdId='84804812')) + + # def test_get_withdrawal_history(self): + # print(self.FundingAPI.get_withdrawal_history()) + + # def test_get_deposit_history(self): + # print(self.FundingAPI.get_deposit_history()) + + # def test_withdrawal(self): + # print(self.FundingAPI.withdrawal(ccy='USDT',amt='1',dest='3',toAddr='18740405107',fee='0',areaCode='86')) + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/test/GridTest.py b/test/GridTest.py index 072e67c..5efb68a 100644 --- a/test/GridTest.py +++ b/test/GridTest.py @@ -1,12 +1,12 @@ import unittest -from ..okx import Grid +from okx import Grid class GridTest(unittest.TestCase): def setUp(self): - api_key = 'ef06bf27-6a01-4797-b801-e3897031e45d' - api_secret_key = 'D3620B2660203350EEE80FDF5BE0C960' - passphrase = 'Beijing123' + api_key = 'da097c9c-2f77-4dea-be18-2bfa77d0e394' + api_secret_key = '56CC6C72D6B8A46EC993D48C83142A25' + passphrase = '123456aA.' self.GridAPI = Grid.GridAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='1', debug=False) """ GRID_COMPUTE_MARIGIN_BALANCE = '/api/v5/tradingBot/grid/compute-margin-balance' @@ -49,7 +49,37 @@ class GridTest(unittest.TestCase): """ - def test_order_algo(self): - print(self.GridAPI.grid_order_algo("BTC-USDT","grid","45000","20000","100","1",quoteSz="50")) + # def test_order_algo(self): + # print(self.GridAPI.grid_order_algo("BTC-USDT","grid","45000","20000","100","1",quoteSz="50")) + + # def test_place_recurring_buy_order(self): + # print(self.GridAPI.place_recurring_buy_order(stgyName="jzhtest",recurringList=[{ + # 'ccy':"ETH", + # 'ratio':'1' + # }],period="daily",recurringDay='1',recurringTime='0',timeZone='8',amt='100',investmentCcy='USDT',tdMode='cross')) + + # def test_amend_recurring_buy_order(self): + # print(self.GridAPI.amend_recurring_buy_order(algoId="581185292170952704",stgyName="changtest")) + + # def test_stop_recurring_buy_order(self): + # orderData = [{ + # "algoId": "581190894481838080" + # }] + # print(self.GridAPI.stop_recurring_buy_order(orderData)) + + # def test_get_recurring_buy_order_list(self): + # print(self.GridAPI.get_recurring_buy_order_list()) + + # def test_get_recurring_buy_order_history(self): + # print(self.GridAPI.get_recurring_buy_order_history()) + + # def test_get_recurring_buy_order_details(self): + # print(self.GridAPI.get_recurring_buy_order_details(algoId="581191143417970688")) + + # def test_get_recurring_buy_sub_orders(self): + # print(self.GridAPI.get_recurring_buy_sub_orders(algoId="581191143417970688")) + + #581191143417970688 + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/test/MarketTest.py b/test/MarketTest.py index fdf8df7..7ce0bec 100644 --- a/test/MarketTest.py +++ b/test/MarketTest.py @@ -1,6 +1,6 @@ import unittest -from ..okx import MarketData +from okx import MarketData ''' ORACLE = '/api/v5/market/open-oracle' #need to update? if it is open oracle @@ -58,7 +58,11 @@ class MarketAPITest(unittest.TestCase): print(self.MarketApi.get_volume()) ''' + # def test_get_order_lite_book(self): + # print(self.MarketApi.get_order_lite_book(instId='BTC-USDT')) + def test_get_option_trades(self): + print(self.MarketApi.get_option_trades(instFamily='BTC-USD')) if __name__ == "__main__": diff --git a/test/PublicDataTest.py b/test/PublicDataTest.py index f0b5138..f723425 100644 --- a/test/PublicDataTest.py +++ b/test/PublicDataTest.py @@ -1,10 +1,10 @@ import unittest -from ..okx import PublicData +from okx import PublicData class publicDataTest(unittest.TestCase): def setUp(self): - api_key = 'ef06bf27-6a01-4797-b801-e3897031e45d' - api_secret_key = 'D3620B2660203350EEE80FDF5BE0C960' - passphrase = 'Beijing123' + api_key = 'da097c9c-2f77-4dea-be18-2bfa77d0e394' + api_secret_key = '56CC6C72D6B8A46EC993D48C83142A25' + passphrase = '123456aA.' self.publicDataApi = PublicData.PublicAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='1') ''' TestCase For: @@ -50,8 +50,14 @@ class publicDataTest(unittest.TestCase): print(self.publicDataApi.get_mark_price('SWAP')) ''' - def test_position_tier(self): - print(self.publicDataApi.get_position_tiers('SWAP','cross',uly='ETH-USD')) + # def test_position_tier(self): + # print(self.publicDataApi.get_position_tiers('SWAP','cross',uly='ETH-USD')) + + # def test_get_option_tickBands(self): + # print(self.publicDataApi.get_option_tick_bands(instType='OPTION')) + + def test_get_option_trades(self): + print(self.publicDataApi.get_option_trades(instFamily='BTC-USD')) if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/test/StackingTest.py b/test/StackingTest.py index 1d6a875..feff55b 100644 --- a/test/StackingTest.py +++ b/test/StackingTest.py @@ -1,5 +1,5 @@ import unittest -from ..okx import Status +from okx import Status class StackingTest(unittest.TestCase): def setUp(self): @@ -22,15 +22,6 @@ class StackingTest(unittest.TestCase): def test_purcase(self): print(self.StackingAPI.purchase(1456,"USDT","100","0")) - def test_redeem(self): - print(self.StackingAPI.redeem()) - def test_cencel(self): - print(self.StackingAPI.cancel()) - def test_order_activity(self): - print(self.StackingAPI.get_activity_orders()) - def test_order_history(self): - print(self.StackingAPI.stack_get_order_history()) - if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/test/SubAccountTest.py b/test/SubAccountTest.py index c251c0b..69491d9 100644 --- a/test/SubAccountTest.py +++ b/test/SubAccountTest.py @@ -1,11 +1,11 @@ import unittest -from ..okx import SubAccount +from okx import SubAccount class SubAccountTest(unittest.TestCase): def setUp(self): - api_key = '52c37310-a8b0-454a-8191-3250acff2626' - api_secret_key = 'EC37534156E6B8C32E78FE8D8C1D506B' - passphrase = 'Hanhao0.0' + api_key = 'e2ea07df-15ca-405c-9e23-addb4aca8a42' + api_secret_key = 'DE69BED90FF154085B56020A88B2638A' + passphrase = '12345678aA.' self.SubAccountApi = SubAccount.SubAccountAPI(api_key, api_secret_key, passphrase, use_server_time=False, flag='1') ''' ENTRUST_SUBACCOUNT_LIST = '/api/v5/users/entrust-subaccount-list' #need to add @@ -36,5 +36,15 @@ class SubAccountTest(unittest.TestCase): ''' + # def test_get_the_user_affiliate_rebate_information(self): + # print(self.SubAccountApi.get_the_user_affiliate_rebate_information(apiKey='3af380a7-72af-4cc6-80d1-4b5a34ea69ad')) + + # def test_set_sub_accounts_VIP_loan(self): + # print(self.SubAccountApi.set_sub_accounts_VIP_loan(enable='true',alloc=[{'subAcct':'coretrading7', + # 'loanAlloc':'1'}])) + + def test_get_sub_account_borrow_interest_and_limit(self): + print(self.SubAccountApi.get_sub_account_borrow_interest_and_limit(subAcct='coretrading7')) + if __name__ == "__main__": unittest.main() \ No newline at end of file diff --git a/test/TradeTest.py b/test/TradeTest.py index d963787..0434564 100644 --- a/test/TradeTest.py +++ b/test/TradeTest.py @@ -1,10 +1,10 @@ import unittest -from ..okx import Trade +from okx import Trade class TradeTest(unittest.TestCase): def setUp(self): - api_key = '35d8f27e-63cc-45bc-a578-45d76363d47f' - api_secret_key = '0B7C968025BC2D4D71CF74771EA0E15C' - passphrase = '123456' + api_key = 'da097c9c-2f77-4dea-be18-2bfa77d0e394' + api_secret_key = '56CC6C72D6B8A46EC993D48C83142A25' + passphrase = '123456aA.' self.tradeApi = Trade.TradeAPI(api_key, api_secret_key, passphrase, False, '1') """ def test_place_order(self): @@ -112,10 +112,80 @@ class TradeTest(unittest.TestCase): """ #485903392536264704 #485936482235191296 - def test_oneclick_repay_history(self): - print(self.tradeApi.oneclick_repay_history()) + # def test_oneclick_repay_history(self): + # print(self.tradeApi.oneclick_repay_history()) + # def test_order_algo(self): + # print(self.tradeApi.place_algo_order(instId='BTC-USDT-SWAP', tdMode='cross', side='buy', ordType='conditional', \ + # tpTriggerPx='15', tpOrdPx='18',sz='2')) + # 581628185981308928 + # def test_get_algo_order_details(self): + # print(self.tradeApi.get_algo_order_details(algoId='581628185981308928')) + #581628185981308928 + # def test_amend_algo_order(self): + # print(self.tradeApi.amend_algo_order(instId='BTC-USDT-SWAP', algoId='581628185981308928',newSz='3')) + # def test_get_order_history(self): + # print(self.tradeApi.get_orders_history(instType="SPOT",begin='1684857629313',end='1684857629313')) + + # def test_get_order_histry_archive(self): + # print(self.tradeApi.get_orders_history_archive(instType="SPOT",begin='1684857629313',end='1684857629313')) + # def test_place_order(self): + # print(self.tradeApi.place_order("BTC-USDT", tdMode="cross", clOrdId="asCai1", side="buy", ordType="limit", + # sz="0.01", px="18000")) + # def test_batch_order(self): + # orderData = [{ + # "instId": "ETH-USDT", + # "tdMode": "cross", + # "clOrdId": "b151121", + # "side": "buy", + # "ordType": "limit", + # "px": "2.15", + # "sz": "2" + # }, + # { + # "instId": "BTC-USDT", + # "tdMode": "cross", + # "clOrdId": "b152233", + # "side": "buy", + # "ordType": "limit", + # "px": "2.15", + # "sz": "2" + # }] + # print(self.tradeApi.place_multiple_orders(orderData)) + + #581616258865516544 + #581616258865516545 + # def test_amend_order(self): + # print(self.tradeApi.amend_order("BTC-USDT", ordId="581616258865516544", newSz="0.03")) + # def test_amend_order_batch(self): + # orderData = [ + # { + # 'instId': 'ETH-USDT', + # 'ordId': '581616258865516544', + # 'newSz': '0.02' + # }, + # { + # 'instId': 'BTC-USDT', + # 'ordId': '581616258865516545', + # 'newPx': '3.0' + # } + # ] + # print(self.tradeApi.amend_multiple_orders(orderData)) + + # def test_order_algo(self): + # + # print(self.tradeApi.place_algo_order(instId='BTC-USDT-SWAP', tdMode='cross', side='buy', ordType='conditional', \ + # tpTriggerPx='15', tpOrdPx='18', sz='2',algoClOrdId='7678687',quickMgnType='manual')) + + def test_order_algos_list(self): + print(self.tradeApi.order_algos_list(ordType='conditional')) + + # def test_order_algo(self): + # print(self.tradeApi.place_order(instId='BTC-USDT-SWAP', tdMode='cross', side='buy',px='121',sz='2', + # clOrdId='234234565535',ordType='market')) + # def test_close_all_positions(self): + # print(self.tradeApi.close_positions(instId="BTC-USDT-SWAP", mgnMode="cross",clOrdId='1213124')) if __name__=='__main__': unittest.main() diff --git a/test/WsPublicTest.py b/test/WsPublicTest.py index e0fbec5..957f234 100644 --- a/test/WsPublicTest.py +++ b/test/WsPublicTest.py @@ -8,7 +8,8 @@ def publicCallback(message): if __name__ == '__main__': - url = "wss://ws.okx.com:8443/ws/v5/public" + #url = "wss://wspri.coinall.ltd:8443/ws/v5/ipublic?brokerId=9999" + url = "wss://wspap.okx.com:8443/ws/v5/public" ws = WsPublic(url=url) ws.start() args = [] diff --git a/test/__pycache__/AccountTest.cpython-310.pyc b/test/__pycache__/AccountTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..695099c947a21be4dbc6b7788e2775a654e50608 GIT binary patch literal 972 zcmZuvJ8u&~5Z=9qeQ}&bL68Co1QJ5J!tvX&C5Ym@5RE}f(p2M}}u$^a?SPS=WeJ99@`Kre|@R*<(XI;^=eX3&Id{lB-+z4mr@k#j4o%{bUkn zzP?x%1B^XT`51sB4>RN$3^U^zdFIM(DbHf|333Z+^)}5Zmzj?t;!bqeMbHCK`5b`Z zOGt8QF!R#P&;_33xiN>nnav6}_8bu?1SyMy*)!hYw6?>Bm3rH!l~%3oS9-kBtWd_@ zx2R9MwAJvQ93FLg`$vbp+VOF{-Kurl`|VDxQR{cR`;AVs+n=r08_ia`v(u&h?PG=O zuHkJ=Bqx%Kk6e%}h`6$bAsxAf&{M0@?J)hfuU$)7l7~aDNYj9f`P5t22g!ZGGi|F< zN~KKC1(p0O5-Sk@>t*!}a?5Hm=AwGY-QhIaqCF{ literal 0 HcmV?d00001 diff --git a/test/__pycache__/BlockTradingTest.cpython-310.pyc b/test/__pycache__/BlockTradingTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c78dbfe89060c41e467530b354a7bfe1130eba6 GIT binary patch literal 1044 zcmZuwOHbQC5Z+xsVrYP>m8z;zt5!mlTq(pR0SBp~kPs>^Q48VX%gSUoA;huWT?auF zPH^o%=mC!XOTPBhztBo;XC07&=vwo6_BD@hX5)p0c?9G4yNI1WLg zFMu>a#VHpw?GJgTcf+7(6QL5%mS*$W{p@_2pbgaG?c>L_a;r!q|+EpedNKX4QD5`u+`$l>|e~KnR{54Ue zPw1Jze)!U8I;lWOOY&t8B<0!t&ek9X9mJvDj3zfb7jplmoR;f9*mKllY zN2yT$`~`l-JEN4-FQYi+z^N*}uZO%Rb7rQXdOmxqGN<>>%MY-TXG;jd)}QD4c=
    50#&6MPyq=IK=o@LfQ2kf%wjcP zRmO)wKcdtwWY#F^rz!|vgZfRI#!^LVKm+8*#S&P_bai9KNA5Du+fgc5Z(1h;-rCANF1mH>Y+mNA&u=csgbIxG)aL=gw*!p11mSXY125i*>w<& z(o=iwkvkmuM`*8{`WLvstkZ^60>MZ#nqAMlnb|i^9y}-`kWZy|^xG0b-_>DJ3^?q9 ziXAW%Q5>NFQH|;m9%+Gw(JMp^YF;5~GIXY2>Vd&bS{Q2lDMOzNUl4|zgIw+64Pc<| zjRw}n((1PNcrs+Xr>+-81?+-~XJ8l#FhzkzG1ab6pqCKUsR168JwSFrmS-r3Ok_O_ z33sAeFM_r}#d9zeUjW7hG=HII=nPNsRGR`8g@&)qDI%B_0nwW9a(V4m8eXryRd=0g z=pQ@P&BkU}_1zb4weB^Xu-ETyWuqV z=7F!n_%uwM4QGBcS^u9(!P>t{OiFX?eTiLL3zo-%5yAKe#z{69F=_Op@T6;NT!%N2 zOLr{1eEY^Wq#;<;4~k(rAVYQ@JXDTgJNN%4)5G#__3A&MYZ2-ZKUVY6f8SR3yLBOj8QbOfmiWlWg#pNxks&{ zS>@!^u7Z=HDG+*=FNs=@YyA?#<{_Zd>;`5(j06iT&+$B`;kdV+@4)*=^O&6sVyUy3 z+PXATK8Q1}_9l3I0#kE#9A=E9@OlZSFsO~W>NFpIX4D@fpQz!;pEB|$)k?!y>kDK3 zHKA*p(jp`dM~o0zCS;V*aishTA@9dwH2cEge?@%xelLm=t{UQM{Y}vPT`go`tx|FG zTLnG}2QeXbQCj18kf~Mz9VnXZgmnn#7I2)0^A$jmhRRqNdR|Cc+q3?56f2?v#=;f+ LNV9e;*!cMiEa3== literal 0 HcmV?d00001 diff --git a/test/__pycache__/ConvertTest.cpython-310.pyc b/test/__pycache__/ConvertTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..178dd5561e296c1d46728b66fd1351a398475c5b GIT binary patch literal 756 zcmYjP&2G~`5Z?7qY|@kp#HkX9148m4#EBaxk)SI1LtG-H(#u{}Zg$f;c5JijAW|hK zdgUG9$Sd$Dz9J5N1uih_wvxx1PqVZ0^UZkE{rx%u`SUDdzYK(at3y@5hfYA{F#tmh z$A}=NF+IjBjc6FXL(E|2HDV@5OZ}@(3~sVoq=}~-eXspM7;;Wab*vkxfo3-vpo0r* zlqR3K$mhyi6?K0CDxUywL@+}{W0+~zi0Di|MUGMI-6enIGM{6JyB9^+0v&2=dV^l`ybl)l`h%Y9 zwfRw(k>_L2@3_N`@4Fq>^SbV2GU>b1@w7XfxTAsZlKPN`%P_fUcf4tV+m1#K){;}n z1&mAcaK#H_5eFBJCUhW3>UXoe{qP%^(>GwyA*-s zKaqF<`G4QE&Y-qzr4bjcF_%%EX02?KU#3Y@vgqDSqc5!-*43)4?p3xaOv&@JOzlnD z00vgyA-;N4jVohjK+mQ$309oaqE6{5W$Rek4N5<)gZTDF>_M55S_RZI6RL?CS=In- zWMjiDeX8mz2op*jtFYHem@A@02g>D&3S0f>5zJhMiw2|@hRUdPP`ePSO<}*jC3dVH RhE%~eYT(D%K5Ss)-+$$avt0lH literal 0 HcmV?d00001 diff --git a/test/__pycache__/CopyTradingTest.cpython-310.pyc b/test/__pycache__/CopyTradingTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9375323abbc44e0668b1315896d38078e265c88f GIT binary patch literal 1046 zcma)4%}(1u5Z?7qVjzHo)LW}oDy`&7AtWS_R23o#Q1ud30xrI+R@qH3acp?$-C3)z(p~({0z9joDJQwo`BH z^7huTq1(O{tWUILTB@&7u`C=*;|wA`^lgPx2Wt!Cv_F3`D<>K6j{qcae8)IiMuVWp z(~yniG+4ufmVG5N^v!b0wNB3!*YYP(OHlCdapepy)0Jc-Rpn6XQI@2Ybef$faaoH| zxeq)%_{r#7B?AmA3r!%VTj|ueT4radi$IpZI24}}wP@*X_Uv(d9{V2?$chb`GqC}O zjLZT58|#)_QP>bfo%Vd&xTy-`Ou;6S;LQ-`n#4--D4a>bQk4wCjOlX@F+(O~#=}Va zR3XRtxc3GZ+PuR_*pn)3LcB)!H|XsB<5`|wrsuoHV=U%l$(UJYY@CQmgy#}tUnV@d z|D#s0+f_8k(1O9f6{3WDs}TZ^c(n8~|AwWNF` kt2IbB4rVOekYAX?<9)dAZXcP+DfLK+Zdl&y5_RtW0XU@#PXGV_ literal 0 HcmV?d00001 diff --git a/test/__pycache__/EarningTest.cpython-310.pyc b/test/__pycache__/EarningTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45c80bbcbbc34df3aa4d1f371287519f17673c3a GIT binary patch literal 973 zcmZ`%&2AGh5VrRx*`{eLdMFYC2?>PQLz+#xNvQ-?e-aRv2r2Ew94u$;wCN_B#okmT zO1ZSxz5^V2C0{x53S3~kX{8{1GXAB2&<_(Vivz&{sM-g^ z5ywMB%-;Kwk^r5Qa0|T>ZjNsDU~@*2OlH z$sjq4%)+u*5FCK2$6y2^m?L6w%&i+l?8QaI;cgfC1-*J#m*Cf22tDV3f}ro?w7SD@IhH`PG6}B_kJ;ma+5u4|6E!umAu6 literal 0 HcmV?d00001 diff --git a/test/__pycache__/FundingTest.cpython-310.pyc b/test/__pycache__/FundingTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5bfe0a73080a710dbcd41a274e8634e3fbd00089 GIT binary patch literal 1001 zcmah|O>fgM7`F4#W?eS~he?1yJ0PS;bWOXo>kyju)uBnKLfUrm#Y$^;%i1Qvb}6m8 z({@7Ie}E%@DOXPX04`kMb-GF60*>A%ex3L8d7XG=rG#Kjetu?;R}uQImHe_m*#(h1 z01PoaL`1)hAs!jT!00VvCbMo3vpBjmuT5fco7n?HJmcs~;VZ)6bCQW$_yI9c$Hi&! zXdJOHI`8R&{4zk<1(DAII3k!KVld2%8$`^dyHvzt_6c$e>GEBeQ!Z5xgU9{SRTn`H zK;%mRhOZ#VmBGv_Q=v;d$8%#2bu*h4ZtXdukO)E+JF^$Peo*sjTdcC}dqKtb8~sYq zZ`3Q@P2cNvS+nbLkE}Nj8s47Y-fnsIP1x-3x3@gM>DOw9?L)7=)toKW>YIL}8SHHw zrPy-~@?b1Em0Wz}f~s)DQ>#A=&Rs+3p3~A@D|_#cT`RRDANENxNJ2W`Q?jZzlJ^8x zT2D(!AZ2nP0?EH2u>}6V_N!+QTUO%%7u7>92P#gg$y8m$QAM&rr57jDdp#a}sw$wY znxk(cnWnbn>MSW}&Kv*>>*oocJHh+<=iPwZ@WUs+Sp*c`|na%AMUt_oenq0F( zoR;76{8p{*Vq#6$F>}q-PDB_fq0^G5=g=YJNi0J}C!xAvBA8IA0yUN{7J8&vy9>}a zH(l4A(0}-~!Afe5*YNCBzLWnsc3eAkD2;*Mdco`)<0IJk@-8P2;hwtoKsV2bp5 literal 0 HcmV?d00001 diff --git a/test/__pycache__/GridTest.cpython-310.pyc b/test/__pycache__/GridTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e7abd90bcfc50f57b2e6fe7d66baab7ae8a471b GIT binary patch literal 1002 zcmah|&2G~`5Z?7q;+C|Pdg!SjkT_tZkUDYV1fi-Sg{qensqJMiD<`{2(>Sr&wGoNZ zQ+w?@z<~p=v(DA(V5}L>*fX==d}GHO8|w(9_9bH9HWB)+gH^F0H~^LV zU>IUJLPXz<2u}=RV046-$*dd1ERHVCYm->qX7<<+4>|f&_>3^roaX8len1b@b+NLJ z#EA8Ev?>M!2cYs17>)>Lh!_kr;|39P?aw*HV)iL=3(C$^7K3@XvQ>k7S`7;o^ReK zZ$wFhf}dvi4&cY{cj zp4w~w104B1AR+n6iNC-FW*u6kg0W^ivpdgkHZGTo2yKIJ|m3{giJySbl`1r1%C7T@?{ z!d1^#{;57&Cj*Q_V7U!~BZ3(s2E)v_Lc}cmtwtnBb3?lM zJa89SJ_W(>1*Ew!n0a9;G{#H3G?vgjvsv!iULtBR1WEJ5#SR~Nt#_k(yVCN#T4lGr z->$sd1C2NK_S;^g#&?^HJn1!Bb+1!zwY<95Xf(ZkzrW`VdV^-C?{)WE9w~NsFb<-# zTD>tyam_Wz=1g)bx%j{ZRl$^})+qGPTvO<=N#S;y^hQkr*GetP!x72*NkAujPBye6 z`KjPa+i5ZJrA*F+FZmZF3Xtj7LG=Wx$Z9;{qT1tfqT-~Q%++}uRV16-sPW`uRRM6- zRbh?c^JJddlB<*Cz6Q<#VPX9}#*0U{{bin+*B#6?{u=iT^DR&mS_0DJY=PJK62o)Q z7@NaIzH{8IoE-IBOo~Ay)xe(y;oLP-I}t&oL=K|KgEJU0PE-&_R0*GP>0+UmnoYS9 z`U$67dJ6iF_aWR#4eb_Q?A&es{{chSP8~`kf66IMi{K i)Y1`aHL{Y~*v`SKzZV*Kshu5M!iMp%=rl{%`uztq1n+PF literal 0 HcmV?d00001 diff --git a/test/__pycache__/PublicDataTest.cpython-310.pyc b/test/__pycache__/PublicDataTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49c2efb20727cf4b2c8ef6b2c004fae785e9ddca GIT binary patch literal 1000 zcmZuw%Wl&^6rJ%SaY9lALS2ABEC9)iG>wzyp`xm(LlK*(QrpdJMs8-(x^ZGNGeIOu zSM9d{089RaZ?M?0;uqM!9f#8JxYj+M8Q zoBZ$3=xB2W?Ug+7Jg+T7PAkLn@iV{-;s{ER09l7H==9L zgZiNI1pvbr5a+^R=7p)yIbPs}v4HBC&2rcF0#Sn@h??)upRr)G(;9RJ6>r#TRT_*3 zl@nfTSG<#9&}y+wUhg!>)2*iOH~p5^YwoqXjpi%A)2a6wZNFWwHN393H80e>dSj~@ zbT{@>TyqU_cPcrRT)g9gs&LFxYZwKmt|@feq_E_rd+;VL-!|4wLf1+y$)h332T4dr zd`8yvLh^y&O7GKR5=fbxi9qsCNE9I2_uc9-WRlf*#6`8op5t@jQe$1D6{~^&$CHh z<4X+pLUV2Q=lQ)OzjA!ob1^A~6RGxtaTv{9Gqn>DPL#-jH@SBTea49j;|WzFU|hOb z=;3CqE2-e6 zei883AW_z!NnZh7jxYhVX8bwG!G>M(vQr&=9E1}}-F)gyC!x}H5EI6cU53=r)cP>b m%v`KNl+@B5D><^1S>MjfWqmuEd07H*Pzm41&UOh~KYjvvn)BEI literal 0 HcmV?d00001 diff --git a/test/__pycache__/StackingTest.cpython-310.pyc b/test/__pycache__/StackingTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6bad0393cdbca9370eb24cbf37b53578c0890a31 GIT binary patch literal 952 zcmY*X%}yIJ5VrRx*@jRmP6eq|TUC|z5VA=i0jWY15~^OJN`Z?n))G5p*<`b|H&sF5 z1lPU;9DC~%^g(>>iC5^Qo!KZ=@M=ag-tjk|KhI=!wM1ZTZ6xBCOUQ3bmX`y`0hrzg zCy1aU!icbhJ)&caS(JPv!V&H*5w0W`_KnRP>54*ZsTY#m748XzGripW;saoi?t=y1 zr>4-$!fdMhxVgOW_W_uG2~HA51!0z;!n!5QenNyT9EhN4kN5>s29$mrCFdtnXMGAs z77M8t!H&T6J8*(t1Ijg!zqT`SL1%Pk%>YdR;qUH@aOeb>#qQNxIS86(gL-AO<@p-_P{w5zfF3z{-`i7dZab#{$J}&NHQ`5h41or!xy`EZYYcb z>g#r+pU{Chr@i(GvuiWFOcYAW?d1 zul)~jMB@J-`O1mEzy-z|s)nAxtNGSr&x~j0o1{`HAy{9(MZC3w(08LOF9(!e5VZrq z5yxXh%-*T>Qchh=B$^)}`ag zX+H>(Nt^}dYaAzFepw)n8x>;$aZZghg` zwrFiu8Rw^M7O);`x5%@D!|wLp;lXy}=&0FgH+r4DPPfr&^n1O%R(G@4pRG1qo9#|_ ztH=7aBaNHBMIKC)pi0R1LeeaZgm#8wcIMmC6izC4_4MDo*2`)d`i^##7!OI2r6C=O zDOoccB?2ijqw7-2luFMfQ{oGfKq&foSU-W+R6Q99Sw9eJlqG3Boo44rTvdEj4U%+v zt0$w6^$glrzstgOwU$n`t3-B^x~7#LfP>BV7|$NvGtJHZqQOvNsK{wphfRj&(EN*> z)Ej(-VMI*Z?ExtV2~;8(596~fACscW=OpuO?WQt}Gg$zC;-5jea7Ec-hUjS`W%7Z7 zfsl|dWihAYFbXptOEUp^Cl+AFUDr&J^q-^Dz(*N+*75A+y?XyI(!h7MM`_F=L8&fL z8YO%(Hv2NA?52iv;S!kir43*@nls@c4_j_|BR@64BNoP#`bF(c;xIG$ y5gUlj=SzEr&wUt=++40f6zv#~r8n{?^FDbm7WwTM4pkYzLuLHX@~UO*{Q3=+)fbom literal 0 HcmV?d00001 diff --git a/test/__pycache__/TradeTest.cpython-310.pyc b/test/__pycache__/TradeTest.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50bc818f3ad93fa18b914d8033fca29dfeca1a28 GIT binary patch literal 949 zcmZuw&2G~`5Z?7q;*=B+5*3#MhhBV0)BH3)QdKp$fVf0RO)q;{x!x^x!tg*`UZsw9`CD?%Y>uTZ!29Wcny zrMW#)zK{XBi(-JY1F9c`k%Un}m?5YzE(kL#zY8%-*n7k+<&^?tBy|>0h`$l+xD4un z>NPNeo&vXSVe|0rC@ah4jGw~V|rYy=L0>buxI4a9I`t>5{obklh}`3%F2ln zqiHH#Gq+O}#+kAqo!y7eQgJ_elV~1=I&-Ni!9_9UwW)xcKg0p}zrkPNN+Yi;boS)7 z@BhXQT|0L;kNt_{JYV8`l8BQC&sEOfp7_!Ajlv&6RnZ_V3kLg8CKyzWVGePqVUx4! zdhs3MCw>@n?v``sBn~rdgqgs9vHaW_f$zZfb=sFDw9UL>Sag@7cqy+oCOiz{`tcsCH@*zT@Fn<$*% z%CYzM*uS*bp7;yB&{?NQF6vk_n)S}>`)1?S)nx?oZRr#HSU~8PKIFxM!!D@Y0mBf( zA@UJ3m>J@+;TsseMa*LMHDWeL=jN5^Tij-aks+RN^u6!{VaPem)GOXX4b;Ciz^UOP49XV!v(08bXlyrX)iQ0LRLfh< zEn05ZUf0Tvdb3J{!Jyu%xBTb5PGh^-*s3*Kz1Dua)2R2h+XuaNx813Ao7L9-Z0Q}1 z&S+eHRXtF+<{AFlL~N?hWfG+kGQCGxg4c&Qc0%iSsaxm8{NC{=xZef z#wxj%n!#7eRN0cJ#|gX&Bwa8T)}MCTjLGB z!tgXS&t~5@_m4Ur_RS!edZw}yF^p27cjlK)0b)u41Q~?!7Y_>uerFIDW(AJwv4-$B z>?DkX5xI!N7jPr>JKDgr&4=UuFQM<*${{48V@`-#CS)A5NvM67kk1nuE^dS-LzJ}9 zOy`WAMQF%2sMLcx$iYUzUC;jN;$u3D2=R)_nMA`>PvM)egT>w*&3p%zn1zcqD4;Bz dk?WDQ%s@MD7W3_BqO%P-$ilXk3 literal 0 HcmV?d00001 diff --git a/test/ws_org.py b/test/ws_org.py new file mode 100644 index 0000000..c429cfb --- /dev/null +++ b/test/ws_org.py @@ -0,0 +1,542 @@ +import asyncio +import base64 +import datetime +import hmac +import json +import time +import zlib + +import requests +import websockets + + +def get_timestamp(): + now = datetime.datetime.now() + t = now.isoformat("T", "milliseconds") + return t + "Z" + + +def get_server_time(): + url = "https://www.okx.com/api/v5/public/time" + response = requests.get(url) + if response.status_code == 200: + return response.json()['data'][0]['ts'] + else: + return "" + + +def get_local_timestamp(): + return int(time.time()) + + +def login_params(timestamp, api_key, passphrase, secret_key): + message = timestamp + 'GET' + '/users/self/verify' + + mac = hmac.new(bytes(secret_key, encoding='utf8'), bytes(message, encoding='utf-8'), digestmod='sha256') + d = mac.digest() + sign = base64.b64encode(d) + + login_param = {"op": "login", "args": [{"apiKey": api_key, + "passphrase": passphrase, + "timestamp": timestamp, + "sign": sign.decode("utf-8")}]} + login_str = json.dumps(login_param) + return login_str + + +def partial(res): + data_obj = res['data'][0] + bids = data_obj['bids'] + asks = data_obj['asks'] + instrument_id = res['arg']['instId'] + # print('全量数据bids为:' + str(bids)) + # print('档数为:' + str(len(bids))) + # print('全量数据asks为:' + str(asks)) + # print('档数为:' + str(len(asks))) + return bids, asks, instrument_id + + +def update_bids(res, bids_p): + # 获取增量bids数据 + bids_u = res['data'][0]['bids'] + # print('增量数据bids为:' + str(bids_u)) + # print('档数为:' + str(len(bids_u))) + # bids合并 + for i in bids_u: + bid_price = i[0] + for j in bids_p: + if bid_price == j[0]: + if i[1] == '0': + bids_p.remove(j) + break + else: + del j[1] + j.insert(1, i[1]) + break + else: + if i[1] != "0": + bids_p.append(i) + else: + bids_p.sort(key=lambda price: sort_num(price[0]), reverse=True) + # print('合并后的bids为:' + str(bids_p) + ',档数为:' + str(len(bids_p))) + return bids_p + + +def update_asks(res, asks_p): + # 获取增量asks数据 + asks_u = res['data'][0]['asks'] + # print('增量数据asks为:' + str(asks_u)) + # print('档数为:' + str(len(asks_u))) + # asks合并 + for i in asks_u: + ask_price = i[0] + for j in asks_p: + if ask_price == j[0]: + if i[1] == '0': + asks_p.remove(j) + break + else: + del j[1] + j.insert(1, i[1]) + break + else: + if i[1] != "0": + asks_p.append(i) + else: + asks_p.sort(key=lambda price: sort_num(price[0])) + # print('合并后的asks为:' + str(asks_p) + ',档数为:' + str(len(asks_p))) + return asks_p + + +def sort_num(n): + if n.isdigit(): + return int(n) + else: + return float(n) + + +def check(bids, asks): + # 获取bid档str + bids_l = [] + bid_l = [] + count_bid = 1 + while count_bid <= 25: + if count_bid > len(bids): + break + bids_l.append(bids[count_bid - 1]) + count_bid += 1 + for j in bids_l: + str_bid = ':'.join(j[0: 2]) + bid_l.append(str_bid) + # 获取ask档str + asks_l = [] + ask_l = [] + count_ask = 1 + while count_ask <= 25: + if count_ask > len(asks): + break + asks_l.append(asks[count_ask - 1]) + count_ask += 1 + for k in asks_l: + str_ask = ':'.join(k[0: 2]) + ask_l.append(str_ask) + # 拼接str + num = '' + if len(bid_l) == len(ask_l): + for m in range(len(bid_l)): + num += bid_l[m] + ':' + ask_l[m] + ':' + elif len(bid_l) > len(ask_l): + # bid档比ask档多 + for n in range(len(ask_l)): + num += bid_l[n] + ':' + ask_l[n] + ':' + for l in range(len(ask_l), len(bid_l)): + num += bid_l[l] + ':' + elif len(bid_l) < len(ask_l): + # ask档比bid档多 + for n in range(len(bid_l)): + num += bid_l[n] + ':' + ask_l[n] + ':' + for l in range(len(bid_l), len(ask_l)): + num += ask_l[l] + ':' + + new_num = num[:-1] + int_checksum = zlib.crc32(new_num.encode()) + fina = change(int_checksum) + return fina + + +def change(num_old): + num = pow(2, 31) - 1 + if num_old > num: + out = num_old - num * 2 - 2 + else: + out = num_old + return out + + +# subscribe channels un_need login +async def subscribe_without_login(url, channels): + l = [] + while True: + try: + async with websockets.connect(url) as ws: + sub_param = {"op": "subscribe", "args": channels} + sub_str = json.dumps(sub_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + + while True: + try: + res = await asyncio.wait_for(ws.recv(), timeout=25) + except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed) as e: + try: + await ws.send('ping') + res = await ws.recv() + print(res) + continue + except Exception as e: + print("连接关闭,正在重连……") + break + + print(get_timestamp() + res) + res = eval(res) + if 'event' in res: + continue + for i in res['arg']: + if 'books' in res['arg'][i] and 'books5' not in res['arg'][i]: + # 订阅频道是深度频道 + if res['action'] == 'snapshot': + for m in l: + if res['arg']['instId'] == m['instrument_id']: + l.remove(m) + # 获取首次全量深度数据 + bids_p, asks_p, instrument_id = partial(res) + d = {} + d['instrument_id'] = instrument_id + d['bids_p'] = bids_p + d['asks_p'] = asks_p + l.append(d) + + # 校验checksum + checksum = res['data'][0]['checksum'] + # print('推送数据的checksum为:' + str(checksum)) + check_num = check(bids_p, asks_p) + # print('校验后的checksum为:' + str(check_num)) + if check_num == checksum: + print("校验结果为:True") + else: + print("校验结果为:False,正在重新订阅……") + + # 取消订阅 + await unsubscribe_without_login(url, channels) + # 发送订阅 + async with websockets.connect(url) as ws: + sub_param = {"op": "subscribe", "args": channels} + sub_str = json.dumps(sub_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + + elif res['action'] == 'update': + for j in l: + if res['arg']['instId'] == j['instrument_id']: + # 获取全量数据 + bids_p = j['bids_p'] + asks_p = j['asks_p'] + # 获取合并后数据 + bids_p = update_bids(res, bids_p) + asks_p = update_asks(res, asks_p) + + # 校验checksum + checksum = res['data'][0]['checksum'] + # print('推送数据的checksum为:' + str(checksum)) + check_num = check(bids_p, asks_p) + # print('校验后的checksum为:' + str(check_num)) + if check_num == checksum: + print("校验结果为:True") + else: + print("校验结果为:False,正在重新订阅……") + + # 取消订阅 + await unsubscribe_without_login(url, channels) + # 发送订阅 + async with websockets.connect(url) as ws: + sub_param = {"op": "subscribe", "args": channels} + sub_str = json.dumps(sub_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + except Exception as e: + print(e) + print("连接断开,正在重连……") + continue + + +# subscribe channels need login +async def subscribe(url, api_key, passphrase, secret_key, channels): + while True: + try: + async with websockets.connect(url) as ws: + # login + timestamp = str(get_local_timestamp()) + login_str = login_params(timestamp, api_key, passphrase, secret_key) + await ws.send(login_str) + # print(f"send: {login_str}") + res = await ws.recv() + print(res) + + # subscribe + sub_param = {"op": "subscribe", "args": channels} + sub_str = json.dumps(sub_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + + while True: + try: + res = await asyncio.wait_for(ws.recv(), timeout=25) + except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed) as e: + try: + await ws.send('ping') + res = await ws.recv() + print(res) + continue + except Exception as e: + print("连接关闭,正在重连……") + break + + print(get_timestamp() + res) + + except Exception as e: + print("连接断开,正在重连……") + continue + + +# trade +async def trade(url, api_key, passphrase, secret_key, trade_param): + while True: + try: + async with websockets.connect(url) as ws: + # login + timestamp = str(get_local_timestamp()) + login_str = login_params(timestamp, api_key, passphrase, secret_key) + await ws.send(login_str) + # print(f"send: {login_str}") + res = await ws.recv() + print(res) + + # trade + sub_str = json.dumps(trade_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + + while True: + try: + res = await asyncio.wait_for(ws.recv(), timeout=25) + except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed) as e: + try: + await ws.send('ping') + res = await ws.recv() + print(res) + continue + except Exception as e: + print("连接关闭,正在重连……") + break + + print(get_timestamp() + res) + + except Exception as e: + print("连接断开,正在重连……") + continue + + +# unsubscribe channels +async def unsubscribe(url, api_key, passphrase, secret_key, channels): + async with websockets.connect(url) as ws: + # login + timestamp = str(get_local_timestamp()) + login_str = login_params(timestamp, api_key, passphrase, secret_key) + await ws.send(login_str) + # print(f"send: {login_str}") + + res = await ws.recv() + print(f"recv: {res}") + + # unsubscribe + sub_param = {"op": "unsubscribe", "args": channels} + sub_str = json.dumps(sub_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + + res = await ws.recv() + print(f"recv: {res}") + + +# unsubscribe channels +async def unsubscribe_without_login(url, channels): + async with websockets.connect(url) as ws: + # unsubscribe + sub_param = {"op": "unsubscribe", "args": channels} + sub_str = json.dumps(sub_param) + await ws.send(sub_str) + print(f"send: {sub_str}") + + res = await ws.recv() + print(f"recv: {res}") + + +api_key = "4497a4fa-062e-41f3-a991-b46814a9f104" +secret_key = "2CD859E62F9A8E1D25702A093C3EED58" +passphrase = "123456aA." + + +# WebSocket公共频道 public channels +# 实盘 real trading +# url = "wss://ws.okx.com:8443/ws/v5/public" +# 模拟盘 demo trading +url = "wss://wspap.okx.com:8443/ws/v5/public?brokerId=9999" +# url = "wss://ws.okx.com:8443/ws/v5/public?brokerId=9999" +# WebSocket私有频道 private channels +# 实盘 real trading +# url = "wss://ws.okx.com:8443/ws/v5/private" +# 模拟盘 demo trading +# url = "wss://wspap.okx.com:8443/ws/v5/private" +# 充值信息/提币信息频道、定投策略订单频道(实盘) +# url = "wss://ws.okx.com:8443/ws/v5/business" +# 充值信息/提币信息频道、提币信息频道、定投策略订单频道(模拟盘) +# url = "wss://ws.okx.com:8443/ws/v5/business?brokerId=9999" + +''' +公共频道 public channel +:param channel: 频道名 +:param instType: 产品类型 +:param instId: 产品ID +:param uly: 合约标的指数 + +''' + +# 产品频道 Instruments Channel +# channels = [{"channel": "instruments", "instType": "FUTURES"}] +# 行情频道 tickers channel +channels = [{"channel": "tickers", "instId": "BTC-USDT"}, {"channel": "tickers", "instId": "ETH-USDT"}] +# 持仓总量频道 Open interest Channel +# channels = [{"channel": "open-interest", "instId": "BTC-USD-210326"}] +# K线频道 Candlesticks Channel +# channels = [{"channel": "candle1m", "instId": "BTC-USD-210326"}] +# 交易频道 Trades Channel +# channels = [{"channel": "trades", "instId": "BTC-USD-201225"}] +# 预估交割/行权价格频道 Estimated delivery/exercise Price Channel +# channels = [{"channel": "estimated-price", "instType": "FUTURES", "uly": "BTC-USD"}] +# 标记价格频道 Mark Price Channel +# channels = [{"channel": "mark-price", "instId": "BTC-USDT-210326"}] +# 标记价格K线频道 Mark Price Candlesticks Channel +# channels = [{"channel": "mark-price-candle1D", "instId": "BTC-USD-201225"}] +# 限价频道 Price Limit Channel +# channels = [{"channel": "price-limit", "instId": "BTC-USD-201225"}] +# 深度频道 Order Book Channel +# channels = [{"channel": "books", "instId": "BTC-USD-SWAP"}] +# 期权定价频道 OPTION Summary Channel +# channels = [{"channel": "opt-summary", "uly": "BTC-USD"}] +# 资金费率频道 Funding Rate Channel +# channels = [{"channel": "funding-rate", "instId": "BTC-USD-SWAP"}] +# 指数K线频道 Index Candlesticks Channel +# channels = [{"channel": "index-candle1m", "instId": "BTC-USDT"}] +# 指数行情频道 Index Tickers Channel +# channels = [{"channel": "index-tickers", "instId": "BTC-USDT"}] +# status频道 Status Channel +# channels = [{"channel": "status"}] +# 平台公共爆仓单频道 +# channels = [{"channel": "liquidation-orders", "instType":"SWAP"}] +# 期权公共成交频道 +# channels = [{"channel": "option-trades", "instType":"OPTION","instFamily":"BTC-USD"}] +# 公共大宗交易频道 Public block trading channel +# channels = [{"channel": "public-struc-block-trades"}] +# 大宗交易行情频道 Block trading market channel +# channels = [{"channel": "block-tickers", "instId":"BTC-USDT-SWAP"}] +# 公共大宗交易单腿交易频道 +# channels = [{"channel": "public-block-trades", "instId":"BTC-USDT-SWAP"}] + +''' +私有频道 private channel +:param channel: 频道名 +:param ccy: 币种 +:param instType: 产品类型 +:param uly: 合约标的指数 +:param instId: 产品ID + +''' + +# 账户频道 Account Channel +# channels = [{"channel": "account", "ccy": "BTC"}] +# 持仓频道 Positions Channel +# channels = [{"channel": "positions", "instType": "FUTURES", "uly": "BTC-USDT", "instId": "BTC-USDT-210326"}] +# 余额和持仓频道 Balance and Position Channel +# channels = [{"channel": "balance_and_position"}] +# 订单频道 Order Channel +# channels = [{"channel": "orders", "instType": "FUTURES", "uly": "BTC-USD", "instId": "BTC-USD-201225"}] +# 策略委托订单频道 Algo Orders Channel +# channels = [{"channel": "orders-algo", "instType": "FUTURES", "uly": "BTC-USD", "instId": "BTC-USD-201225"}] +# 高级策略委托订单频道 Cancel Advance Algos +# channels = [{"channel": "algo-advance", "instType": "SPOT","instId": "BTC-USD-201225","algoId":"12345678"}] +# 爆仓风险预警推送频道 +# channels = [{"channel": "liquidation-warning", "instType": "SWAP","instType": "","uly":"","instId":""}] +# 账户greeks频道 +# channels = [{"channel": "account-greeks", "ccy": "BTC"}] +# 询价频道 Inquiry channel +# channels = [{"channel": "rfqs"}] +# 报价频道 Quote channel +# channels = [{"channel": "quotes"}] +# 大宗交易频道 Block trading channel +# channels = [{"channel": "struc-block-trades"}] +# 现货网格策略委托订单频道 Consignment order channel of spot grid strategy +# channels = [{"channel": "grid-orders-spot", "instType": "ANY"}] +# 合约网格策略委托订单频道 Spot grid policy delegated order channel contract grid policy delegated order channel +# channels = [{"channel": "grid-orders-contract", "instType": "ANY"}] +# 合约网格持仓频道 Contract grid position channel +# channels = [{"channel": "grid-positions", "algoId": ""}] +# 网格策略子订单频道 Grid policy suborder channel +# channels = [{"channel": "grid-sub-orders", "algoId": ""}] +# 充值信息频道 +# channels = [{"channel": "deposit-info", "ccy":"BTC"}] +# 提币信息频道 +# channels = [{"channel": "withdrawal-info", "ccy":"BTC"}] +# 定投策略委托订单频道 +# channels = [{"channel": "algo-recurring-buy", "instType":"SPOT"}] +''' +交易 trade +''' + +# 下单 Place Order +# trade_param = {"id": "1512", "op": "order", "args": [{"side": "buy", "instId": "BTC-USDT", "tdMode": "isolated", "ordType": "limit", "px": "19777", "sz": "1"}]} +# 批量下单 Place Multiple Orders +# trade_param = {"id": "1512", "op": "batch-orders", "args": [ +# {"side": "buy", "instId": "BTC-USDT", "tdMode": "isolated", "ordType": "limit", "px": "19666", "sz": "1"}, +# {"side": "buy", "instId": "BTC-USDT", "tdMode": "isolated", "ordType": "limit", "px": "19633", "sz": "1"} +# ]} +# 撤单 Cancel Order +# trade_param = {"id": "1512", "op": "cancel-order", "args": [{"instId": "BTC-USDT", "ordId": "259424589042823169"}]} +# 批量撤单 Cancel Multiple Orders +# trade_param = {"id": "1512", "op": "batch-cancel-orders", "args": [ +# {"instId": "BTC-USDT", "ordId": ""}, +# {"instId": "BTC-USDT", "ordId": ""} +# ]} +# 改单 Amend Order +# trade_param = {"id": "1512", "op": "amend-order", "args": [{"instId": "BTC-USDT", "ordId": "259432767558135808", "newSz": "2"}]} +# 批量改单 Amend Multiple Orders +# trade_param = {"id": "1512", "op": "batch-amend-orders", "args": [ +# {"instId": "BTC-USDT", "ordId": "", "newSz": "2"}, +# {"instId": "BTC-USDT", "ordId": "", "newSz": "3"} +# ]} + + +loop = asyncio.get_event_loop() + +# 公共频道 不需要登录(行情,持仓总量,K线,标记价格,深度,资金费率等)subscribe public channel +loop.run_until_complete(subscribe_without_login(url, channels)) + +# 私有频道 需要登录(账户,持仓,订单等)subscribe private channel +# loop.run_until_complete(subscribe(url, api_key, passphrase, secret_key, channels)) + +# 交易(下单,撤单,改单等)trade +# loop.run_until_complete(trade(url, api_key, passphrase, secret_key, trade_param)) + +loop.close() + +if __name__ == '__main__': + subscribe(url,api_key,passphrase,secret_key,channels) \ No newline at end of file