NautilusTrader
Integrations

Betfair v2

The Betfair Rust adapter is in active parity work. This page tracks the current Rust behavior and the planned cutover from the stable guide in Betfair.

This page mirrors the main section order from Betfair. When the Rust adapter becomes the primary Betfair path, this file can replace betfair.md with small edits instead of a full rewrite.

Scope

  • Source of truth for this page: crates/adapters/betfair
  • Stable guide today: Betfair
  • Purpose of this page: track the current Rust surface, the known gaps, and the cutover path

Current Rust status

AreaCurrent Rust behaviorDifference from betfair.md todayCutover work
Order typesMARKET only supports AT_THE_CLOSE; LIMIT supports BSP on close flowsStable guide is still Python shaped in this areaDecide final Betfair market order model
Batch operationsSubmitOrderList and BatchCancelOrders are implementedStable guide used to mark these as unsupportedKeep and promote
Reconciliation scopereconcile_market_ids_only uses reconcile_market_ids; otherwise Rust falls back to stream_market_ids_filterStable guide says stream filtering and reconciliation are separateDecide if Rust keeps or removes this coupling
Full image cache checksRust uses generate_mass_status() at startup and does not run check_cache_against_order_imageStable guide describes the Python full image cache checkAdd parity or document the Rust path as final
External order filteringignore_external_orders only skips OCM updates with no rfoPython also uses it during full image cache checksDecide final filtering behavior
Config surfaceNo certs_dir, no instrument_config, fixed keep alive, required heartbeat valueStable guide still documents the Python config surfaceDecide whether to add parity or bless the Rust surface
SSL certificatesStream client currently hardcodes certs_dir=NoneStable guide documents certificate configuration and BETFAIR_CERTS_DIRAdd support or remove from the future guide

Orders capability

Order types

Order TypeSupportedNotes
MARKET✓*Rust only supports AT_THE_CLOSE, which maps to Betfair MARKET_ON_CLOSE.
LIMITRust supports regular limit orders and BSP on close limit orders.
STOP_MARKET-Not supported.
STOP_LIMIT-Not supported.
MARKET_IF_TOUCHED-Not supported.
LIMIT_IF_TOUCHED-Not supported.
TRAILING_STOP_MARKET-Not supported.

Time in force

Time in forceSupportedNotes
GTCMaps to Betfair PERSIST.
DAYMaps to Betfair LAPSE.
FOKMaps to Betfair FILL_OR_KILL.
IOCMaps to FILL_OR_KILL with min_fill_size=0.
AT_THE_CLOSEUsed for Betfair BSP LIMIT_ON_CLOSE and MARKET_ON_CLOSE.

Rust currently also accepts LIMIT orders in AT_THE_OPEN mode and routes them through Betfair LIMIT_ON_CLOSE instructions. Treat that as current behavior, not a settled public contract.

Batch operations

OperationSupportedNotes
Batch SubmitImplemented through SubmitOrderList.
Batch Modify-Not supported.
Batch CancelImplemented through BatchCancelOrders.

Execution control flow

The current Rust execution path is:

  1. Connect the HTTP client and fetch initial account funds.
  2. Seed OCM state from cached orders.
  3. Connect the Betfair execution stream and subscribe to order updates.
  4. Generate startup mass status from listCurrentOrders.
  5. Reconcile order and fill reports into the execution engine.

Current Rust notes:

  • stream_market_ids_filter filters live OCM updates.
  • reconcile_market_ids_only=True uses explicit reconcile_market_ids.
  • When reconcile_market_ids_only=False and reconcile_market_ids is unset, Rust currently falls back to stream_market_ids_filter for startup reconciliation.
  • Rust does not yet implement the Python check_cache_against_order_image full-image cache check.
  • ignore_external_orders=True currently skips only OCM updates with no rfo.

Current Rust configuration

Data client configuration

OptionDefaultNotes
account_currencyRequiredBetfair account currency.
usernameNoneFalls back to BETFAIR_USERNAME.
passwordNoneFalls back to BETFAIR_PASSWORD.
app_keyNoneFalls back to BETFAIR_APP_KEY.
proxy_urlNoneOptional HTTP proxy.
request_rate_per_second5General HTTP rate limit.
default_min_notionalNoneOptional minimum notional override.
event_type_idsNoneOptional navigation filter.
event_type_namesNoneOptional navigation filter.
event_idsNoneOptional navigation filter.
country_codesNoneOptional navigation filter.
market_typesNoneOptional navigation filter.
market_idsNoneOptional navigation filter.
min_market_start_timeNoneOptional navigation filter.
max_market_start_timeNoneOptional navigation filter.
stream_hostNoneOptional stream host override.
stream_portNoneOptional stream port override.
stream_heartbeat_ms5,000Required in Rust today.
stream_idle_timeout_ms60,000Idle timeout before reconnect.
stream_reconnect_delay_initial_ms2,000Initial reconnect delay.
stream_reconnect_delay_max_ms30,000Maximum reconnect delay.
stream_use_tlsTrueUse TLS for the stream connection.
stream_conflate_msNoneExplicit conflation setting.
subscription_delay_secs3Delay before the first market subscription.
subscribe_race_dataFalseSubscribe to RCM updates.

Rust does not yet expose certs_dir or instrument_config. Rust also uses a fixed 36,000 second keep-alive interval.

Execution client configuration

OptionDefaultNotes
trader_idTRADER-001Trader ID for the client core.
account_idBETFAIR-001Account ID for the client core.
account_currencyGBPBetfair account currency.
usernameNoneFalls back to BETFAIR_USERNAME.
passwordNoneFalls back to BETFAIR_PASSWORD.
app_keyNoneFalls back to BETFAIR_APP_KEY.
proxy_urlNoneOptional HTTP proxy.
request_rate_per_second5General HTTP rate limit.
order_request_rate_per_second20Order endpoint rate limit.
stream_hostNoneOptional stream host override.
stream_portNoneOptional stream port override.
stream_heartbeat_ms5,000Required in Rust today.
stream_idle_timeout_ms60,000Idle timeout before reconnect.
stream_reconnect_delay_initial_ms2,000Initial reconnect delay.
stream_reconnect_delay_max_ms30,000Maximum reconnect delay.
stream_use_tlsTrueUse TLS for the stream connection.
stream_market_ids_filterNoneOptional live OCM market filter.
ignore_external_ordersFalseOnly skips OCM updates with no rfo.
calculate_account_stateTrueGates periodic account state polling in Rust today.
request_account_state_secs300Poll interval for account funds.
reconcile_market_ids_onlyFalseWhen True, use reconcile_market_ids.
reconcile_market_idsNoneExplicit startup reconciliation market IDs.
use_market_versionFalseAttach market version to place and replace requests.

Rust does not yet expose certs_dir or instrument_config.

Cutover plan

Use this page as the transition tracker until the Rust adapter becomes the primary Betfair path.

At cutover:

  1. Decide whether Rust keeps its current reconciliation filter behavior or matches the Python split.
  2. Decide whether Rust adds certificate configuration and other Python config fields.
  3. Decide whether Rust keeps BSP-only MARKET orders or adds the Python aggressive-limit path.
  4. Promote this file to betfair.md.
  5. Move any remaining Python-only notes into a short legacy note or release note.

On this page