Metadata-Version: 2.4
Name: ordernet
Version: 0.1.2
Summary: A typed Python client for the OrderNet Spark API
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://github.com/ereli/Ordernet
Project-URL: Repository, https://github.com/ereli/Ordernet
Project-URL: Issues, https://github.com/ereli/Ordernet/issues
Project-URL: Inspiration, https://github.com/assafmo/OrdernetAPI
Keywords: ordernet,spark,finance,israel
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Ordernet

A small, typed Python client and command-line tool for the OrderNet Spark API.
It currently supports Spark authentication, account discovery, and total balance
lookup for the `nesua`, `meitav`, and `psagot` broker hosts.

> This is an unofficial client. Do not use it as the sole source for financial
> decisions, and never commit Spark credentials or bearer tokens.

## Installation

```bash
python -m pip install ordernet
```

## Python API

```python
from ordernet_api import Broker, OrdernetClient

client = OrdernetClient(Broker.MEITAV)
client.authenticate("username", "password")

for account in client.get_accounts():
    print(account.number, client.get_account_balance(account))
```

Balances are returned as `decimal.Decimal` values to avoid floating-point
rounding surprises.

## Command line

Let the command prompt securely for the password:

```bash
ordernet --username 1234 --broker meitav
```

Or supply it through the environment and optionally restrict the lookup:

```bash
export ORDERNET_PASSWORD='your-password'
ordernet -u 1234 -b meitav -a ACC_000-111111
```

Passing `--password` is supported for compatibility, but can expose the secret
in shell history and process listings.

## Development

```bash
uv sync --dev
./scripts/check.sh
./scripts/build.sh
```

The project uses Ruff for linting and formatting, `ty` for type checking, and
the standard-library test runner. Development dependencies are locked in
`uv.lock`.

Install [Lefthook](https://lefthook.dev/installation/) once, then enable the
repository's pre-commit checks:

```bash
lefthook install
```

The hook runs linting, formatting checks, type checking, and tests before each
commit.

## Releasing

GitHub Actions runs the quality suite and tests Python 3.10 through 3.13 on
every pull request and push to `main`. Version tags build and publish through
PyPI Trusted Publishing:

```bash
uv version --bump patch
git add pyproject.toml uv.lock
git commit -m "Release v0.1.1"
git tag v0.1.1
git push origin main v0.1.1
```

Before the first release, configure a pending PyPI Trusted Publisher for GitHub
owner `ereli`, repository `Ordernet`, workflow `release.yml`, and environment
`pypi`. No PyPI API token is stored in GitHub.

## Credits

Courtesy shout-out to [Assaf Morami](https://github.com/assafmo) for publishing
[OrdernetAPI](https://github.com/assafmo/OrdernetAPI), which helped inspire this
project.

## License

GPL-3.0-only. See [`LICENSE`](LICENSE).
