Hello, RuDex users and the Scorum community!

Today we have prepared for you something entirely new and very useful. So, the RuDex exchange interface got a new section “Bots”, which name speaks for itself.

At the moment there are two bots that present the strategies of SpreadTrade and TrailingStop.

Over time, our zoo of public trading bots for Bitshares DEX will be expanded, so we invite all users to subscribe to this blog and check the updates.

We sincerely believe that public bots are crucial for the development of DEX and increasing liquidity on the platform by automating routine actions, which is why we decided to equip you with this tools. If you are like us don't mind robots doing all the work for you, then read the instructions below or watch a video tutorial on how to use them for your own benefit.

SpreadTrade bot

STEP-BY-STEP INSTRUCTION:

Basic settings:

- `base` and `quote` fields specify the trading pair that bot uses;

- `balance` field: balance available to the bot for using in `base` & `quote`;

- `amount` field: the amount of the asset, that is placed in the orders (absolute numbers if the `value` is chosen, or percentage of the `balance` if the `balance %` is chosen);

- `spread` field: spread from the center price for every asset pair;

- `default price`: the default price, if this isn’t a bitAsset;

- `get a price from the market`: sets if to take the price from the market or not;

After starting the bot subscribes for a new block in the blockchain. Every time the new block is received it checks two orders: to buy and sell.

If there is no order, it checks if the new order will be executed on placement with the price equal to `feed_price * (1 ± spread / 100)` and if the `balance` is sufficient to place an order with the `amount`.

If the `balance` is sufficient and the order wouldn’t be immediately executed, then the new order is placed. After placing the order, the `balance` field is diminished by `amount`.

If an order exists, the `feed_price` is checked against the order price. If the prices differ more than `spread / 2`, and placing the order at `feed_price * (1 ± spread / 100)` will not immediately execute it, the bot decides to move the order to `feed_price * (1 ± spread / 100)`.

To that end, it cancels the current order, increments the `balance` by the amount remaining in the canceled order, and then creates a new order with required price and an amount that is lower between `balance` and `amount`.

If the `balance` field is a number. If the order for the `base` asset was placed, but after the current check it wasn’t found, then the bot considers an order to be executed. On top of the actions described above, `balance` for `quote` asset is incremented by the price of the executed order, and similar checks exist for the `quote` order.

If the `balance` field is left blank. Then the bot uses full balance of the account that the bot is running from.

If the `balance` field is set to “-”, then the asset balance is considered to be 0, and is not changed.

Price calculation. If the `get price from market` is set, then the price is taken from the market. If the assets are a pair of a smart asset, and core asset (`BTS`), then the prices are recalculated against `base` asset using the price, that was taken from the blockchain. For the smartcoin pairs that don’t use the core asset (`BTS`), the recalculation happens in two steps: the first one calculates price against BTS, and then to the `base` asset.

For the pairs that only have MPA (or only UIA), there is a check if `default price` is set. If it is empty, then the bot asks `binance.com` for a feed. For 2nd tier assets (RUDEX.BTC, OPEN.BTC, etc) the prefixes are dropped. USD matches to USDT. For example the query for OPEN.BTC/OPEN.USD is sent as a BTC/USDT pair.

If the pair doesn’t exist on `Binance`, then the price is set to 0, and no trading happens.

---

TrailingStop bot

STEP-BY-STEP INSTRUCTION:

Basic settings:

- `sellAsset` & `getAsset`: are the asset to sell, and to buy respectively;

- `amount`: is the amount of asset to sell;

- `stoploss` & `minAmount`: the price after which an order is created, and the minimum amount of asset from `getAsset`;

- `trailing percent`: the maximum difference between `stoploss` price and current price.

`Stoploss` field and `minAmount` are linked and shown only for the ease of setting up the bot.

After starting the bot subscribes to the new block in the blockchain. Every time after receiving a block it checks the market price.

If the market price is higher than `stoploss` by more than `trailing_percent`, then the `stoploss` price is changed by this difference. If the market price is lower than `stoploss + trailing_percent / 3`, then the order to sell `sellAsset` with the `stoploss` price and `amount` is placed.

After placing the order the bot stops.

That's all for now! We hope that now it will become even easier for you to maintain SCR and other DEX coins without making excessive efforts.

We will be glad to see any feedback from you, so don’t hesitate and write comments under this post. Also, we will answer any of your questions if you have any.

Our crew wishes you a pleasant flight, stay in touch and be sure to try these new marvelous tools.

- RuDex team


Download RuDex open source desktop application


Support our BLCKCHND witness on Scorum blockchain, your votes support our work!