随着招投标普罗斯珀API的代码示例QuickSnipe.java |点对点贷款,点对点的贷款,人民对人民贷款|点对点贷款新闻,资讯,借贷策略

For my ProsperDays presentation this year I will demonstrating bidding with the Prosper API… I have built a quick and dirty bid snipping java program. (This program is not ready for primetime as bid sniping tool, but it is very close and a very effective demo. The reason I say it is not ready is that it lacks memory, meaning that it would bid on the same listing on subsequent passes.)对于我国ProsperDays介绍,今年我会证明投标的普罗斯珀空气污染指数…我建立了一个快速和肮脏的出价snipping Java程序。 (这个项目是不准备申办黄金作为狙击工具,但它是非常密切和非常有效的演示。我之所以说这是没有准备好是它缺乏内存,这意味着它将出价相同的上市以后的通行证。 )

I think API bidding is the 1st step in a brave new world of Prosper Lending. For one, it easily allows custom models.我认为, API的出价是第一步骤,一个勇敢的新世界的普罗斯珀贷款。原因之一,这很容易使自定义模式。

So what does this 126 line program do?因此,这是什么126线计划怎么办呢?

It queries the active AA-C credit grade listings… If a listing passes my extended credit filters (hard coded) AND the minimum Prosper calculated ROI values (generated by Prosper and the floor is passed in as a parameter) AND the minimum time remaining in the auction it will place a validation test bid or a real bid.它回答了积极机管局碳信用等级物品…如果我国上市通行证扩大信贷过滤器(硬编码)和最低普罗斯珀的投资回报率计算值(所产生的繁荣,请通过在作为参数)和最短的时间留在拍卖将进行验证试验的出价或真正的出价。

What are the extended credit requirements of this code?什么是信贷要求延长这个代码?Short answer… very tight.简单的答案…很紧。

  • 0 current DQ 0目前德泉
  • 0-1 inquires in the last 6 months 0-1询问在过去的六个月
  • 0 public records in last 10 years 0公共记录在过去的10年
  • 0 DQ in last 7 years 0德泉在过去7年
  • Bankcard utilization between 3% and 80%自动取款利用3 %和80 %

Here is the java code (I have contributed this code to the这是Java代码(我有此代码贡献的SourceForge Prosper API project繁荣API的源代码项目). It requires the API classes generated by the Java2WSDL and open source tool by Apache foundation. ) 。它需要上课的空气污染指数所产生的Java2WSDL和开源工具,由Apache的基础。

