Skip to content

Configuration

Call configure() before any Bloomberg request to set connection parameters, pool sizes, and auth. Once the engine starts on the first request, calling configure() again raises RuntimeError.

import xbbg
from xbbg import blp, EngineConfig
# Keyword arguments — most common
xbbg.configure(request_pool_size=4, subscription_pool_size=2)
# EngineConfig object
xbbg.configure(EngineConfig(request_pool_size=4, subscription_pool_size=2))
# EngineConfig + overrides (kwargs take precedence)
cfg = EngineConfig(request_pool_size=4)
xbbg.configure(cfg, subscription_pool_size=2)

configure() is also available on the blp module:

from xbbg import blp
blp.configure(server_host='192.168.1.100', server_port=18194)

Legacy aliases are accepted and normalized:

AliasCanonical field
server, server_hosthost
server_portport
max_attemptnum_start_attempts
auto_restartauto_restart_on_disconnection
retry_maxretry_max_retries
retry_delayretry_initial_delay_ms
retry_backoffretry_backoff_factor
max_recoverymax_recovery_attempts

xbbg runs a Rust async engine with pre-warmed worker pools:

┌─────────────────────────────────────────────────┐
│ xbbg Engine │
│ │
│ ┌──────────────────────┐ ┌─────────────────┐ │
│ │ Request Worker Pool │ │ Subscription │ │
│ │ (request_pool_size) │ │ Session Pool │ │
│ │ │ │ (sub_pool_size) │ │
│ │ Worker 1 ──session │ │ │ │
│ │ Worker 2 ──session │ │ Session 1 │ │
│ │ ... │ │ ... │ │
│ └──────────────────────┘ └─────────────────┘ │
│ │ round-robin │ isolated │
│ ▼ ▼ │
│ bdp/bdh/bds/bdib subscribe/stream │
│ bql/bsrch/beqs vwap/mktbar/depth │
└─────────────────────────────────────────────────┘
  • Request workers each hold an independent Bloomberg session. Concurrent bdp/bdh/bds calls are dispatched round-robin. request_pool_size=4 allows 4 parallel Bloomberg requests.
  • Subscription sessions are isolated per session to prevent cross-contamination between topic streams. Each subscribe() call gets its own session from the pool.
  • Workers are pre-warmed at first use — sessions are started and services opened before your first request, eliminating cold-start latency.

ParameterDefaultDescription
host'localhost'Bloomberg server host. Aliases: server_host, server
port8194Bloomberg server port. Alias: server_port
num_start_attempts3Retries before giving up on session start. Alias: max_attempt
auto_restart_on_disconnectionTrueAuto-reconnect on session disconnect. Alias: auto_restart
ParameterDefaultDescription
request_pool_size2Number of pre-warmed request workers (parallel Bloomberg sessions for bdp/bdh/bds/etc.)
subscription_pool_size1Number of pre-warmed subscription sessions (isolated sessions for subscribe/stream)
warmup_services['//blp/refdata', '//blp/apiflds']Services to pre-open on startup
ParameterDefaultDescription
subscription_flush_threshold1Ticks buffered before flushing to Python. Increase for throughput; decrease for latency
subscription_stream_capacity256Backpressure buffer size per subscription stream
overflow_policy'drop_newest'Slow consumer policy: 'drop_newest' or 'block'
ParameterDefaultDescription
max_event_queue_size10000Bloomberg SDK event queue depth
command_queue_size256Internal command channel capacity
ParameterDefaultDescription
validation_mode'disabled'Field validation: 'disabled', 'strict' (reject unknown fields), or 'lenient' (warn)
field_cache_path~/.xbbg/field_cache.jsonPath for persistent field type cache
ParameterDefaultDescription
auth_methodNoneAuth mode: 'user', 'app', 'userapp', 'dir', 'manual', or 'token'
app_nameNoneApplication name (required for app, userapp, manual)
user_idNoneBloomberg user ID (required for manual)
ip_addressNoneBloomberg IP address (required for manual)
dir_propertyNoneActive Directory property (required for dir)
tokenNoneAuth token (required for token)

from xbbg import blp
# Application auth — requires app name registered with Bloomberg
blp.configure(
auth_method='app',
app_name='myapp:8888',
host='bpipe-host',
port=8194,
)

Pass a list of (host, port) tuples to servers. When set, servers overrides host/port.

from xbbg import blp
blp.configure(
servers=[
('bbg-primary.example.com', 8194),
('bbg-secondary.example.com', 8194),
]
)

Bloomberg will attempt servers in order and fall back on failure.


For Bloomberg Zero-Footprint (ZFP) connectivity over leased lines, set zfp_remote to the remote port string. Accepted values are "8194" and "8196". TLS credentials are required.

from xbbg import blp
blp.configure(
zfp_remote='8194',
tls_client_credentials='/path/to/client.p12',
tls_client_credentials_password='secret',
tls_trust_material='/path/to/trust.p12',
)

ParameterDefaultDescription
tls_client_credentialsNonePath to client certificate file (PKCS#12)
tls_client_credentials_passwordNonePassword for the client certificate
tls_trust_materialNonePath to trust store file (PKCS#12)
tls_handshake_timeout_msNoneTLS handshake timeout in milliseconds
tls_crl_fetch_timeout_msNoneCRL fetch timeout in milliseconds
from xbbg import blp
blp.configure(
host='bbg-tls.example.com',
tls_client_credentials='/certs/client.p12',
tls_client_credentials_password='changeit',
tls_trust_material='/certs/trust.p12',
tls_handshake_timeout_ms=5000,
)

Route Bloomberg connections through a SOCKS5 proxy by setting both socks5_host and socks5_port.

ParameterDefaultDescription
socks5_hostNoneSOCKS5 proxy hostname
socks5_portNoneSOCKS5 proxy port (required when socks5_host is set)
from xbbg import blp
blp.configure(
host='bbg-server.example.com',
socks5_host='proxy.internal',
socks5_port=1080,
)

Retries apply to individual Bloomberg requests that fail transiently. Retry is disabled by default (retry_max_retries=0).

ParameterDefaultDescription
retry_max_retries0Maximum retry attempts per request. 0 disables retry
retry_initial_delay_ms1000Delay before first retry (milliseconds)
retry_backoff_factor2.0Multiplier applied to delay after each retry
retry_max_delay_ms30000Maximum delay between retries (milliseconds)
from xbbg import blp
# Retry up to 3 times with exponential backoff: 1s → 2s → 4s (capped at 30s)
blp.configure(
retry_max_retries=3,
retry_initial_delay_ms=1000,
retry_backoff_factor=2.0,
retry_max_delay_ms=30000,
)

Bloomberg SDK log output is suppressed by default. Two ways to enable it:

At configure time — set sdk_log_level in EngineConfig:

from xbbg import blp
blp.configure(sdk_log_level='INFO')

At runtime — call enable_sdk_logging() after configuration:

import xbbg
xbbg.enable_sdk_logging('DEBUG')

Accepted levels are Bloomberg SDK level strings: 'OFF', 'FATAL', 'ERROR', 'WARN', 'INFO', 'DEBUG', 'TRACE'.