和顺 / 衡律 返回所属 Agent
17.9

成交记录与执行成本评价

原能力

保存成交和执行成本评价,关联原订单、市场观测和实际费用。(合同附件 R7 17.9)

首选项目

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

匹配范围

事件记录和 SQL 汇总成本构成。

源码

NautilusTrader · pub struct OrderFilled

crates/model/src/events/order/filled.rs · 49–62 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
pub struct OrderFilled {
    /// The trader ID associated with the event.
    pub trader_id: TraderId,
    /// The strategy ID associated with the event.
    pub strategy_id: StrategyId,
    /// The instrument ID associated with the event.
    pub instrument_id: InstrumentId,
    /// The client order ID associated with the event.
    pub client_order_id: ClientOrderId,
    /// The venue order ID associated with the event.
    pub venue_order_id: VenueOrderId,
    /// The account ID associated with the event.
    pub account_id: AccountId,
    /// The trade match ID (assigned by the venue).
  • // Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.

DuckDB · SinkResultType PhysicalHashAggregate::Sink(

src/execution/operator/aggregate/physical_hash_aggregate.cpp · 396–409 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, DataChunk &chunk,
                                           OperatorSinkInput &input) const {
	auto &local_state = input.local_state.Cast<HashAggregateLocalSinkState>();
	auto &global_state = input.global_state.Cast<HashAggregateGlobalSinkState>();

	if (distinct_collection_info) {
		SinkDistinct(context, chunk, input);
	}

	if (CanSkipRegularSink()) {
		return SinkResultType::NEED_MORE_INPUT;
	}

	DataChunk &aggregate_input_chunk = local_state.aggregate_input_chunk;

实现与验收要点

实际成交、成交前基线、费用与时点口径独立核。