Skip to content

Refactor: Documentation Update 1.2.10 #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"presets": [
"env"
["@babel/preset-env", {
"targets": {
"node": "8.3.0"
}
}]
],
"plugins": [
"transform-regenerator",
"transform-object-rest-spread"
"@babel/plugin-transform-regenerator",
"@babel/plugin-proposal-object-rest-spread"
]
}
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"root": true,

"plugins": [
"jsdoc",
"mocha"
Expand Down
3 changes: 1 addition & 2 deletions .jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dictionaries": ["jsdoc"]
},
"source": {
"include": ["lib", "DOCUMENTATION.md"],
"include": ["index.js", "lib", "DOCUMENTATION.md"],
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
Expand All @@ -24,7 +24,6 @@
"recurse": true,
"template": "./node_modules/docdash"
},
"package": "",
"docdash": {
"static": true,
"sort": true,
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.2.10
- meta: bump deps
- meta: normalize eslint config
- refactor: improve doclets

# 1.2.9
- feature: add Invoice model

Expand Down
142 changes: 0 additions & 142 deletions DOCUMENTATION.md

This file was deleted.

37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

[![Build Status](https://travis-ci.org/bitfinexcom/bfx-api-node-models.svg?branch=master)](https://travis-ci.org/bitfinexcom/bfx-api-node-models)

This repo contains model classes for working with the data structures returned by the Bitfinex REST & WebSocket APIs. The models can all be initialized with an array-format payload as returned by an API call, and can be unserialized back to the array format when needed.
This repo contains model classes for working with the data structures returned
by the Bitfinex REST & WebSocket APIs. The models can all be initialized with
an array-format payload as returned by an API call, and can be unserialized
back to the array format when needed.

Some models, such as `Order` and `OrderBook` provide higher level methods which operate on the underlying data sets.
Some models, such as `Order` and `OrderBook` provide higher level methods which
operate on the underlying data sets.

All models provide `serialize()` and `unserialize()` methods, which convert to/from array-format payloads respectively. All model constructors can take either array-format payloads, or objects/other model instances. A helper `toJS()` method is also provided for converting models to plain JS objects (POJOs).
All models provide `serialize()` and `unserialize()` methods, which convert
to/from array-format payloads respectively. All model constructors can take
either array-format payloads, or objects/other model instances. A helper
`toJS()` method is also provided for converting models to plain JS objects
(POJOs).

### Features

Expand Down Expand Up @@ -68,12 +76,15 @@ console.log(o.toNewOrderPacket())

### Docs

Refer to the [docs/](https://cdn.statically.io/gh/bitfinexcom/bfx-api-node-models/master/docs/index.html)
folder for JSDoc-generated API documentation covering each model class.
Refer to [docs/reference.md](docs/reference.md) for JSDoc-generated API
documentation.

### Examples

The order model provides helper methods for order submission, updates, and cancellation. These methods are compatible with version 2.0.0 of `bitfinex-api-node`, and return promises which resolve upon receival of the relevant success/error notifications.
The order model provides helper methods for order submission, updates, and
cancellation. These methods are compatible with version 2.0.0 of
`bitfinex-api-node`, and return promises which resolve upon receival of the
relevant success/error notifications.

Orders are matched with their API packets by one/all of `id`, `gid`, and `cid`.

Expand Down Expand Up @@ -114,13 +125,21 @@ o.submit().then(() => {
})
```

The order book model constructor takes either entire book snapshots as returned by the WSv2 API, or individual update packets with single bids/asks. Once constructed, order books may be updated either with complete snapshots via `updateFromSnapshot(snapshot)` or individual update packets via `updateWidth(entry)`.
The order book model constructor takes either entire book snapshots as returned
by the WSv2 API, or individual update packets with single bids/asks. Once
constructed, order books may be updated either with complete snapshots via
`updateFromSnapshot(snapshot)` or individual update packets via
`updateWidth(entry)`.

Static helpers are also provided for working with array-format order books, in the form of `updateArrayOBWith(ob, entry, raw)`, `arrayOBMidPrice(ob, raw)`, and `checksumArr(ob, raw)`.
Static helpers are also provided for working with array-format order books, in
the form of `updateArrayOBWith(ob, entry, raw)`, `arrayOBMidPrice(ob, raw)`,
and `checksumArr(ob, raw)`.

Checksums may be calculated for normal books via `checksum()`, for comparison with the checksums reported by the WSv2 API.
Checksums may be calculated for normal books via `checksum()`, for comparison
with the checksums reported by the WSv2 API.

Example usage:

```js
const ob = new OrderBook([
[140, 1, 10],
Expand Down
Empty file added docs/.keep
Empty file.
Binary file removed docs/fonts/Montserrat/Montserrat-Bold.eot
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Bold.ttf
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Bold.woff
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Bold.woff2
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Regular.eot
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Regular.ttf
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Regular.woff
Binary file not shown.
Binary file removed docs/fonts/Montserrat/Montserrat-Regular.woff2
Binary file not shown.
Binary file not shown.
Loading