Git Product home page Git Product logo

final-year-project's Introduction

Automated IB Report Pipeline

Part of my COMP0029 Final Year Project submission at University College London (UCL).

What is this?

This software automates the retrieval and processing of financial data. Specifically, it searches your Gmail for reports generated by InteractiveBrokers' PortfolioAnalyst. These reports are extracted, processed according to your specifications, and uploaded to a Sheet in your Google Drive. This solution is completely stateless, loading reports from Gmail attachments into memory via Report object instances, and uploading them directly to Google Sheets.

  • Reports are retrieved from email attachments via the Gmail API.
    • Processed reports are marked using a label defined in the GmailManager class.
    • The report is taken from the most recent email that hasn't been labelled as processed.
  • The report CSV is broken down, with processing handlers applied to each section to transform the data and run metrics.
  • The processed CSV is rebuilt and uploaded to Google Drive.
    • A single directory, Financial Reports, holds all report spreadsheets in your Google Drive.
    • One spreadsheet is made for each year of reports.
    • Each month of reports is given its own sheet within its year spreadsheet.

Requirements

Retrieving reports via email

  • You must have valid Google credentials saved in src/main/resources/credentials.json
  • You must use your Gmail for your InteractiveBrokers account.
    • This is to ensure report emails are delivered to your Gmail.
  • Reports must be configured in the PortfolioAnalyst Reports section of InteractiveBrokers' website.
  • Reports, either default or custom, must be configured for email delivery in CSV format.
  • Reports are assumed to hold data from time period month-to-date at the daily frequency.

Processing report CSVs

  • You must write your own handlers for processing each report section!

    • Example files are already configured under src/main/java/dataprocessing/reportpage/
    • Edit the processDataSection method:
      • Its parameter is a CSV in string.
        • The format of the given CSV parameter is the same as that in the email attachment, but of a single section without its section name
        • Strings are delimited by \n for each row, and , for each cell within.
      • It must return a CSV in string format.
  • By default, if you do not change the processing classes, the report CSV remains unchanged.

Uploading reports

  • You must have valid Google credentials saved in src/main/resources/credentials.json
  • Reports overwrite old data in their corresponding sheets, according to the date of the report.

Prerequisites

Gradle

Ensure you have Gradle installed to download dependencies and run the app.

Credentials

You must have Google credentials stored in src/main/resources/credentials.json

You can email [email protected] and request the credential file.

Alternatively, you can set up your own Google Cloud Platform project:

  • Enable Drive, Gmail, Sheets APIs from the API library.
  • Set up the OAuth consent screen:
    • Enable the following scopes:
      • /auth/gmail.labels - used to create a label to mark already-processed report emails
      • /auth/drive.file - create, access and edit Drive files only used by this app
      • /auth/gmail.modify - used to label emails as processed
    • Add your email to the project's test users
  • Navigate to the credentials tab:
    • Select + CREATE CREDENTIALS
    • Choose OAuth client ID of type 'Desktop app'
    • Download the JSON file
      • Rename it to credentials.json
      • Create a directory and move it to src/main/resources

Running the app

cd to the repository's top level directory.

Enter gradle run into the terminal.

Select your email - which must be among the app's test users - on the OAuth consent screen.

Approve usage of the 3 scopes.

Enjoy your automated IB-reports-to-Google-Sheets pipeline!

final-year-project's People

Contributors

michaelkhot avatar

Watchers

 avatar  avatar

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.