open-index/open-npm huggingface dataset:
npm package: @muybuen/cursor
Description: Custom cursor component for React with CSS.
Author: John Choura
Latest version: 1.0.8

# @muybuen/cursor

A TypeScript first Custom Cursor for React and Next.js

## Installation

To install the package, run:

```bash
npm install @muybuen/cursor
```

## Usage

### Using in Next.js App Router

1. Create a custom provider component to enclose your application in the cursor provider. This provider should include the `BuenCursorProvider` and the `Cursor` component from the package. The `Cursor` component should be placed at the end of the provider's children.

```tsx
// /AppProvider.tsx

"use client";

import { BuenCursorProvider, Cursor } from "@muybuen/cursor";
import { ReactNode } from "react";

import "@muybuen/cursor/dist/base.css";

type ProviderProps = {
  children: ReactNode;
};

export function Provider({ children }: ProviderProps) {
  return (
    <BuenCursorProvider>
      {children}
      <Cursor className={"buen-cursor-mod"} />
    </BuenCursorProvider>
  );
}
```

2. Include that provider at the root layout of page template of your application

```tsx
// /app/layout.tsx

import { Provider } from "../AppProvider";

export default function RootLayout({ children }) {
  return(
    <html lang="en">
      <body className="font-sans">
        <Provider>{children}</Provider>
      </body>
    </html>
  );
}
```

## Customizing

[coming soon]

## Type Properties

[coming soon]

## Contributing

This project is maintained by John Choura, but it open to contributions from anyone. See [CONTRIBUTORS](https://github.com/johnchourajr/buen-cursor/blob/main/CONTRIBUTORS.md) for a guide on how to contribute.

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/johnchourajr/buen-cursor/blob/main/LICENSE) file for details.
npm package: @muyi086/cal
Description: calculate a string expression
Author: MuYi086
Latest version: 1.0.8

# cal

