jgillick / LendingClubAutoInvestor

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

lcinvestor could not find notes #26

Open erick-repo opened 10 years ago

erick-repo commented 10 years ago

I can see that my selection in filters I am getting notes in LendingClub but with the script it is not pulling anything. Here it is my log. Do you know what could be happening?

server1 .lcinvestor # lcinvestor --config=./investing.json --email=myemail@gmail.com --pass=secret --quiet --run-once -v

DEBUG: 11-04 11:11 - Reading investment settings file: /root/.lcinvestor/investing.json (line #313) DEBUG: 11-04 11:11 - Investment settings JSON: { "version": "2.2.3", "profiles": { "none": { "min_percent": 10, "max_per_note": 25, "filter_id": 32160866, "portfolio": "myportfolio", "min_cash": 25, "max_percent": 50 }, "myemail@gmail.com": { "max_per_note": 50, "portfolio": "myportfolio", "filters": null, "filter_id": 32160866, "min_percent": 16, "min_cash": 25, "max_percent": 50 } } } (line #320) DEBUG: 11-04 11:11 - Normalized settings JSON: {u'version': u'2.2.3', u'profiles': {u'none': {u'min_percent': 10, u'max_per_note': 25, u'filter_id': 32160866, u'portfolio': u'myportfolio', u'min_cash': 25, u'max_percent': 50}, u'myemail@gmail.com': {u'min_percent': 16, u'max_per_note': 50, u'filters': None, u'filter_id': 32160866, u'portfolio': u'myportfolio', u'min_cash': 25, u'max_percent': 50}}} (line #328) DEBUG: 11-04 11:11 - Reading investment settings file: ./investing.json (line #313) DEBUG: 11-04 11:11 - Investment settings JSON: { "version": "2.2.3", "profiles": { "none": { "min_percent": 10, "max_per_note": 25, "filter_id": 32160866, "portfolio": "myportfolio", "min_cash": 25, "max_percent": 50 }, "myemail@gmail.com": { "max_per_note": 50, "portfolio": "myportfolio", "filters": null, "filter_id": 32160866, "min_percent": 16, "min_cash": 25, "max_percent": 50 } } } (line #320) DEBUG: 11-04 11:11 - Normalized settings JSON: {u'version': u'2.2.3', u'profiles': {u'none': {u'min_percent': 10, u'max_per_note': 25, u'filter_id': 32160866, u'portfolio': u'myportfolio', u'min_cash': 25, u'max_percent': 50}, u'myemail@gmail.com': {u'min_percent': 16, u'max_per_note': 50, u'filters': None, u'filter_id': 32160866, u'portfolio': u'myportfolio', u'min_cash': 25, u'max_percent': 50}}} (line #328) DEBUG: 11-04 11:11 - Select investing profile: none (line #368) DEBUG: 11-04 11:11 - Load profile: {u'min_percent': 10, u'max_per_note': 25, u'filter_id': 32160866, u'portfolio': u'myportfolio', u'min_cash': 25, u'max_percent': 50} (line #377)

///--------------------------- $$$ ---------------------------\ | Welcome to the unofficial Lending Club investment tool |


DEBUG: 11-04 11:11 - Attempting to authenticate: email@gmail.com (line #71) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/account/login.action (line #71) DEBUG: 11-04 11:11 - Status code: 302 (line #71) DEBUG: 11-04 11:11 - Status code: 302 (line #71) DEBUG: 11-04 11:11 - Redirected to: https://www.lendingclub.com/account/summary.action (line #71)

Authenticated successfully!

========= Summary ========= Invest ALL available funds...

With at LEAST $25 available to invest Select a portfolio with an average interest rate between 10% - 50% Invest as much as $25 per loan note Add investments to: "myportfolio" DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/browse/getSavedFilterAj.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71)

Using saved filter "big_income" (id:32160866)

DEBUG: 11-04 11:11 - Attempting to authenticate: email@gmail.com (line #71) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/account/login.action (line #71) DEBUG: 11-04 11:11 - Status code: 302 (line #71) DEBUG: 11-04 11:11 - Status code: 302 (line #71) DEBUG: 11-04 11:11 - Redirected to: https://www.lendingclub.com/account/summary.action (line #71) 'www.lendingclub.com-prod_lcui_grp'] (line #71) INFO: 11-04 11:11 - Authenticated (line #198) INFO: 11-04 11:11 - Checking for funds to invest... (line #204) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/browse/cashBalanceAj.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - Cash available: $250.00 (line #90) INFO: 11-04 11:11 - $ $ $ $ $ $ $ $ $ $ (line #212) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/browse/getSavedFilterAj.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) INFO: 11-04 11:11 - Searching for a portfolio for $250 (line #232) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/portfolio/confirmStartNewPortfolio.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - POST VALUES -- amount: 250, max_per_note: 25, filter: ... (line #90) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/portfolio/lendingMatchOptionsV2.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - No lending portfolios were returned with your search (line #90) INFO: 11-04 11:11 - Could not find any matching portfolios for $250 (line #245) INFO: 11-04 11:11 - Searching for a portfolio for $200 (line #232) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/portfolio/confirmStartNewPortfolio.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - POST VALUES -- amount: 200, max_per_note: 25, filter: ... (line #90) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/portfolio/lendingMatchOptionsV2.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - No lending portfolios were returned with your search (line #90) INFO: 11-04 11:11 - Could not find any matching portfolios for $200 (line #245) INFO: 11-04 11:11 - Searching for a portfolio for $150 (line #232) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/portfolio/confirmStartNewPortfolio.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - POST VALUES -- amount: 150, max_per_note: 25, filter: ... (line #90) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/portfolio/lendingMatchOptionsV2.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - No lending portfolios were returned with your search (line #90) INFO: 11-04 11:11 - Could not find any matching portfolios for $150 (line #245) INFO: 11-04 11:11 - Searching for a portfolio for $100 (line #232) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/portfolio/confirmStartNewPortfolio.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - POST VALUES -- amount: 100, max_per_note: 25, filter: ... (line #90) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/portfolio/lendingMatchOptionsV2.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - No lending portfolios were returned with your search (line #90) INFO: 11-04 11:11 - Could not find any matching portfolios for $100 (line #245) INFO: 11-04 11:11 - Searching for a portfolio for $50 (line #232) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/portfolio/confirmStartNewPortfolio.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - POST VALUES -- amount: 50, max_per_note: 25, filter: ... (line #90) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/portfolio/lendingMatchOptionsV2.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - No lending portfolios were returned with your search (line #90) INFO: 11-04 11:11 - Could not find any matching portfolios for $50 (line #245) INFO: 11-04 11:11 - Searching for a portfolio for $25 (line #232) DEBUG: 11-04 11:11 - GET request to: https://www.lendingclub.com/portfolio/confirmStartNewPortfolio.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - POST VALUES -- amount: 25, max_per_note: 25, filter: ... (line #90) DEBUG: 11-04 11:11 - POST request to: https://www.lendingclub.com/portfolio/lendingMatchOptionsV2.action (line #71) DEBUG: 11-04 11:11 - Status code: 200 (line #71) DEBUG: 11-04 11:11 - No lending portfolios were returned with your search (line #90) INFO: 11-04 11:11 - Could not find any matching portfolios for $25 (line #245) WARNING: 11-04 11:11 - No investment portfolios matched your filters at this time -- Trying again in 30 minutes (line #295)

jgillick commented 10 years ago

Looks like LendingClub was not returning any investment portfolios for your filter. Go to the LC invest page, select your saved filter "big_income", enter $25 max per note and see if anything shows up. That should do the same as the "lendingMatchOptionsV2.action" action from the log, which appears to not be getting anything from LC.com. When that returns nothing, the program tries a different amount to invest ($250 portfolio, then $200, then $150).

If you see available portfolios on the LC invest page, go back to the program and try running it again. Sometimes the LC marketplace is empty while they're getting new lending notes.

erick-repo commented 10 years ago

Thank You for answering very quickly. Hey I have debug the lcinvestor and it looks like the "build_portfolio" always gets "FALSE" I even have use the sample with no saved filters and I'm getting same problem. Could you shed some light of what could be happening?

from lendingclub.filters import Filter lc = LendingClub(email='myemail@gmail.com', password='secret') lc.authenticate() True filters = Filter() # Set the filters filters['grades']['B'] = True # See Pro Tips for a shorter way to do this filters['grades']['C'] = True filters['grades']['D'] = True filters['grades']['E'] = True lc.get_cash_balance() # See the cash you have available for investing 250.0 portfolio = lc.build_portfolio(200, min_percent=17.0, max_percent=19.0, max_per_note=25, filters=filters) print portfolio False len(portfolio['loan_fractions']) Traceback (most recent call last): File "", line 1, in TypeError: 'bool' object has no attribute 'getitem'

jgillick commented 10 years ago

build_portfolio returns FALSE when LendingClub.com cannot find any investment portfolios for you. So in this case, it looks like there were no $200 portfolios between 17% and 19%. That's no uncommon, as loan notes get picked up pretty quickly sometimes. Did you try going to LendingClub.com and seeing if there were any portfolios matching your requirements on the site?

erick-repo commented 10 years ago

Hi The problem persisted. So i have to create an small program with your library. Using the filter = lc.get_saved_filter and get the loans ids. But I am not using the lc.build_portfolio because it is not working properly. I did try manually with the webpage and I can see notes. For now i just have an small hard coded script written by me but it does the trick :)

Las question, Is there an easy way to get my notes which one it is defaulting? in order to sell/trade those?

jgillick commented 10 years ago

That's very interesting that it worked on the website but no through the program. Would you mind sharing the script with me so I can see how they are different?

I'm not sure if I understand your last question. If you're asking if you can get a list of notes from build_portfolio; yes you can. That method returns a dict with the portfolio details.

erick-repo commented 10 years ago

Here it is my little program that doesn't use the build_portfolio function

from lendingclub import LendingClub from lendingclub.filters import Filter lc = LendingClub(email='user', password='secret) lc.authenticate() filters=filters) filter = lc.get_saved_filter(XXXXX) # Use the saved filter results = lc.search(filter) print results print "Number of Available Loans: %s" % len(results) cash = lc.get_cash_balance() print "Available Cash$$$$$: %s" % cash if cash > 25: for loan in results['loans']: order = lc.start_order() load_id = loan['loan_id'] print "Loan Shark : %s" % load_id order.add(load_id, 25) order.execute() order.assign_to_portfolio('python') # Name of your Portfolio