Since, I haven’t posted on here in a while, you probably didn’t even know that I was using Lending Club, but now you know!
What is Lending Club?
I’ll give you a brief intro on Lending Club if you are unfamiliar. Lending Club is a site that facilitates peer to peer lending. Here is a common loan story on lending club:
John has got himself into a situation where he owes a lot of money at high interest rates on his credit cards. He has decided that he wants to take control of his life and pay off his credit card debt, but a bank won’t give him a loan to pay it off. He goes online to Lending Club and requests a loan from his peers that is much lower than the interest rate on his credit cards. His online peers can choose to invest in his loan in increments as small as $25. He pays off all his credit cards and now only has 1 monthly payment to Lending Club at a lower interest rate than he previously had.
This is a very common situation on Lending Club, but people can actually get loans for all kinds of reasons such as home improvement, starting a business, etc.
So what is this bot for?
Anyway, Lending Club has grown in popularity over the past few years since I started investing. Large institutional investors have started dumping millions of dollars into these loans and have started acquiring the best loans as soon as they are available for investors to put money in. Since the loans were getting snatched up so quickly, I was left with all of the loans that historically performed the worst. (I will have to write another post on how to analyze what loans perform the best.) This was really frustrating so I decided to use the same techniques that the large investors were using and built a bot that automatically invested in loans that historically have good performance.
The other advantage of having a bot to invest is that whenever a loan payment is received, the bot will automatically reinvest which means that money is never just sitting around getting no return.
How did I build it?
Building the bot was actually fairly easy, Lending Club posts new notes on their website 4 times per day at 6 AM, 10 AM, 2 PM, and 6 PM PT. I found a developer online who built a python API that works by screen scraping. He also had an auto investor tool, but his autoinvestor tool was using Lending Club’s portfolio builder tool which typically results in adding some poor loans.
I just setup a cron job to run at 6:02, 10:02, 14:02, and 18:02 that bought loans that historically had excellent performance. These loans should return over 10% on average return after defaults.
What are my current returns?
I created my Lending Club account in October of 2012. My net annualized return is currently at 13.28%. This number will drop over the next year or two as more defaults start rolling in and a large amount of my initial loans were not really the best.
That’s it for now, let me know what you think…
So how do you auto invest by using the API provided by the Lending Club?
Hi Akash,
The lending club api I use: https://github.com/jgillick/LendingClub is written in python. I wrote a small program using the API’s methods that will login, check available account balance, find notes that match my filter, and invest in the notes at an amount specified. To use the API, you need to have knowledge of python and know how to do some basic programming.
The program would only run if launched manually, so I used another program called cron that would automatically launch my program at the times when Lending Club releases new notes.
William
Hey William, I came across your post while researching for automated approach to purchase notes. great job! I do have a few questions:
1. How long does it take for your program to run from the time you query for available notes until the actual purchase is successfully made. I ‘ve heard that this has to be about 10 seconds or less in order to get the best of the best loans.
2. Where do you host your code? On your own server or on the cloud somewhere? Base on #1, I wonder if I have my own up and running where should I host it to get the fastest response since speed is king here..
Hi Nat,
1) The bot will typically finish purchasing the notes within 2 seconds of checking available inventory. However, new notes are not always released at exact times, it could be seconds or minutes after. I could have it continuously poll every few seconds to see if new notes are available at the hours they release them and could have it purchased within 10 seconds. I don’t use this technique though. Instead, I just have it poll 1 minute after the hour, 2 minutes, and 3 minutes and see if any new notes are available. I have had no trouble getting the notes on Lending Club that I need with this strategy.
2) I am hosting on DigitalOcean (note, that is an affiliate link). They are well know for having SSD’s for $5/month. I have only had good performance with them. Like I said, after my program launches, orders are typically placed within 2 seconds and I have that server in their San Franciso region.
William
Thanks william! very insightful! Another question: do you use other automated approach of purchasing notes in addition to your bot? like PRIME, bluevestment.com and etc..?
You’re welcome! I was using Prime for a while but they would only invest like once or twice a month and would frequently not invest a very large percentage of the cash I had in my account. This led to money sitting around earning no interest. I stopped using Prime for that reason. I built my own bot because I didn’t really know of any others at the time and it didn’t take me very long to make (I have programming experience and already had that server running). Bluevestment, InterestRadar, and others sound good. I don’t really like the idea of giving them the username and password to my lending club account though.
William,
Great post! I looked at the Python code also, but it seems that the filters are lacking. They only list basic filters like grade, term, and funding progress. Did you edit the Filter function to search for mortgage or anything else? The function calls return much more information (loan ID, loan time remaining, loan amount requested, etc), but that doesn’t seem to have the web GUI filter for things like mortgage. I’d love to get some more detailed filters from the Python code, and wasn’t sure if you were able to dig into the details.
Thanks for the post, this is some great code you recommended.
Hi Geoff,
What I wound up doing was creating a filter on Lending Club and then loading them from the python api.
filter = lc.get_saved_filter(FILTER_ID)
results = lc.search(filter) # this only fetches 100 notes
Then you can add any of the results from the search to your order.
William
William,
Great solution! I love the idea of creating a specific filter, but the hard coded filter options seem limited. I was thinking of updating the code with more filter args, but creating a saved filter ID would work too.
Thanks for the tips, and happy trading.
It appears as if the use of this sort of thing is prohibited by Lending Club TOS. Have you had any issues? The language they use is pretty all encompassing. Are you doing this via a personal account or business account? Thanks, Andy
Hi Andy,
I was just reviewing the terms of service and saw that automated data collection is no longer allowed. This was not the case when I began. I will probably have to disable this soon.
However, they do have an API that you can sign up and use that allows you to do the same things. I told them on the phone that I was running this one time and they had no problem with it.
William
Hi, thanks for your feedback. Are you talking about Lending Club Prime? (You mentioned an API that allows you to do the same thing as your bot.)
–Andy
They have replaced Lending Club Prime with their auto investment tool and I believe they don’t even charge for it now. However, from what I’ve heard it still has the same problem. If you have much money in your account ($50K+), it will only invest a little bit at a time so it takes a long time to put all your money into loans. The reason they do this is because if there is someone with a multi-million dollar account, they don’t want to auto invest all their money and have no more loan inventory for anyone else.
Lending Club’s official API let’s you purchase notes and browse inventory via web requests directly to the website. My bot scrapes the HTML from the website to browse the inventory. They will both allow you to do the same thing, however if everyone is using the official API, Lending Club will have more control over the notes they release to people/companies using the API.
Hello William
Have you had any success Using lending clubs API
I have struggled using Python to make the simple “Available Cash” Get
Do you have a couple of code lines that work.
Thanks
Andrew
Hi Andrew,
If you are using the same library that I linked to in this article, then I can provide a few lines of code that should work.
from lendingclub import LendingClub
lc = LendingClub(email=USER_NAME, password=PASSWORD)
lc.authenticate()
balance = lc.get_investable_balance()
print balance
William
I am also interested in buying an automated solution to interact with folio’s API. Do you have a program available?
Hi Eric,
I have nothing available for others as I don’t want to be responsible if anything doesn’t work as intended.
Lending Club returns have dropped over the past few years and there are other more attractive alternatives with better risk profiles.
William
I currnetly use a screen scraper to buy notes 25-50 per day for the last3 years.
I am setting up Lending Club API and have been successful with allt of the documented API Calls that I have tried.
I have use Postman to test calls and MicroSoft Power Shell to run Invoke-RestMethod to acquire (summary, portfolios, detailednotes) all API calls so far with no problems.
Example of working calls:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command “Invoke-RestMethod https://api.lendingclub.com/api/investor/v1/accounts/123456/detailednotes -Method Get -OutFile APIRaw -Header @{Authorization=’abcdefghijklmnop’}”
PowerShell -NoProfile -ExecutionPolicy Bypass -Command “Invoke-RestMethod https://api.lendingclub.com/api/investor/v1/accounts/123456/portfolios -Method Post -OutFile APIRaw -Header @{Authorization=’abcdefghijklmnop’} -Body (@{actorId=2168672; portfolioName=’Porfolio 7′; portfolioDescription=’Sample description 7′} | ConvertTo-Json) -ContentType ‘application/json'”
I still need to see the loan performance information, this will let me review, “Payment History” and “Collection Log”, to help me with my buying decision.
To try to get the loan performance I have tried from Postman (with/without Authorization Key) and (Basic Authorization with email & password):
https://www.lendingclub.com/foliofn/browseNotesLoanPerf.action?showfoliofn=true&loan_id=123456789&order_id=123456789¬e_id=123456789
But Receive:
**************************************************************************************************************************************************
This website does not support this version of Internet Explorer. Please upgrade to the latest version for a better experience. Upgrade Now
Lending Club
Utilities
Sign in
Help
View Full Site
Member Sign-In
Email Address
Password
Forgot password
Remember me on this computer
Sign In
… (more data just basic text)
****************************************************************************************************************************************************
Since I am not logged in and not using a web browser I know I probably need to add a least: (Internet Explore, value) & (Email & Password, value) and may need to use MS Invoke-WebRequest in replace of Invoke-RestMethod.
Can you help me with the (-Header and/or -Body) values I will need to make Postman work then I should be able to move it to MS Invoke command.
Thanks
Hayden Large
There’s also an R package that lets you interact with the LC API. I use that and wrote an R script that authenticates, checks available loans, buys the ones that meet my criteria (my criteria are coded in the R script), and saves all the loans released at that time for later aggregation, analysis, and backtesting. It’s been working very well for me for the past 4 months since I settled on my finished version.
William, I see you’ve posted your net annualized return. I’m curious what your *adjusted* net annualized return is, account for late and charged-off loans.
Hi Paul,
That sounds pretty interesting, what kind of returns are you getting? I left the bot running for several years and got to see the performance over time. Most of the loans start defaulting later on. Therefore, if you keep investing new funds into lending club, or reinvesting current funds, that can artificially inflate the return over time because all the new loans typically pay on time.
I have since stopped investing in Lending Club and 99% of my money is now back to me. My *adjusted* net annualized return after years of investment and no new investment now sits at 7.11%. This is an acceptable return, but not really worth the risk of un-collateralized debt in my opinion. If you buy a piece of real estate with no debt, 4% cap rate, and estimate 3% annual appreciation, you are making the same annual return with much less risk.
Additionally, loan interest is taxed at your ordinary income tax rate. If you are in a high income tax bracket, you can be subject to an income tax rate of 37% plus subject to the 3.8% obamacare investment surtax. Whereas with real estate, any appreciation is tax deferred, and the income is tax advantaged.
When comparing the risk profiles and tax treatment, I couldn’t justify continuing to invest in LC notes.
[…] in 2013, I wrote on article about building a Lending Club bot. At the time, I was just getting into investing and learning about different types of […]