@@ -13,7 +13,7 @@ jobs:
|
|||||||
- node-deps-v1-{{ .Branch }}-{{checksum "package-lock.json"}}
|
- node-deps-v1-{{ .Branch }}-{{checksum "package-lock.json"}}
|
||||||
- run:
|
- run:
|
||||||
name: install packages
|
name: install packages
|
||||||
command: npm ci
|
command: npm ci --ignore-scripts
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: node-deps-v1-{{ .Branch }}-{{checksum "package-lock.json"}}
|
key: node-deps-v1-{{ .Branch }}-{{checksum "package-lock.json"}}
|
||||||
paths:
|
paths:
|
||||||
|
|||||||
4
.github/workflows/npmpublish.yml
vendored
4
.github/workflows/npmpublish.yml
vendored
@@ -40,13 +40,13 @@ jobs:
|
|||||||
node-version: 12
|
node-version: 12
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci --ignore-scripts
|
||||||
if: steps.version-updated.outputs.has-updated
|
if: steps.version-updated.outputs.has-updated
|
||||||
- run: npm run clean
|
- run: npm run clean
|
||||||
if: steps.version-updated.outputs.has-updated
|
if: steps.version-updated.outputs.has-updated
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
if: steps.version-updated.outputs.has-updated
|
if: steps.version-updated.outputs.has-updated
|
||||||
- run: npm publish
|
- run: npm publish --ignore-scripts
|
||||||
if: steps.version-updated.outputs.has-updated
|
if: steps.version-updated.outputs.has-updated
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -15,6 +15,17 @@ Node.js connector for the Bybit APIs and WebSockets, with TypeScript & browser s
|
|||||||
- Issues? Check the [issues tab](https://github.com/tiagosiebler/bybit-api/issues).
|
- Issues? Check the [issues tab](https://github.com/tiagosiebler/bybit-api/issues).
|
||||||
- Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram.
|
- Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram.
|
||||||
|
|
||||||
|
## Related projects
|
||||||
|
Check out my related projects:
|
||||||
|
- Try my connectors:
|
||||||
|
- [ftx-api](https://www.npmjs.com/package/ftx-api)
|
||||||
|
- [bybit-api](https://www.npmjs.com/package/bybit-api)
|
||||||
|
- [binance](https://www.npmjs.com/package/binance)
|
||||||
|
- Try my misc utilities:
|
||||||
|
- [orderbooks](https://www.npmjs.com/package/orderbooks)
|
||||||
|
- Check out my examples:
|
||||||
|
- [awesome-crypto-examples](https://github.com/tiagosiebler/awesome-crypto-examples)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Most methods accept JS objects. These can be populated using parameters specified by Bybit's API documentation.
|
Most methods accept JS objects. These can be populated using parameters specified by Bybit's API documentation.
|
||||||
- [Bybit API Inverse Documentation](https://bybit-exchange.github.io/docs/inverse/#t-introduction).
|
- [Bybit API Inverse Documentation](https://bybit-exchange.github.io/docs/inverse/#t-introduction).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"description": "Node.js connector for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.",
|
"description": "Node.js connector for Bybit's REST APIs and WebSockets, with TypeScript & integration tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"clean": "rm -rf lib dist",
|
"clean": "rimraf lib dist",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:clean": "npm run clean && npm run build",
|
"build:clean": "npm run clean && npm run build",
|
||||||
"build:watch": "npm run clean && tsc --watch",
|
"build:watch": "npm run clean && tsc --watch",
|
||||||
|
|||||||
@@ -393,21 +393,6 @@ export class InverseClient extends BaseRestClient {
|
|||||||
return this.postPrivate('v2/private/position/switch-isolated', params);
|
return this.postPrivate('v2/private/position/switch-isolated', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Risk Limit
|
|
||||||
*/
|
|
||||||
|
|
||||||
getRiskLimitList(): Promise<APIResponseWithTime<any>> {
|
|
||||||
return this.getPrivate('open-api/wallet/risk-limit/list');
|
|
||||||
}
|
|
||||||
|
|
||||||
setRiskLimit(params: {
|
|
||||||
symbol: string;
|
|
||||||
risk_id: string;
|
|
||||||
}): Promise<APIResponseWithTime<any>> {
|
|
||||||
return this.postPrivate('open-api/wallet/risk-limit', params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funding
|
* Funding
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -401,24 +401,6 @@ export class InverseFuturesClient extends BaseRestClient {
|
|||||||
return this.getPrivate('futures/private/trade/closed-pnl/list', params);
|
return this.getPrivate('futures/private/trade/closed-pnl/list', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
**** The following are all the same as the inverse client ****
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Risk Limit
|
|
||||||
*/
|
|
||||||
getRiskLimitList(): Promise<APIResponseWithTime<any>> {
|
|
||||||
return this.getPrivate('open-api/wallet/risk-limit/list');
|
|
||||||
}
|
|
||||||
|
|
||||||
setRiskLimit(params: {
|
|
||||||
symbol: string;
|
|
||||||
risk_id: string;
|
|
||||||
}): Promise<APIResponseWithTime<any>> {
|
|
||||||
return this.postPrivate('open-api/wallet/risk-limit', params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Funding
|
* Funding
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -79,12 +79,6 @@ describe('Public Inverse-Futures REST API GET Endpoints', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getRiskLimitList()', async () => {
|
|
||||||
expect(await api.getRiskLimitList()).toMatchObject(
|
|
||||||
successResponseList('ok')
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getMyLastFundingFee()', async () => {
|
it('getMyLastFundingFee()', async () => {
|
||||||
expect(await api.getMyLastFundingFee({ symbol: symbol })).toMatchObject(
|
expect(await api.getMyLastFundingFee({ symbol: symbol })).toMatchObject(
|
||||||
successResponseObject()
|
successResponseObject()
|
||||||
|
|||||||
@@ -183,16 +183,4 @@ describe('Private Inverse-Futures REST API POST Endpoints', () => {
|
|||||||
ret_msg: 'Isolated not modified',
|
ret_msg: 'Isolated not modified',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setRiskLimit()', async () => {
|
|
||||||
expect(
|
|
||||||
await api.setRiskLimit({
|
|
||||||
symbol,
|
|
||||||
risk_id: 'myriskid',
|
|
||||||
})
|
|
||||||
).toMatchObject({
|
|
||||||
ret_code: -1,
|
|
||||||
ret_msg: `Currently not support symbol[${symbol}]`,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -77,12 +77,6 @@ describe('Private Inverse REST API Endpoints', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('getRiskLimitList()', async () => {
|
|
||||||
expect(await api.getRiskLimitList()).toMatchObject(
|
|
||||||
successResponseList('ok')
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getClosedPnl()', async () => {
|
it('getClosedPnl()', async () => {
|
||||||
expect(await api.getClosedPnl({ symbol: symbol })).toMatchObject(
|
expect(await api.getClosedPnl({ symbol: symbol })).toMatchObject(
|
||||||
successResponseObject()
|
successResponseObject()
|
||||||
|
|||||||
@@ -178,16 +178,4 @@ describe('Private Inverse REST API Endpoints', () => {
|
|||||||
})
|
})
|
||||||
).toMatchObject(successResponseObject());
|
).toMatchObject(successResponseObject());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('setRiskLimit()', async () => {
|
|
||||||
expect(
|
|
||||||
await api.setRiskLimit({
|
|
||||||
symbol,
|
|
||||||
risk_id: 'myriskid',
|
|
||||||
})
|
|
||||||
).toMatchObject({
|
|
||||||
ret_code: API_ERROR_CODE.RISK_LIMIT_NOT_EXISTS,
|
|
||||||
ret_msg: 'risk limit not exists',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user