和顺 / 衡律 返回所属 Agent
17.1

批准目标与新增订单数量上限

原能力

依据已批准目标限制新增订单数量,防止重复派发或超出获准份额。(合同附件 R7 17.1)

首选项目

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

匹配范围

订单数量对象及上限规则求值。

源码

NautilusTrader · pub struct Quantity

crates/model/src/types/quantity.rs · 162–175 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
pub struct Quantity {
    pub(crate) raw: QuantityRaw,
    /// The number of decimal places, with a maximum of [`FIXED_PRECISION`].
    pub precision: u8,
}

impl Quantity {
    /// Creates a new [`Quantity`] instance with correctness checking.
    ///
    /// # Errors
    ///
    /// Returns an error if:
    /// - `value` is invalid outside the representable range [0, `QUANTITY_MAX`].
    /// - `precision` is invalid outside the representable range [0, `FIXED_PRECISION`].
  • // 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.

实现与验收要点

批准目标、资本资格、原单位与超限原语义。