Inspiration

when i saw polymarket for the first time ever, i was really fascinated with the way it works, ie the market changes soo quick and even 1 second delay can result in loss of our asset, from that day i wanted to make all this process free of human interventions, and hence i decided the build it, this hackathon helped me showcase my project

What it does

this is a real time trading bot built for polygon, it constantly fetches the bitcoin price updates and uses this data to make decision quickly, this bot works in a 5 min cycle where at the start of each cycle it records the current btc price as a baseline, as the market moves forward it tracks the current price and compares it with the baseprice to make decision at the very end of the cycle the bot analyzes the price movement and decides if the price is likely to go up or down compared to the baseline, on this analyzed data it places a trade deal

How we built it

the bot is connected to a websocket to get continous bitcoin price updates, these updates are powered by chainlink data streams, which provide real time price tracking for the backend logic we have used typescript and bun for fast execution for interaction with the polymarket we have used CLOB ie central limit order book api, this allows the bot to programmatically create and submit orders and for wallet integration and signing the contract we have used ethers.js the whole app is designed to be automated and lightweight

Challenges we ran into

the first one for us was setting up the environment as i havent used bun much, installing all the dependencies was a bit hectic then, the biggest bug i feel in my project was the baseline error, the bot always compared the values with assumption of baseline as 0, this made all the written logic of no use. private key want loading due to which the bot crashed instantly, this we fixed by adding a .env file

Accomplishments that we're proud of

1)real time blockchain trading: we can proudly say that we built a bot that places real prediction market orders on polygon blockchain autonomously 2)live oracle integration: the main this is connecting the blockchain with real life, which is possible through api integration, chainlink's integration via polymarket's web socket helped us receive btc updtes every second in real time 3)no human intervention: our bot is fully self dependent ie no human is needed in between the process, it starts, it watches, it makes decision, it places the trade all this on its own, no human clicks no buttons just bot using his own brain 4)fullstack web3 in one single project: we have connected chainlink, polymarket websocket, clob api, polygon blockchain, all working in sync through a single typescript bot

What we learned

1) how prediction market actually works 2) how chainlink works 3) how on chain order books work 4) websocket communication 5) bun as a runtime, till now i was well versed with node.js but bun is much faster 6) use of typescript in real world projects 7) debugging the whole code in a given time frame 8) web3 is not just about crypto, its a world of its own

What's next for polyBot

1) market beyond btc, we are aiming to give diversity for the users, not just limit them to bet on btc but on othr polygon tokens aswell, we want to expand it to eth, sol and even non crypto predictions like sports, election and other real world stuff 2) daily loss manager, we are planning to reduce the risk of an individual losing a big chuck of his crypto, the bot shuts down automatically if the loss crosses the threshold, we want to make the bot even smarter, right now it knows when to enter but it dosent know when to stop 3)multi wallet manager, right now the bot works synchronously, but we want the bot to manage the whole portfolio for an individual ie multiple tokens at the same time, and we believe this is when we can actually make this bot commercial by adding a small subscription fee, this will make the app more scalable 4)real time alerts, we want our bot to send the user real time notifications through discord or whatsapp 5) we are planning to make an ecosystem for web3 under a big umbrella where polybot would be a small component for it, integrating all the web3 trading needs under a single roof will make our work more trustworthy and would really be scalable

Built With

Share this project:

Updates