Skip to content

Clients and accounts

Bridge uses authorization: Bearer TOKEN metadata. Manage service clients from the Bridge container, where the database configuration and encryption key exist:

Terminal window
python -m omsbridge.clients create noname
python -m omsbridge.clients show noname
python -m omsbridge.clients list
python -m omsbridge.clients rotate noname
python -m omsbridge.clients revoke noname

With local Compose, prefix these commands with docker compose exec bridge. Create, show and rotate print the token. The CLI defaults to /etc/omsbridge/config.toml; a host process can supply --config config.toml before the subcommand. Tokens are stored encrypted in MongoDB.

Rotation and revocation apply to new RPCs immediately. Existing streams retain their authentication until they disconnect. Rotation preserves the service-client identity used for order IDs and order visibility.

from omsbridge.v1.client import channel
from omsbridge.v1.proto import bridge_pb2 as pb
from omsbridge.v1.proto import bridge_pb2_grpc as stubs
async def list_accounts(token):
async with channel("grpcs://omsbridge.example.com:443", token) as connection:
return await stubs.AccountsStub(connection).ListAccounts(
pb.ListAccountsRequest(), timeout=10,
)

Use grpcs:// through the TLS proxy. Bare host:port targets also use TLS. For a trusted backend connection, grpc://bridge:8080 uses cleartext HTTP/2. For a private certificate authority, pass its PEM bytes as root_certificates. The client helper attaches authentication and disables transport retries.

OMS Broker codes Managed trading
Ephoenix Bourse Bimeh 1, Ganjineh Sepehr 2, Karamad 4 Ordinary orders
OMEX Khobregan Saham 3 UNIMPLEMENTED
Exphoenix Future Bourse Bimeh 1 Ordinary futures orders

Call Accounts.CreateAccount with the broker code, OMS enum, username, password and identity_user_id. The service client supplies the Identity OIDC sub claim as identity_user_id. Keep the returned Bridge account_id.

ListAccounts can filter by identity_user_id. This links accounts to an Identity subject; it does not restrict other configured Bridge clients from administering the account. UpdateAccount supports credentials, enabled state and subject changes.

Market calls that omit an account ID allow Bridge to select an account. Managed order submission always requires an explicit account ID.

Download the files linked from the API reference, retaining the omsbridge/v1/proto/ directory structure. Use the directory containing omsbridge/ as the protobuf include root. Generate message bindings for every imported schema and gRPC service bindings for bridge.proto with your language’s tools.

Dates and datetimes use ISO 8601 strings unless a field declares a protobuf Timestamp. Broker numeric enums preserve adapter values. Opaque broker query filter and aggregate fields contain UTF-8 JSON bytes.