How to make a profitable trading bot on Aldrin dTWAP? Or how to generate passive income in web3?

rinegade_sol

rinegade.sol

Posted on March 27, 2022

How to make a profitable trading bot on Aldrin dTWAP? Or how to generate passive income in web3?

Aldrin Labs recently released dTWAP - distributed TWAP order
(https://twitter.com/Aldrin_Exchange/status/1505272899149598721)

What is dTWAP

dTWAP - distributed TWAP order.
TWAP - means execution over time (read more here: https://en.wikipedia.org/wiki/Time-weighted_average_price)

What does it mean "distributed"?

It describes the nature of dTWAP implementation:

  1. You create dTWAP order ( example: buy $10mln SOL over next 2 weeks )
  2. dTWAP program will lock $10mln and start slowly unlock it for execution
  3. dTWAP executor bot will notice arbitrage opportunity against any other source of liquidity and execute the ticket

So distributed means that your order might be executed across many liquidity sources from Serum/AMM to private liquidity pool by some VC

So how to create a bot that will be generating revenue?

Well, it's quite easy actually, first you need to learn node.js basics
Then you need to create a simple node.js web-server in Typescript and figure out how to deploy it to Heroku for example
Then you can just add this file https://github.com/aldrin-exchange/aldrin-sdk/blob/feature/dtwap-executor/examples/dtwap/dtwapSwap.ts
to your project, import it, setup private key in ENV and you are good to go

Don't forget to tweak priceDiff at Line 13! At this point (27mar 2022) priceDiff must be at least bigger than 0.5 to be profitable with execution against Aldrin AMM

Improvement ideas:

  • integrate with aggregator
  • integrate with CEX
  • integrate with own liquidity

NOTICE:
dTWAP right now is in private beta mode, so volume might be not that interesting, but it's good opportunity to learn how to create own bot and prepare for full launch in few weeks!

Image description

💖 💪 🙅 🚩
rinegade_sol
rinegade.sol

Posted on March 27, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related