Code Monkey home page Code Monkey logo

api-arbs-example's Introduction

Arbitrage BOT using Jupiter API

This is not 100% risk free as transaction may fail but it's a proof of concept to use Jupiter API to do arbitrage on Solana.

This code shows:

  • It checks for USDC => SOL, then SOL => USDC, if output amount in USDC is more than input amount in USDC, then it will trade.
  • It will send a minimum 2 transactions and it may fail but it's fine since transaction fee is cheap on Solana.

example

It shows that it earns 1 cent from the screenshot above:

  • First tx: use 20 USDC to get 0.21213753 SOL
  • Second tx: use 0.21213755 SOL to get 20.01 USDC

It earns less than 1 cent because it uses 0.00000002 SOL but that is insignificant.

How to use?

  1. Install dependencies
pnpm install
  1. Just create a .env file with your PRIVATE_KEY

  2. run the file

node index.mjs

api-arbs-example's People

Contributors

siong1987 avatar zhengyutay 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.