ex-apis-node-sdk
v1.0.0
Published
Unified Node.js SDK for multiple cryptocurrency exchange APIs
Readme
使用说明
安装
npm i ex-apis-node-sdk本地运行
git clone https://github.com/tina0597/ex-apis-node-sdk.git
cd ex-apis-node-sdk
npm run install
npm run build测试用例
| 文件名 | 说明 | | :--------------------------------: | :------------------: | | __test__/api.spec.ts | 现货/合约相关测试用例 | | __test__/websocketTest.spec.ts | 消息推送相关测试用例(待实现) |
运行特定测试
1. 运行名称包含 "获取币种信息" 的测试
npm test -- -t "获取币种信息"2. 运行 TestAccount 测试套件下的所有测试
npm test -- -t "TestAccount"API示例
import 'dotenv/config';
import { SpotFactory, IBitmartConfig } from '../src';
const config: IBitmartConfig = {
apiKey: process.env.BITMART_API_KEY || '',
apiSecret: process.env.BITMART_SECRET_KEY || '',
memo: process.env.BITMART_MEMO || '',
};
const bitmartSpot = SpotFactory.getInstance('bitmart', config);
const coins = await bitmartSpot.account.coins('floki');
console.log('获取币种信息:', coins);websocket示例
待实现RSA
如果你的apikey是RSA类型则主动设置签名类型为RSA
// config.ts
const config: IBitmartConfig = {
apiKey: '',
apiSecret: '',
memo: '',
signType: BIZ_CONSTANT.RSA // 如果你的apikey是RSA类型则主动设置签名类型为RSA
}项目结构
ex-apis-node-sdk/
├── __test__/ # 测试用例
├── src/ # 源代码
│ ├── core/ # 核心客户端
│ ├── exchanges/ # 交易所实现
│ │ └── bitmart/ # Bitmart 交易所实现
│ ├── factory/ # 工厂模式实现
│ └── types/ # 类型定义
├── tsconfig.json # TypeScript 配置
├── package.json # 项目配置
└── README.md # 项目文档