Trading Bot Integration with SushiSwap SDK: Code, Setup, Monitoring

A trading bot that makes direct SushiSwap contract calls instead of using the SDK can lose up to 30% of routes. The difference is that the SDK automatically provides current router addresses across 30+ chains and builds routes through v3 pools that legacy code simply ignores. In our practice, we oft

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1450
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1308
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    1003
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1269
  • image_logo-advance_0.webp
    B2B Advance company logo design
    719
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1009

A trading bot that makes direct SushiSwap contract calls instead of using the SDK can lose up to 30% of routes. The difference is that the SDK automatically provides current router addresses across 30+ chains and builds routes through v3 pools that legacy code simply ignores. In our practice, we often encounter projects where integration bypasses the SDK, resulting in lost liquidity and reduced profits. One client with an arbitrage bot on Arbitrum increased successful routes by 24% and cut gas costs by 18% after switching to @sushiswap/router, thanks to dynamic gas pricing.

We are a team with many years of experience in blockchain development. Over that time, we have completed over 40 trading bot integrations on SushiSwap and other DEXs. In this article, we share key aspects to consider when connecting a bot to the SushiSwap SDK.

Which version of SushiSwap SDK to choose for a trading bot?

SushiSwap SDK v3 (@sushiswap/sdk) and the newer @sushiswap/router are different packages with different APIs. @sushiswap/router is the current standard, supporting SushiSwap v3 (concentrated liquidity), v2, and routing through multiple protocols simultaneously. The old @sushiswap/sdk only works with v2 pools—it's outdated for most tasks. We've seen bots that ran on the old SDK for years, unaware they lost 20-30% of routes due to missing v3 pools.

Version v2 Support v3 Support Multi-chain Status
@sushiswap/sdk Yes No Yes Legacy
@sushiswap/router Yes Yes Yes Active

Why passing an accurate gasPrice is critical for net profit?

import { Router } from '@sushiswap/router' import { ChainId } from '@sushiswap/chain' const trade = await Router.getBestRoute({ chainId: ChainId.ARBITRUM, fromToken: WETH, toToken: USDC, amount: parseUnits('1', 18), gasPrice: await provider.getGasPrice(), }) 

getBestRoute returns the optimal route considering gas. If a zero or stale gasPrice is passed, the route is optimized only by output token amount, ignoring net profit. The formula for a trading bot is: netProfit = outputAmount - inputAmount - gasCost. The gasPrice should be fetched from the mempool, not cached. In one project, we reduced gas costs by 18% after implementing dynamic gas pricing.

How does monitoring pools via The Graph help a bot?

SushiSwap has subgraphs for each chain. For a bot monitoring liquidity events or tracking price changes, queries through The Graph are more efficient than direct on-chain calls. However, The Graph has a delay of a few seconds, so for real-time, WebSocket subscriptions to Sync (v2) or Swap (v3) events via ethers.js are better. Comparison of methods:

Method Latency RPC Load Suitable For
The Graph 2-10 seconds Low Infrequent price updates
WebSocket (ethers.js) 100-500 ms Medium Arbitrage, HFT
On-chain (polling) 1-12 seconds High Fallback option

Risks of using an outdated SDK version?

The old @sushiswap/sdk does not support v3 routes, leading to a loss of 20-30% of available liquidity. Additionally, it may not support new chains or EIPs, causing transaction errors. For example, after the transition to EIP-1559, code without an SDK update cannot correctly set maxPriorityFeePerGas, causing transactions to stall. Regularly update the SDK to the latest version—the SushiSwap team adds support for new networks and fixes bugs.

Multi-chain configuration

The SDK automatically resolves contract addresses by chainId, but for custom configurations (own node, custom RPC), you must pass the providers map explicitly:

import { providers } from 'ethers' const providerMap = { [ChainId.ETHEREUM]: new providers.JsonRpcProvider(ETH_RPC), [ChainId.ARBITRUM]: new providers.JsonRpcProvider(ARB_RPC), [ChainId.POLYGON]: new providers.JsonRpcProvider(POLY_RPC), } 

Using public RPCs (Infura, Alchemy free tier) leads to rate limiting under intensive monitoring. For a production bot, we recommend a private node or a paid tier with guaranteed throughput.

Executing the swap via the router

The SushiSwap v3 router on Arbitrum is 0x...RouteProcessor3. The SDK generates calldata for processRoute() automatically:

const { routeProcessorAddr, routeCode } = trade const tx = await routeProcessor.processRoute( fromToken.address, amountIn, toToken.address, minAmountOut, // amountOut * (1 - slippage) recipient, routeCode, ) 

minAmountOut is protection against slippage. For an arbitrage bot, slippage tolerance should be minimal (0.1-0.3%), otherwise the transaction could execute at a loss if the market moves between simulation and block inclusion.

What our work includes

  1. Analysis of the current bot architecture and trading strategy.
  2. Designing routing accounting for multi-chain and multi-version.
  3. Writing code using @sushiswap/router, configuring RPC, gas management.
  4. Testing on testnet with simulated peak loads.
  5. Deployment to mainnet with gradual volume increase.
  6. Monitoring and alerting—integration with Tenderly or a custom backend.
  7. Configuration and operations documentation.
  8. Support for one month after launch.

Timeline estimates

Integration of a trading bot with SushiSwap SDK takes 3–5 days for a single chain. A multi-chain system with routing through multiple protocol versions and pool monitoring takes up to one week. Includes testnet testing and documentation. Contact us for a project assessment—we will prepare a commercial proposal considering your strategy. Get a consultation to learn how to optimize your bot for the current architecture.