
Security News
US Government Forces Anthropic to Pull Claude Fable Days After Launch
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.
node-futu-api
Advanced tools
npm install --save node-futu-api
跟官方的例子一样,可直接拷贝官方的例子运行,唯一的区别是安装的依赖由 futu-api 改为 node-futu-api
import ftWebsocket from "futu-api";
import beautify from "js-beautify";
function QotGetSecuritySnapshot() {
let [addr, port, enable_ssl, key] = [
"127.0.0.1",
33333,
false,
"xxx", // TODO 这里需替换为自己的websocket秘钥
];
let websocket = new ftWebsocket();
websocket.onlogin = (ret, msg) => {
if (ret) {
// 登录成功
const req = {
c2s: {
securityList: [
{
market: 1,
code: "00700",
},
],
},
};
websocket
.GetSecuritySnapshot(req)
.then((res) => {
let { errCode, retMsg, retType, s2c } = res;
console.log(
"Snapshot: errCode %d, retMsg %s, retType %d",
errCode,
retMsg,
retType
);
if (retType == 0) {
let snapshot = beautify(JSON.stringify(s2c), {
indent_size: 2,
space_in_empty_paren: true,
});
console.log(snapshot);
}
})
.catch((error) => {
console.log("error:", error);
});
} else {
console.log("error", msg);
}
};
websocket.start(addr, port, enable_ssl, key);
//关闭行情连接,连接不再使用之后,要关闭,否则占用不必要资源
//同时OpenD也限制了最多128条连接
//也可以一个页面或者一个项目维护一条连接,这里范例请求一次创建一条连接
setTimeout(() => {
websocket.stop();
console.log("stop");
}, 5000); // 5秒后断开
}
QotGetSecuritySnapshot();
FAQs
Futu Websocket API for Node.js
We found that node-futu-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.