Metadata-Version: 2.4
Name: fundedops
Version: 0.1.1
Summary: Official Python SDK for the FundedOps API — typed accounts, positions, orders, history, and real-time streaming.
Project-URL: Homepage, https://fundedops.com
Project-URL: Documentation, https://api.fundedops.com/docs
Project-URL: Source, https://github.com/fundedops/fundedops-python
Author: FundedOps
License: MIT
Keywords: api,fundedops,metatrader,mt5,sdk,trading
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: certifi>=2023.7.22
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic<3,>=2.7
Requires-Dist: websockets>=13
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# fundedops

The official Python SDK for the [FundedOps API](https://api.fundedops.com/docs) —
typed access to accounts, positions, orders, trade history, and real-time
streaming, backed by pydantic v2 models that mirror the wire format exactly.

Supports both MT4 and MT5 accounts — the same clients, methods, and models work
identically against either platform.

> This file doubles as the package's [PyPI](https://pypi.org/project/fundedops/) page.

## Install

```bash
pip install fundedops
```

Requires Python 3.10+.

## Authentication

Every request carries your API key as a bearer token
(`Authorization: Bearer fo_...`). Create a key from the developer portal. The
key travels in the WebSocket URL's query string — never log stream URLs.

## Usage

Two first-class clients with an identical method surface — synchronous
`FundedOps` and asynchronous `AsyncFundedOps`. Every method lives under the
`client.accounts` namespace, except `wait_until_connected` and `stream`,
which are on the client itself.

### Synchronous

```python
from fundedops import FundedOps

with FundedOps(api_key="fo_live_...") as client:
    for account in client.accounts.list():
        print(account.id, account.state, account.connection_status)

    info = client.accounts.account_information(account.id)
    print(info.balance, info.equity, info.currency)

    # Deploy and block until connected (timeout is mandatory).
    client.accounts.deploy(account.id)
    client.wait_until_connected(account.id, timeout=180)
```

The full lifecycle and read surface is available on `client.accounts`:
`create`, `get`, `list`, `update`, `delete`, `deploy`, `undeploy`,
`redeploy`, `account_information`, `positions`, `pending_orders`,
`history_deals`, and `history_orders`.

### Asynchronous

`AsyncFundedOps` is the exact awaitable mirror — same constructor, same
method names, same return types (a parity test enforces it):

```python
import asyncio
from fundedops import AsyncFundedOps

async def main():
    async with AsyncFundedOps(api_key="fo_live_...") as client:
        accounts = await client.accounts.list()
        info = await client.accounts.account_information(accounts[0].id)
        print(info.equity)

asyncio.run(main())
```

### Streaming

`client.stream([account_id, ...])` opens a WebSocket, subscribes each
account, answers server pings for you, and yields typed events:

```python
from fundedops import FundedOps

client = FundedOps(api_key="fo_live_...")
for event in client.stream(["9b2c..."]):
    if event.type == "positions_updated":
        print("open:", len(event.updated), "closed:", event.removed_ids)
```

### Errors

Every non-2xx response raises a typed exception derived from
`FundedOpsError` (`ValidationError`, `UnauthorizedError`,
`PaymentRequiredError`, `NotFoundError`, `RateLimitedError` with
`retry_after`, and more), each carrying `status`, `message`, and
`request_id`.

## Documentation

Full API reference and guides: https://api.fundedops.com/docs

## License

MIT
