deltadefi 0.0.6__tar.gz → 1.0.1__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.
- deltadefi-1.0.1/.env.example +3 -0
- deltadefi-1.0.1/.github/workflows/publish.yml +37 -0
- deltadefi-1.0.1/.gitignore +62 -0
- deltadefi-1.0.1/.pre-commit-config.yaml +67 -0
- deltadefi-1.0.1/Makefile +94 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/PKG-INFO +49 -34
- {deltadefi-0.0.6 → deltadefi-1.0.1}/README.md +30 -16
- deltadefi-1.0.1/coverage.xml +791 -0
- deltadefi-1.0.1/examples/websocket_example.py +311 -0
- deltadefi-1.0.1/pyproject.toml +128 -0
- deltadefi-1.0.1/src/deltadefi/__init__.py +2 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/api.py +4 -4
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/api_resources/auth.py +3 -4
- deltadefi-1.0.1/src/deltadefi/clients/__init__.py +3 -0
- deltadefi-1.0.1/src/deltadefi/clients/accounts.py +289 -0
- deltadefi-1.0.1/src/deltadefi/clients/client.py +137 -0
- deltadefi-0.0.6/src/deltadefi/clients/market.py → deltadefi-1.0.1/src/deltadefi/clients/markets.py +19 -36
- deltadefi-0.0.6/src/deltadefi/clients/order.py → deltadefi-1.0.1/src/deltadefi/clients/orders.py +60 -14
- deltadefi-1.0.1/src/deltadefi/clients/websocket.py +360 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/constants/constants.py +1 -1
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/error.py +2 -2
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/models/models.py +29 -5
- deltadefi-1.0.1/src/deltadefi/responses/accounts.py +92 -0
- deltadefi-1.0.1/src/deltadefi/responses/responses.py +73 -0
- deltadefi-1.0.1/src/deltadefi/utils/__init__.py +2 -0
- deltadefi-0.0.6/src/deltadefi/lib/utils.py → deltadefi-1.0.1/src/deltadefi/utils/helpers.py +2 -2
- deltadefi-1.0.1/tests/clients/__init__.py +0 -0
- deltadefi-1.0.1/tests/clients/test_accounts.py +47 -0
- deltadefi-1.0.1/tests/clients/test_order.py +40 -0
- deltadefi-1.0.1/tests/clients/test_sign.py +26 -0
- deltadefi-1.0.1/uv.lock +1856 -0
- deltadefi-0.0.6/pyproject.toml +0 -46
- deltadefi-0.0.6/src/deltadefi/__init__.py +0 -2
- deltadefi-0.0.6/src/deltadefi/clients/__init__.py +0 -2
- deltadefi-0.0.6/src/deltadefi/clients/accounts.py +0 -162
- deltadefi-0.0.6/src/deltadefi/clients/app.py +0 -23
- deltadefi-0.0.6/src/deltadefi/clients/clients.py +0 -66
- deltadefi-0.0.6/src/deltadefi/responses/accounts.py +0 -62
- deltadefi-0.0.6/src/deltadefi/responses/responses.py +0 -68
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/api_resources/__init__.py +0 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/api_resources/validation.py +0 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/constants/__init__.py +0 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/models/__init__.py +0 -0
- {deltadefi-0.0.6 → deltadefi-1.0.1}/src/deltadefi/responses/__init__.py +0 -0
- {deltadefi-0.0.6/src/deltadefi/lib → deltadefi-1.0.1/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
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
# Standard pre-commit hooks
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: v5.0.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: trailing-whitespace
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
- id: check-yaml
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
- id: check-json
|
|
11
|
+
- id: check-toml
|
|
12
|
+
- id: check-merge-conflict
|
|
13
|
+
- id: debug-statements
|
|
14
|
+
|
|
15
|
+
# Ruff for linting and formatting
|
|
16
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
+
rev: v0.12.10
|
|
18
|
+
hooks:
|
|
19
|
+
- id: ruff
|
|
20
|
+
args: [--fix]
|
|
21
|
+
- id: ruff-format
|
|
22
|
+
|
|
23
|
+
# MyPy for type checking (lenient for now)
|
|
24
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
25
|
+
rev: v1.17.1
|
|
26
|
+
hooks:
|
|
27
|
+
- id: mypy
|
|
28
|
+
additional_dependencies: [types-requests]
|
|
29
|
+
args: [--ignore-missing-imports, --disable-error-code=no-any-return, --disable-error-code=call-arg]
|
|
30
|
+
|
|
31
|
+
# Custom hooks for project-specific checks
|
|
32
|
+
- repo: local
|
|
33
|
+
hooks:
|
|
34
|
+
# Install dependencies
|
|
35
|
+
- id: uv-sync
|
|
36
|
+
name: Install dependencies
|
|
37
|
+
entry: uv sync --dev
|
|
38
|
+
language: system
|
|
39
|
+
pass_filenames: false
|
|
40
|
+
stages: [pre-commit]
|
|
41
|
+
|
|
42
|
+
# Run tests
|
|
43
|
+
- id: pytest
|
|
44
|
+
name: Run tests
|
|
45
|
+
entry: uv run pytest
|
|
46
|
+
language: system
|
|
47
|
+
pass_filenames: false
|
|
48
|
+
stages: [pre-commit]
|
|
49
|
+
|
|
50
|
+
# Build package
|
|
51
|
+
- id: uv-build
|
|
52
|
+
name: Build package
|
|
53
|
+
entry: uv build --out-dir .pre-commit-build
|
|
54
|
+
language: system
|
|
55
|
+
pass_filenames: false
|
|
56
|
+
stages: [pre-commit]
|
|
57
|
+
|
|
58
|
+
# Clean up build artifacts
|
|
59
|
+
- id: cleanup-build
|
|
60
|
+
name: Clean build artifacts
|
|
61
|
+
entry: rm -rf .pre-commit-build
|
|
62
|
+
language: system
|
|
63
|
+
pass_filenames: false
|
|
64
|
+
stages: [pre-commit]
|
|
65
|
+
|
|
66
|
+
# Configure which hooks run at different stages
|
|
67
|
+
default_stages: [pre-commit]
|
deltadefi-1.0.1/Makefile
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
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())"
|
|
86
|
+
|
|
87
|
+
precommit-install: ## Install pre-commit hooks
|
|
88
|
+
@$(UV) run pre-commit install
|
|
89
|
+
|
|
90
|
+
precommit: ## Run pre-commit hooks on all files
|
|
91
|
+
@$(UV) run pre-commit run --all-files
|
|
92
|
+
|
|
93
|
+
precommit-update: ## Update pre-commit hooks
|
|
94
|
+
@$(UV) run pre-commit autoupdate
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: deltadefi
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.0.1
|
|
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
|
-
|
|
25
|
-
|
|
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.7
|
|
26
|
+
Requires-Dist: urllib3>=2.2.3
|
|
27
|
+
Requires-Dist: websockets>=12.0
|
|
26
28
|
Description-Content-Type: text/markdown
|
|
27
29
|
|
|
28
30
|
# DeltaDeFi Python SDK
|
|
@@ -55,11 +57,8 @@ from sidan_gin import HDWallet
|
|
|
55
57
|
network="preprod",
|
|
56
58
|
api_key="your_api_key",
|
|
57
59
|
|
|
58
|
-
# Initialize HDWallet
|
|
59
|
-
wallet = HDWallet("your_wallet_mnemonic")
|
|
60
|
-
|
|
61
60
|
# Initialize ApiClient
|
|
62
|
-
api = ApiClient(network=network, api_key=api_key
|
|
61
|
+
api = ApiClient(network=network, api_key=api_key)
|
|
63
62
|
```
|
|
64
63
|
|
|
65
64
|
### Accounts
|
|
@@ -72,36 +71,52 @@ account_balance = api.accounts.get_account_balance()
|
|
|
72
71
|
print(account_balance)
|
|
73
72
|
```
|
|
74
73
|
|
|
75
|
-
###
|
|
74
|
+
### Markets
|
|
76
75
|
|
|
77
76
|
The Market client allows you to interact with market-related endpoints.
|
|
78
77
|
|
|
79
78
|
```python
|
|
80
79
|
# Get market depth
|
|
81
|
-
market_depth = api.
|
|
80
|
+
market_depth = api.markets.get_depth("ADAUSDM")
|
|
82
81
|
print(market_depth_response)
|
|
83
82
|
|
|
84
83
|
# Get market price
|
|
85
|
-
market_price_response = api.
|
|
84
|
+
market_price_response = api.markets.get_market_price("ADAUSDM")
|
|
86
85
|
print(market_price_response)
|
|
87
86
|
```
|
|
88
87
|
|
|
89
|
-
###
|
|
88
|
+
### Orders
|
|
90
89
|
|
|
91
90
|
The Order client allows you to interact with order-related endpoints.
|
|
92
91
|
|
|
93
92
|
```python
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
### Tests
|
|
113
|
+
|
|
114
|
+
Testing sdk:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
DELTADEFI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx make test
|
|
102
118
|
```
|
|
103
119
|
|
|
104
120
|
## License
|
|
105
121
|
|
|
106
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>
|
|
107
|
-
|
|
@@ -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,50 @@ 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)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
### Tests
|
|
84
|
+
|
|
85
|
+
Testing sdk:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
DELTADEFI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx make test
|
|
75
89
|
```
|
|
76
90
|
|
|
77
91
|
## License
|