package prosper.api;包prosper.api ,import java.math.BigDecimal;进口java.math.BigDecimal ;import java.math.MathContext;进口java.math.MathContext ;import java.rmi.RemoteException;进口java.rmi.RemoteException ;import java.sql.Timestamp;进口java.sql.Timestamp ;import java.util.Calendar;进口java.util.Calendar ;import java.util.Iterator;进口java.util.Iterator ;import java.util.TreeMap;进口java.util.TreeMap ;import javax.xml.rpc.ServiceException; javax.xml.rpc.ServiceException进口;import com.prosper.services.ProsperAPI.DefinitionResult;进口com.prosper.services.ProsperAPI.DefinitionResult ;import com.prosper.services.ProsperAPI.Field;进口com.prosper.services.ProsperAPI.Field ;import com.prosper.services.ProsperAPI.Listing; com.prosper.services.ProsperAPI.Listing进口;import com.prosper.services.ProsperAPI.ProsperAPILocator; com.prosper.services.ProsperAPI.ProsperAPILocator进口;import com.prosper.services.ProsperAPI.ProsperAPISoap;进口com.prosper.services.ProsperAPI.ProsperAPISoap ;import com.prosper.services.ProsperAPI.ProsperObject;进口com.prosper.services.ProsperAPI.ProsperObject ;import com.prosper.services.ProsperAPI.ProsperObjectResult;进口com.prosper.services.ProsperAPI.ProsperObjectResult ;public class QuickSnipe公共类QuickSnipe{ (private String m_Username;私人弦乐m_Username ;private String m_Password;私人弦乐m_Password ;private double m_MinROI;双m_MinROI私营;private int m_HoursToGo; m_HoursToGo私人整数;private boolean m_PlaceBids;私人布尔m_PlaceBids ;private ProsperAPISoap m_APISoap; ProsperAPISoap m_APISoap私营;public QuickSnipe(String username, String password, double minROI, int hoursToGo, boolean placeBids) throws ServiceException公共QuickSnipe (串的用户名,弦乐的密码,双重minROI摘要hoursToGo ,布尔placeBids )全ServiceException{ (m_Username = username; m_Username =用户;m_Password = password; m_Password =密码;m_MinROI = minROI; m_MinROI = minROI ;m_PlaceBids = placeBids; m_PlaceBids = placeBids ,m_HoursToGo = hoursToGo; m_HoursToGo = hoursToGo ;m_APISoap = (new ProsperAPILocator()).getProsperAPISoap(); m_APISoap = (新ProsperAPILocator ( ) ) 。 getProsperAPISoap ( ) ;} )/** / *** @param args * @参数args*/ * /public static void main(String[] args)公共静态无效的主要(弦[ ] args ){ (if (args.length!=5)如( args.length ! = 5 ){ (System.err.println(“Usage: QuickSnipe username password minROI hoursToGo PlaceBids”); System.err.println ( “用法: QuickSnipe用户名密码minROI hoursToGo PlaceBids ” ) ;return;返回;} )try尝试{ (QuickSnipe qs = new QuickSnipe(args[0], args[1], Double.parseDouble(args[2]), Integer.parseInt(args[3]), Boolean.parseBoolean(args[4])); QuickSnipe新的分流= QuickSnipe ( args [ 0 ] , args [ 1 ] , Double.parseDouble ( args [ 2 ] ) , Integer.parseInt ( args [ 3 ] ) , Boolean.parseBoolean ( args [ 4 ] ) ) ;qs.snipe(); qs.snipe ( ) ;} )catch (Exception e)渔获物(异常戊){ (e.printStackTrace(System.err); e.printStackTrace ( System.err ) ;} )} )private void snipe() throws Exception私人无效狙击( )全异常{ (DefinitionResult res = m_APISoap.login(m_Username,m_Password); DefinitionResult水库= m_APISoap.login ( m_Username , m_Password ) ;String token = res.getMessage();弦乐令牌= res.getMessage ( ) ;ProsperObjectResult por = m_APISoap.query(token, “listing”, getFieldsString(“listing”,true), “status=2 and (creditgrade=7 or creditgrade=6 or creditgrade=5 or creditgrade=4)”); ProsperObjectResult房= m_APISoap.query (令牌, “上市” , getFieldsString ( “上市” ,真正的) , “现况= 2和( creditgrade = 7或creditgrade = 6或creditgrade = 5或creditgrade =四) ” ) ;ProsperObject[] pos = por.getProsperObjects(); ProsperObject [ ]位置= por.getProsperObjects ( ) ;TreeMap timeLeftListings = new TreeMap(); TreeMap timeLeftListings =新TreeMap ( ) ;for (int i=0; i<pos.length; i++)为(整数字母i = 0我“ pos.length我+ ){ (Listing l = (Listing)pos[i];上市升= (上市)排名第[ i ] ;Calendar end = (Calendar)l.getStartDate().clone();日历结束= (日历) l.getStartDate ( ) 。克隆( ) ;end.add(Calendar.HOUR, (l.getDuration()*24)); end.add ( Calendar.HOUR , ( l.getDuration ( ) * 24 ) ) ;long millisToGo = end.getTimeInMillis() – System.currentTimeMillis();长期millisToGo = end.getTimeInMillis ( ) -S ystem.currentTimeMillis( ) ;if (l.getNowDelinquent()==0 //my required extended credit and ROI如( l.getNowDelinquent ( ) == 0 / /我需要扩大信贷和投资回报率&& (millisToGo/1000/60/60)<=m_HoursToGo & & ( millisToGo/1000/60/60 ) “ = m_HoursToGo&& l.getInquiriesLast6Months()<2 & & l.getInquiriesLast6Months ( ) “第2&& l.getPublicRecordsLast10Years()==0 & & l.getPublicRecordsLast10Years ( ) == 0&& l.getDelinquenciesLast7Years()==0 & & l.getDelinquenciesLast7Years ( ) == 0&& l.getBankcardUtilization().doubleValue()<=.8 & & l.getBankcardUtilization ( ) 。 doubleValue ()=.03 & & l.getBankcardUtilization ( ) 。 doubleValue ()>=. 03&& ((l.getBidMaximumRate().doubleValue()+l.getROINetDefaultRate().doubleValue()+l.getROIInterestAndFeesRate().doubleValue()+l.getROIServicingFeeRate().doubleValue())>=m_MinROI) & & ( ( l.getBidMaximumRate ( ) 。 doubleValue ( ) l.getROINetDefaultRate + ( ) 。 doubleValue ( ) l.getROIInterestAndFeesRate + ( ) 。 doubleValue ( ) l.getROIServicingFeeRate + ( ) 。 doubleValue ())>= m_MinROI )) ){ (timeLeftListings.put(end, l); timeLeftListings.put (为此, 1 ) ;} )} )boolean pause = false;布尔暂停=虚假的;for (Iterator i = timeLeftListings.values().iterator(); i.hasNext(); )为(迭代 =字母i timeLeftListings.values ( ) 。迭代( ) ; i.hasNext ( ) ){ (if (pause) // you have to pause to avoid bid throttling如(暂停) / /你不得不暂停,以避免收购节流{try {Thread.sleep(6000);}catch (Exception ignore){}}尝试( ( Thread.sleep ( 6000 ) ; )渔获物(异常忽略) ( ) )Listing l = i.next();上市升= i.next ( ) ;Timestamp startts = new Timestamp(l.getStartDate().getTimeInMillis());时间戳startts =新的时间戳( l.getStartDate ( ) 。 getTimeInMillis ( ) ) ;Calendar end = (Calendar)l.getStartDate().clone();日历结束= (日历) l.getStartDate ( ) 。克隆( ) ;end.add(Calendar.HOUR, (l.getDuration()*24)); end.add ( Calendar.HOUR , ( l.getDuration ( ) * 24 ) ) ;Timestamp endts = new Timestamp(end.getTimeInMillis());时间戳= endts新的时间戳( end.getTimeInMillis ( ) ) ;long hoursToGo = (end.getTimeInMillis() – System.currentTimeMillis())/1000/60/60;长期hoursToGo = ( end.getTimeInMillis ( ) -S ystem.currentTimeMillis( ) ) / 1 000/60/60;System.err.println(“\n”+startts+” + “+l.getDuration()+” days = “+endts+” | Hours To Go: “+hoursToGo); System.err.println ( “ \ ñ ” + startts + “ + ” + l.getDuration ( ) + “天= ” + endts + “ |小时,转到: ” hoursToGo + ) ;System.err.println(“Bid on Listing: “+l.getListingNumber()+”\nAt Rate: “+(m_MinROI-l.getROINetDefaultRate().doubleValue()-l.getROIInterestAndFeesRate().doubleValue()-l.getROIServicingFeeRate().doubleValue())); System.err.println ( “买入上市: ” + l.getListingNumber ( ) + “ \自然率: ” + ( m_MinROI – l.getROINetDefaultRate ( ) 。 doubleValue ( ) l.getROIInterestAndFeesRate ( ) 。 doubleValue ( ) -1 。 getROIServicingFeeRate ( ) 。 doubleValue ()));res = m_APISoap.bid(token, l.getListingNumber(), new BigDecimal(50,new MathContext(4)), new BigDecimal(m_MinROI-l.getROINetDefaultRate().doubleValue()-l.getROIInterestAndFeesRate().doubleValue()-l.getROIServicingFeeRate().doubleValue(),new MathContext(4)), m_PlaceBids);水库= m_APISoap.bid (令牌, l.getListingNumber ( ) ,新的BigDecimal ( 50岁,新MathContext ( 4 ) ) ,新的BigDecimal ( m_MinROI – l.getROINetDefaultRate ( ) 。 doubleValue ( ) l.getROIInterestAndFeesRate ( ) 。 doubleValue ( ) – l.getROIServicingFeeRate ( ) 。 doubleValue ( ) ,新MathContext ( 4 ) ) , m_PlaceBids ) ;pause = true;暂停=真正的;System.err.println(“Bid Message: “+res.getMessage()); System.err.println ( “买入讯息: ” + res.getMessage ( ) ) ;} )m_APISoap.logout(token); m_APISoap.logout (凭证) ;} )private String getFieldsString(String type, boolean authenticated) throws RemoteException私人弦乐getFieldsString (字符串类型,布尔认证)全RemoteException{ (DefinitionResult res = m_APISoap.describe(null, type); DefinitionResult水库= m_APISoap.describe (空,输入) ;Field[] fields = res.getDefinition().getFields();外勤[ ] = res.getDefinition领域( ) 。 getFields ( ) ;int count = 0;整数计数= 0 ;String s=””;弦乐秒= “ ” ;for (int i=0; i<fields.length; i++)为(整数字母i = 0我“ fields.length我+ ){ (if (authenticated || !fields[i].isAuthenticated())如(认证| | !领域第[ i ] 。 isAuthenticated ( ) ){ (if (count!=0)如(伯爵! = 0 ){ (s+= ",";这是一种为了满足+ = “ , ” ;} )s+= fields[i].getName();这是一种为了满足+ =领域[我] 。 getName ( ) ;count++;伯爵+ ;} )} )return s;返回服务器;} )} )If you liked this article, vote for it on若你喜欢本文中,投赞成票的del.icio.usdel.icio.usandstumbleuponStumbleUpon公司.

Categories:分类:

Related Articles相关文章

Related Stores相关店铺

Leave a Reply

Your email address will not be published. Required fields are marked *