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

@lanren0721/common

v1.0.1

Published

Technical analysis utilities extracted from lanren project

Readme

@lanren0721/common

常用技术与市场工具函数库,支持 Node ESM。

安装

npm install @lanren0721/common

使用示例

import { getTechAnalysis, technical, market } from '@lanren0721/common';

// 技术分析主入口
const tech = await getTechAnalysis(klineData, endDate);

// 或分别使用子模块
const { calculateIndicators, analyzeTrend } = technical;
const { getMarketType, marketCode2Name } = market;

导出清单

根入口(index.js)

  • getTechAnalysis(klineData, endDate) —— 综合技术分析主函数
  • technical —— 技术指标与趋势分析命名空间(见下)
  • market —— 市场工具命名空间(见下)

technical 子模块(lib/technical/index.js)

  • getTechAnalysis —— 同上,可被直接导入
  • 重导出以下全部指标与趋势函数:

指标函数(lib/technical/indicators/index.js)

  • calculateIndicators(klineData) —— 一键计算全部指标
  • calculateRSI(prices, period=14)
  • calculateMACD(prices)
  • calculateKDJ(prices, highs, lows)
  • calculateBOLL(prices)
  • calculateIchimoku(prices)
  • calculateOBV(klineData)
  • calculateSAR(highs, lows)
  • calculateFibonacci(prices)
  • calculateBIAS(prices)
  • calculateVolumeRatio(klineData)
  • calculateMagicNine(prices)
  • calculateDragonSignal({ macd, kdj, rsi, prices })
  • calculateChipDistribution(prices)
  • calculateMA(prices) —— 多均线
  • calculateWR(prices, highs, lows)
  • calculateDMI(prices, highs, lows)
  • calculateTRIX(prices)

趋势/策略分析(lib/technical/analyzers/trendAnalyzer.js)

  • analyzeTrend({ indicators, currentPrice, prevPrice, klineData }) —— 综合趋势研判

通用工具(lib/technical/common/index.js)

  • calculateMA10(klineData)
  • analyzeUptrendPullback(klineData, ma10Data, baseVolume)
  • generateStrategyAnalysis(...) —— 策略评分与建议
  • getConfidenceLevel(score) —— 置信度级别
  • combinePriceTrend(short, mid, long) —— 多周期趋势合并
  • 更多辅助函数……

market 子模块(lib/market/index.js)

  • marketParamsMap —— 市场代码→东财 API 参数映射表
  • marketNewTypeMap —— 市场简称映射
  • marketCode2Name(marketCode) —— 代码转市场名称
  • getMarketFromCode(code) —— 旧版市场编号推断
  • getNewMarketFromCode(code) —— 新版市场类型字符串推断
  • getMarketType(code) —— 返回 'a' | 'hk' | 'us' | null
  • getMarketInfo(code) —— 返回 { market, type } 完整信息
  • market2ItickMarket(code) —— 转换为 itick 市场标识

发布日志

  • 1.0.0 初始发布,包含完整技术指标与趋势分析
  • 1.1.0 新增 market 工具模块,补充市场编码相关函数