Quick Engine

Quick engine allows to use upstream liquidity market source to create market pairs, which are not present on upstream exchange.

For example, if upstream exchange has BTC/ABC pair listed, and does not have desired BTC/XYZ pair, but there is a service to provide live ABC/XYZ conversion prices, quick engine can be used to list BTC/XYZ on your platform.

Quick Orders

Quick orders are the only order type available for quick engine. Under the hood, when a quick order is submitted, f.e, BTC/XYZ, engine will recalculate it's value in intermediate currency ABC and submit BTC/ABC FOK (fill or kill) order to upstream engine.

API for creating QE orders is almost the same as regular trading API, except it does not accept 'type' for order. To get valid price for submitting an order, use quick exchange price (/api/v2/qe/prices) endpoint.

API

Running quick engine also allows to access to additional API:

POST /api/v2/qe/orders

API for creating "quick" orders. This the only order type available for quick engine. Quick orders act as a market orders. Quick engine does not support limit orders.

Params

param type desc
market string market id
side string buy or sell
amount decimal valid decimal value
price decimal valid decimal value

GET /api/v2/qe/prices

API for estimating current conversion price.

Params

param type desc
market string market id
side string buy or sell

Forex service

Forex is a service providing live updates of prices. It unifies several price providers under same API:

  • Binance
  • Bitfinex
  • Fixer
  • Uniswap v2 and v3
  • Static provider for predefined price (testing purposes mainly)

Finex uses openware/pkg implementation of forex client for integration.

Configuration

Environment variables:

Name Description
FINEX_FOREX_HOST Host of Forex service
FINEX_QE_CURRENCY Intermediate currency for conversion
FINEX_QE_MAX_AMOUNT Maximum value per one order (in intermediate currency)
FINEX_QE_MIN_AMOUNT Minimum value per one order (in intermediate currency)
FINEX_QE_LIQUIDITY_ACCOUNT Account used by engine to reflect "other side" of trades

Database:

To create a quick market, set market type to "qe" (default is "spot"). Also next options can be set in market's data:

Name Description
buy_spread Spread adjustment for buy orders
sell_spread Spread adjustment for sell orders
pair (Required) Upstream market pair to use, should be separated by '/', BTC/USD
max_slippage Maximum price slippage (for submitted price and current forex price)
upstream_price_precision Upstream market price precision
upstream_amount_precision Upstream market amount precision