OpenPit C++ SDK
C++17 SDK for the OpenPit pre-trade risk engine
openpit::Configurator Class Reference

Public Member Functions

 Configurator (const ::openpit::Engine &engine) noexcept
 
void OrderSizeLimit (std::string_view name, ::openpit::pretrade::policies::OrderSizeBrokerBarrierUpdate broker=::openpit::pretrade::policies::OrderSizeBrokerBarrierUpdate::Unchanged(), std::optional< std::vector<::openpit::pretrade::policies::OrderSizeAssetBarrier >> assets=std::nullopt, std::optional< std::vector< ::openpit::pretrade::policies::OrderSizeAccountAssetBarrier >> accountAssets=std::nullopt) const
 
void PnlBoundsKillSwitch (std::string_view name, std::optional< std::vector<::openpit::pretrade::policies::PnlBoundsBrokerBarrier >> brokers=std::nullopt, std::optional< std::vector< ::openpit::pretrade::policies::PnlBoundsAccountBarrierUpdate >> accounts=std::nullopt) const
 
void RateLimit (std::string_view name, ::openpit::pretrade::policies::RateLimitBrokerBarrierUpdate broker=::openpit::pretrade::policies::RateLimitBrokerBarrierUpdate::Unchanged(), std::optional< std::vector<::openpit::pretrade::policies::RateLimitAssetBarrier >> assets=std::nullopt, std::optional< std::vector<::openpit::pretrade::policies::RateLimitAccountBarrier >> accounts=std::nullopt, std::optional< std::vector< ::openpit::pretrade::policies::RateLimitAccountAssetBarrier >> accountAssets=std::nullopt) const
 
void SetAccountPnl (std::string_view name, ::openpit::param::AccountId accountId, const ::openpit::param::Asset &settlementAsset, ::openpit::param::Pnl pnl) const
 
::openpit::PolicyConfigurationResult SetSpotFundsAccountPnl (std::string_view name, ::openpit::param::AccountId accountId, ::openpit::accountadjustment::PnlHaltReason reason) const
 Replaces one SpotFunds live account P&L accumulator with a halt reason. More...
 
::openpit::PolicyConfigurationResult SetSpotFundsAccountPnl (std::string_view name, ::openpit::param::AccountId accountId, ::openpit::param::Pnl pnl) const
 Replaces one SpotFunds live account P&L accumulator with a numeric value. More...
 
void SpotFunds (std::string_view name, std::optional< std::uint16_t > globalSlippageBps=std::nullopt, std::optional<::openpit::pretrade::policies::SpotFundsPricingSource > pricingSource=std::nullopt, std::optional< std::vector<::openpit::pretrade::policies::SpotFundsOverride >> overrides=std::nullopt) const
 
void SpotFundsAccountGroupLimitMode (std::string_view name, ::openpit::param::AccountGroupId accountGroupId, std::optional<::openpit::pretrade::policies::SpotFundsLimitMode > mode) const
 
void SpotFundsAccountLimitMode (std::string_view name, ::openpit::param::AccountId accountId, std::optional<::openpit::pretrade::policies::SpotFundsLimitMode > mode) const
 
void SpotFundsGlobalLimitMode (std::string_view name, ::openpit::pretrade::policies::SpotFundsLimitMode mode) const
 
::openpit::AccountBlockOutcomes SpotFundsPnlBoundsKillSwitch (std::string_view name, ::openpit::pretrade::policies::SpotFundsPnlBoundsGlobalBarrierUpdate global=::openpit::pretrade::policies::SpotFundsPnlBoundsGlobalBarrierUpdate::Unchanged(), std::optional< std::vector< ::openpit::pretrade::policies::SpotFundsPnlBoundsAccountGroupBarrier >> accountGroups=std::nullopt, std::optional< std::vector< ::openpit::pretrade::policies::SpotFundsPnlBoundsAccountBarrier >> accounts=std::nullopt) const
 Retunes the SpotFunds self-computed P&L bounds axis. More...
 

Constructor & Destructor Documentation

◆ Configurator()

openpit::Configurator::Configurator ( const ::openpit::Engine engine)
inlineexplicitnoexcept

Member Function Documentation

◆ OrderSizeLimit()

void openpit::Configurator::OrderSizeLimit ( std::string_view  name,
::openpit::pretrade::policies::OrderSizeBrokerBarrierUpdate  broker = ::openpit::pretrade::policies::OrderSizeBrokerBarrierUpdate:: Unchanged(),
std::optional< std::vector<::openpit::pretrade::policies::OrderSizeAssetBarrier >>  assets = std::nullopt,
std::optional< std::vector< ::openpit::pretrade::policies::OrderSizeAccountAssetBarrier >>  accountAssets = std::nullopt 
) const
inline

◆ PnlBoundsKillSwitch()

void openpit::Configurator::PnlBoundsKillSwitch ( std::string_view  name,
std::optional< std::vector<::openpit::pretrade::policies::PnlBoundsBrokerBarrier >>  brokers = std::nullopt,
std::optional< std::vector< ::openpit::pretrade::policies::PnlBoundsAccountBarrierUpdate >>  accounts = std::nullopt 
) const
inline

