Deribit.com RxJS bindings
yarn add deribit-rxjs
ENV vars
DERIBIT_KEY=key_here // API Key
DERIBIT_SECRET=secret_here // API Secret
import { quote, index, positions$, orders$, trades$, sec$, read$, deribit } from 'deribit-rxjs'
See https://www.deribit.com/apiconsole/v2
Websocket messages observable
deribit$.subscribe(console.log)
Authenticate
deribit.authenticate()
.then(() =>
deribit.msg({
method: 'private/get_positions',
params: { currency: 'BTC' },
}),
)
.then(positions => console.log(positions))
Send message
deribit
.msg({'method': 'public/get_time'})
.then(timestamp => console.log(timestamp))
Seconds (no drift)
sec$.subscribe(console.log) // 1545007679000
Index
index('btc').subscribe(console.log) // 3500
Quote
quote('BTC-PERPETUAL').subscribe(console.log) // One instrument
quote('future', 'ETH').subscribe(console.log) // By kind - ['all', 'future', 'option']
Order management
import { order, edit, cancel, stop } from 'deribit-rxjs'
order(opts).subscribe(console.log)
edit(opts).subscribe(console.log)
cancel(order_id).subscribe(console.log)
stop(opts).subscribe(console.log)
Trades
trades$.subscribe(console.log)
Positions
positions$.subscribe(console.log)
Orders
orders$.subscribe(console.log)