jgillick / LendingClubAutoInvestor

A simple command line tool that will automatically invest all cash that becomes available
MIT License
47 stars 21 forks source link

Bug when a filter only returns a single loan #18

Closed gtfann closed 10 years ago

gtfann commented 10 years ago

I use tight Lending Club filters that do not return many loans. Often they don't return a loan and sometimes they only return a single loan. On several occasions, the program has failed to invest funds when a saved Lending Club filter returns only a single loan.

I confirmed that the single loan appears in the LC results when opening the filter. I ran the lcinvestor program and it returned "Could not find any matching portfolios for $25 (my minimum to invest and maximum per loan)". Next, I loosened filter criteria so that the filter returned three loans and ran the lcinvestor program again. It invested in all three loans, including the original loan that was returned by the tighter filter.

Can you think of why this happens? If the program searches for a $25 portfolio and the filter returns more than one loan, it chooses the best loan and invests in a single loan. Why doesn't it choose the only loan as the best loan when only a single loan is returned by the filter?

ghost commented 10 years ago

The lcinvestor is looking for loan portfolios, not individual notes. When you say that you confirmed that single loan, which page on LC were you looking at? From the "Invest" page or the "Browse Notes" page? lcinvestor essentially goes from the "Invest" page workflow.

I have seen in some cases that the results on the website and through the tool are slightly different for auto-generated portfolios. I'm not entirely sure why, but I suspect that it's because they are from two different browser sessions. When you log into LendingClub from your web browser, that's one session, and when you use the tool it logs in and creates a separate session. My theory is this can cause some discrepancy between portfolios is shows.

If you're looking to automate investing in individual notes, you might try the LendingClub python API I wrote, that the lcinvestor uses. It requires a bit more technical expertise than lcinvestor but will let you search for individual notes and invest in them.

gtfann commented 10 years ago

You are right. When I open the filter from the 'Invest' page, it says 'There are not enough Notes that match your criteria, please modify your settings.' However, when I open the filter from the 'Browse' page, it shows a single loan. The invest page must require 2+ notes to be returned in the results.

I am trying to invest in portfolios but my filter settings are so tight that they often return no results or, in this case, a single result. Doesn't lcinvestor use the buildportfolio function of your LendingClub python API? What function would I use to invest in notes from the 'Invest' page?

On Mon, Jan 27, 2014 at 7:36 PM, Jeremy Gillick notifications@github.comwrote:

The lcinvestor is looking for loan portfolios, not individual notes. When you say that you confirmed that single loan, which page on LC were you looking at? From the "Invest" page or the "Browse Notes" page? lcinvestor essentially goes from the "Invest" page workflow.

I have seen in some cases that the results on the website and through the tool are slightly different for auto-generated portfolios. I'm not entirely sure why, but I suspect that it's because they are from two different browser sessions. When you log into LendingClub from your web browser, that's one session, and when you use the tool it logs in and creates a separate session. My theory is this can cause some discrepancy between portfolios is shows.

If you're looking to automate investing in individual notes, you might try the LendingClub python API https://github.com/jgillick/LendingClub I wrote, that the lcinvestor uses. It requires a bit more technical expertise than lcinvestor but will let you search for individual notes and invest in them.

— Reply to this email directly or view it on GitHubhttps://github.com/jgillick/LendingClubAutoInvestor/issues/18#issuecomment-33405756 .

ghost commented 10 years ago

lcinvestor does use the build_portfolio function. What you want to use is the search function outlined in the first example: https://github.com/jgillick/LendingClub#simple-search-and-order

gtfann commented 10 years ago

Thanks! One more quick question...can the search function also use a Lending Club filter or do you need to define the filter as shown in the example?

---------- Forwarded message ---------- From: Jeremy Gillick notifications@github.com Date: Wed, Jan 29, 2014 at 12:15 AM Subject: Re: [LendingClubAutoInvestor] Bug when a filter only returns a single loan (#18) To: jgillick/LendingClubAutoInvestor < LendingClubAutoInvestor@noreply.github.com> Cc: gtfann lendratio@gmail.com

lcinvestor does use the build_portfolio function. What you want to use is the search function outlined in the first example: https://github.com/jgillick/LendingClub#simple-search-and-order

Reply to this email directly or view it on GitHubhttps://github.com/jgillick/LendingClubAutoInvestor/issues/18#issuecomment-33538950 .

ghost commented 10 years ago

There's an entire example section on using saved filters in the documentation: https://github.com/jgillick/LendingClub#using-saved-filters

ghost commented 10 years ago

I hope that helped. Let me know if you have any other questions.

gtfann commented 10 years ago

I edited the LCAI code to cap available cash so that it tries lower amounts and smaller increments. But I do have another questions ... Can I run multiple cron jobs at the same time to invest in LC notes from the same machine? What does it take for LC to treat cron jobs as separate sessions?

Sent from my iPad

On Feb 10, 2014, at 8:24 PM, Jeremy Gillick notifications@github.com wrote:

I hope that helped. Let me know if you have any other questions.

— Reply to this email directly or view it on GitHub.

ghost commented 10 years ago

Every process or cron job should be seen as separate sessions automatically. I'll be committing a version soon that even has support for multiple LC logins.

gtfann commented 10 years ago

Thanks. I forgot to mention that I set the filter to a wide range of interest rates so that more than 1 note appears in the LC results and then I restricted the interest rate band in the .json file so that the lower interest rate notes would get dropped. This means that LCAI still functions if only 1 note in my band is available.

Sent from my iPad

On Feb 10, 2014, at 8:49 PM, Jeremy Gillick notifications@github.com wrote:

Every process or cron job should be seen as separate sessions automatically. I'll be committing a version soon that even has support for multiple LC logins.

— Reply to this email directly or view it on GitHub.

gtfann commented 10 years ago

When I scheduled multiple jobs at the same time ... it returned this error message: Failed trying to invest: "Could not get struts token. Error message: 'No struts token'"

Does this make sense?

On Mon, Feb 10, 2014 at 9:36 PM, Bryan Gross lendratio@gmail.com wrote:

Thanks. I forgot to mention that I set the filter to a wide range of interest rates so that more than 1 note appears in the LC results and then I restricted the interest rate band in the .json file so that the lower interest rate notes would get dropped. This means that LCAI still functions if only 1 note in my band is available.

Sent from my iPad

On Feb 10, 2014, at 8:49 PM, Jeremy Gillick notifications@github.com wrote:

Every process or cron job should be seen as separate sessions automatically. I'll be committing a version soon that even has support for multiple LC logins.

Reply to this email directly or view it on GitHubhttps://github.com/jgillick/LendingClubAutoInvestor/issues/18#issuecomment-34674199 .

jgillick commented 10 years ago

Are the jobs using the same user account? That could be the problem because when you start an order with LC it seems to put the notes onto an order for that user, despite the session. For example, if you login in one browser and select a bunch of notes to order, then login from another browser, those notes will still be selected for that order. So, per user, you can only have one order open at a time. I forgot to mention this. Multiple jobs for different users should be able to be run at the same time though.

jgillick commented 10 years ago

On second look that error started occurring for me and other people today. I've pushed a fix, so perhaps the latest version could work for your purpose.