Comments (6)
Hi. I'm glad that you're using the module.
How are you trying to add the IDs to the order? Are you following the first example in the README?
When creating an order, it should handle staging the loans for you. Currently, however, the batch_add method requires a list of dictionaries -- not a list of IDs (I should fix this) Here's an example of how it should work:
from lendingclub import LendingClub
lc = LendingClub(email='[email protected]', password='secret123')
# Create list of loan IDs
ids = [
{'loan_id': 1234},
{'loan_id': 2345},
{'loan_id': 3456}
]
# Invest $25 in all loans
order = lc.start_order()
order.add_batch(ids, 25)
order_id = order.execute()
print 'Order placed: {0}'.format(order_id)
If this doesn't work, send me the error message you're seeing and we'll go from there. Cheers.
from lendingclub.
I think I might have found a bug in my order staging code. Please send me the error you're getting so I can verify. Thank you.
from lendingclub.
I found and fixed some bugs with the loan note staging code. I'm not sure if these were your bugs, but update to version 0.1.1 and let me know.
You can now add a list of IDs to the add_batch method, instead of a list of dictionaries. The example I showed above still works, but here is a simpler version, using version 0.1.1:
from lendingclub import LendingClub
lc = LendingClub(email='[email protected]', password='secret123')
# Create list of loan IDs
ids = [1234, 2345, 3456]
# Invest $25 in all loans
order = lc.start_order()
order.add_batch(ids, 25)
order_id = order.execute()
print 'Order placed: {0}'.format(order_id)
from lendingclub.
Thank you so much
I'll try running this and let you know if it fixes the issue
Regards
Sent from my iPhone
On 30 Jul, 2013, at 12:03 PM, Jeremy Gillick [email protected] wrote:
I found and fixed some bugs with the loan note staging code. I'm not sure if these were your bugs, but update to version 0.1.1 and let me know.
You can now add a list of IDs to the add_batch method, instead of a list of dictionaries. The example I showed above still works, but here is a simpler version, using version 0.1.1:
from lendingclub import LendingClub
lc = LendingClub(email='[email protected]', password='secret123')
Create list of loan IDs
ids = [1234, 2345, 3456]
Invest $25 in all loans
order = lc.start_order()
order.add_batch(ids, 25)
order_id = order.execute()print 'Order placed: {0}'.format(order_id)
—
Reply to this email directly or view it on GitHub.
from lendingclub.
I think it fixed the previous issue but it is still not working..
Here's what I am trying to do.
My program downloads the InFunding2Statsnew csv file from lending club - the file that is periodically refreshed and has new loans available for lending.
I am running criteria off the file - reason is there are far more attributes in the file than are available in web UI and my criteria uses some of these variables
Now since the file is updated in batches - there are notes in the file that are filled up by the time the program runs and thus is no longer available on the web. In such a case I just want to be able to pick whatever is available out of the pool that I find through parsing the file
Here is the error it is picking up. I found 45 matches on the file ... but only 22 were available when I run the code to add batch order as you explain above
Found 45 selected ones
Traceback (most recent call last):
File "csv_lc.py", line 109, in
order.execute()
File "/Users/xxx/Documents/LendingClub-master/lendingclub/init.py", line 714, in execute
self.stage_order()
File "/Users/xxx/Documents/LendingClub-master/lendingclub/__init.py", line 771, in __stage_order
raise LendingClubError('Could not stage the loans. The number of loans in your batch does not match totalRecords. {0} != {1}'.format(len(self.loans), results['totalRecords']), results)
lendingclub.LendingClubError: 'Could not stage the loans. The number of loans in your batch does not match totalRecords. 45 != 22'
from lendingclub.
Ah, this makes sense. Currently, when you create an order it treats it as an atomic transaction, all loans are invested in or none. I might change this in the future, but there is a good workaround.
First I've updated the module to make this process smoother, so update your version of lendingclub to version 0.1.2 or greater:
sudo pip install lendingclub --upgrade
Now, get the list of loan IDs from your CSV and perform a search by ID. Only the loans that are still available will return. You can then add these to the order and invest. In the following example, it searches for 4 loans by ID and then invests $25 in whichever ones are still available:
from lendingclub.filters import FilterByLoanID
# Search for loans by ID
loan_ids = [54321, 65432, 76543, 876543]
filter = FilterByLoanID(loan_ids)
results = lc.search(filter)
print len(results['loans'])
# Invest $25 in all the loans that were found
order = lc.start_order()
order.add_batch(results['loans'], 25)
order.execute()
I haven't tried this myself, but it should work. The search results contain quite a bit of up-to-date information about each loan. So you could also check the funding progress on each one and adjust amount you invest per loan note -- you don't want to invest $100 in a loan that only has $25 left to fund.
I also finally have the full API documentation hosted, which might help:
https://python-lendingclub.readthedocs.org/en/latest/index.html
Feel free to message me with any other questions.
from lendingclub.
Related Issues (20)
- Exception when running order execute HOT 7
- Error: 'Could not get struts token' on order.execute() HOT 2
- order execute exit with no exception HOT 1
- order.execute() error HOT 2
- Authentication failure HOT 4
- Foliofn loan data download issue (got only header, no loan data) HOT 1
- Lending Club end points must by updated. HOT 1
- Repo Out-of-Date HOT 6
- Python3 is not supported HOT 3
- Implementing the Loans listed page HOT 1
- Cannot install LendingClub API HOT 2
- Filtered list of Loans in Secondry market
- is this a still maintained project? has support of the new token based authentication? HOT 2
- session.authenticate() broken ? HOT 1
- assign_to_portfolio
- Passing login /password as variables HOT 2
- Python Version HOT 2
- Extract Collection Log
- Get notes/Cash balance returns an error
- Installing LendingClub in Python 3.8 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lendingclub.