{"id":32204522,"url":"https://github.com/xanadunf/matchbook","last_synced_at":"2025-10-22T04:58:16.114Z","repository":{"id":56937458,"uuid":"44117642","full_name":"xanadunf/matchbook","owner":"xanadunf","description":"This R package provides some simple functions to enable interaction with the Matchbook.com RESTful API service.","archived":false,"fork":false,"pushed_at":"2017-08-25T08:24:22.000Z","size":81,"stargazers_count":6,"open_issues_count":2,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-22T04:58:01.544Z","etag":null,"topics":["betting","exchange","exchange-api","gambling","r"],"latest_commit_sha":null,"homepage":"http://www.matchbook.com","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xanadunf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-12T15:50:01.000Z","updated_at":"2019-01-24T04:20:57.000Z","dependencies_parsed_at":"2022-08-21T01:40:18.954Z","dependency_job_id":null,"html_url":"https://github.com/xanadunf/matchbook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xanadunf/matchbook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanadunf%2Fmatchbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanadunf%2Fmatchbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanadunf%2Fmatchbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanadunf%2Fmatchbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xanadunf","download_url":"https://codeload.github.com/xanadunf/matchbook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xanadunf%2Fmatchbook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382997,"owners_count":26321423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["betting","exchange","exchange-api","gambling","r"],"created_at":"2025-10-22T04:58:14.994Z","updated_at":"2025-10-22T04:58:16.105Z","avatar_url":"https://github.com/xanadunf.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# R package for the Matchbook.com API service #\n\nThis R package provides some simple functions to enable interaction with the [Matchbook.com](http://www.matchbook.com) RESTful API service. Please read the documentation carefully for each individual function before use.  A registered [Matchbook.com](http://www.matchbook.com) account is required to use this package. Please read the documentation fully before use.\n\n* * *\n# *Pre-requisites \u0026 Installation* \n\n* a valid Matchbook.com username and password\n* R-version \u003e= 3.0\n* R-packages: httr, jsonlite\n\nTo install the package requires the devtools library:\n``` \nlibrary(devtools)\ninstall_github(\"xanadunf/matchbook\")\n``` \n\n* * *\n\n# *Supported Functions*\n\nThe following two functions aid with account session verification\n\n* **mb_login**\n* **mb_logout**\n\nThe following functions provide the ability to get information on the sports that are available. This provides the ids that Matchbook uses for each sport. With these, you can obtain all of the events for the sports that you are interested in. Following on from that, you can obtain market ids and runner ids for any list of event ids. See the R documentation for more details on this.\n\n* **mb_get_sports**\n* **mb_get_events**\n* **mb_get_markets**\n\nI\nThe following function can be used to obtain details of any bets that have been placed but have not yet settled. Both details of unmatched and matched bets can be obtained. See the R documentation for more details (e.g. ? mb_get_bets)\n\n* **mb_get_bets**\n\nThe following functions provide the core betting functionality.\n\n* **mb_bet_place**\n* **mb_bet_update**\n* **mb_bet_cancel**\n\nIn order to obtain details on bets that have settled the following function can be used. Again, full function parameters can be see in the R documentation (?mb_get_settled)\n\n* **mb_get_settled**\n\n* * *\n\n# *Quickstart Tutorial*\nThis should help you get up and running in a very short time, assuming that you have met the pre-requisites.\nLet's set a target in this tutorial to place a bet on the first football game we find that contains the name 'man'. We will proceed to place a back bet of 5 EUR (or whatever the currency of your account) on the home team to win the game outright at odds of 1.10. \n\nTo start, you need to login with your [Matchbook.com](http://www.matchbook.com) account credentials.\n``` \nlibrary(devtools)\ninstall_github(\"xanadunf/matchbook\")\nlibrary(matchbook)\n\nusername \u003c- \"my_user_name\"     ### replace with your username\npassword \u003c- \"verysafepassword\" ### replace with your password\nsession_details \u003c- mb_login(username,password)\n```\n Since we are betting on football, we need to find out the id of that sport.\n\n```\nsport_id_data \u003c- mb_get_sports(session_details)\nsport_id_data\nfootball_sport_id \u003c- sport_id_data$id[which(sport_id_data$name==\"Soccer\")]\nfootball_sport_id\n```\n\nFrom the results, we can see that football has sport id=15. We can use this to get any football events with a team containing the 'man' string.\n\n```\nevent_data \u003c- mb_get_events(session_data=session_details,sport_ids=football_sport_id)\nevent_data[grep(tolower(\"man\"), tolower(event_data$name)),]\ntest_event_id \u003c- event_data$id[grep(tolower(\"man\"), tolower(event_data$name))[1]]\ntest_event_id\n\n```\nObviously, depending on when you run this, you may have many or no results. If you dont find a successful result, exchange 'man' for the name of a football team that you know is playing soon. \nSo lets get all of the market data for this event. Since we want to bet on the match outcome, we will try to extract the 'single-winner-wins' market type.\n```\nmarket_data \u003c- mb_get_markets(session_data=session_details,event_id=test_event_id,include_runners=TRUE)\nmarket_data\ntest_market_id \u003c- market_data$id[market_data$'market-type'==\"one_x_two\"]\ntest_market_id\n```\nNow that we have the correct market, lets get information for all runners in this market. This time, we include the parameter 'include_prices=TRUE' so that we can see what price each runner is available at. Also, lets select the runner from the resulting data.\n```\nrunner_data \u003c- mb_get_runners(session_data=session_details,event_id=test_event_id,market_id=test_market_id,include_prices=TRUE)\nrunner_data\ntest_runner_id \u003c- runner_data$id[grep(\"man\", runner_data$name,ignore.case=TRUE)]\ntest_runner_id\n```\nNow we have details on all of the runners, lets get details on the prices for the runner that we have selected.\n```\nprices_data \u003c- runner_data$prices[[which(runner_data$id==test_runner_id)]]\nprices_data_back \u003c- prices_data[prices_data$side==\"back\",]\nbest_available_current_price \u003c- min(prices_data_back$'decimal-odds') # min because we are backing, use the max if you are laying. \n```\nNow that we have found the price levels that we can back at (the volume is also available via 'prices_data_back$'available-amount'') we can place a bet on the runner we have selected. \n```\nmb_bet_place(session_data=session_details,runner_id=test_runner_id,side='back',stake=5,odds=1.10)\nmb_get_bets(session_data=session_details)\n```\nWhen the bet is placed, its important to examine the status of the bet. If the status is 'matched' then you have been matched at the price provided. If it is 'open' then the bet has not been fully matched. For further details on placed bets check out the documentation: ?mb_bet_place\n```\nmb_get_bets(session_data=my_session,runner_id=test_runner_id)\n```\n\n* * *\n\n# *Status*\nThis package is under active development and feedback and suggested improvements are welcome.\n\n* * *\n\n# *Bug-Reporting*\nPlease create an issue using the [Issues](https://github.com/xanadunf/matchbook/issues) area.\n\n* * *\n\n# *Future Development*\n* add pagination to the results of calls where applicable.\n* add parameter to allow sorting of prices returned.\n* add function to retrieve account details\n* add function to retrieve more detailed settlement report\n\n* * *\n\n# *Disclaimer*\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxanadunf%2Fmatchbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxanadunf%2Fmatchbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxanadunf%2Fmatchbook/lists"}