#App

By Jason Ridgway-Taylor

Batcher stands out amongst DEXs due to its batch clearing method, but this uniqueness can also cause some friction with traders who are used to traditional ‘live’ DEXs.

The batches that give Batcher its name are ten-minute windows, within which traders on either side of the trade can deposit a swap order in the expectation that sufficient volume will be deposited on the other side so that the order can be filled. The timing of finding volume for your trade can be problematic in periods of low activity.

With this in mind, Marigold has built new bots to alleviate this friction and make transitioning to using Batcher easier. The first is a notification bot to post to Telegram when trades are made. The second is a bot that can supply liquidity into Batcher automatically based on some rules.

Telegram Notification Bot

The telegram bot runs as part of the Marigold infrastructure, listens to the Batcher contract, and sends notifications to Telegram upon deposits and batch state changes.

https://hackmd-prod-images.s3-ap-northeast-1.amazonaws.com/uploads/upload_5548de3a00cf62cebabc09baad39bfef.png?AWSAccessKeyId=AKIA3XSAAW6AWSKNINWO&Expires=1684749958&Signature=nBRe99uYyHkiZSq9fCVoITTVfUM%3D

The deposit notifications will supply helpful information regarding deposits made into Batcher.

          - The batch number
          - The trading pair
          - The side the trade was made on
          - The tolerance level
          - The amount of the deposit

Batch Status Updates

https://hackmd-prod-images.s3-ap-northeast-1.amazonaws.com/uploads/upload_e1187f25f215a19bcd592c51758f7e2b.png?AWSAccessKeyId=AKIA3XSAAW6AWSKNINWO&Expires=1684749996&Signature=3ilAGsKg5ekoYlqn2nJt3TuHmWs%3D

Batch status updates are posted to Telegram upon changes to the batch state when the volume in the batch is non-zero.

          - The batch number
          - The trading pair
          - The batch state (open -> closed -> cleared)
          - The buy and sell volume within the given batch

Telegram Channels

The notifications are made to the following channels:

Liquidity Bot

The liquidity bot allows deposits to be made automatically based on configuration. There are two specific modes of liquidity:

          - JIT (just-in-time): This mode listens for trades in each batch and places an opposing deposit.
         - ALWAYS-ON: This mode supplies a given deposit at batch open.

Both modes use a similar configuration file that supplies rules for the deposits for one or more pairs. Examples of config files for mainnet and ghostnet are bundled with the release; they include the variables for the Batcher contract address, the address of a Tezos node and the relevant tzkt api address. More importantly, they contain the configuration of the liquidity provision for the token pairs.


 "token_pairs":  [
    {
      "name": "tzBTC/USDT",
      "side": "both",
      "buy_limit_per_batch": 0.02,
      "buy_tolerance": "worse",
      "sell_limit_per_batch": 200,
      "sell_tolerance": "oracle"
    },
    {
      "name": "tzBTC/EURL",
      "side": "either",
      "buy_limit_per_batch": 0.02,
      "buy_tolerance": "oracle",
      "sell_limit_per_batch": 220,
      "sell_tolerance": "better"
    }
  ]

When running the bot, a user is free to only include the pairs they are interested in.

Side

The ‘side’ configuration is the side that a user is interested in trading.  These can be:

  • both - one can supply liquidity to both sides of a trade if one should choose.
  • either - one can supply either side of a trade; this is only a valid option for the ‘jit’ mode.
  • buy - only supply liquidity for the buy side of a given pair
  • sell - only supply liquidity for the sell side of a given pair

Limit Per Batch

The buy_limit_per_batch and sell_limit_per_batch configurations define the deposit size that will occur in any given batch.

Tolerance

With the buy_tolerance and sell_tolerance, one can set their choice of price level for a given batch that one is willing to trade at. These follow the usual Batcher conventions:

  • worse - A worse price but a better chance of the order being filled
  • oracle - Trade at the Oracle price accepted after the batch has closed
  • better - A better price but less chance of being filled.
The tolerances are ten basis points off a given future Oracle price.

Releases

The first release (v1.0.0) for the liquidity bot can be found in the Batcher repo release page.

Batcher Releases

More detailed instructions on how to run the run the bot are included in the README; this will also be bundled with the release. The bots are provided as is, but as always, any feedback or suggestions for improvements or features is most welcome.

Conclusion

Marigold is committed to bringing new and novel tools to Tezos. These additional tools for the burgeoning Batcher ecosystem will provide new ways of interacting with Batcher.

If you wantto know more about Marigold, please follow us on social media (Twitter, Reddit, Linkedin)!

Scroll to top