◆ RateLimit()

void openpit::Configurator::RateLimit ( std::string_view  name,
::openpit::pretrade::policies::RateLimitBrokerBarrierUpdate  broker = ::openpit::pretrade::policies::RateLimitBrokerBarrierUpdate:: Unchanged(),
std::optional< std::vector<::openpit::pretrade::policies::RateLimitAssetBarrier >>  assets = std::nullopt,
std::optional< std::vector<::openpit::pretrade::policies::RateLimitAccountBarrier >>  accounts = std::nullopt,
std::optional< std::vector< ::openpit::pretrade::policies::RateLimitAccountAssetBarrier >>  accountAssets = std::nullopt 
) const
inline

◆ SetAccountPnl()

void openpit::Configurator::SetAccountPnl ( std::string_view  name,
::openpit::param::AccountId  accountId,
const ::openpit::param::Asset settlementAsset,
::openpit::param::Pnl  pnl 
) const
inline

◆ SetSpotFundsAccountPnl() [1/2]

::openpit::PolicyConfigurationResult openpit::Configurator::SetSpotFundsAccountPnl ( std::string_view  name,
::openpit::param::AccountId  accountId,
::openpit::accountadjustment::PnlHaltReason  reason 
) const
inline

Replaces one SpotFunds live account P&L accumulator with a halt reason.

This is separate from barrier retuning and does not affect any position-level accumulator. When an effective account P&L barrier is configured, the result reports the policy block even when the account is already blocked. The engine processes the block request before returning and preserves the existing first cause.

◆ SetSpotFundsAccountPnl() [2/2]

::openpit::PolicyConfigurationResult openpit::Configurator::SetSpotFundsAccountPnl ( std::string_view  name,
::openpit::param::AccountId  accountId,
::openpit::param::Pnl  pnl 
) const
inline

Replaces one SpotFunds live account P&L accumulator with a numeric value.

This is separate from barrier retuning and re-arms the accumulator after a calculation halt. It does not affect any position-level accumulator. A value outside the effective bounds returns the policy-reported block, even when the account already has a block. The engine processes the block request before returning and preserves the existing first cause. Otherwise the returned block list is empty.

◆ SpotFunds()

void openpit::Configurator::SpotFunds ( std::string_view  name,
std::optional< std::uint16_t >  globalSlippageBps = std::nullopt,
std::optional<::openpit::pretrade::policies::SpotFundsPricingSource pricingSource = std::nullopt,
std::optional< std::vector<::openpit::pretrade::policies::SpotFundsOverride >>  overrides = std::nullopt 
) const
inline

◆ SpotFundsAccountGroupLimitMode()

void openpit::Configurator::SpotFundsAccountGroupLimitMode ( std::string_view  name,
::openpit::param::AccountGroupId  accountGroupId,
std::optional<::openpit::pretrade::policies::SpotFundsLimitMode mode 
) const
inline

◆ SpotFundsAccountLimitMode()

void openpit::Configurator::SpotFundsAccountLimitMode ( std::string_view  name,
::openpit::param::AccountId  accountId,
std::optional<::openpit::pretrade::policies::SpotFundsLimitMode mode 
) const
inline

◆ SpotFundsGlobalLimitMode()

void openpit::Configurator::SpotFundsGlobalLimitMode ( std::string_view  name,
::openpit::pretrade::policies::SpotFundsLimitMode  mode 
) const
inline

◆ SpotFundsPnlBoundsKillSwitch()

::openpit::AccountBlockOutcomes openpit::Configurator::SpotFundsPnlBoundsKillSwitch ( std::string_view  name,
::openpit::pretrade::policies::SpotFundsPnlBoundsGlobalBarrierUpdate  global = ::openpit::pretrade::policies:: SpotFundsPnlBoundsGlobalBarrierUpdate::Unchanged(),
std::optional< std::vector< ::openpit::pretrade::policies::SpotFundsPnlBoundsAccountGroupBarrier >>  accountGroups = std::nullopt,
std::optional< std::vector< ::openpit::pretrade::policies::SpotFundsPnlBoundsAccountBarrier >>  accounts = std::nullopt 
) const
inline

Retunes the SpotFunds self-computed P&L bounds axis.

The global update uses the explicitly named Unchanged, Clear, and Set operations. Optional group/account vectors are PATCH axes: std::nullopt leaves the axis unchanged and an engaged empty vector clears it. Account updates preserve each live accumulated P&L value. With a known effective account currency, an account-tier mismatch fails closed and blocks the account; account-group and global mismatches are skipped. A known-currency account with no account barrier and no matching fallback has no effective barrier, but its P&L keeps accumulating and publishing. Without an effective currency, the first in-scope barrier applies. Bounds are compared as stored and are never FX-converted.

An account whose effective barrier changed is evaluated against its stored account P&L in the same call: an already halted account, or one already beyond the new barrier, is blocked before this call returns and its block is reported here as already recorded by the engine. Each returned accounts::AccountBlockOutcome names the account that owns its newly inserted block. Removing the last effective barrier reports no block and does not release an existing block. Clearing an override can expose a fallback barrier; the fallback is evaluated normally and may record and report a block.