[中文](https://github.com/MuYi086/npm_package/blob/master/cal/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/cal) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/cal) ![npm](https://img.shields.io/npm/dt/@muyi086/cal) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/cal
# common JS
const { cal } = require('@muyi086/cal')
# es6
import { cal } from '@muyi086/cal'
```

## Use
```JS
const str = '-(-5+(-2*33//3****4)-2)+((5*6)/2+2)-23*4/2+43'
const value = cal.dealBracket(str)
```

## Function

function|parameter|default|required|description|
--|--|--|--|--|
dealBracket|string|string|required|a string include expression|
npm package: @muyi086/calendar
Description: calendar and Lunar calendar
Author: MuYi086
Latest version: 1.0.8

# calendar

[中文](https://github.com/MuYi086/npm_package/blob/master/calendar/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/calendar) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/calendar) ![npm](https://img.shields.io/npm/dt/@muyi086/calendar) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/calendar
# common JS
const { calendar } = require('@muyi086/calendar')
# es6
import { calendar } from '@muyi086/calendar'
```

## Use
```JS
// all data is in object @muyi086/calendar after init
console.log(calendar)
```

## Attr explain
1. `currentMonthDay` : daily info 
1. `currentMonthFarmDay` : daily info with Lunar

## Function

function|parameter|default|required|description|
--|--|--|--|--|
search|date string|string|required|self-defined search with a date string like '2019.12.12'或'2019-12-12'或'2019/12/12'|
npm package: @muyi086/chrome-extension-interface-url-copy
Description: render interface name, copy name and url
Author: MuYi086
Latest version: 1.0.1

# chrome-extension-interface-url-copy

## 介绍
随着项目的迭代，不同网关下 `api` 数量不断增加。前端维护接口地址,取名和复制路径的成本也不断上升。于是考虑是否可以自动生成接口地址对应的变量名，并且拷贝变量名和路径到剪切板，方便一键粘贴。

## 适配
后续视用户需求，再考虑支持 `swagger`，`apifox`，`yapi` 等其他接口文档

平台|是否支持|
--|--|
Apipost|✅|

## Chrome插件使用
```SHELL
# 1. 使用chrome扩展程序加载source目录
# 2. 打开Apipost对应的接口链接
# 3. 右下角"点击复制"
```
npm package: @muyi086/git-commit-export-html
Description: Find the commit records of a user for a specific time period, and generate corresponding HTML and JSON files
Author: MuYi086
Latest version: 1.0.6

# git-commit-export-html

[中文](https://github.com/MuYi086/npm_package/blob/master/git-commit-export-html/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/git-commit-export-html) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/git-commit-export-html) ![npm](https://img.shields.io/npm/dt/@muyi086/git-commit-export-html) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/git-commit-export-html
# common JS
const { gitCommitExportHtml } = require('@muyi086/git-commit-export-html')
```

## Use

```JS
const options = {
  since: '2021-02-29', // start time
  until: '2021-04-01', // end time
  number: 1000, // records limit
  // default fields: ['abbrevHash', 'hash', 'subject', 'authorName']
  // hash - the long hash of the commit
  // abbrevHash - the abbreviated commit hash
  // treeHash - the tree hash of the commit
  // abbrevTreeHash - the abbreviated commit hash
  // parentHashes - the parent hashes
  // abbrevParentHashes - the abbreviated parent hashes
  // authorName - author name of the commit
  // authorEmail - author email of the commit
  // authorDate - author date of the commit
  // authorDateRel - relative author date of the commit
  // committerName - committer name
  // committerEmail - committer email
  // committerDate - committer date
  // committerDateRel - relative committer date
  // subject - commit message (first line)
  // body - commit body
  // rawBody - raw body (subject + body)
  // tag - raw tag information of commit
  fields: ['subject', 'authorName', 'authorDate']
}
gitCommitExportHtml(options)
```
npm package: @muyi086/git-commit-info
Description: get commit info
Author: MuYi086
Latest version: 1.2.0

# git-commit-info

[中文](https://github.com/MuYi086/npm_package/blob/master/git-commit-info/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/git-commit-info) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/git-commit-info) ![npm](https://img.shields.io/npm/dt/@muyi086/git-commit-info) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/git-commit-info
# common JS
const { gitCommitInfo } = require('@muyi086/git-commit-info')
```

## Use
```JS
const {
  projectName,
  branch,
  gitUserName,
  gitUserEmail,
  commitName,
  commitEmail,
  commitDate,
  commitSubject,
  commitHash,
  latestTag
} = gitCommitInfo(env = '')
// projectName, branch, gitUserName, gitUserEmail, commitName, commitEmail, commitDate, commitSubject, commitHash, latestTag
console.log(projectName, branch, gitUserName, gitUserEmail, commitName, commitEmail, commitDate, commitSubject, commitHash, latestTag)
// env = 'prod', return all commit subject between two tag
console.log(projectName, branch, gitUserName, gitUserEmail, commitName, commitEmail, commitDate, commitSubjects, commitHash, latestTag)
```
npm package: @muyi086/img-compress
Description: img compress
Author: MuYi086
Latest version: 1.0.10

# img-compress

[中文](https://github.com/MuYi086/npm_package/blob/master/img-compress/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/img-compress) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/img-compress) ![npm](https://img.shields.io/npm/dt/@muyi086/img-compress) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/img-compress
# common JS
const { imgCompress } = require('@muyi086/img-compress')
# es6
import { imgCompress } from '@muyi086/img-compress'
```

## Use
Currently only supports pc, mobile framework uniapp and others will hijack canvas related functions, causing unable to create the native canvas of the browser.

```JS
// Data loaded without CORS approval will cause the canvas to be polluted, and the canvas.toDataURL will report an error
// compress img, return base64
console.log(imgCompress.compress(imgObj, quality))
// download compressed img
console.log(imgCompress.downloadImg(imgObj, name, quality))
```

## Function

function|parameter|default|required|description|
--|--|--|--|--|
compress|object||required|a img object|
compress|number|1|optional|a float between 0 and 1|
downloadImg|object||required|a img object|
downloadImg|string||required|name for save new img|
downloadImg|number|1|optional|a float between 0 and 1|


## Tips
A Number between `0` and `1` indicating the image quality to use for image formats that use lossy compression such as `image/jpeg` and `image/webp` .

## Wiki
1. [HTMLCanvasElement.toDataURL()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL 'HTMLCanvasElement.toDataURL()')
npm package: @muyi086/img-to-base64
Description: trans img to base64
Author: MuYi086
Latest version: 1.0.10

# img-to-base64

[中文](https://github.com/MuYi086/npm_package/blob/master/img-to-base64/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/img-to-base64) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/img-to-base64) ![npm](https://img.shields.io/npm/dt/@muyi086/img-to-base64) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/img-to-base64
# common JS
const { imgToBase64 } = require('@muyi086/img-to-base64')
# es6
import { imgToBase64 } from '@muyi086/img-to-base64'
```

## Use
Currently only supports pc, mobile framework uniapp and others will hijack canvas related functions, causing unable to create the native canvas of the browser.

```JS
// Data loaded without CORS approval will cause the canvas to be polluted, and the canvas.toDataURL will report an error
// parse img url
const url = 'http://img.qipeiren.com/UploadFile/UserProPic/2019/11/23/4b65b8aadcfb0ac65a91.jpg'
console.log(await imgToBase64.parse(url))
// parse img object
const img = document.getElementById('test')
console.log(await imgToBase64.parse(img))
// useCanvas img object
const img = document.getElementById('test')
console.log(imgToBase64.useCanvas(img))
```

## Function

function|parameter|default|required|description|
--|--|--|--|--|
parse|string/object||optional|a img object or img url|
useCanvas|object||required|a img object|


## Tips
As soon as you draw into a canvas any data that was loaded from another origin without `CORS` approval, the canvas becomes tainted.A tainted canvas is one which is no longer considered secure, and any attempts to retrieve image data back from the canvas will cause an exception to be thrown.

## Wiki
1. [Allowing cross-origin use of images and canvas](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image 'Allowing cross-origin use of images and canvas')
npm package: @muyi086/qs
Description: Implementing qs.Stringify and qs.Parse in native JavaScript
Author: MuYi086
Latest version: 1.0.4

# qs

[中文](https://github.com/MuYi086/npm_package/blob/master/qs/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/qs) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/qs) ![npm](https://img.shields.io/npm/dt/@muyi086/qs) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/qs
# common JS
const { qs } = require('@muyi086/qs')
# es6
import { qs } from '@muyi086/qs'
```

## Use
```JS
const queryObj = {
  runEnv: 'mp-weixin',
  shopTabType: 0,
  hasLocation: true,
  longitude: 120.209885,
  latitude: 30.246592,
  vConsole: 0
}
console.log(qs.stringify(queryObj))


const url = '?runEnv=mp-weixin&shopTabType=0&hasLocation=true&longitude=120.209885&latitude=30.246592&vConsole=0'
console.log(qs.parse(url))
```
npm package: @muyi086/quant-learn
Description: record of learning quant, and try
Author: MuYi086
Latest version: 1.0.0

# quant-learn
学习量化的记录和尝试

## 总结
本项目归档于2020年,记录学习量化的一些尝试和想法,应用的技术栈有`js`, `nodejs`, `python` 最终无疾而终。量化一途，博大精深，本人越是深入和尝试，越是自认无法在这个游戏中获得优势，决定放弃。现将整理内容和代码脱敏后开源,仅供学习参考使用，请勿用于商业用途。

## 背景
原设想是使用 `js` 开发的，好上手写策略回测，可是现实很残酷，在使用了 `tqsdk-js` 后，发现 `api` 残缺不全，比 `python` 版`tqsdk` 差的不是一点半点,而且考虑到后期需要本地缓存数据，最终选用了 `akshare`

## 文档说明
[JQData-本地量化数据说明书](https://www.joinquant.com/help/api/help?name=JQData 'JQData-本地量化数据说明书')

[Tqsdk文档](https://doc.shinnytech.com/tqsdk/latest/ 'Tqsdk文档')

[真格文档](https://quant.pobo.net.cn/doc?name=api '真格文档')

[tqsdk-js文档（不完善，接口没数据）](https://github.com/shinnytech/tqsdk-js 'tqsdk-js文档')

[akshare文档](https://www.akshare.xyz/zh_CN/latest/index.html 'akshare文档')


## 交易市场
交易所|示例代码|证券名称
--|:--:|--:
上海证券交易所|'600519.XSHG'|贵州茅台|
深圳证券交易所|'000001.XSHE'|平安银行|
中金所|'IC9999.CCFX'|中证500主力合约|
大商所|'A9999.XDCE'|豆一主力合约|
上期所|'AU9999.XSGE'|黄金主力合约|
郑商所|'CY8888.XZCE'|棉纱期货指数|
上海能源交易所|'SC9999.XINE'|原油主力合约|

## 使用
```SHELL
# tqsdk 下载某个合约所有月份数据, 已保存csv需前往比特球-天勤数据下载
# python获取区间交易日期
https://quant.pobo.net.cn/main#/strategy/editor/52976/0
# python获取日期对应主力合约
https://quant.pobo.net.cn/main#/strategy/editor/54126/0
# python获取全市场期货合约列表
https://quant.pobo.net.cn/main#/strategy/editor/54129/0
# dealtick/src/common/trans.js node截取并存储每个交易日对应主力合约的json
# 已保存json需前往比特球-天勤数据下载
# dealtick node处理所有json并根据策略计算出'买卖标记'
# 将标记导入tqsdk，进行回测
https://www.joinquant.com/algorithm/index/edit?algorithmId=ea6c465ca56c082fddfe5373438fe32b
```

## 策略统计
统计区间 2016-09-01 至 2020-06-01
fn_15波幅最大,从浮盈2倍到负值,感兴趣可以深入研究

策略|盈利次数|亏损次数|次数|交易日|最大回撤|收益|
--|:--:|:--:|:--:|:--:|:--:|--:|
fn_3|49|45|94|918|37.38%|18.17%|
fn_7|25|27|52|918|15.32%|48.87%|
fn_8|27|17|44|918|10.34%|14.38%|
fn_9|22|28|52|918|43.03%|39.72%|
fn_11|22|17|39|918|29.99%|13.57%|
fn_14|43|41|84|918|18.06%|51.21%|
fn总|188|175|363|918|24.71%|185.92%|
fn杠|188|175|363|918|72.37%|523.53%|

## 说明
聚宽策略 `fn` 杠加了强制平仓后策略收益159.3%,最大回撤77.93%，相比之前，损失了许多收益，自此后续日内策略，暂不考虑强制平仓.
```SHELL
# 导入策略回测
https://www.joinquant.com/algorithm/index/edit?algorithmId=332d4db097ad718184b1fdca942e2bae
```

## 常见问题
1. `node` 处理数据内存耗完
```JS
// https://segmentfault.com/a/1190000010437948
node --max-old-space-size=8192 ./trans.js // MB
node --max-new-space-size=8192 ./trans.js // KB
```
npm package: @muyi086/validator
Description: do some useful validate
Author: MuYi086
Latest version: 1.0.9

# validator

[中文](https://github.com/MuYi086/npm_package/blob/master/validator/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/validator) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/validator) ![npm](https://img.shields.io/npm/dt/@muyi086/validator) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/validator
# common JS
const validator = require('@muyi086/validator')
# es6
import validator from '@muyi086/validator'
```

## Use
```JS
// phone
const phone = '15507810249'
const value = validator.verify(phone, 'phone')

// telPhone
const telPhone = '0571-4340259'
const value = validator.verify(telPhone, 'telPhone')

// email
const email = 'yanglu4340@gmail.com'
const value = validator.verify(email, 'email')

// password
const password = 'helloWorld888'
const value = validator.verify(password, 'password')

// dateTime
const dateTime = '2020-11-03'
const value = validator.verify(dateTime, 'dateTime')

// identityCard
const identityCard = '43062319181212003X'
const value = validator.verify(identityCard, 'identityCard')

// website
const url = 'www.baidu.com'
const value = validator.verify(url, 'website')

// taxnum
const taxnum = '259595959529592'
const value = validator.verify(taxnum, 'taxnum')

// isNum
const temp = '259595'
const value = validator.verify(temp, 'isNum')

// isImg
const temp = 'jpg'
const value = validator.verify(temp, 'isImg')

// isVideo
const temp = 'mp4'
const value = validator.verify(temp, 'isVideo')

// isAudio
const temp = 'mp3'
const value = validator.verify(temp, 'isAudio')

// isLetter
const temp = 'mp3'
const value = validator.verify(temp, 'isLetter')

// isNumLetter
const temp = 'mp3'
const value = validator.verify(temp, 'isNumLetter')

// isHanzi
const temp = '张三'
const value = validator.verify(temp, 'isHanzi')

// verify length
const password = 'helloWorld888'
const limitLength = 10
const value = validator.verify(password, 'password', limitLength)

// verify general fields
// input label name，example: verify (value, '地区')
const address = '杭州市'
const value = @validator.verify(address, '地区')
```

## Attr explain
1. `typeArr` : verify attr array 
1. `typeKeyValue` : verify attr key and value

## Function

function|parameter|default|required|description|
--|--|--|--|--|
verify|value|string|required|a string value needs to verify|
verify|key|string|optional|key attr|
verify|limitLength|number|optional|a number limit value's length|
npm package: @muyi086/var-type
Description: JS variable type checking
Author: MuYi086
Latest version: 1.0.6

# var-type

[中文](https://github.com/MuYi086/npm_package/blob/master/var-type/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/var-type) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/var-type) ![npm](https://img.shields.io/npm/dt/@muyi086/var-type) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/var-type
# common JS
const varType = require('@muyi086/var-type')
# es6
import varType from '@muyi086/var-type'
```

## Use
```JS
// isArray
const a = null
varType.isArray(a)
varType['isArray'](a)

// isArrayBuffer
varType.isArrayBuffer(a)

// isBlob
varType.isBlob(a)

// isBoolean
varType.isBoolean(a)

// isDate
varType.isDate(a)

// isFile
varType.isFile(a)

// isFormData
varType.isFormData(a)

// isFunction
varType.isFunction(a)

// isMap
varType.isMap(a)

// isNull
varType.isNull(a)

// isNumber
varType.isNumber(a)

// isObject
varType.isObject(a)

// isRegExp
varType.isRegExp(a)

// isSet
varType.isSet(a)

// isString
varType.isString(a)

// isURLSearchParams
varType.isURLSearchParams(a)

// isUndefined
varType.isUndefined(a)

// isWeakMap
varType.isWeakMap(a)

// isWeakSet
varType.isWeakSet(a)

// isBuffer
varType.isBuffer(a)

// isStream
varType.isStream(a)

// isProxy
varType.isProxy(a)
```
npm package: @muyi086/verify-code
Description: random some verify Codes
Author: MuYi086
Latest version: 1.0.11

# verify-code

[中文](https://github.com/MuYi086/npm_package/blob/master/verify-code/README-CN.md '中文')

![npm](https://img.shields.io/npm/v/@muyi086/verify-code) ![npm bundle size](https://img.shields.io/bundlephobia/min/@muyi086/verify-code) ![npm](https://img.shields.io/npm/dt/@muyi086/verify-code) ![GitHub](https://img.shields.io/github/license/MuYi086/npm_package)

## Install
```SHELL
npm install @muyi086/verify-code
# common JS
const { verifyCode } = require('@muyi086/verify-code')
# es6
import { verifyCode } from '@muyi086/verify-code'
```

## Use
```JS
// dom create
<canvas id="canvas"></canvas>
// render verify code
const codeArr = verifyCode.random(3, 5)
// draw on the page
verifyCode.drawImg(codeArr, '#canvas')
/**
 * @param {number} type 1: number;2: letter;3: number + letter 
 * @param {number} len verify code length
 * @param {boolean} slash show slash
 * @param {boolean} point show point
 */
random(type, len, slash = true, point = true)
```