{"id":20879930,"url":"https://github.com/mirayatech/btc-predictor","last_synced_at":"2026-03-06T09:02:32.652Z","repository":{"id":182982640,"uuid":"669410961","full_name":"mirayatech/btc-predictor","owner":"mirayatech","description":"💰 Bitcoin price guessing game - High/Low in 10 seconds.","archived":false,"fork":false,"pushed_at":"2023-08-05T19:24:45.000Z","size":2420,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T00:42:29.038Z","etag":null,"topics":["api","bitcoin","btc","dollar","e2e-tests","game","money","playwright","react","soundeffects","tailwindcss","typescript","ui","ux","vite","websocket"],"latest_commit_sha":null,"homepage":"https://www.btc-predictor.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mirayatech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-07-22T07:27:52.000Z","updated_at":"2024-12-16T11:30:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"adec7c67-2425-4c71-a980-c07b035c9709","html_url":"https://github.com/mirayatech/btc-predictor","commit_stats":null,"previous_names":["mirayatech/btc-predictor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mirayatech/btc-predictor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirayatech%2Fbtc-predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirayatech%2Fbtc-predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirayatech%2Fbtc-predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirayatech%2Fbtc-predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirayatech","download_url":"https://codeload.github.com/mirayatech/btc-predictor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirayatech%2Fbtc-predictor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30168608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bitcoin","btc","dollar","e2e-tests","game","money","playwright","react","soundeffects","tailwindcss","typescript","ui","ux","vite","websocket"],"created_at":"2024-11-18T07:18:20.555Z","updated_at":"2026-03-06T09:02:32.611Z","avatar_url":"https://github.com/mirayatech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 💰 BTC Predictor\n\nA game where you can guess if the price of Bitcoin (BTC/USD) will be higher or lower after 5 seconds. It uses real Bitcoin prices from trusted online sources and updates in real-time.\n\n## 🎲 How to play it\n\n- You'll guess whether the price of Bitcoin will be higher or lower after 5 seconds by clicking the buttons:\n\n  - \"Up\" button for price going up.\n  - \"Down\" button for price going down.\n\n- You can always see your score and the latest Bitcoin price.\n\n- Once you make a guess, you must wait until the guess is resolved before you can guess again.\n\n- The guess is checked after 5 seconds, and you can only make one guess at a time.\n\n- **If you're right:**\n\n  - You said \"up\" and the price went up, or\n  - You said \"down\" and the price went down.\n  - You win 1 point, and you'll get a toast message about it, and you'll hear a sound effect.\n\n- **If you're wrong:**\n\n  - You will lose 1 point, and you'll get a toast message about it, and you'll hear a sound effect.\n  - Your score will never go below 0.\n\n- Your score is saved, so you can come back anytime to see your score and continue guessing.\n\n## ⚡ Technologies\n\n- `Vite`\n- `React.js`\n- `TypeScript`\n- `Firebase`\n- `Zustand`\n- `Tailwind CSS`\n- `Playwright`\n\n## 🚀 API\n\nI got the real-time Bitcoin prices from a service called [Coinbase cloud](\u003c(https://docs.cloud.coinbase.com/exchange/docs/websocket-overview)\u003e).\n\nTo get the current Bitcoin price, I used the fetch method from a URL: \"https://api.coindesk.com/v1/bpi/currentprice/BTC.json.\" Then, I used async/await to wait for the response and find the actual Bitcoin price from the JSON data.\n\nI used WebSocket from [Coinbase Cloud](https://docs.cloud.coinbase.com/exchange/docs/websocket-overview) and a library called [ReconnectingWebSocket](https://github.com/joewalnes/reconnecting-websocket) to get real-time Bitcoin price updates. It connected to 'wss://ws-feed.pro.coinbase.com' and received live updates from Coinbase cloud whenever the Bitcoin price changed.\n\n## 💭 Process:\n\nI started by focusing on the game's features and testing. In the beginning, I didn't focus too much on how it looked.\n\nI started by creating the authentication components, including their functionalities, so I could save each user's data and their initial score, which is 0, in the backend.\n\nAfter that, I worked on the game page. At first, I used random numbers for the price (Math.random()) and buttons. Then, I set up the countdown timer. When the timer ends, a new price shows, and you can make your guess. Initially, the console.log was the only place to see if your guess was right or wrong. Later, I added notifications on the screen to tell you whether your guess was correct.\n\nOne tricky part was finding a 3rd-party library to provide real Bitcoin prices because many of them charged money, but I finally found one that worked well and was free. After setting up real-time Bitcoin prices, I moved to the backend to save the scores. Lastly, I created the home pages and styled the whole app.\n\n## 🌪️ Challenges\n\nCombining all the parts of the game to work together was a bit tricky. I had to learn about Websockets, which I hadn't used before, and how to fetch real-time Bitcoin prices using the library [ReconnectingWebSocket](https://github.com/joewalnes/reconnecting-websocket).\n\n## 🤔 How can it be improved?\n\nAdding animations would make the game feel more lively too. Also, I might let you guess prices for other digital money like Ethereum, not just Bitcoin, so the players have more fun options to choose from when playing.\n\n### 🐛 Current Bug\n\n- Sound effect only works on desktop and not mobile.\n\n## 🎥 Demo/Preview\n\nhttps://github.com/mirayatech/BTC-Predictor/assets/71933266/987b4872-1105-4b36-9123-5e4205aec0fb\n\n## 🚦 Running the Project\n\nTo run the project in your local environment, follow these steps:\n\n1. Clone the repository to your local machine\n2. Run `npm install` or `yarn` in the project directory to install the required dependencies\n3. Setup your Firebase account and replace the Firebase config values in the `.env` file with your own\n4. Run `npm start dev` or `yarn start dev` to get the project started.\n5. Open http://localhost:5173 (or the address shown in your console) in your web browser to see the app.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirayatech%2Fbtc-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirayatech%2Fbtc-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirayatech%2Fbtc-predictor/lists"}