Skip to content

Commit

Permalink
cleaning & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Dec 26, 2020
1 parent 96ef642 commit 976ff20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[1]: https://www.npmjs.com/package/bybit-api

A production-ready Node.js connector for the Bybit APIs and WebSockets.
A production-ready Node.js connector for the Bybit APIs and WebSockets, with TypeScript & browser support.

## Installation
`npm install --save bybit-api`
Expand Down Expand Up @@ -36,12 +36,12 @@ Build a bundle using webpack:
- `npm build`
- `npm pack`

The bundle can be found in `lib/`. Altough usage should be largely consistent, smaller differences will exist. Docs TBC.
The bundle can be found in `dist/`. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO.

### Inverse Contracts
#### Rest client
```javascript
const {RestClient} = require('bybit-api');
const { RestClient } = require('bybit-api');

const API_KEY = 'xxx';
const PRIVATE_KEY = 'yyy';
Expand Down Expand Up @@ -88,11 +88,11 @@ client.changeUserLeverage({leverage: 4, symbol: 'ETHUSD'})
});
```

See inverse [rest-client.js](./lib/rest-client.js) for further information.
See inverse [rest-client.ts](./src/rest-client.ts) for further information.

#### Websocket client
```javascript
const {WebsocketClient} = require('bybit-api');
const { WebsocketClient } = require('bybit-api');

const API_KEY = 'xxx';
const PRIVATE_KEY = 'yyy';
Expand Down Expand Up @@ -150,7 +150,7 @@ ws.on('error', err => {
console.error('ERR', err);
});
```
See inverse [websocket-client.js](./lib/websocket-client.js) & [ws api docs](./doc/websocket-client.md) for further information.
See inverse [websocket-client.ts](./src/websocket-client.ts) for further information.

### Customise Logging
Pass a custom logger which supports the log methods `silly`, `debug`, `notice`, `info`, `warning` and `error`, or override methods from the default logger as desired:
Expand Down
5 changes: 0 additions & 5 deletions src/websocket-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ export class WebsocketClient extends EventEmitter {

const ws = new WebSocket(url);

// ws.onopen!(this._wsOpenHandler.bind(this));
// ws.onmessage!(this._wsMessageHandler.bind(this));
// ws.onerror!(this._wsOnErrorHandler.bind(this));
// ws.onclose!(this._wsCloseHandler.bind(this));

ws.onopen = this._wsOpenHandler.bind(this);
ws.onmessage = this._wsMessageHandler.bind(this);
ws.onerror = this._wsOnErrorHandler.bind(this);
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"compileOnSave": true,
"compilerOptions": {
"declaration": true,
"allowJs": true,
"target": "es6",
"moduleResolution": "node",
"module": "commonjs",
"outDir": "lib",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"removeComments": false,
"noEmitOnError": true,
"noImplicitAny": false,
"strictNullChecks": true,
"skipLibCheck": true,
"sourceMap": true,
"esModuleInterop": true,
"lib": ["es2017","dom"],
"baseUrl": ".",
"outDir": "lib",
"paths": {
"@src/*": ["src/*"]
}
Expand Down

0 comments on commit 976ff20

Please sign in to comment.