和顺 / 知衡 返回所属 Agent
ZH-08.01

风险与执行准备

原能力

把流动性、规模、约束违反和实际执行条件交给负责人审阅。(细化版 p.16–17)

首选项目

NautilusTrader(LGPL-3.0(仓库标注))。 NautilusTrader

匹配范围

订单对象和业务策略校验支持准备审阅。

源码

NautilusTrader · pub struct RiskEngine

crates/risk/src/engine/mod.rs · 74–87 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
pub struct RiskEngine {
    clock: Rc<RefCell<dyn Clock>>,
    cache: Rc<RefCell<Cache>>,
    portfolio: Portfolio,
    trading_state: TradingState,
    config: RiskEngineConfig,
    max_notional_per_order: AHashMap<InstrumentId, Decimal>,
    throttler_submit: Throttler<TradingCommand, SubmitCommandFn>,
    throttler_modify: Throttler<ModifyOrder, ModifyOrderFn>,
    reservations: Vec<Reservation>,
    command_count: u64,
    event_count: u64,
}
  • // Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.

Open Policy Agent · func (pq PreparedEvalQuery) Eval(

v1/rego/rego.go · 608–621 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
func (pq PreparedEvalQuery) Eval(ctx context.Context, options ...EvalOption) (ResultSet, error) {
	ectx, finish, err := pq.newEvalContext(ctx, options)
	if err != nil {
		return nil, err
	}
	defer finish(ctx)

	ectx.compiledQuery = pq.r.compiledQueries[evalQueryType]

	return pq.r.eval(ctx, ectx)
}

// PreparedPartialQuery holds the prepared Rego state that has been pre-processed
// for partial evaluations.
  • // Copyright 2017 The OPA Authors. All rights reserved.

实现与验收要点

真实流动性、准入、执行权及独立资本批准。