npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

trading-sim-engine

v0.2.3

Published

A 股交易模拟执行器——纯计算引擎仓(自 trading-logic 拆出)

Readme

trading-sim-engine

A 股交易模拟执行器——纯计算、零依赖、零 I/O 的 TypeScript 引擎。 自 trading-logic 拆出(git filter-repo,历史完整)。

它是什么

给定一段 K 线序列和初始资金,模拟「在真实市场里下单会发生什么」: 撮合时点(信号棒收盘决策 → 次日开盘成交)、滑点与最小价差、佣金 印花税、T+1、手数、涨跌停/停牌闸门、做空与保证金、风控强平、 光标推进、有序事件流与账户投影。

它不是:策略框架(不识别形态)、训练器(不管脱敏/呈现)、 行情源(K 线由调用方注入)。

用法

import { Engine } from 'trading-sim-engine';

const e = new Engine({ bars, symbol: 'X.SH', startIdx: 0, endIdx: n, capital: 1e5 });
e.seek(20);
e.buy({ pct: 0.5, stopLoss: -0.05 });   // 风控参数平铺,见 BuyOptions
e.hold();
const result = e.settle();

完整语义见源码仓 contracts/semantics.md(R1-R45 + I1-I8); HTTP 服务化形状见 contracts/openapi.yaml(均未随包分发)。

测试

npm test            # 引擎套件:规则断言 + 不变量 + 黄金指纹 + 模块守卫
npm run typecheck
npm run lint:md

黄金快照是漂移探测器:npm run golden:update 只在行为变更有意时跑, diff 本身就是变更审计单。