Skip to content

Latest commit

 

History

History
145 lines (111 loc) · 4.67 KB

func_docs.md

File metadata and controls

145 lines (111 loc) · 4.67 KB

Functions

genAuthSig(apiSecret, payload)Object

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

isClass(f)boolean
isSnapshot(msg)boolean
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(n, 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

genAuthSig(apiSecret, payload) ⇒ Object

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

Kind: global function
Returns: Object - authSignature

Param Type Description
apiSecret string
payload string optional signature payload, generated by default

isClass(f) ⇒ boolean

Kind: global function
Returns: boolean - isClass

Param Type
f Class

isSnapshot(msg) ⇒ boolean

Kind: global function
Returns: boolean - isSnapshot

Param Type
msg Array | Array.<Array>

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(n, 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 Description
n number
maxSigs number default 5

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
number number | string 0
decimals number 0

prepareAmount(amount) ⇒ string

Prepares a amount for submitting via the API

Kind: global function
Returns: string - preparedAmount

Param Type Default
amount number | string 0

preparePrice(price) ⇒ string

Prepares a price for submitting via the API

Kind: global function
Returns: string - preparedPrice

Param Type Default
price number | string 0