Inspiration
When I first came across Polymarket, I was really fascinated by how fast everything moves. The market updates in real time, and even a delay of a second can impact a trade. It made me realize how hard it is for humans to consistently react at that speed.
That’s what pushed me to think about automating the process. I wanted to build something that could remove human delay and respond instantly to market changes. This project started from that idea, and this hackathon gave me the opportunity to actually build it and showcase how it works.
What it does
This is a real-time trading bot built for Polygon. It continuously fetches live Bitcoin price updates and uses this data to make quick decisions.
The bot operates in 5-minute cycles. At the start of each cycle, it records the current Bitcoin price as a baseline. As the market progresses, it keeps tracking the price and compares it with this baseline.
Towards the end of the cycle, the bot analyzes how the price has moved and decides whether it is likely to go up or down compared to the starting point. Based on this analysis, it places a trade on Polymarket.
How we built it
The bot is connected to a WebSocket to receive continuous Bitcoin price updates. These updates are powered by Chainlink data streams, which provide reliable real-time price tracking.
For the backend logic, the project is built using TypeScript and runs on the Bun runtime for fast execution. To interact with Polymarket, it uses the CLOB (Central Limit Order Book) API, which allows the bot to programmatically create and submit orders.
Wallet integration and transaction signing are handled using ethers.js. Overall, the system is designed to be lightweight and fully automated, where data collection, decision-making, and execution happen without manual intervention.
Challenges we ran into
One of the first challenges we faced was setting up the environment, since I hadn’t worked much with Bun before. Installing dependencies and getting everything to run properly took more effort than expected.
The biggest issue in the project was a bug with the baseline logic. The bot was incorrectly treating the baseline as 0, which made all the comparisons meaningless and broke the entire decision-making process.
We also ran into an issue where the private key wasn’t loading, causing the bot to crash immediately. This was resolved by properly configuring a .env file to securely store and access environment variables.
Accomplishments that we're proud of
- Real-time blockchain trading We built a bot that can autonomously place prediction market orders on the Polygon blockchain. It operates in real time without manual input.
- Live oracle integration A key part of the project is connecting blockchain systems with real-world data. Using Chainlink data streams via Polymarket’s WebSocket, the bot receives live Bitcoin price updates every second.
- No human intervention The entire system is fully automated. The bot starts, monitors the market, makes decisions, and places trades completely on its own — no clicks, no manual actions.
- Full-stack Web3 system in one project This project brings together multiple components — Chainlink (data), Polymarket WebSocket (streaming), CLOB API (trading), and the Polygon blockchain — all working together through a single TypeScript-based system.
What we learned
1)How prediction markets work Learned how platforms like Polymarket operate, where instead of trading assets, users trade outcomes based on probabilities. 2)Chainlink and real-world data integration Understood how Chainlink acts as an oracle to bring real-time external data (like BTC price) into blockchain-based systems. 3)On-chain order books (CLOB) Explored how Central Limit Order Books work in a decentralized setting and how orders are created and matched programmatically. 4)WebSocket communication Learned how to handle real-time data streams and build systems that react instantly to continuous updates. 5)Bun as a runtime Got hands-on experience with Bun, which is significantly faster compared to Node.js and simplifies dependency management. 6)Using TypeScript in real-world projects Improved understanding of writing structured, type-safe code for better scalability and maintainability. 7)Debugging under time constraints Learned how to identify and fix critical issues quickly, such as baseline errors and environment configuration bugs. 8)Understanding Web3 beyond crypto Realized that Web3 is not just about cryptocurrencies, but about building decentralized, automated systems that interact with real-world data.
What's next for polyBot
1)Expanding beyond BTC markets We plan to support multiple markets instead of limiting the bot to Bitcoin. This includes other crypto assets like ETH and SOL, as well as non-crypto prediction markets such as sports and elections. 2)Daily loss management system To reduce risk, the bot will automatically stop trading if losses cross a defined threshold. Currently, it knows when to enter trades, but we want it to also know when to stop. 3)Multi-wallet and portfolio management We aim to extend the bot to handle multiple wallets and assets at the same time, effectively managing a user’s portfolio. This also opens up possibilities for scaling the project commercially with a subscription model. 4)Real-time alerts and notifications We plan to add real-time alerts through platforms like Discord or WhatsApp to keep users updated about trades and performance. 5)Building a broader Web3 ecosystem This bot is part of a larger vision to create a unified Web3 platform that brings together multiple trading tools under one ecosystem, making it more scalable and user-friendly.
Built With
- bun
- chainlink
- css
- ethers.js
- gitbash
- github
- html
- javascript
- polymarketclobapi
- polymarketwebsocket
- typescript
Log in or sign up for Devpost to join the conversation.