Building a Trading Bot with 1inch API on Polygon

Let’s build a simple trading bot on polygon with 1inch API!

yuichiro aoki
3 min readOct 10, 2021
Photo by Maxim Hopman on Unsplash

Today I’m going to show you how to build a simple trading bot on polygon using 1inch api.

1inch api

With 1inch api, you can get the latest rates on 1inch, trade, and get some tokens information. It’s all free and easy to use, and has an example in the docs. Supported networks are as follows:

  • Ethereum
  • Binance Smart Chain
  • Polygon
  • Optimism
  • Arbitrum

For more

The repo I use in the demo is here.

Let’s Get Started😁

Strategy

This bot trade based on the price change from the last buy/sell action. First, set the base price to the current price, and update it when the bot executes trade. Here is an example of how this would trade when trading Matic and DAI. It sets the threshold as 3%.

--

--