deltadefi 0.0.10__tar.gz → 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of deltadefi might be problematic. Click here for more details.
- deltadefi-0.1.0/.env.example +3 -0
- deltadefi-0.1.0/.github/workflows/publish.yml +37 -0
- deltadefi-0.1.0/.gitignore +62 -0
- deltadefi-0.1.0/Makefile +85 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/PKG-INFO +39 -35
- {deltadefi-0.0.10 → deltadefi-0.1.0}/README.md +20 -16
- deltadefi-0.1.0/coverage.xml +762 -0
- deltadefi-0.1.0/examples/websocket_example.py +311 -0
- deltadefi-0.1.0/pyproject.toml +124 -0
- deltadefi-0.1.0/src/deltadefi/__init__.py +2 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/api.py +3 -3
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/api_resources/auth.py +3 -4
- deltadefi-0.1.0/src/deltadefi/clients/__init__.py +3 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/clients/accounts.py +70 -7
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/clients/client.py +14 -6
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/clients/markets.py +2 -25
- deltadefi-0.1.0/src/deltadefi/clients/websocket.py +355 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/error.py +2 -2
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/models/models.py +3 -3
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/responses/accounts.py +28 -6
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/responses/responses.py +4 -4
- deltadefi-0.1.0/tests/clients/__init__.py +0 -0
- deltadefi-0.1.0/tests/clients/test_accounts.py +44 -0
- deltadefi-0.1.0/tests/clients/test_order.py +37 -0
- deltadefi-0.1.0/tests/clients/test_sign.py +26 -0
- deltadefi-0.1.0/uv.lock +1696 -0
- deltadefi-0.0.10/pyproject.toml +0 -47
- deltadefi-0.0.10/src/deltadefi/__init__.py +0 -2
- deltadefi-0.0.10/src/deltadefi/clients/__init__.py +0 -2
- deltadefi-0.0.10/src/deltadefi/clients/app.py +0 -23
- deltadefi-0.0.10/src/deltadefi/lib/utils.py +0 -46
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/api_resources/__init__.py +0 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/api_resources/validation.py +0 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/clients/orders.py +0 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/constants/__init__.py +0 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/constants/constants.py +0 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/models/__init__.py +0 -0
- {deltadefi-0.0.10 → deltadefi-0.1.0}/src/deltadefi/responses/__init__.py +0 -0
- {deltadefi-0.0.10/src/deltadefi/lib → deltadefi-0.1.0/tests}/__init__.py +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Release Distributables
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-n-upload:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Set up Python 3.11
|
|
15
|
+
uses: actions/setup-python@v4
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.11"
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v3
|
|
21
|
+
with:
|
|
22
|
+
enable-cache: true
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv sync --dev
|
|
26
|
+
|
|
27
|
+
- name: Lint with ruff
|
|
28
|
+
run: uv run ruff check src
|
|
29
|
+
|
|
30
|
+
- name: Run unit tests
|
|
31
|
+
run: uv run pytest --cov=deltadefi --cov-report=xml
|
|
32
|
+
|
|
33
|
+
- name: Build distributables
|
|
34
|
+
run: uv build
|
|
35
|
+
|
|
36
|
+
- name: Build and publish to PyPI
|
|
37
|
+
run: uv publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Virtual environment
|
|
2
|
+
.venv/
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.pyc
|
|
7
|
+
*.pyo
|
|
8
|
+
*.pyd
|
|
9
|
+
.Python
|
|
10
|
+
build/
|
|
11
|
+
develop-eggs/
|
|
12
|
+
dist/
|
|
13
|
+
downloads/
|
|
14
|
+
eggs/
|
|
15
|
+
.eggs/
|
|
16
|
+
lib/
|
|
17
|
+
lib64/
|
|
18
|
+
parts/
|
|
19
|
+
sdist/
|
|
20
|
+
var/
|
|
21
|
+
wheels/
|
|
22
|
+
*.egg-info/
|
|
23
|
+
.installed.cfg
|
|
24
|
+
*.egg
|
|
25
|
+
|
|
26
|
+
# Testing
|
|
27
|
+
.pytest_cache/
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov/
|
|
30
|
+
.tox/
|
|
31
|
+
.nox/
|
|
32
|
+
cov_html/
|
|
33
|
+
|
|
34
|
+
# Type checking
|
|
35
|
+
.mypy_cache/
|
|
36
|
+
.dmypy.json
|
|
37
|
+
dmypy.json
|
|
38
|
+
|
|
39
|
+
# Linting
|
|
40
|
+
.ruff_cache/
|
|
41
|
+
|
|
42
|
+
# Environment variables
|
|
43
|
+
.env
|
|
44
|
+
.env.local
|
|
45
|
+
.env.development.local
|
|
46
|
+
.env.test.local
|
|
47
|
+
.env.production.local
|
|
48
|
+
|
|
49
|
+
# Documentation
|
|
50
|
+
docs/build/
|
|
51
|
+
docs/_build/
|
|
52
|
+
|
|
53
|
+
# IDEs
|
|
54
|
+
.vscode/
|
|
55
|
+
.idea/
|
|
56
|
+
*.swp
|
|
57
|
+
*.swo
|
|
58
|
+
*~
|
|
59
|
+
|
|
60
|
+
# OS
|
|
61
|
+
.DS_Store
|
|
62
|
+
Thumbs.db
|
deltadefi-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
# Makefile for deltadefi-python-sdk (uv-managed Python project)
|
|
3
|
+
# Usage examples:
|
|
4
|
+
# make install # create venv and install project + dev deps
|
|
5
|
+
# make test # run pytest
|
|
6
|
+
# make fmt lint # format + lint with Ruff
|
|
7
|
+
# make build # build the package
|
|
8
|
+
# make help # list targets
|
|
9
|
+
|
|
10
|
+
SHELL := /bin/bash
|
|
11
|
+
.DEFAULT_GOAL := help
|
|
12
|
+
|
|
13
|
+
UV := uv
|
|
14
|
+
PY := python
|
|
15
|
+
|
|
16
|
+
.PHONY: help venv install fmt lint type test cov build clean docs deps
|
|
17
|
+
|
|
18
|
+
help: ## Show this help with grouped commands
|
|
19
|
+
@echo "Available commands:"
|
|
20
|
+
@echo ""
|
|
21
|
+
@echo "📦 Installation & Setup:"
|
|
22
|
+
@grep -E '^[a-zA-Z_\-]+:.*##.*install' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
23
|
+
@echo ""
|
|
24
|
+
@echo "🔧 Testing & Quality:"
|
|
25
|
+
@grep -E '^[a-zA-Z_\-]+:.*##.*\[(test|lint|format|type|quality|check)\]' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
26
|
+
@echo ""
|
|
27
|
+
@echo "🏗️ Building & Distribution:"
|
|
28
|
+
@grep -E '^[a-zA-Z_\-]+:.*##.*\[(build|dist)\]' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
29
|
+
@echo ""
|
|
30
|
+
@echo "📚 Other Utilities:"
|
|
31
|
+
@grep -E '^[a-zA-Z_\-]+:.*##[^[]*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
32
|
+
|
|
33
|
+
# 📦 Installation & Setup
|
|
34
|
+
venv: ## Create virtual environment [install]
|
|
35
|
+
@$(UV) venv
|
|
36
|
+
|
|
37
|
+
install: ## Install project in editable mode with dependencies [install]
|
|
38
|
+
@$(UV) pip install -e . --group dev --group docs
|
|
39
|
+
|
|
40
|
+
deps: install ## Install dependencies (alias for install) [install]
|
|
41
|
+
|
|
42
|
+
# 🔧 Testing & Quality
|
|
43
|
+
fmt: ## Format code with Ruff formatter [format]
|
|
44
|
+
@$(UV) run ruff format .
|
|
45
|
+
|
|
46
|
+
lint: ## Lint with Ruff (auto-fix + fail on remaining issues) [lint]
|
|
47
|
+
@$(UV) run ruff check --fix --exit-non-zero-on-fix .
|
|
48
|
+
|
|
49
|
+
type: ## Static type-check with mypy [type]
|
|
50
|
+
@$(UV) run mypy --config-file=pyproject.toml src/ || true
|
|
51
|
+
|
|
52
|
+
test: install ## Run tests with pytest [test]
|
|
53
|
+
@$(UV) run pytest -vv
|
|
54
|
+
|
|
55
|
+
cov: install ## Check code coverage [test]
|
|
56
|
+
@$(UV) run pytest -n 4 --cov deltadefi
|
|
57
|
+
|
|
58
|
+
cov-html: cov ## Check code coverage and generate HTML report [test]
|
|
59
|
+
@$(UV) run coverage html -d cov_html
|
|
60
|
+
@echo "Coverage report generated in cov_html/"
|
|
61
|
+
|
|
62
|
+
# 🏗️ Building & Distribution
|
|
63
|
+
build: install ## Build the package [build]
|
|
64
|
+
@$(UV) build
|
|
65
|
+
|
|
66
|
+
# 📚 Other Utilities
|
|
67
|
+
docs: install ## Build the documentation
|
|
68
|
+
@mkdir -p docs/requirements
|
|
69
|
+
@$(UV) export --group docs > docs/requirements.txt
|
|
70
|
+
@rm -r -f docs/build
|
|
71
|
+
@$(UV) run sphinx-build docs/source docs/build/html
|
|
72
|
+
@echo "Documentation built in docs/build/html/"
|
|
73
|
+
|
|
74
|
+
clean-test: ## Remove test and coverage artifacts
|
|
75
|
+
@rm -f .coverage
|
|
76
|
+
@rm -fr cov_html/
|
|
77
|
+
@rm -fr .pytest_cache
|
|
78
|
+
|
|
79
|
+
clean: clean-test ## Remove caches, build artifacts, and temp files
|
|
80
|
+
@rm -rf .mypy_cache .ruff_cache dist build
|
|
81
|
+
@find . -type d -name __pycache__ -prune -exec rm -rf {} +
|
|
82
|
+
|
|
83
|
+
version: ## Show uv and Python versions
|
|
84
|
+
@$(UV) --version
|
|
85
|
+
@$(UV) run $(PY) -c "import platform; print('Python', platform.python_version())"
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: deltadefi
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Python SDK for DeltaDeFi protocol.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Requires-Python: >3.11,<4.0.0
|
|
5
|
+
Author-email: HinsonSIDAN <wongkahinhinson@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: cardano,defi,sdk,trading
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
9
|
Classifier: Intended Audience :: Developers
|
|
11
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
11
|
Classifier: Natural Language :: English
|
|
13
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier:
|
|
17
|
-
|
|
18
|
-
Requires-
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: <4.0.0,>3.11
|
|
19
|
+
Requires-Dist: certifi>=2024.8.30
|
|
20
|
+
Requires-Dist: charset-normalizer>=3.4.0
|
|
21
|
+
Requires-Dist: idna>=3.10
|
|
22
|
+
Requires-Dist: pycardano>=0.12.3
|
|
23
|
+
Requires-Dist: python-dotenv>=0.9.9
|
|
24
|
+
Requires-Dist: requests>=2.25.0
|
|
25
|
+
Requires-Dist: sidan-gin>=0.1.6
|
|
26
|
+
Requires-Dist: urllib3>=2.2.3
|
|
27
|
+
Requires-Dist: websockets>=12.0
|
|
27
28
|
Description-Content-Type: text/markdown
|
|
28
29
|
|
|
29
30
|
# DeltaDeFi Python SDK
|
|
@@ -56,11 +57,8 @@ from sidan_gin import HDWallet
|
|
|
56
57
|
network="preprod",
|
|
57
58
|
api_key="your_api_key",
|
|
58
59
|
|
|
59
|
-
# Initialize HDWallet
|
|
60
|
-
wallet = HDWallet("your_wallet_mnemonic")
|
|
61
|
-
|
|
62
60
|
# Initialize ApiClient
|
|
63
|
-
api = ApiClient(network=network, api_key=api_key
|
|
61
|
+
api = ApiClient(network=network, api_key=api_key)
|
|
64
62
|
```
|
|
65
63
|
|
|
66
64
|
### Accounts
|
|
@@ -73,33 +71,40 @@ account_balance = api.accounts.get_account_balance()
|
|
|
73
71
|
print(account_balance)
|
|
74
72
|
```
|
|
75
73
|
|
|
76
|
-
###
|
|
74
|
+
### Markets
|
|
77
75
|
|
|
78
76
|
The Market client allows you to interact with market-related endpoints.
|
|
79
77
|
|
|
80
78
|
```python
|
|
81
79
|
# Get market depth
|
|
82
|
-
market_depth = api.
|
|
80
|
+
market_depth = api.markets.get_depth("ADAUSDM")
|
|
83
81
|
print(market_depth_response)
|
|
84
82
|
|
|
85
83
|
# Get market price
|
|
86
|
-
market_price_response = api.
|
|
84
|
+
market_price_response = api.markets.get_market_price("ADAUSDM")
|
|
87
85
|
print(market_price_response)
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
###
|
|
88
|
+
### Orders
|
|
91
89
|
|
|
92
90
|
The Order client allows you to interact with order-related endpoints.
|
|
93
91
|
|
|
94
92
|
```python
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
api_key = os.environ.get("DELTADEFI_API_KEY")
|
|
94
|
+
password = os.environ.get("TRADING_PASSWORD")
|
|
95
|
+
|
|
96
|
+
api = ApiClient(api_key=api_key)
|
|
97
|
+
api.load_operation_key(password)
|
|
98
|
+
|
|
99
|
+
res = api.post_order(
|
|
100
|
+
symbol="ADAUSDM",
|
|
101
|
+
side="sell",
|
|
102
|
+
type="limit",
|
|
103
|
+
quantity=51,
|
|
104
|
+
price=15,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
print("Order submitted successfully.", res)
|
|
103
108
|
```
|
|
104
109
|
|
|
105
110
|
## Development
|
|
@@ -115,4 +120,3 @@ DELTADEFI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx make test
|
|
|
115
120
|
## License
|
|
116
121
|
|
|
117
122
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
|
|
118
|
-
|
|
@@ -28,11 +28,8 @@ from sidan_gin import HDWallet
|
|
|
28
28
|
network="preprod",
|
|
29
29
|
api_key="your_api_key",
|
|
30
30
|
|
|
31
|
-
# Initialize HDWallet
|
|
32
|
-
wallet = HDWallet("your_wallet_mnemonic")
|
|
33
|
-
|
|
34
31
|
# Initialize ApiClient
|
|
35
|
-
api = ApiClient(network=network, api_key=api_key
|
|
32
|
+
api = ApiClient(network=network, api_key=api_key)
|
|
36
33
|
```
|
|
37
34
|
|
|
38
35
|
### Accounts
|
|
@@ -45,33 +42,40 @@ account_balance = api.accounts.get_account_balance()
|
|
|
45
42
|
print(account_balance)
|
|
46
43
|
```
|
|
47
44
|
|
|
48
|
-
###
|
|
45
|
+
### Markets
|
|
49
46
|
|
|
50
47
|
The Market client allows you to interact with market-related endpoints.
|
|
51
48
|
|
|
52
49
|
```python
|
|
53
50
|
# Get market depth
|
|
54
|
-
market_depth = api.
|
|
51
|
+
market_depth = api.markets.get_depth("ADAUSDM")
|
|
55
52
|
print(market_depth_response)
|
|
56
53
|
|
|
57
54
|
# Get market price
|
|
58
|
-
market_price_response = api.
|
|
55
|
+
market_price_response = api.markets.get_market_price("ADAUSDM")
|
|
59
56
|
print(market_price_response)
|
|
60
57
|
```
|
|
61
58
|
|
|
62
|
-
###
|
|
59
|
+
### Orders
|
|
63
60
|
|
|
64
61
|
The Order client allows you to interact with order-related endpoints.
|
|
65
62
|
|
|
66
63
|
```python
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
api_key = os.environ.get("DELTADEFI_API_KEY")
|
|
65
|
+
password = os.environ.get("TRADING_PASSWORD")
|
|
66
|
+
|
|
67
|
+
api = ApiClient(api_key=api_key)
|
|
68
|
+
api.load_operation_key(password)
|
|
69
|
+
|
|
70
|
+
res = api.post_order(
|
|
71
|
+
symbol="ADAUSDM",
|
|
72
|
+
side="sell",
|
|
73
|
+
type="limit",
|
|
74
|
+
quantity=51,
|
|
75
|
+
price=15,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
print("Order submitted successfully.", res)
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
## Development
|