cobinhood-rx
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

CobinhoodRx

CobinhoodRx is a Reactive library that was built with TypeScript and rxjs for the Cobinhood API which runs on the node.js platform.


npm npm Travis Renovate badge David


Other Clients

Basic Usage

yarn add cobinhood-rx

or

npm install cobinhood-rx --save

Include in your project

import {
    CobinhoodRxClient,
    LogTypeValue,
    LedgerTypeValue,
    WithdrawalStatusValue,
    TimeframeValue,
    OrderSideValue,
    OrderStateValue,
    Model,
    HttpMethod
} from "cobinhood-rx";

Note: To gain access to rxjs operators such as map(), flatMap(), filter(), you will need to include rxjs in your project.

Install

npm install rxjs

Include in your project

import "rxjs";

Note: Any data that is returned containing decimal values, eg. 0.0007 is converter to a Bignumber Instance.

CobinhoodRx Settings

Parameters

Parameter Type Example
settings (Optional) object {
token: 'xxxx....'
logType: LogTypeValue.Debug,
logWriter: console.log
}

Note: To get your API token sign into your account on cobinhood and generate it. For first time use select the read only options.

Logging

  • logType: The type of logs that should be written or displayed.
    • Debug: Writes all log messages.
    • Error: Writes only error messages.
    • Warning: Writes only warning messages.
    • None: No messages are written.
  • logWriter: A function that takes a single string argument and outputs the log message.

Example

const cobinhoodRx = new CobinhoodRx({
    token: 'xvgru....',
    logType: LogTypeValue.Debug,
    logWriter: console.log
});

Observable Extension

intervalTime(param)

The intervalTime operator returns an observable that emits some sequence of data at specified intervals.

Parameters

Parameter Type Example
milliseconds number 5000

Example

cobinhoodRx.Market.getMarketStats()
    .intervalTime(5000)
    .subscribe(
        data => {
            for (let market of data) {
                console.log(market);
            }
        });

The example above fetches market stats data every 5 seconds.

Documentation

Package Sidebar

Install

npm i cobinhood-rx

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

537 kB

Total Files

319

Last publish

Collaborators

  • harry-sm