Skip to main content

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:

pip install pokpok-sdk

Configuration

The SDK requires some environment variables to be set up. Create a .env file in your project root:

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:

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

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

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:

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

Metadata

Release files for pokpok-sdk 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pokpok-sdk 0.1.6
File Size Uploaded
pokpok_sdk-0.1.6.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pokpok-sdk 0.1.6
File Interpreter ABI Platform
pokpok_sdk-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / pokpok_sdk-0.1.6.tar.gz

Download URL pokpok_sdk-0.1.6.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
03d36b602dfa2cbaa81ce632376a7bcc8adb948a3bfb8afb6601b80aaa171a1a
BLAKE2b-256 checksum
How to use checksums
cfc0eab5dfa6682219a13a88d7eb847d50e690899fea79b8eeda1dc9765eac25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / pokpok_sdk-0.1.6-py3-none-any.whl

Download URL pokpok_sdk-0.1.6-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b53d4aee70f0baf63672f9ca2eab2d30d94602c18cf7e732adec216778db3a3
BLAKE2b-256 checksum
How to use checksums
0dd17a1c44fb70682018ef26da3e109825da6d70af74c0fb4d2bc6171046c2c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page