Skip to content

Commit a278d23

Browse files
author
jason.hsu
committed
feat: rmv requirements-dev.txt
1 parent c35c355 commit a278d23

File tree

5 files changed

+80
-34
lines changed

5 files changed

+80
-34
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ jobs:
4747
print(f' okx version: {okx.__version__}')
4848
"
4949
50-
- name: Install dev dependencies and verify test imports
50+
- name: Verify test imports
5151
run: |
52-
pip install -r requirements-dev.txt
52+
pip install pytest
5353
python -c "
5454
import pytest
5555
import unittest
56-
print('✅ Dev imports successful')
56+
print('✅ Test imports successful')
5757
"
5858
5959
# ============================================
@@ -105,15 +105,15 @@ jobs:
105105
uses: actions/cache@v4
106106
with:
107107
path: ~/.cache/pip
108-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt') }}
108+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
109109
restore-keys: |
110110
${{ runner.os }}-pip-${{ matrix.python-version }}-
111111
${{ runner.os }}-pip-
112112
113113
- name: Install dependencies
114114
run: |
115115
python -m pip install --upgrade pip
116-
pip install -r requirements-dev.txt
116+
pip install -r requirements.txt
117117
pip install -e .
118118
119119
- name: Run tests

README.md

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,80 @@ Make sure you update often and check the [Changelog](https://www.okx.com/docs-v5
2020
### Quick start
2121
#### Prerequisites
2222

23-
`python version:>=3.9`
23+
`python version:>=3.7`
2424

25-
`WebSocketAPI: websockets package advise version 6.0`
26-
27-
#### Step 1: register an account on OKX and apply for an API key
25+
#### Step 1: Register an account on OKX and apply for an API key
2826
- Register for an account: https://www.okx.com/account/register
2927
- Apply for an API key: https://www.okx.com/account/users/myApi
3028

31-
#### Step 2: install python-okx
29+
#### Step 2: Install python-okx
3230

33-
```python
31+
```bash
3432
pip install python-okx
3533
```
3634

35+
### API Credentials
36+
37+
#### Option 1: Hardcoded credentials
38+
39+
```python
40+
from okx import Account
41+
42+
account = Account.AccountAPI(
43+
api_key="your-api-key-here",
44+
api_secret_key="your-api-secret-here",
45+
passphrase="your-passphrase-here",
46+
flag="1", # 0 = live trading, 1 = demo trading
47+
debug=False
48+
)
49+
```
50+
51+
#### Option 2: Using `.env` file (recommended)
52+
53+
Create a `.env` file in your project root:
54+
55+
```bash
56+
OKX_API_KEY=your-api-key-here
57+
OKX_API_SECRET=your-api-secret-here
58+
OKX_PASSPHRASE=your-passphrase-here
59+
OKX_FLAG=1
60+
```
61+
62+
Then load it in your code:
63+
64+
```python
65+
import os
66+
from dotenv import load_dotenv
67+
from okx import Account
68+
69+
load_dotenv()
70+
71+
account = Account.AccountAPI(
72+
api_key=os.getenv('OKX_API_KEY'),
73+
api_secret_key=os.getenv('OKX_API_SECRET'),
74+
passphrase=os.getenv('OKX_PASSPHRASE'),
75+
flag=os.getenv('OKX_FLAG', '1'),
76+
debug=False
77+
)
78+
```
79+
80+
### Development Setup
81+
82+
For contributors or local development:
83+
84+
```bash
85+
# Clone the repository
86+
git clone https://github.com/okxapi/python-okx.git
87+
cd python-okx
88+
89+
# Install dependencies
90+
pip install -r requirements.txt
91+
pip install -e .
92+
93+
# Run tests
94+
pytest test/unit/ -v
95+
```
96+
3797
#### Step 3: Run examples
3898

3999
- Fill in API credentials in the corresponding examples

requirements-dev.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

requirements.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
# Core dependencies for python-okx
1+
# Core dependencies
22
httpx[http2]>=0.24.0
33
requests>=2.25.0
44
websockets>=10.0
55
certifi>=2021.0.0
66
loguru>=0.7.0
7+
python-dotenv>=1.0.0
78

9+
# Development & Testing
10+
pytest>=7.0.0
11+
pytest-asyncio>=0.21.0
12+
pytest-cov>=4.0.0
13+
ruff>=0.1.0
14+
build>=1.0.0
15+
twine>=4.0.0

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,4 @@ def parse_requirements(filename): # type: (str) -> list
5454
"Operating System :: OS Independent",
5555
],
5656
install_requires=parse_requirements("requirements.txt"),
57-
extras_require={
58-
"dev": parse_requirements("requirements-dev.txt"),
59-
},
6057
)

0 commit comments

Comments
 (0)