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 🙏

© 2024 – Pkg Stats / Ryan Hefner

futu-sdk

v0.2.0

Published

futu-api 的高性能精简易用版;基于*.proto静态编译,提供高性能的多层封装但层层开放的易用接口,获取最原始最完整的量化数据;相较于Python, nodejs更接近Web, 从而轻而易举搭建一个可视化交易站点,这是进行可控量化交易的不二选择。

Downloads

839

Readme

说明

本 SDK 用于对接富途 OpenAPI 量化接口的网关程序 OpenD. 虽然富途官方提供了配套的futu-api,但如果你在使用 futu-api 过程中遇到了一些卡点,可以尝试选择futu-sdk来对接。这些卡点可能是:

  • 依赖缺失(如 long, WebSocket, memcpy)、不兼容(node >=0.8 <=0.12)或过于老旧(如 bytebuffer)
  • 模块化接口不一致(commonjsesm 混用)
  • 缺少类型支持和提示等

使用

1. 安装

本 SDK 提供可直接执行的 commonjsesm 模块,也可以在 nextjs, nestjs, create-react-app 等开发环境下安装使用。

$ npm install --save futu-sdk

2. 使用

对应官方获取交易业务账户列表的例子,futu-sdk 简化了建立连接逻辑,提供了基于 Promise / Generator(SubSubAccPush 两个接口返回是 Generator,其他都是 Promise) 的接口和类型支持。

import { getFutuApi } from 'futu-sdk';
// import { Trd_Common } from 'futu-sdk/proto';

const { webRequest, webSocket } = getFutuApi('ws://127.0.0.1:33333', '9d261112869397f0');
try {
  const { accList } = await webRequest.GetAccList({ userID: 0, needGeneralSecAccount: true });
  console.log({ accList });
} finally {
  webSocket.close();
}

其他接口的使用方式如此类推,需要特别注意的是 futu-sdk 统一简化了两个数据结构:

  • 请求参数:只需传入 req, 自动将 req 装箱为 { c2s: req };
  • 响应结果:直接使用 res, 自动将 { s2c: res } 拆箱为 res.