Introducing the LendingClub Package

Ryan Kuhn



Lending Club is a peer-to-peer lending site. Peer-to-peer lending crowd-funds loans by matching borrowers with willing investors. This LendingClub library makes it easy for you to see your investor account data such as the amount of free cash or the details on which loans you own. This package is a convenience wrapper for the Lending Club API so that you get get the data into R. You can learn more about the API by reading Lending Club’s documentation

Getting Started

Creating a User Credential

To get started, you’ll need to supply the investor’s account number and API key. You can find the account number from the Account Summary page. The API key is located at the bottom of the Account Settings page. HIn the example below, the account number and API key are loaded from an .Renviron file but you can use whatever process you are comfortable to pass them to the MakeCredential function. If you are going to share your code, then I recommend doing something similar to this method rather than put it directly in your code.

The MakeCredential() function uses the investorID and APIkey inputs to create an S3 object. If you save this object as LC_CRED, then the other functions in this package will find it in the global environment and you will not have to pass it as an argument to the other functions.


investorID<- Sys.getenv("id")
APIkey<- Sys.getenv("key")

LC_CRED<- MakeCredential(investorID, APIkey)

A Few More Function Examples

Here are a few examples of other functions in the package. As mentioned above, all other functions in this package will look for the LC_CRED object before processing the respective API calls. You can see a dataframe of the currently listed loans using the ListedLoans() function.


Another useful function to start with is AccountSummary(). This returns key statistics such as the available cash, total number of notes owned, and all time total interest received. You don’t pass any inputs to the function but it will search the global environment for the LC_CRED object.