GithubHelp home page GithubHelp logo

pangcong / betfair-horse-racing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dickreuter/betfair-horse-racing

0.0 0.0 0.0 32.09 MB

A fully functional automated horse racing trading system for betfair in python. Collects data, uses a neural network to analyse the data, makes trading recommendations and places the bets before races start.

Python 3.17% Batchfile 0.01% MATLAB 0.13% CSS 43.03% HTML 32.54% PHP 3.72% JavaScript 17.40%

betfair-horse-racing's Introduction

Betfair horse racing

The code consists of the follwoing parts

  • Collecting data from betfair and matchbook (below cronjobs need to run)
  • Analyzing the pricing data of horse racing through neural networks and creating a model to make betting recommandations for backing or laying
  • Executing bets according to the trained model
  • Flask web interface that shows logging activity, graphical pnl overview and statistical analysis of past bets

Building the venv

You can create a venv with the environment.yml file as follows:

  • Download anaconda 64 python 3
  • conda create env -f environment.yml -n horse_racing (or simply run update_venv.bat). On Linux you need to use conda env create -f environment.yml
  • The env will be in anaconda/envs/horse_racing

Commands

The application is controlled over app.py. The pnl overview web server is launched over webserver.py (but better use webserver.wsgi).

Usage:
  app.py ts train STRATEGY CLASS COUNTRYCODES [--batchsize=<>] [--from_year=<>] [--to_year=<>] [--localhost]
  app.py ts backtest STRATEGY CLASS COUNTRYCODES [MODEL_PATH] [--from_year=<>] [--to_year=<>] [--localhost]
  app.py collect_prices
  app.py bet [--armed] [--sandbox_key] [--config=<>]
  app.py update_unfilled_orders [--armed] [--config=<>]
  app.py collect_results
  app.py evaluate_pnl [--overwrite_calculated_pnls] [--config=<>]
  app.py email_summary
  app.py upload_tarball FILE [DESTINATION]
  app.py map_reduce SOURCE DESTINATION CLASS [--localhost] [--use_archive]
  app.py propagate_race_results_to_price_scrape

Exmaple
  app.py ts backtest lay FlyingSpiderBookie GB,IE --from_year 2018 --to_year 2018`
  app.py ts train lay FlyingSpider GB,IE,US,NZ --localhost --from_year 2015 --to_year 2017
  app.py ts backtest lay FlyingSpider GB,IE,US,NZ --localhost --from_year 2016 --to_year 2016
  app.py propagate_race_results_to_price_scrape   adds a winner and losers column to each price in price_scrape
  app.py map_reduce price_scrape price_scrape_enriched DEBookies --localhost
Cronjobs that need to be set up:
    * * * * * sh app.sh collect_prices
    * * * * * sh app.sh bet
    * * * * * sh app.sh update_unfilled_orders --armed
    5 * * * * sh app.sh collect_results
    6 * * * * sh app.sh evaluate_pnl
    7 22 * * * sh app.sh email_summary
    9 4 * * * sh app.sh propagate_race_results_to_price_scrape
    5 5 * * * sh app.sh map_reduce price_scrape price_scrape_enriched_bookies DEBookies

Database

All data is collected onto a mongodb server which can be set up over config.ini.

Example plots of neural network training:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.