npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@steven4354/js-routefire

v1.0.8

Published

Trade cryptocurrencies and digital assets across all major exchanges with a single, stable, unified API.

Downloads

11

Readme

js-routefire: a native Javascript SDK for the Routefire API

Trade cryptocurrencies and digital assets across all major exchanges with a single, stable, unified API.

Setup

Installing

Can be installed with NPM via:

npm install js-routefire

Importing

Simply import as normal:

const Routefire = require("js-routefire")

Getting an account

You will at minimum need a free Routefire account, which can be obtained for free at the Routefire web site -- use the access code OSSFIRE to obtain a free account supporting all DMA features.

Usage

The simplest way to use the API is using username/password authentication. To do this, simply call the New function:

const rfClient = new Routefire("<your-routefire-user>", "<your-routefire-password>")

Direct market access (DMA) orders

The DMA API provides low-level access to the connectivity layer in Routefire Core. Therefore, DMA orders specify precisely the venue and price level at which to place a trade, instead of using an algorithm to decide the optimal way to enter the order. (A standard free Routefire account is a DMA account.)

The DMA API is available via the methods ending in *DMA:

  • submitOrderDMA: submit an order to a trading venue
  • orderStatusDMA: get order status from a trading venue
  • cancelOrderDMA: cancel a given order at a trading venue
  • GetConsolidatedOrderBookDMA: get consolidated order book across trading venues
  • BalanceDMA: get balance for a given asset at a given venue

Routefire (algorithmic) orders

To submit orders that are worked by Routefire algorithms, a different set of methods is used from DMA (direct market access) modules. The unit tests in routefire_test.go demonstrate how these orders are parameterized: each algorithm has a unique set of parameters that it accepts; the parameters used in the unit test are the most commonly used.

To submit an order, call submitOrder:

algoParams = {
	"target_seconds": "100",
	"backfill":       "1.0",
	"aggression":     "0.0",
}

resp = rfClient.submitOrder("btc", "usd", "0.003", "", "rfxw", algoParams)

This submits an algorithmic order to buy 0.003 BTC using USD via the RFXW trading algorithm. RFXW is instructed to target 100 seconds to fill the order, and the 1.0 value given to backfill indicates that liquidity can be taken to avoid falling behind schedule. Note that no price is provided or needed for algorithmic orders.

The order ID for the new order (assuming submission was successful) will be contained in the OrderId field of resp. This ID can be used in subsequent calls to either check the status of or cancel the order. For example:

status = rfClient.getOrderStatus(resp['order_id'])

Or:

status = rfClient.cancelOrder(resp['order_id'])

Handling numbers

All functions accept string values for prices and quantities (to preserve numerical precision).

Important constants

String identifiers are used to specify assets, trading venues, and side. These constants are provided in costants.js. Most importantly, there are:

  • Assets: e.g. Usd, Btc
  • Trading venues: e.g. CoinbasePro, Binance
  • Side: SideBuy, SideSell, SideShort, SideCover

Examples

Examples are provided in the examples directory of this repository: