Name | pokpok-sdk JSON |
Version |
0.1.6
JSON |
| download |
home_page | None |
Summary | Python SDK for PokPok API |
upload_time | 2025-02-04 08:34:56 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | None |
keywords |
pokpok
trading
api
sdk
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PokPok SDK
A Python SDK for interacting with PokPok's options trading platform. This SDK provides easy access to both Pay-as-you-go (PAYG) and Spread trading functionalities.
## Installation
Install the package using pip:
```bash
pip install pokpok-sdk
```
## Configuration
The SDK requires some environment variables to be set up. Create a `.env` file in your project root:
```env
MERCHANT_PKEY=your_private_key_here
```
## Usage
### Initialize Clients
You can initialize both PAYG and Spread clients with your API key. Optionally, you can provide a custom RPC URL:
```python
from pokpok_sdk import Payg, Spread
# Basic initialization
payg = Payg(api_key='your_api_key')
spread = Spread(api_key='your_api_key')
# With custom RPC URL
payg = Payg(api_key='your_api_key', rpc_url='your_custom_rpc_url')
spread = Spread(api_key='your_api_key', rpc_url='your_custom_rpc_url')
```
### PAYG Trading Example
```python
from pokpok_sdk import Payg, QuoteFetchInput
from pokpok_sdk.exceptions import PokPokError
# Create input for quote fetching
payg_input = QuoteFetchInput(
duration=3,
meal="economical",
coin="eth",
option="up",
size=0.5,
amount=1
)
# Execute PAYG trade
try:
payg = Payg(api_key='your_api_key')
# Fetch quote
fetched_quote = payg.fetch_quote(input=payg_input)
# Place order
tx_receipt = payg.place_order(
fetch_quote_input=payg_input,
fetched_quote=fetched_quote
)
print(f"Transaction Receipt: {tx_receipt}")
except PokPokError as e:
print(f"Error: {e}")
```
### Spread Trading Example
```python
from pokpok_sdk import Spread, SpreadQuoteFetchInput
from pokpok_sdk.exceptions import PokPokError
# Create input for spread quote fetching
spread_input = SpreadQuoteFetchInput(
duration=3,
meal="economical",
coin="eth",
option="up",
size=0.5,
spreadPercent=5,
amount=1
)
# Execute Spread trade
try:
spread = Spread(api_key='your_api_key')
# Fetch quote
fetched_quote = spread.fetch_quote(input=spread_input)
# Place order
tx_receipt = spread.place_order(
fetch_quote_input=spread_input,
fetched_quote=fetched_quote
)
print(f"Transaction Receipt: {tx_receipt}")
except PokPokError as e:
print(f"Error: {e}")
```
## Input Parameters
### QuoteFetchInput
- `duration`: Trading duration `3 or 7` days
- `meal`: Trading strategy type (e.g., "economical")
- `coin`: Trading pair (e.g., "eth")
- `option`: Option type ("up" or "down")
- `size`: Position size
- `amount`: Trading amount
### SpreadQuoteFetchInput
Includes all parameters from QuoteFetchInput plus:
- `spreadPercent`: Spread percentage for the trade
## Error Handling
The SDK uses custom `PokPokError` for error handling. Always wrap your API calls in try-except blocks:
```python
from pokpok_sdk.exceptions import PokPokError
try:
# Your SDK calls here
except PokPokError as e:
print(f"Error: {e}")
```
## License
MIT
## Support
For support, please contact support@pokpok.io
Raw data
{
"_id": null,
"home_page": null,
"name": "pokpok-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "pokpok, trading, api, sdk",
"author": null,
"author_email": "pokpok team <support@pokpok.io>",
"download_url": "https://files.pythonhosted.org/packages/cf/c0/eab5dfa6682219a13a88d7eb847d50e690899fea79b8eeda1dc9765eac25/pokpok_sdk-0.1.6.tar.gz",
"platform": null,
"description": "# PokPok SDK\n\nA Python SDK for interacting with PokPok's options trading platform. This SDK provides easy access to both Pay-as-you-go (PAYG) and Spread trading functionalities.\n\n## Installation\n\nInstall the package using pip:\n\n```bash\npip install pokpok-sdk\n```\n\n## Configuration\n\nThe SDK requires some environment variables to be set up. Create a `.env` file in your project root:\n\n```env\nMERCHANT_PKEY=your_private_key_here\n```\n\n## Usage\n\n### Initialize Clients\n\nYou can initialize both PAYG and Spread clients with your API key. Optionally, you can provide a custom RPC URL:\n\n```python\nfrom pokpok_sdk import Payg, Spread\n\n# Basic initialization\npayg = Payg(api_key='your_api_key')\nspread = Spread(api_key='your_api_key')\n\n# With custom RPC URL\npayg = Payg(api_key='your_api_key', rpc_url='your_custom_rpc_url')\nspread = Spread(api_key='your_api_key', rpc_url='your_custom_rpc_url')\n```\n\n### PAYG Trading Example\n\n```python\nfrom pokpok_sdk import Payg, QuoteFetchInput\nfrom pokpok_sdk.exceptions import PokPokError\n\n# Create input for quote fetching\npayg_input = QuoteFetchInput(\n duration=3,\n meal=\"economical\",\n coin=\"eth\",\n option=\"up\",\n size=0.5,\n amount=1\n)\n\n# Execute PAYG trade\ntry:\n payg = Payg(api_key='your_api_key')\n\n # Fetch quote\n fetched_quote = payg.fetch_quote(input=payg_input)\n\n # Place order\n tx_receipt = payg.place_order(\n fetch_quote_input=payg_input,\n fetched_quote=fetched_quote\n )\n print(f\"Transaction Receipt: {tx_receipt}\")\nexcept PokPokError as e:\n print(f\"Error: {e}\")\n```\n\n### Spread Trading Example\n\n```python\nfrom pokpok_sdk import Spread, SpreadQuoteFetchInput\nfrom pokpok_sdk.exceptions import PokPokError\n\n# Create input for spread quote fetching\nspread_input = SpreadQuoteFetchInput(\n duration=3,\n meal=\"economical\",\n coin=\"eth\",\n option=\"up\",\n size=0.5,\n spreadPercent=5,\n amount=1\n)\n\n# Execute Spread trade\ntry:\n spread = Spread(api_key='your_api_key')\n\n # Fetch quote\n fetched_quote = spread.fetch_quote(input=spread_input)\n\n # Place order\n tx_receipt = spread.place_order(\n fetch_quote_input=spread_input,\n fetched_quote=fetched_quote\n )\n print(f\"Transaction Receipt: {tx_receipt}\")\nexcept PokPokError as e:\n print(f\"Error: {e}\")\n```\n\n## Input Parameters\n\n### QuoteFetchInput\n\n- `duration`: Trading duration `3 or 7` days\n- `meal`: Trading strategy type (e.g., \"economical\")\n- `coin`: Trading pair (e.g., \"eth\")\n- `option`: Option type (\"up\" or \"down\")\n- `size`: Position size\n- `amount`: Trading amount\n\n### SpreadQuoteFetchInput\n\nIncludes all parameters from QuoteFetchInput plus:\n\n- `spreadPercent`: Spread percentage for the trade\n\n## Error Handling\n\nThe SDK uses custom `PokPokError` for error handling. Always wrap your API calls in try-except blocks:\n\n```python\nfrom pokpok_sdk.exceptions import PokPokError\n\ntry:\n # Your SDK calls here\nexcept PokPokError as e:\n print(f\"Error: {e}\")\n```\n\n## License\n\nMIT\n\n## Support\n\nFor support, please contact support@pokpok.io\n",
"bugtrack_url": null,
"license": null,
"summary": "Python SDK for PokPok API",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://game.pokpok.io/"
},
"split_keywords": [
"pokpok",
" trading",
" api",
" sdk"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0dd17a1c44fb70682018ef26da3e109825da6d70af74c0fb4d2bc6171046c2c3",
"md5": "7a83f0a0ba97740d57b8477d64260a51",
"sha256": "5b53d4aee70f0baf63672f9ca2eab2d30d94602c18cf7e732adec216778db3a3"
},
"downloads": -1,
"filename": "pokpok_sdk-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7a83f0a0ba97740d57b8477d64260a51",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9892,
"upload_time": "2025-02-04T08:34:54",
"upload_time_iso_8601": "2025-02-04T08:34:54.313181Z",
"url": "https://files.pythonhosted.org/packages/0d/d1/7a1c44fb70682018ef26da3e109825da6d70af74c0fb4d2bc6171046c2c3/pokpok_sdk-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cfc0eab5dfa6682219a13a88d7eb847d50e690899fea79b8eeda1dc9765eac25",
"md5": "79fd88ba76646d869fa5989e8677ecf1",
"sha256": "03d36b602dfa2cbaa81ce632376a7bcc8adb948a3bfb8afb6601b80aaa171a1a"
},
"downloads": -1,
"filename": "pokpok_sdk-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "79fd88ba76646d869fa5989e8677ecf1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 11412,
"upload_time": "2025-02-04T08:34:56",
"upload_time_iso_8601": "2025-02-04T08:34:56.458117Z",
"url": "https://files.pythonhosted.org/packages/cf/c0/eab5dfa6682219a13a88d7eb847d50e690899fea79b8eeda1dc9765eac25/pokpok_sdk-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-04 08:34:56",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pokpok-sdk"
}