Tools commonly used in financial scenarios development
- Simple API, support modular import
- No dependencies
- Unit function test coverage rate and line output coverage rate are both 100%
- Refactor project by typescript, ts project can use those tools directly
$ npm install finance-ai-toolCommonJS:
const financeAITool = require('finance-ai-tool');ES module:
import financeAITool from 'finance-ai-tool';Add financeAITool to global scope:
<script src='path/to/finance-ai-tool.js'></script>The library exports a single object, financeAITool.
Each key of this object corresponds to a secondary file in the src folder.
The directory list example is as follows
|-- src
|-- index.js
|-- calc
| |-- index.js
| |-- number.js
|-- display
| |-- formatter.js
| |-- index.js
|-- util
|-- acquire.js
|-- compare.js
|-- index.js
Use the formatToPercent method in formatter module.
const res1 = financeAITool.formatter.formatToPercent(0.233578, "+", 3);
console.log(res1); // +23.358%
const res2 = financeAITool.formatter.formatToPercent(0.232323, "", 2);
console.log(res2); // 23.23%Use the getIntPartLength method in acquire module.
const res3 = financeAITool.acquire.getIntPartLength(123.456);
console.log(res3); // 3There is a modules directory in the project compilation product, the output format of these files is CJS
The directory list example is as follows
|-- modules
|-- number.js
|-- formatter.js
|-- acquire.js
|-- compare.js
CommonJS:
const { isRealNumber } = require('finance-ai-tool/modules/number');ES module:
import { isRealNumber } from 'finance-ai-tool/modules/number';