CapitalGuard
A full stack Android personal finance and wealth management app built in Android Studio with Java, XML, Firebase Authentication and Realtime Database, Stanford CoreNLP, AnyChart JavaScript library, Google Cloud Functions written in Node.js, and the Plaid, Dialogflow, News, and Twitter (via Twitter4J) APIs.
Install / Use
/learn @ramanv0/CapitalGuardREADME
CapitalGuard
A full stack Android personal finance and wealth management app built in Android Studio with Java, XML, Firebase Authentication and Realtime Database, Stanford CoreNLP, AnyChart JavaScript library, Google Cloud Functions written in Node.js, and the Plaid, Dialogflow, News, and Twitter (via Twitter4J) APIs. CapitalGuard allows you to connect all of your financial accounts into one space to get a complete picture of your financial health, help you gain control of your spending, and track and optimize your investments.
Key Features
- Email and password based authentication with custom UI using the Firebase Authentication SDK
- Client-side integration to the Plaid API via Plaid Link that handles credential validation, authenticates users' bank account information, and connects users' financial accounts to Plaid
- Alert users about suspicious activity or overspending if the transaction data retrieved using the Plaid API exceeds their spending limit
- Data analysis and interactive visualization on users' spending data retrieved with the Plaid API using custom adapters, various UI layouts, and the AnyChart JavaScript library
- Financial assistant chatbot with a custom chat UI built using the Dialogflow API and Google Cloud Functions written in Node.js that query users' financial data from the Plaid API stored in the Firebase database
- Provide advice to users about potential investment opportunities based on sentiment analysis performed on news articles retrieved using the News API and Twitter tweets retrieved using the Twitter API (via the Twitter4J Java library) using the Stanford CoreNLP library
Technologies Used
Languages
- Java
- XML
- JavaScript (Node.js)
- Regex
Back end
APIs
-
- The following Plaid API product endpoints were used to build CapitalGuard (Note: all Plaid API endpoint requests return standard JSON responses):
- Institutions: retrieve data (e.g. the institution's id, name, supported Plaid products, logo, etc.) about supported financial institutions
- Account: fetch account information (e.g. the accounts's id, name, balance, type, etc.) and schemas (the account, currency code, and investment transaction types and corresponding subtypes recognized by Plaid)
- Token: obtain a
link_tokento initialize Plaid Link, which is the client-side component that the user interacts with in order to connect their financial accounts with the Plaid API. Once Link is initialized and the user has successfully created anItem(Note:Itemis a Plaid term for a login at a financial institution), it will return apublic_tokenthrough anonSuccesscallback that can be exchanged for a Plaid APIaccess_token. Theaccess_tokenmust be obtained in order to call Plaid API endpoints and retrieve information about anItem. - Transactions: receive paginated user-authorized transaction data for credit, depository, and loan-type accounts
- Auth: retrieve and verify bank account and identification numbers (e.g. routing numbers), and high-level account auth data
- Balance: obtain real-time balance data for each of an
Item's financial accounts - Identity: retrieve and verify the user's identity (name, address, phone number, email) against obtained bank account information
- Assets: access the user's financial information to create and retrieve Asset Reports that contain detailed information about the user's assets and transactions, which can be used for loan underwriting
- Investments: get user-authorized stock position and transaction data from the user's investment accounts
- To use the Plaid API in CapitalGuard, you will need to receive API keys by signing up here. Once you have signed up, you will have access to two API keys:
client_idandsecret. You can find your Plaid API keys here. Then, in MainActivityJava.java, you must set the value ofclientUserIdin thecreateLinkTokenmethod to yourclient_idand insert yourclient_idandsecretas the first and second arguments ofclientIdAndSecret, respectively, in thecreatePlaidClientmethod. You will also see that there are three different environments in which you can use the Plaid API: Sandbox, Development, and Production. CapitalGuard was built in the Sandbox environment, which gives you access to test credentials and life-like data.- Sandbox environment simple test credentials -> username:
user_good, password:pass_good, pin:credential_good(when required). You can learn more about Sandbox test credentials here.
- Sandbox environment simple test credentials -> username:
- The Plaid API was installed in CapitalGuard with the following Gradle dependencies:
implementation 'com.plaid.link:sdk-core:3.2.6' implementation 'com.plaid:plaid-java:8.1.0' - The following Plaid API product endpoints were used to build CapitalGuard (Note: all Plaid API endpoint requests return standard JSON responses):
-
- CapitalGuard uses the Dialogflow API to build a personal finance assistant that is able to answer users' questions about their financial health based on their financial data retrieved via the Plaid API and stored in the Firebase database.
- Since CapitalGuard uses a custom-built, in-app conversation platform, and not one of Dialogflow's integrations, I had to write code that directly interacts with the end-user. I also had to directly and asynchronously interact with the Dialogflow API for each conversational turn in order to send end-user expressions to Dialogflow and receive information about intent matches. You can learn more about the processing flow when interacting with the Dialogflow API here.
- To use the Dialogflow API in CapitalGuard, you will need to set up a Google Cloud Platform (GCP) project and authentication. To do so, follow the steps in the GCP Setup quickstart: It will guide you through all of the steps required to start using the Dialogflow API, such as creating a Dialogflow project, GCP billing, enabling the Dialogflow API and audit logs, setting up authentication with service accounts and keys (for more information about authentication, you can also read this), initializing the Google Cloud SDK (the Cloud SDK provides many useful tools for managing resources hosted on Google Cloud), and installing the Dialogflow API client library.
- CapitalGuard uses the most common option for calling GCP APIs (in this case, the Dialogflow API): Google supported client libraries. There are two other options for calling the Dialogflow API: REST and gRPC (you can read more about them here). The Dialogflow API client library was installed in CapitalGuard with the following Gradle dependencies:
If you choose to setup your CapitalGuard project with Maven or sbt, you can learn how to install the Dialogflow API here.implementation platform('com.google.cloud:libraries-bom:20.8.0') implementation 'com.google.cloud:google-cloud-dialogflow' - After you setup your GCP project and authentication, you will need to build agents, which are virtual agents that are trained to handle expected conversations with end-users, using the Dialogflow Console. You can learn more about how Dialogflow agents work here.
- To build an agent:
- Go to your Dialogflow Console and sign in
- Click "Create Agent" in the left sidebar menu
- Enter the requested information (agent's name, language, time zone)
- Select "Create a new Google project"
- Click "Create"
- To build an agent:
- Once you created your agent, you will need to define and train intents to categorize end-user intentions for each conversation turn. The combined intents of a successful agent should be able to handle a complete conversation with the end-user. When the end-user writes a question to CapitalGuard'
