POLONIEX > Pololen Bitcoin Lending Bot

A Decentralized Bitcoin Lending Bot for Poloniex

I've been lending on Poloniex for a while now. I tried a number of bots and while they did lend out my bitcoin well they didn't seem to have profit in mind. I realized after a while that I probably should just write my own, given that I write software for a living, so I did. It started out as a basic lending bot, dropping in offers as funds became available at the so called "market rate." In time I realized that there were a couple of things I could do that would maximize profits - the first was taking advantage of above average rates by extending those loans out longer so I had a chance of holding a profitable loan for a while after the offer rates dropped. The second was to not drop in offers just because the rate was where it was. Rather, I wrote in rules that define how quickly the bot would allow a loan offer rate to drop. Oftentimes, in just a minute or two, the market corrects and the rates rise again, and I don't end up getting stuck with a loan issued at the bottom of the dip. Initially I planned on just writing it for myself but as I continued to use and refine it I realized that it's something that a lot of lenders could use.

So - here it is...


Pololen is a full featured, lightweight application for lending Bitcoin (only) on the Poloniex exchange, requiring no installer and capable of running off a USB drive if portability is required. It's designed to be both anonymous and decentralized, though I can't help the fact that it does connect to a centralized exchange. Once configured with the Poloniex API keys, Pololen will check the users account each minute, monitoring the current offer book and placing offers at a user configurable depth within the book as funds become available in the lending account. Pololen also tracks rates for the last 15 days, building a database of points to accurately calculate the mean loan rate as well as the average deviation from the mean allowing it to accurately define when calculated rates are outliers. With user configurable settings Pololen allows the user to set a limit, in deviations, of how low they will allow a bid. Pololen also allows the user to maximize earnings by extending the duration of loans based on how many deviations they are from the mean. In human speak, this is a "sliding scale" of loan durations in which the higher the rate, the longer the duration. These settings are completely configurable by the user and will show the user the result of each change they make based on the current mean and deviation. By making these changes based on deviation and mean, rather than hard and fast numbers, the settings will follow the market as it ebbs and flows. To avoid "Polo Pogo" and further maximize earnings Pololen uses a step down technique as loan rates drop. Rather than drop offered rates into the hole when a large amount of funds become available and rates plummet, Pololen will drop it's target rate slowly toward the market rate, giving the market time to stabilize and work it's way back up toward more profitable rates.

Loan rates on Poloniex for the last two weeks (may require refreshing the page)

Loan rates for the last three hours. Recommended and minimum based on maker's settings (may require refreshing the page)



Options & Features:
Depth BTC: This user option allows the user to vary the depth in which the loans are placed. While the default depth is working fine in the current market, should the user experience long delays between loans being accepted this number should be be worked downward toward one (slowly). In the event that the user feels their loan rates are not high enough, the user should (slowly) increase this number. Please note that the higher this number is, the longer it will take loan offers to be taken. The lower it is, the lower the rate that will be received for the loan.

Bank: By default Pololen lends all the funds in the user's lending account. As there is no way for the lender to end a loan prematurely, the bank function was added to allow the user the ability to stop loaning a set number of funds, but not have to completely stop lending. Once the user puts a number in the box (say, ".5" for example) Pololen will stop making loans until the lending account reaches that amount. After the account reaches that value all funds in the account over the bank amount will continue to be offered as loans. This keeps as many funds as possible lent out while still allowing the user access to needed funds as loans mature.

Variable Duration: Variable duration allows Pololen to maximize earnings by extending loans for longer than two days depending on how many deviations the loan is from the average. While not required, these settings allow the user to possibly pick up longer, higher rate loans during an uptick in the market and possibly hold those loans after the market settles to more average rates. While not guaranteed to hold a loan for any length of time, the fact is you most definitely won't hold it for more than two days if it's only offered for two days. What lender out there wouldn't want to hold a loan at 0.8% or 1% for 40 days in the current market? When using variable duration the user sets three parameters. The first is the maximum amount of time the user will allow their funds to be lent for. The second is how many rate deviations below the mean the user is willing to post a loan for. The third is the amount of deviations the user would like to have before adding a day to the duration. This sounds confusing, no doubt, but when making changes to these settings you'll be able to see the effect those changes will have at the current calculated market rates.

Manual Override Manual override allows you to set more traditional values, with a defined minimum and a defined duration length, should you choose to not use variable duration.


Reporting: Pololen records all loans closed on CSV files saved by month. In addition to the information that can be downloaded from Poloniex, Pololen will also stamp the data with the value of the earned amount for the loan in USD based on the current value of bitcoin. This is tremendously helpful when comparing current and prior values. Files are stored in the "Records" folder in the same folder as the application.


Charting: Pololen includes several charts to help the user see what's happening in the market. The market chart shows the rates over the last 15 days as well as showing mean + deviation and mean - deviation to indicate where the "Average" lending rates are over that 15 day period. The hourly chart shows the last hour of rate data by minute indicating where the market rates are as well as where Pololen would have placed your loan offer based on the market rate and it's step down rate drop functionality.




