CobinhoodRx is a Reactive library that was built with TypeScript and rxjs for the Cobinhood API which runs on the node.js platform.
- Coinbinhood.Java (JAVA)
- CryptoExchangeClient (F#)
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.
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.
- 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.
const cobinhoodRx = new CobinhoodRx({
token: 'xvgru....',
logType: LogTypeValue.Debug,
logWriter: console.log
});
The intervalTime operator returns an observable that emits some sequence of data at specified intervals.
Parameter | Type | Example |
---|---|---|
milliseconds | number | 5000 |
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.