Git Product home page Git Product logo

simple-limit-order-bot's Introduction

Simple Limit Order Bot

Client library for a limit order bot that uses [MEV-share](https://docs.flashbots.net/flashbots-mev-share/overview).

limit orders

Limit orders are a common feature on exchanges which let you fill an order when the price of a trading pair (e.g. ETH/DAI) reaches a target that you specify. For example, if I wanted to buy DAI when the price reaches 1800 DAI/ETH, I could place a limit order for to buy 1800 DAI for 1 ETH, and the trade would automatically execute when the price reached 1800. If the price was over 1800, then we’d want to fill our order at the higher price — since we’re buying DAI, we want more DAI out for a fixed amount of ETH in.

MEV-Share bot

This bot watches the MEV-Share event stream for pending transactions that change the price of a desired trading pair. Then it backruns each of those transactions with our ideal trade. When a transaction sufficiently shifts the price in our favor, our backrun will be first in line to buy the tokens at a discounted rate.

Our backrun transaction will specify an exact price at which the order can be filled, otherwise the transaction reverts. Because we’re sending to Flashbots, reverted transactions won’t land on chain and we won’t pay any fees for failed attempts.

quickstart

Install from npm:

yarn add @flashbots/mev-share-buyer
# or
npm i @flashbots/mev-share-buyer

guide

You can find a longer guide for how to use this bot, and MEV-Share, on the Flashbots docs.

Environment variables

  • BUNDLE_SIMULATION - set to 1 to add simulation to every bundle submission (must wait until user transaction lands on-chain)
  • RPC_URL = Ethereum JSONRPC endpoint
  • EXECUTOR_KEY = Private key of Ethereum account containing the asset you wish to sell on Uniswap V2
  • FB_REPUTATION_PRIVATE_KEY - Private key used for Flashbots submission reputation. Recommend using a brand new private key with no funds

simple-limit-order-bot's People

Contributors

0xsamgreen avatar epheph avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.