Automatically Move To lending Account: When this option is checked Pololen will automatically move any BTC that appears in your exchange account to your lending account and lend it out. If you are an active trader DO NOT TURN ON THIS OPTION. However, if you have funds being delivered to your exchange account and want to automatically lend those funds, turning on this option in the deviation calculations tab will move the BTC automatically and lend it out.

Requirements:
Microsoft .NET 4.5.2 Library
A Poloniex lending account 
API Access to Poloniex (DO NOT turn on trading and DO NOT turn on withdrawal.)
A Windows computer, OS 7 or above, to run Pololen preferably 24/7.
And, of course, An internet connection

Costs:
After careful evaluation I've decided that offering the software with the SaaS model is the best option. As such, and in the spirit of Bitcoin, the software uses the block chain to allow for anonymous payment. Payment needs to be purchased at a rate of 5% of expected revenue. For instance, to earn 0.1 bitcoin in interest payment will need to be made at a value of 0.005. Please note that the software will allow the user to run a deficit in credits, allowing 0.02 BTC to be earned before the application stops lending and begs for money. This was built in not only to allow new users to try before they buy, but also for established users to ensure they have adequate warning before the application stops lending. I further recommend, simply based on sound judgement, that the user not pay for more than is needed to cover their expected profits for a two to four week period. 

API Requirements:
The user will need to create an API Key for Pololen on the Poloniex website. The key should NOT allow trading and most certainly should NOT allow withdrawal. While you can restrict the API to a certain IP address, you will experience problems if you are operating from a location with a dynamic IP - or you install the application on a USB and run it from more than one location. For that reason please only restrict to a single IP address if you understand what it means to do so. Only the minimum permissions are required to run Pololen. DO NOT turn on trading and DO NOT turn on withdrawal. Please do not attempt to reuse an existing API. It can cause errors. Also, please only run one copy of Pololen on a given account and turn off any other BTC lending bots you may have.


Data Averaging (Important):
Pololen ships with a representative file of rate data to get things going for you. However, this data will not reflect current market rates until the application has run, 24/7, for a couple of weeks. For that reason the user should check the "Deviation Calculations" tab daily, or more often if you can, and make adjustments to target the application to their lending style. As the application runs it will collect more and more data and you will find your changes in this tab will be less and less until ultimately it's tuned in to operate as you expect it to in a shifting market.

Little Loans:
If you are new to automated lending you should know that over time your big chunk of a BTC loan will turn into a bunch of little BTC loans. This happens as the loans are oftentimes divided between multiple traders and positions may be closed at different times. Eventually you will have lots of little loans that are being offered and closed all the time. This is a good thing as it helps average out the rates you get in a particular day, as well as allow some of your loans to be higher rates for a longer duration than you are likely to get with just one big loan.


If you're interested in downloading or looking for additional information, please check out http://poloniexbitcoinlendingbot.com/

Change request log:

Released:
Change bot to keep offer in place rather than cancelling and reposting it if the rate has not changed. (COMPLETE - Build 1.0.1.6)
Allow minimum minutes to be set before an offer is cancelled. (COMPLETE Build 1.0.1.6)

Coded - in testing - users can expect in next build:
Stats page to show more in depth analysis. (Code Complete - in testing but easy stats - amount on offer, amount on loan, total of on offer and on loan, total credits available, estimated days worth of credits, gross fee total of current loans)
Better credit estimating by day (Code Complete - in testing - On stats tab)
List of open loans with current Poloniex fees and durations. (Code Complete - in testing - new tab)

Under Review:
Review API lock in the event that the user has not entered in an API yet.
Status alerts on low credits (email, SMS, both?)
Add a date to bank functionality so funds will continue to be lent and only stop lending as the date approaches to hold out the bank amount on time.
Change maximum loan offer functionality so all funds get lent - ie if max is .5 and .5001234 is available split into two loans so that .0001234 isn't left unleant.
Show total amount available for loans on Poloniex (not by user but by total offers on the book.)
Allow more currencies than USD AND no currency to be selected.

Deferred for the moment:
Referral system for the bot. 
Create Mac version of the bot.
Retail sales.

Unlikely:
Create online version of the bot.
Lend altcoins as well as Bitcoin.

EDIT: 
06-01-2017 - Added note regarding only running on systems that use a "." for a decimal separator.
06-01-2017 - Removed note regarding localization. Application is changed to run in en-US mode on all locals. Updated link and MD5 for updated application.
06-02-2017 - Updated total generation to ensure it only includes BTC. Updated link and MD5.
06-02-2017 - Updated report generation to only report BTC loan returns. Updated link and MD5
06-07-2017 - Added functionality for automatically moving funds from exchange to lending (thanks Brobbel for the idea!). New build 1.0.1.0. Updated link and MD5
06-07-2017 - Added FAQ section
06-13-2017 - Somewhat surprised by the number of people registering. Put up a small webpage and linked to it in tile above.
06-17-2017 - Redirected downloads to the website so as not to have to continue to update two pages.
06-22-2017 - Added live rate charts
07-07-2017 - Added change request log to better keep track of change requests




source>'barcodeguy'>bitcointalk.org
0