Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

futuquant

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

futuquant - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.babelrc

22

CHANGELOG.md

@@ -0,4 +1,20 @@

### 0.1.2
### 0.1.0 2018.07.16
2017.07.20
* feature: 使用babel编译,可以直接使用require('futuquant')
* docs: 修改README.md中的示例代码
* fix: package.json中main的路径
### 0.1.1
2018.07.16
* docs: 更新完善文档;
* fix: 修复示例代码的错误。
### 0.1.0
2018.07.16
* docs: 完善FutuQuant所有接口的文档,包括所有基础结构体的定义

@@ -10,4 +26,6 @@ * fix: 修复连包没有及时处理导致接口性能下降的bug

### 0.0.1 2018.07.14
### 0.0.1
2018.07.14
* feature: 完成对接futuquant底层协议
{
"name": "futuquant",
"version": "0.1.1",
"version": "0.1.2",
"description": "FutuQuant-Nodejs",

@@ -8,3 +8,6 @@ "main": "src/futuquant.js",

"test": "mocha -r esm -t 600000 -b -w test/*",
"doc": "rm -rf doc && jsdoc -c jsdoc.json -t ./node_modules/ink-docstrap/template"
"doc": "rm -rf doc && jsdoc -c jsdoc.json -t ./node_modules/ink-docstrap/template",
"build": "babel src/*.mjs -d .",
"demo-es6": "node --experimental-modules demo.mjs",
"demo-es5": "node demo.js"
},

@@ -27,2 +30,6 @@ "repository": {

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-preset-es2015": "^6.24.1",
"eslint": "^4.19.1",

@@ -29,0 +36,0 @@ "eslint-config-airbnb": "^16.1.0",

@@ -7,8 +7,18 @@ ## FutuQuant量化接口Nodejs版本

* 使用了ES6 modules,对应nodejs版本v8.5.0以上,启动时添加参数:--experimental-modules,参考:[v8.5.0 proposal #15308](https://github.com/nodejs/node/pull/15308)。
* 使用了ES6 modules,对应nodejs版本v8.5.0以上,启动时添加参数:`--experimental-modules`,参考:[v8.5.0 proposal #15308](https://github.com/nodejs/node/pull/15308)。
> 最新版本使用了babel编译es modules为modules.exports。
> 可以直接使用require('futuquant'),不再需要 --experimental-modules 参数。
* 使用了async/await语法,要求nodejs版本v7.10.1以上,v7.5.1可以使用`--harmony`或者`--harmony-async-await`参数开启async/await的支持。
* 底层协议基于FutuQuant v3.1.2,参考:[FutunnOpen/futuquant](https://github.com/FutunnOpen/futuquant/)。
* 数据传输格式强制使用protobuf。
* **为了方便使用,请注意相关接口参数及返回结果和富途官方版本不一致,详细请参考API文档**。
* API文档相关:[https://yisbug.github.io/futuquant/doc/index.html](https://yisbug.github.io/futuquant/doc/index.html)
> 为了方便使用,请注意部分接口参数及返回结果和富途官方版本不完全一致,详细请参考[API文档](https://yisbug.github.io/futuquant/doc/index.html)。
### 更新
[点击查看更新日志](https://github.com/yisbug/futuquant/blob/master/CHANGELOG.md)
### 安装

@@ -29,8 +39,22 @@

``` javascript
import FtQuant from 'futuquant';
const FtQuant = require('./src/futuquant');
const fs = require('fs');
const path = require('path');
const FILENAME = typeof __filename !== 'undefined' ? __filename : (/^ +at (?:file:\/*(?=\/)|)(.*?):\d+:\d+$/m.exec(Error().stack) || '')[1];
const DIRARR = FILENAME.split('/');
DIRARR.pop();
const DIRNAME = typeof __dirname !== 'undefined' ? __dirname : DIRARR.join('/');
const FutuOpenDXMLPath = path.join(DIRNAME, '../FutuOpenD_1.01_Mac/FutuOpenD.xml');
const ftOpenDConfig = fs.readFileSync(FutuOpenDXMLPath, {
encoding: 'utf8'
});
const userID = ftOpenDConfig.match(/login_account>(\d*?)<\/login_account/)[1];
const pwdMd5 = ftOpenDConfig.match(/trade_pwd_md5>(.*?)<\/trade_pwd_md5/)[1];
const ft = new FtQuant({
ip: '127.0.0.1', // FutuOpenD服务IP
port: 11111, // FutuOpenD服务端口
userID: '5894668', // 牛牛号
userID, // 牛牛号
});

@@ -44,4 +68,4 @@

console.log('getGlobalState', res);
await ft.trdUnlockTrade(true, 'md5'); // 解锁交易密码
const accID = (await this.ft.trdGetAccList())[0].accID;
await ft.trdUnlockTrade(true, pwdMd5); // 解锁交易密码
const accID = (await ft.trdGetAccList())[0].accID;
await ft.setCommonTradeHeader(1, accID, 1); // 设置为港股的真实环境

@@ -48,0 +72,0 @@ };

doc/FutuQuant.html

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc