Skip to main content

IBKR Proxy

PyPI - Version PyPI - Downloads Codecov

Setup

You need to have the following files in the local directory to enable the use of the IBKR OAuth service:

  • config.yaml and
  • privatekey.pem.

See the README for the ibauth project for documentation of the config.yaml content.

Running Locally

uv sync
uv run ibproxy --debug

Running on EC2

To run on an EC2 instance you'd do precisely the same thing as for running locally. Since the proxy is configured to only answer requests from localhost this will mean that requests from outside will not reach the proxy. In general this is a good thing.

There are ways that you can expose the proxy to the outside world. For the purpose of illustration suppose that you are running the proxy on an EC2 instance at 3.218.141.190.

Sending a Request

Just send your request to the proxy as if you were sending it to the IBKR API. For example, if you were going to request

curl "http://api.ibkr.com/v1/api/iserver/accounts"

then do this instead

curl "http://127.0.0.1:9000/v1/api/iserver/accounts"

NGINX

Unless you set up authentication this would definitely open up a can of worms.

SSH Tunnel

This is a simple and secure approach. Presumably you have SSH access to the EC2 instance. Run the following on your local machine to set up an SSH tunnel to the EC2 instance:

ssh -N -L 9000:127.0.0.1:9000 ubuntu@3.218.141.190

That will connect port 9000 on your local machine to port 9000 on the EC2 instance. Local requests on port 9000 will then be relayed via the secure tunnel to the proxy on the EC2 instance.

Development

uv sync
uv run ibproxy --debug

You can access the Swagger interface at http://127.0.0.1:9000/docs.

Local IBKR Authentication Workflow

If you are testing changes to ibauth then you can install a local copy.

  1. Add this to the end of pyproject.toml:

    [tool.uv.sources]
    ibauth = { path = "../ibauth", editable = true }
    
  2. uv lock --upgrade

  3. uv sync

You can also set this up in one quick move:

uv add --editable ../ibauth

Tests

To run tests:

uv run pytest

The integration tests require a running proxy. To run those, first launch a proxy process and then run:

uv run pytest -m integration

There are also some tests that are marked specifically for infrequent use. To run those:

uv run pytest -m seldom

Metadata

Release files for ibproxy 0.2.1

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

Source distribution (sdist)

Source distribution for ibproxy 0.2.1
File Size Uploaded Provenance Actions
ibproxy-0.2.1.tar.gz 30.4 kB Without provenance Details for ibproxy-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ibproxy 0.2.1
File Interpreter ABI Platform Actions
ibproxy-0.2.1-py3-none-any.whl Python 3 none any Details for ibproxy-0.2.1-py3-none-any.whl

Total release size: 51.6 kB

Release files / ibproxy-0.2.1.tar.gz

Download URL ibproxy-0.2.1.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
09227008930ddbebd8f17bffa57f32fb773e5fe30fb6eef5dc060eb07965f2ca
BLAKE2b-256 checksum
How to use checksums
bbdc840dbb875ce80f7f0ea658bbbdb43690c0d0ef75c020a868bb8ff0e0bc06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ibproxy-0.2.1-py3-none-any.whl

Download URL ibproxy-0.2.1-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d5506f980250ea5886db66b98556ad5e2adedbc466c78a26ab79523829373e6
BLAKE2b-256 checksum
How to use checksums
4e5d6c19a7f8f72e1b7dee143a6756adfb88194eb5ab844ec6ddb42c89488458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ibproxy 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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