semvec/pypi-packages huggingface dataset:
pokpok-sdk 0.1.6
Python SDK for PokPok API
Requires Python: >=3.7
Keywords: pokpok, trading, api, sdk

# 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
ypywidgets 0.9.7
Y-based Jupyter widgets for Python
Requires Python: >=3.8
Keywords: jupyter, widgets, yjs

[![Build Status](https://github.com/QuantStack/ypywidgets/workflows/test/badge.svg)](https://github.com/QuantStack/ypywidgets/actions)
[![Code Coverage](https://img.shields.io/badge/coverage-100%25-green)](https://img.shields.io/badge/coverage-100%25-green)

# ypywidgets: Y-based Jupyter widgets for Python

`ypywidgets` is a communication backend between a Jupyter kernel and clients. It allows to synchronize data structures that can be modified concurrently, and automatically resolves conflicts. To do so, it uses:
- the Jupyter kernel [Comm](https://jupyter-client.readthedocs.io/en/stable/messaging.html#custom-messages) protocol as the transport layer, and the [comm](https://github.com/ipython/comm) implementation of it.
- the [pycrdt](https://github.com/jupyter-server/pycrdt) CRDT implementation.
- the [reacttrs](https://github.com/QuantStack/reacttrs) library that implements the observer pattern and validation.

It is a replacement for (a part of) [ipywidgets](https://ipywidgets.readthedocs.io). When used with [yjs-widgets](https://github.com/QuantStack/yjs-widgets), it supports JupyterLab clients that implement widgets. The difference with `ipywidgets` is that these widgets are collaborative: they can be manipulated concurrently from the kernel or from any client. The CRDT algorithm ensures that a widget state will eventually be consistent across all clients.