Code Monkey home page Code Monkey logo

quantt-web-scraper's Introduction

QUANTT-Web-Scraper

This web scraper program is for the QUANTT team at Queen's University to scrape Quantopian in order to get data on each live trading algorithm.

Setup Google Sheets

For this program to work correctly, the Google Sheets file must be set up correctly.

  1. The file name must be: 'QUANTT Contest'.
  2. The first sheet must be 'Data'.
  3. The data input must start A5, with the A column being the date, the B column being Cumulative P/L ($) and the C column being Returns (%).
  4. There should be no other data below the last line of data that was inserted (program appends a row).
  5. The order of the names from left to right must follow the order of the names in Quantopian from bottom to top.
    For example:
    Google Sheets (Left to Right) - John, Mark, Katie, Ralph
    Quantopian (Bottom to Top) - John, Mark, Katie, Ralph

How to use

  1. Install the requirements
pip install -r requirements.txt
  1. Share the Google Spreadsheet with the following email address, giving it editing privilges
  1. Run the program. Copy and paste the URL directly from the browser as the 3rd argument
python2.7 webscraper.py <Quantopian Email> <Quantopian Password> <Google Sheets Link>

Note: A client_secret.json file is needed to run the program. This file can be obtained in two ways:

  1. Contact the creator of the repository
  2. Generate your own client_secret.json:
- Go to the Google APIs Console - https://console.developers.google.com/.
- Create a new project.
- Click Enable API. Search for and enable the Google Drive API.
- Create credentials for a Web Server to access Application Data.
- Name the service account and grant it a Project Role of Editor.
- Download the JSON file.
- Copy the JSON file to your code directory and rename it to client_secret.json

Note: To use the the client_secret.json supplied by the creator of the repository, share the Google Sheets with them as well.

Automatically Run

To automatically run the program everyday, this can be done in two ways:

  1. Crontab
  • Open a terminal window
  • Open the crontab file by entering the following command:
crontab -e
  • Enter the following command to run the program every Monday-FRIDAY AT 6pm EST:
* 18 * * 1-5 python2.7 webscraper.py <Quantopian Email> <Quantopian Password> <Google Sheets Link>

Note: The program will only run if your computer is on at 6pm.

  1. Contact the owner of the repository to have it uploaded to a server.

License

MIT License

Copyright (c) 2019 Sean Remedios

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.