Skip to content

bitfinexcom/mandelbrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mandelbrot

Generic adapters for trading, runs in Node.js and in the browser.

Used in sunbeam and cheesebox.

Supports:

Wallets

ws, wu parsing and snapshot handling

Orderbooks

R0 and P1 book handling.

Reference implementation

sunbeam is heavily relying on Mandelbrot and has a nice documentation

You can find the implemented code, with EOSfinex specific extensions here: https://github.com/bitfinexcom/sunbeam/tree/master/lib

Example

This example connects to a Websocket server. When a wallet is sent with ws and wu, it parsed them, stores the current state and logs the result.

const MB = require('mandelbrot')
const Wallet = MB.BaseWallet

class CustomExchangeAdapter extends MB.WsBase {
  constructor (opts) {
    opts.Wallet = Wallet
    super(opts)
  }
}
const ws = new CustomExchangeAdapter({
  url: 'wss://websocket.example.com'
})

ws.on('message', (m) => {
  console.log(m)
})

ws.on('error', (m) => {
  console.error(m)
})

ws.on('open', (m) => {
  ws.onManagedWalletUpdate({}, (res) => {
    console.log('onManagedWalletUpdate', res)
  })
})

ws.open()

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors