@ercdex/mm
v1.0.19
Published
ERC dEX Automation Toolkit
Downloads
30
Readme
Deprecation Notice:
The previous Electron based Automation Toolkit is no longer supported. We apologize for any inconvenience.
Overview
The ERC dEX Automation Toolkit allows traders to create custom trading strategies that will be executed autonomously. Using the dashboard (or a scripting language of your choice, described below), the user creates Markets (e.g. ZRX/WETH), then adds Bands to that market that specify desired price spreads. When a Market is active, Bands will deploy and cancel ERC dEX Orders in accordance with the user defined strategy.
Installation
- Node.js 8+ should be installed
- Yarn:
yarn global add @ercdex/mm
- NPM:
npm install @ercdex/mm -g
Configuration
Importing Private Key
` ercdex-mm import
Options: --passphrase, -p Passphrase to protect private key [required] --privateKey, -k Wallet private key [required] --out, -o Full path (including file name) to output key store JSON [default: "./store.json"] `
Start Dashboard
ercdex-mm start
Start the bot
Options:
--network, -n ERC dEX Network
[choices: "app.ercdex.com", "kovan.ercdex.com", "staging.ercdex.com",
"kovan-staging.ercdex.com", "localhost:8443"] [default: "app.ercdex.com"]
--passphrase, -p Passphrase [required]
--workDir, -w Working directory (where persistent data/configuration files
are stored) [default: "."]
--storePath, -s Location of key store file [default: "./store.json"]
Concepts
A Market describes a persistent configuration that facilates the buying and selling of a token pair. An example of a market is "ZRX/WETH", which means that ZRX is being bought and sold in exchange for WETH. A market is created with parameters that describe the range and amount of assets that are available for trading. At a high level, a Market is responsible for maintaining a trader's overall desired position in the market as prices change.
A Band belongs to a Market - a Market can have multiple bands. A band specifies a price spread and some constraints on how much of an asset should be traded within that band. Bands are responsible for deploying Orders, and a Band can contain multiple Orders at a given time.
An Order represents a signed and deployed ERC dEX order. Orders can move between bands in response to price action. If an Order moves out of the specified price range of any band, it may be canceled.
Architecture and Design Considerations
Automated trading for decentralized platforms presents unique challenges not seen in traditional, centralized changes. Trading tools for decentralized applications have to be designed in a way that acknowledges these challenges and optimizes around them. Below, we'll describe some of the challenges of decentralized platforms and how we handle those issues with the toolkit.
Signing Requirements
Unlike centralized exchanges, which expose simple, centralized endpoints for order creation and cancelation, decentralized exchanges depend on off-chain signing and sending transactions to the Ethereum blockchain as the primary way to authorize actions. As a result, any decentralized trading system requires a local wallet implementation that supports signing. The toolkit includes a minimal light client, enabling 'headless' operation.
Usage
Dashboard
Markets
When you first begin, you'll need to create a new market.
- Label: Unique Identifier of the Market
- Token Pair: Assets being traded
- Parameters
- Initial Amount: This is the initial amount available for trading. Orders will be allocated to match this amount or the available token balance, whichever is higher.
- Minimum Amount: This is the minimum amount of an asset that should be reserved. If the asset amount dips below this amount, the market will be paused and will require intervention from a market operator.
- Minimum Ether Amount: This is the minimum amount of Ether that should be contained in the account at any time. If the available about dips below this amount, the market will be paused and will require intervention from a market operator.
Bands
By default, a market will have no bands; the first step in actually deploying a market is to create bands that specify desirable positions.
- Spread BPS: The spread is defined as the different between the market price on a side (buy or sell) and the midpoint price or market price. 1 bp (basis point) = .1% = .0001
- Tolerance BPS: The tolerance specifies how far in BPS the market price can move before an order is considered out of band
- Weight Weight represents how much a band consumes of the Total Market Commitment (TMC).
- Minimum Weight Minimum weight commitment for a particular band; if deployed orders are filled below this amount, additional orders will be created to keep the band fully committed
- Duration Expiration period of deployed orders in seconds. Limited to 300-1200 seconds (5-20 minutes).
Starting/Stopping
By default, a market is in the "stopped" state, meaning that orders are not being deployed. To begin order deployment and automated position maintenance, click the "Start" button. Verify that the orders have been created by viewing the market in ERC dEX or by viewing band logs.
To stop a market, click the "Stop Market" button.
Markets can be deleted with the "Delete" button; the Market must be stopped before deletion is possible.
Troubleshooting
Windows users may run into various issues around node-gyp, Python (if Python is not installed), and more. Install MS build tools to fix these issues:
npm install --global --production windows-build-tools
Then:
(Yarn users) yarn config set msvs_version 2015 --global
(NPM users) npm config set msvs_version 2015 --global