Skip to content

EvanGottschalk/ArbitrageAutomator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

ArbitrageAutomator

A defi arbitrage bot that leverages flash loans
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgements

About The Project

The ArbitrageAutomator is a trading bot built for decentralized exchanges on the Ethereum blockchain. It achieves profits by finding differing prices for the same tokens on different exchanges, and then trading them away on one platform and for them on the other for a positive return. This is known as "arbitrage".

These arbitrage opportunities exist for two reasons:

  1. Liquidity Pool Size - most decentralized exchanges change their exchange rates for tokens based on how many tokens the exchange has itself. Thus, as tokens flow in and out of different exchanges' token pools, the prices on those exchanges fluctuate over time.
  2. Trading Method - some decentralized exchanges use order books for trades, which means traders directly determine the possible trades available to the bot at any given time. Meanwhile, other decentralized exchanges have purely automated market prices based on their liquidity pool size. As a result, the prices of the same tokens can be different on exchanges whose prices are determined in one of these two ways.

In addition to taking advantage of automated market makers (AMMs), which are made possible thanks to blockchain, the ArbitrageAutomator also utilizes another blockchain innovation: flash loans.

Flash loans are zero risk, zero interest loans that can be taken out for very brief periods from decentralized exchanges. This is possible due to the nature of the Ethereum blockchain: when a transaction is attempted, it will either entirely be accepted by the blockchain, or entirely rejected if even one thing goes wrong. By including the borrowing and the repaying of the loan within the same transaction, the only outcomes are that the borrowing doesn't occur, or that the loan is taken out and repaid. There's no risk to the lender, and no risk or interest to the borrower.

Flash loans are used to fund the ArbitrageAutomator's trades. First, it borrows tokens and uses them to buy a token on one exchange. It then sells those tokens at a higher price on a different decentralized exchange, and uses the returns to pay back the loan. By including all of these steps in one transaction, these loans and trades can be executed with zero risk.

Built With

  • Web3
  • Axios

Installation

  1. Clone the repository.

  2. Navigate to the project folder in the command line and install the necessary packages.

npm install
  1. Deploy the Solidity files for the TradingBot smart contract.

  2. Fill in the .env file:

  • RPC_URL - public address of an Ethereum node
  • ADDRESS - bot account public address
  • PRIVATE_KEY - bot account private key
  • CONTRACT_ADDRESS - smart contract address
  1. Run index.js
node src/index.js
  1. Congratulations! Your bot is now up and running. It will check for a new arbitrage opportunity every 3 seconds by default. This value can be changed at the bottom of index.js

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU GPL-3 License. See LICENSE for more information.

Contact

Evan Gottschalk - @EvanOnEarth_eth - [email protected]

Project Link: https://github.com/EvanGottschalk/ArbitrageAutomator

Acknowledgements

Thinking about contributing to this project? Please do! Your Github username will then appear here.

About

A defi trading bot that leverages flash loans

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published