Skip to content

Latest commit

 

History

History
189 lines (143 loc) · 6.18 KB

reference.md

File metadata and controls

189 lines (143 loc) · 6.18 KB

Modules

bfx-api-node-util

This module contains minor utilities shared by the Bitfinex Node.JS API libraries.

Functions

genAuthSig(secret, [payload])AuthSignature

Generates an auth signature, payload, and nonce for passing to the WS & REST APIs

isClass(f)boolean

Query if the provided argument is a class

isSnapshot(msg)boolean

Query if the provided message is a websocket snapshot packet

nonce()number

Generates a new nonce for usage with the Bitfinex APIs

padCandles(candles, candleWidth)Array.<Array>

Fills in missing (0 volume) candles on the provided dataset. The result is a new array (does not mutate)

setSigFig(number, [maxSigs])string

Smartly set the precision (decimal) on a value based off of the significant digit maximum. For example, calling with 3.34 when the max sig figs allowed is 5 would return '3.3400', the representation number of decimals IF they weren't zeros.

setPrecision(number, [decimals])string

Casts the provided value to a number if required, and limits the number of decimals to the specified value. Returns a decimal string.

prepareAmount(amount)string

Prepares a amount for submitting via the API

preparePrice(price)string

Prepares a price for submitting via the API

Typedefs

AuthSignature : object

Authorization signature for WS & REST APIs.

bfx-api-node-util

This module contains minor utilities shared by the Bitfinex Node.JS API libraries.

License: MIT

genAuthSig(secret, [payload]) ⇒ AuthSignature

Generates an auth signature, payload, and nonce for passing to the WS & REST APIs

Kind: global function
Returns: AuthSignature - authSignature

Param Type Default Description
secret string API secret
[payload] string "''" signature payload, generated by default

isClass(f) ⇒ boolean

Query if the provided argument is a class

Kind: global function
Returns: boolean - isClass

Param Type Description
f function function to check

isSnapshot(msg) ⇒ boolean

Query if the provided message is a websocket snapshot packet

Kind: global function
Returns: boolean - isSnapshot

Param Type Description
msg Array | Array.<Array> message

nonce() ⇒ number

Generates a new nonce for usage with the Bitfinex APIs

Kind: global function
Returns: number - nonce

padCandles(candles, candleWidth) ⇒ Array.<Array>

Fills in missing (0 volume) candles on the provided dataset. The result is a new array (does not mutate)

Kind: global function
Returns: Array.<Array> - paddedCandles

Param Type Description
candles Array.<Array> array-format candles
candleWidth number in ms

setSigFig(number, [maxSigs]) ⇒ string

Smartly set the precision (decimal) on a value based off of the significant digit maximum. For example, calling with 3.34 when the max sig figs allowed is 5 would return '3.3400', the representation number of decimals IF they weren't zeros.

Kind: global function
Returns: string - str

Param Type Default Description
number number 0 number
[maxSigs] number 5 max significant figures

setPrecision(number, [decimals]) ⇒ string

Casts the provided value to a number if required, and limits the number of decimals to the specified value. Returns a decimal string.

Kind: global function
Returns: string - result

Param Type Default Description
number number | string 0 number
[decimals] number 0 decimal precision

prepareAmount(amount) ⇒ string

Prepares a amount for submitting via the API

Kind: global function
Returns: string - preparedAmount

Param Type Default Description
amount number | string 0 amount

preparePrice(price) ⇒ string

Prepares a price for submitting via the API

Kind: global function
Returns: string - preparedPrice

Param Type Default Description
price number | string 0 price

AuthSignature : object

Authorization signature for WS & REST APIs.

Kind: global typedef
Properties

Name Type Description
payload string request payload, default 'AUTH${nonce}${nonce}''
sig string signature in hexadecimal
nonce number used nonce