Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
3313cb2
Update WsPrivateTest.py
okxapi Dec 15, 2022
3b79325
Update WsPublicTest.py
okxapi Dec 15, 2022
2830a6e
Update WsPrivateTest.py
okxapi Dec 15, 2022
ed9d820
Update WsClientFactory.py
okxapi Dec 15, 2022
7122e14
Update WsConnectManager.py
okxapi Dec 15, 2022
48373d9
Update WsPrivate.py
okxapi Dec 15, 2022
59f2b56
Update WsPublic.py
okxapi Dec 15, 2022
0fbcb4f
Update README.md
okxapi Dec 16, 2022
41b1950
Update README.md
okxapi Dec 16, 2022
24efd1f
enriched README.md
Feb 15, 2023
ccfc453
modified readme
okxapi Feb 16, 2023
7fdd902
modified readme
okxapi Feb 16, 2023
e472ac4
modified readme
okxapi Feb 16, 2023
93ef09f
modified readme
okxapi Feb 16, 2023
617081b
update README
PerryZhu Feb 16, 2023
48fd15e
update requirements.txt
PerryZhu Feb 16, 2023
3df5503
update version
PerryZhu Feb 16, 2023
ee870fe
add setup.py
PerryZhu Feb 16, 2023
19dc436
Update trade_derivatives_en.ipynb
okxapi Mar 9, 2023
6867bfe
Update trade_derivatives_en.ipynb
okxapi Mar 9, 2023
a0a946b
Update get_started_en.ipynb
okxapi Mar 9, 2023
48d29f1
Update trade_derivatives_en.ipynb
okxapi Mar 9, 2023
cdb0a21
Update get_started_en.ipynb
okxapi Mar 9, 2023
317fb09
Update get_started_en.ipynb
okxapi Mar 9, 2023
709947b
Update get_started_en.ipynb
okxapi Mar 9, 2023
5b9acb6
httpx client not varify and no timeout
Mar 16, 2023
e4b66a4
Merge pull request #3 from Hearty07/master
okxapi Mar 16, 2023
7f9a76d
fix request path of server timestamp
Mar 17, 2023
317ccc9
retry while http request failed
Mar 20, 2023
1c8b51a
show traceback msg while exception
Mar 20, 2023
3084294
re connect while reaching the max request times
Mar 20, 2023
b47f519
retry in 1 second but not raise exception
Mar 21, 2023
b414a60
Merge pull request #8 from Hearty07/master
okxapi Mar 23, 2023
e3fa532
update version
PerryZhu Mar 23, 2023
bb36351
Update get_started_en.ipynb
okxapi Mar 27, 2023
522c7b6
Update trade_derivatives_en.ipynb
okxapi Mar 27, 2023
7b19463
Update get_started_en.ipynb
okxapi Mar 27, 2023
f5e0b6d
Update get_started_en.ipynb
okxapi Mar 28, 2023
f6338c1
Update trade_derivatives_en.ipynb
okxapi Mar 28, 2023
806924e
update dependence and version
PerryZhu Mar 28, 2023
c9e9de6
Merge remote-tracking branch 'origin/master'
PerryZhu Mar 28, 2023
4594cda
delete retry logic
PerryZhu Mar 28, 2023
c8496e5
fixed typo
okxapi Mar 28, 2023
cf81854
Add the wdId parameter to the get_withdrawal_history interface.
Sharp-Lee Apr 9, 2023
8adde22
Merge pull request #14 from Sharp-Lee/master
okxapi Apr 11, 2023
0afee92
update version
PerryZhu Apr 12, 2023
fcd7f52
delete unnecessary log
PerryZhu May 11, 2023
ceadad7
jzh
Jun 16, 2023
9f95fbb
update
Jun 19, 2023
ed77fed
upgrade
Jun 19, 2023
42ea0c3
upgrade
Jun 19, 2023
55f44a3
Delete .DS_Store
okxapi Jun 19, 2023
872d924
Delete test/__pycache__ directory
okxapi Jun 19, 2023
8bd3c5a
Delete .DS_Store
okxapi Jun 19, 2023
f989505
delete unusefull doc
PerryZhu Jun 19, 2023
ec58e88
Delete okx/websocket/__pycache__ directory
okxapi Jun 19, 2023
3137cfe
Merge branch 'master' of github.com:okxapi/python-okx
PerryZhu Jun 19, 2023
a09940e
add git ignore
PerryZhu Jun 19, 2023
9266813
add git ignore
PerryZhu Jun 19, 2023
b136361
add spread
Aug 14, 2023
37782e0
Update README.md
okxapi Oct 8, 2023
1e7bdfa
update version
Oct 9, 2023
7cf0ca5
fix
Oct 18, 2023
12e983d
fix: throws errors when we use the URLs for the demo trading environment
007live Dec 26, 2023
cc2d1f7
fix: client parameter exception
007live Dec 27, 2023
9006434
Update getting ts from _get_timestamp() (#33)
kkathena Jan 8, 2024
7fd4543
fix: Python install python-okx --upgrade error && Error in file name
007live Jan 8, 2024
71504d3
Merge remote-tracking branch 'origin/master'
007live Jan 8, 2024
db0bbb5
Update WsPrivateAsyncTest.py
okxapi Jan 18, 2024
068c63d
feat: upgrade for proxy
007live Jan 25, 2024
422ee7e
feat:Support multiply trigger TP
007live Jan 28, 2024
7d43159
feat: supported position builder
007live Mar 7, 2024
d95d1ae
update Funding non_tradable_assets
Nort007 May 23, 2023
c4e7a98
Rename ORDERS_ALGO_OENDING to ORDERS_ALGO_PENDING
WoLeo-Z Aug 25, 2023
a10a7f1
Rename ORDERS_ALGO_OENDING to ORDERS_ALGO_PENDING
WoLeo-Z Aug 25, 2023
e2e7b4f
updated typo in constant and reference
dalton-cole Nov 15, 2023
26956b9
fix: #55 incorrect timestamp format in 'OK-ACCESS-TIMESTAMP' header w…
grzhan Mar 17, 2024
0df4058
remove use_server_time param
007live May 9, 2024
ef7e4f3
Merge remote-tracking branch 'origin/master'
007live May 9, 2024
2a796ab
add new api and extend new apram
007live May 31, 2024
f983c5b
supported new features, fixed loan & earn
007live Aug 7, 2024
7420e2a
fix get_max_loan
Oct 17, 2024
6cd392d
upgrade
Dec 9, 2024
9313397
upgrade
Dec 26, 2024
1711d62
upgrade
Mar 31, 2025
a3e7a8b
upgrade
Mar 31, 2025
472a5ed
upgrade
Apr 29, 2025
564208c
upgrade
May 12, 2025
53f5582
Update README.md
okxapi May 29, 2025
6d4bcf7
upgrade
Jul 22, 2025
c5d834d
add sol-staking and update endpoint params
alex-okx Jul 28, 2025
e0be0b1
Initialize websocket in constructor to avoid AttributeError
BlazeStorm001 Jun 4, 2025
a5af471
fix bug, func amend_algo_order lost params
Worldworld Oct 31, 2024
46974ba
Update Trade.py add place order param tradeQuoteCcy
lishoujun Oct 19, 2025
91fee83
add set auto earn endpoint
Dec 15, 2025
7a4fa53
feat: add idxVol and fix wrong params for posBuilder
Dec 16, 2025
f8847a9
feat: add unit-testing for the test_account
Dec 16, 2025
0234ece
add set auto earn endpoint
Dec 16, 2025
31fd401
add id parameter to all websocket subscription
Dec 16, 2025
14c3a94
websocket enhancement
Dec 17, 2025
12ebac7
创建0.4.1版本分支
Dec 18, 2025
f78c2fe
add set auto earn endpoint
Dec 18, 2025
e82ee55
feat: add idxVol and fix wrong params for posBuilder
Dec 16, 2025
3f739c2
feat: add unit-testing for the test_account
Dec 16, 2025
94c2070
websocket enhancement
Dec 18, 2025
1f0a83d
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 18, 2025
a392b53
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 18, 2025
0f4d44c
websocket enhancement
Dec 18, 2025
2839e7f
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 18, 2025
69a416a
add /api/v5/account/set-auto-earn endpoint
Dec 18, 2025
68fa15c
add /api/v5/account/set-auto-earn endpoint
Dec 19, 2025
3aebd72
add toAddrType to the 3 withdrawal endpoints
Dec 16, 2025
7398c55
add toAddrType to the 3 withdrawal endpoints
Dec 18, 2025
df68d90
add toAddrType to the 3 withdrawal endpoints
Dec 19, 2025
19f7393
add toAddrType to the 3 withdrawal endpoints
Dec 19, 2025
759c054
add market-data-history endpoint
Dec 17, 2025
46817fe
add market-data-history endpoint
Dec 18, 2025
4b165d0
add market-data-history endpoint
Dec 19, 2025
4391f0e
add /api/v5/account/set-auto-earn endpoint
Dec 19, 2025
2f9fea9
http version compatibility issue
Dec 17, 2025
ed85a8c
confirm if it's version compatibility issue
Dec 18, 2025
0023ce6
confirm if it's version compatibility issue
Dec 19, 2025
e02411c
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 19, 2025
6746db7
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 19, 2025
500baa6
add id parameter to all websocket subscription
Dec 19, 2025
69af821
add id parameter to all websocket subscription
Dec 19, 2025
240216f
Merge pull request #125 from okxapi/dev/BROK-741
okxapi Dec 19, 2025
892bc6b
Merge pull request #128 from okxapi/dev/BROK-1214
okxapi Dec 19, 2025
e808427
feat: add api changes
Dec 19, 2025
61562c4
websocket enhancement
Dec 19, 2025
32706d9
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 19, 2025
11efc37
feat: add ci cd
Dec 19, 2025
b6c3b83
websocket enhancement
Dec 19, 2025
81c269c
feat: add ci cd and remove wrong commit for gitlab
Dec 19, 2025
89e8e25
feat: add cicd
Dec 19, 2025
2d47171
fix: missing import
Dec 19, 2025
ee04e6b
fix: broken testing
Dec 19, 2025
34cf7c4
Merge pull request #130 from okxapi/dev-add-cicd
okxapi Dec 19, 2025
40e7629
Merge branch 'dev-add-cicd' to dev-add-px-amend-type-and-trade-quote-…
Dec 19, 2025
75a20fc
feat: add .env
Dec 19, 2025
6cee7dc
feat: rmv changes
Dec 19, 2025
128da2d
fix: add testing files
Dec 19, 2025
ee3c263
websocket enhancement
Dec 22, 2025
a2b7fb0
Merge pull request #133 from okxapi/dev-add-px-amend-type-and-trade-q…
okxapi Dec 22, 2025
3f53945
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 22, 2025
4813e7e
websocket enhancement
Dec 22, 2025
8d0e78e
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 22, 2025
9dfb5b6
websocket enhancement
Dec 22, 2025
fb237f6
websocket enhancement
Dec 22, 2025
2dfafef
config update
Dec 22, 2025
1fb02f4
Merge pull request #134 from okxapi/dev/config_update
okxapi Dec 22, 2025
883901f
Merge remote-tracking branch 'origin/release/version_0.4.1' into dev/…
Dec 22, 2025
7172e8e
Merge pull request #124 from okxapi/dev/BROK-653
okxapi Dec 22, 2025
c35c355
feat: add dependency file and cicd
Dec 22, 2025
a278d23
feat: rmv requirements-dev.txt
Dec 22, 2025
299acc4
fix: ci build failure
Dec 22, 2025
2b2936a
fix: ci build failure
Dec 22, 2025
b3973c7
Merge pull request #135 from okxapi/dev-add-requirements-files
okxapi Dec 22, 2025
7e40b52
add tradeQuoteCcy request param to the trade-related endpoints
Dec 22, 2025
93672c1
Merge pull request #136 from okxapi/dev/BROK-1216
okxapi Dec 22, 2025
149d3f4
add tradeQuoteCcy request param to the trade-related endpoints
Jan 5, 2026
1bb68a1
Merge pull request #137 from okxapi/dev/BROK-1217
okxapi Jan 6, 2026
bbafebf
add back get_open_interest_history() function
Jan 6, 2026
bd8cd34
add back get_open_interest_history() function
Jan 6, 2026
9473ac0
add back get_open_interest_history() function
Jan 6, 2026
41b3bda
重复字段常量类提取
Jan 8, 2026
eeb851e
Merge pull request #131 from okxapi/release/version_0.4.1
okxapi Jan 8, 2026
199d6ff
Skip dev dependencies in setup.py so pip install only pulls runtime deps
aisk Jun 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# OKX API Credentials
# Copy this file to .env and fill in your actual credentials
# NEVER commit .env to version control!

OKX_API_KEY=your_api_key_here
OKX_API_SECRET=your_api_secret_here
OKX_PASSPHRASE=your_passphrase_here

# Optional: Set to '0' for live trading, '1' for demo trading
OKX_FLAG=1
173 changes: 173 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# GitHub Actions CI/CD Configuration for python-okx
name: CI

on:
push:
branches:
- master
- 'release/*'
- 'releases/*'
pull_request:
branches:
- master
- 'release/*'
- 'releases/*'

jobs:
# ============================================
# DEPENDENCY CHECK JOB
# Ensures all imports are satisfied by requirements.txt
# ============================================
dependency-check:
name: Dependency Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install only from requirements.txt (clean environment)
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Verify all production imports work
run: |
# This catches missing dependencies in requirements.txt
python -c "
import okx
from okx import Account, Trade, Funding, MarketData, PublicData
from okx import SubAccount, Convert, BlockTrading, CopyTrading
from okx import SpreadTrading, Grid, TradingData, Status
from okx.websocket import WsPublicAsync, WsPrivateAsync
print('✅ All imports successful')
print(f' okx version: {okx.__version__}')
"

- name: Verify test imports
run: |
pip install pytest
python -c "
import pytest
import unittest
print('✅ Test imports successful')
"

# ============================================
# LINT JOB
# ============================================
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Run ruff
run: |
ruff check okx/ --ignore=E501
continue-on-error: true # Set to false once codebase is cleaned up

# ============================================
# TEST JOB
# ============================================
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: [dependency-check] # Only run tests if dependencies are valid
strategy:
fail-fast: true
max-parallel: 1
matrix:
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Run tests
run: |
python -m pytest test/unit/ -v --cov=okx --cov-report=term-missing --cov-report=xml

- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false

# ============================================
# BUILD JOB
# ============================================
build:
name: Build Package
runs-on: ubuntu-latest
needs: [test]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Build package
run: python -m build --no-isolation

- name: Check package
run: twine check dist/*

- name: Test install from wheel (clean environment)
run: |
# Create a fresh venv and install the built wheel
python -m venv /tmp/test-install
/tmp/test-install/bin/pip install dist/*.whl
/tmp/test-install/bin/python -c "
import okx
from okx import Account, Trade, Funding
print(f'✅ Package installs correctly: okx {okx.__version__}')
"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
build/
dist/
python_okx.egg-info/
*.DS_Store
**/__pycache__
**/**/__pycache__

### STS ###
.apt_generated
Expand Down Expand Up @@ -29,4 +32,9 @@ build/

### VS Code ###
.vscode/
setup.py
id_rsa*

# Environment files
.env
.env.local
.env.*.local
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include requirements.txt
include README.md

Loading