// Rich_System_Site
Stack
- Node.jsDockerCypressPM2Svelteshell
π€ __My automated betting bot π
For this project, we had a pretty big task on our hands. Our client had a betting system that was a bit sluggish due to manual input, so we decided to automate it to make things smoother. On top of that, I designed a custom logging system. At first, I had it set up on my NAS in a Docker container, but I ran into a few hiccups with one of the tools I was using. Eventually, I managed to eliminate the need for end-to-end testing tools for scraping, which also meant we could ditch the Docker container.
π How it works:
I scrape data from a tips website and then check it against the system, which consists of a set of rules we've created to decide if a bet is worth placing. If it meets the criteria, I open a WebSocket to Betfair and wait for the odds to fall within the 'system's' range. As soon as they do, it places a bet.
ποΈ The User Interface:
The client, need visibility of the automated system. It needed to track the bot‘s progress. I created a website using svelte-kit and a react-native app. They provided graphs, trade history, and fun stats. I also created a developer page secured by password to manage app settings and git branch/tag updates.
π°οΈ What‘s next:
Taking this further, I plan to explore a more algorithmic approach aimed at generating profits by laying all trades within a market.
π§ Skills and tools:
I've implemented advanced shell scripting tools like pm2, Docker, vi, CI scripts, and GitHub Actions to establish a robust CI/CD pipeline. The app now allows for seamless configuration management, and changes can be applied without any need to restart the bot. Ensuring the automated bot runs smoothly 24/7 without any crashes is of utmost importance, and I've set up notifications to keep me informed about any occurrences or issues promptly.
βοΈ Twists:
Initially, I implemented the scraping of the tips website using Nightmarejs. However, I later rewrote the process using Cypress and jQuery due to the logging benefits it offered. To improve performance, I decided to parallelize the scraping service, but this required a Cypress Cloud subscription, which my client was not willing to pay for. As a result, I re-implemented it using asynchronous Cypress processes, which, unfortunately, led to login cookie conflicts. In my quest for a more efficient solution, I discovered that making fetch requests to obtain the raw HTML of the page and then parsing it with cheerio.js was a quicker and simpler approach.
π Betting Bot Interface π
This is an interface for the client to monitor the performance of the betting bot.
βΌοΈ Features
- Graph w/ line of regression, varying graphs to show profit/time, kitty/time, filters
- View for settled/open & historical bets
- stats on {no. races to come, loss streak, total liability, profit, ROI, weekly, monthly earnings, time of next race, time of last race}
- secure DEV route for rolling back to safe git tags/version. seamlessly changing settings on the back-end including defining and using preset settings.
π Features to come
- improve performance of API and loading effeciency
- improve login security, with MFA
π Questions/spikes
- faster to send one large JSON response from API or more granular, eg. request per route