cobinhood-rx
v0.1.4
Published
CobinhoodRx is a rxjs node wrapper for the CobinhoodRx Api.
Downloads
8
Maintainers
Readme
CobinhoodRx
CobinhoodRx is a Reactive library that was built with TypeScript and rxjs for the Cobinhood API which runs on the node.js platform.
Other Clients
- Coinbinhood.Java (JAVA)
- CryptoExchangeClient (F#)
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.