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.

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 LibraryA 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.

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 MD506-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 MD506-07-2017 - Added FAQ section06-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 charts07-07-2017 - Added change request log to better keep track of change requests

It did not work with a new generated API key in the first place.By the way, the app is asking for API/API key instead of API key/secret.I had to generate another new API key, again without trading and withdrawal, and off he goes :-)

Dev, can you give me a more detailed explanation of " add x day to x deviation ".Because that looks like the most important part.

I'll be posting a new download this weekend to correct the labels on the API tab so they make more sense with Poloniex's API page.

In terms the add x day per x deviations, first I just want to remind everyone that BIP 148, Segwit2X, and the Bitmain plan are all coming together in the last week of July. I highly recommend that no one be lending coins during this period. Poloniex has made very clear that if coins are on loan when a split occurs, the lender will not receive back coins on both chains. I'm planning on working my coins out of lending prior to BIP 148 and Segwit2X activation, just to make sure I have them on hand before any possible splits occur.

That said, the idea of adding duration based on deviations is to attempt to maximize profits by holding the loans longer. Based on observation, there's a sweet spot between the 1st deviation and the 15th in which loans often stay in force for longer periods (that's between, roughly, 0.18% and 0.45% in the current market, but will change as the market rises and falls.) I find with rates over that you may have a loan accepted but it won't necessarily stay in force. My highest loan ever was 1.8%, but I only had it for 6 seconds.

For reference I'm personally adding 2 days per .4 deviations and the current average rate is roughly 0.15%. I usually give loans a maximum duration of 45 days. Right now, due to the situation in the end of July, I'm only lending for 5 days. These settings start adding days while still in the "high average" range.

The theory behind it is fairly simple. Loans that are in the average range are the easiest to get. Therefore it makes sense to keep the duration for those short so you can both get the benefits of compound interest and have a chance at a higher loan. As the rates move higher than average the likely hood of getting that loan rate again at the same time you have funds available for lending is less, so we try to hold those loans longer.

You will not hold all those above average loans, but you will hold some, and they will add to your overall amount earned. There is always a possibility, though, that the market will completely take off and you'll have a situation where higher rates are available and your funds are lent out lower. In practice, though, when the market is really flying and rates are high, traders are changing positions and oftentimes your loans will get closed because the trader that has it is shifting his position to include whatever is new and flying at that moment. I've been running this for a few months now and I have not seen a situation where I thought I missed out on higher rates due to extended loans. In theory it can happen and at some point it may, but I have not seen it yet.

It did not work with a new generated API key in the first place.By the way, the app is asking for API/API key instead of API key/secret.I had to generate another new API key, again without trading and withdrawal, and off he goes :-)

Dev, can you give me a more detailed explanation of " add x day to x deviation ".Because that looks like the most important part.

I'm currently using 2 days per .4 deviations. Typically I lend for a max of 45 days, but with Segwit2X and BIP148 coming I want to make sure I'm not lending any coins when they activate, so right now I'm using 5 day max and will be turning off in the second week in July to start moving my coins to a safe "bunker" until the crisis is past.

Good suggestions. In terms the chart holding a longer span, which chart and how much time are you thinking? When I first started it up I was using a 30 day period to generate the mean and deviations, but I found it was too much data and cut it down to 2 weeks. The deviations over a month just got too big and I wanted them tighter. That doesn't mean I couldn't show more data, though.

I've thought about referrals and I've held off at the moment due to transaction fees. Most payments in are micropayments and if I were to pay out a percentage with fees where they are I'd be in a situation where I'd have to spend 100% of the balance in to pay 10% of the balance back out. I'm hoping after the situation in late July passes we'll have some kind of consensus and the fees will be a lot lower and I'll revisit.

The minimum is essentially how low you'll post a loan offer from the average rate. I added it before I added the step down settings, so to be honest I set mine very low (which is a high setting in the drop down) and rely on the step down. As you change this the text underneath for minimum rate will show the lowest rate it'll offer the loan for.

The deviation bit is a tough nut to crack - hopefully this helps. If this doesn't sound like what you were expecting feel free to let me know what you're thinking - here or via PM. You're absolutely right about the average data. Right now it's off the mean by about .05%. The problem is the market changes so often that the starting data will never be perfect.

When I initially started testing this I used real numbers to extend the loans based on my observation of the market. IE I added 1 day if the rate was over .2%, 2 days if over .3%, etc. When I proved to myself I had higher returns over time that's when I took the time to add the heavier math and additional settings. Long story short the only difference between adding loan duration based on a real number such as .2%, .3%, etc. and using deviations is that with deviations the system adjusts to the market whereas using a real value, like .2, .3, etc may not be meaningful at all if the market changes.

In terms an easy example for a deviation, it's a tough one. To be honest I really can't think of a simple example but hopefully this makes sense. Deviations give us an idea of how far a typical loan rate is from the average rate. IE, if the average rate is .15 and the market rate is .2 we can easily see that the market rate is higher than average and that is meaningful. However, we don't really know how meaningful it is. There could be a situation where the historical rates are .1, .2, .1, .2 which would also give us an average of .15, but that would mean the .2 isn't unusual at all - it's happening every other time we check. The idea of deviations is it gives us a way to create an average range rather than a single average number. We create that range as basically (average - deviation) on the low side and (average + deviation) on the high side. Anything falling in that range is nothing special. It also gives us a way to get an idea of how different the rate is that we're checking. The idea is the majority of your rates will fall within the average range, then a smaller amount will be within 1 deviation, and an even smaller amount will be within 2 deviations. As the rate becomes more deviations higher from the average range the likelihood of seeing it becomes less and less and it's value to the lender becomes more and more.

Here's some heavier math:Deviations are a way to measure how far a given value is from the mean (or average). To generate it first we find the average (we add all the points from the last two weeks together and divide by the amount of points). Then, to find the average deviation we measure the distance of all the points from the average to the point's own value (and this is the absolute value, so even if the result is a negative number we make it positive). IE if we have five points that are 3, 8, 7, 9, 5 our average is 6.4. Then to find the deviation we do this:6.4 - 3 = 3.46.4 - 8 = 1.66.4 - 7 = .66.4 - 9 = 2.66.4 - 5 = 1.4

Then we average those results and our deviation is 1.92. That allows us to set a range that we can consider average, in this case it would be 4.48 through 8.32. That means that anything outside that range is unusual. If it's lower than the range then as lenders we don't want it, but we still may want to take it for as short a time as possible. If it's higher than that range then we definitely want it and should treat it better than we would an average point. That's where adding days comes in.

After reading twice, I got headache. So I called my mate over, usually a clever IT pro. He could'nt figure it out either.Sorry mate, I have to ask you in a different way:

What setting keeps my offers at the highest level, with very slow decreasing. So hat PoloLend only makes high offers (above 0.3%).If the rate stays down at 0.13 for 3 days, I don't mind have no active loans.

(I'm worried that PoloLend lends all my 8btc in the first few minutes or hours, while tomorow we get better offers.)

Profit wise my findings are that I make better returns lending consistently letting the loans break up into smaller chunks with variable duration without a hard minimum. The step down rate dropping is also a big reason why I myself don't use a minimum rate at all. BUT - I hear you. I thought about it and while the current build doesn't have manual settings I am going to add them. The coding, in fact, is done. I just need to get the build on my box to test it.

So within the next day or two I'll have a new build with a tab for "Manual Overrides". If you select that you'll be able to set a duration between 2 and 60 days and set the minimum rate. The system will still try to get you a better than minimum rate if the market is higher than your minimum, but it won't go below the minimum rate you set.

This more or less will eliminate the mean and deviation logic in the bot and have it function like other bots have in the past. Again, I think using the mean and deviation does yield a higher return but if you're having good results with a minimum setting I'm more than happy to provide it.

I'm hoping to have the new build out within 36 hours or so. I'll make a post when it's ready for download.

After reading twice, I got headache. So I called my mate over, usually a clever IT pro. He could'nt figure it out either.Sorry mate, I have to ask you in a different way:

What setting keeps my offers at the highest level, with very slow decreasing. So hat PoloLend only makes high offers (above 0.3%).If the rate stays down at 0.13 for 3 days, I don't mind have no active loans.

(I'm worried that PoloLend lends all my 8btc in the first few minutes or hours, while tomorow we get better offers.)

Now you've a website created with information, are you planning to create the possibility to work online instead of locally (like some other bots did/do)? It should be nice to use it online, because normally my computer isn't 24/7 working - but now it does because of this really nice program!

That's a weird one - 200000% is a bit higher than I would expect It was flying for a while there, though. I might have a bug where there is a missing decimal point and it should be 2.00000. Let me know if you see it with any other ones.

The short loans, though, happen all the time at high percentages. Pololen will try to lend them, of course, at a super high rate. My record is 1.8% which lasted, maybe, 8 seconds. As soon as there are lower loan rates available I *think* Poloniex will close the existing ones and give the trader lower rates. That's only a guess though. I know that they can find lower rate loans for traders under certain circumstances, but I don't know what those circumstances are.

Or it could be the trader saw the loan rate and immediately closed their position. I know I would

It's good to hear from you. In terms your question I don't have a plan for it short term. One of the things I'd probably have to sacrifice would be speed. Poloniex limits the amount of inbound connections to the API from a single IP address to 6 connections per second. If I were to set up a website I'd either have to run it quite slow to support multiple users or I'd need to have a way to spawn additional server instances per small group of users so that I could maintain the speed and Poloniex wouldn't be taking in more than 6 connections per second. For that I would need to increase rates quite a bit. Even the rate increase, though, may not be enough. The other problem is that payments tend to be micro payments and transaction fees are so high currently that I'd lose a good portion of the fee to the miners when I try to sell it to pay for the server.

This may all completely change if Segwit activates but at this moment in time I suspect that the rates I'd have to charge to get enough funds after transaction fees are taken into consideration would be higher than the percentage that the user could reasonably expect to gain from using the service.

Now you've a website created with information, are you planning to create the possibility to work online instead of locally (like some other bots did/do)? It should be nice to use it online, because normally my computer isn't 24/7 working - but now it does because of this really nice program!

I realy appreciate your effort to make PoloLen better. Thank you for that.

It is always the Dev's effort what makes things great.

Unfortunately I have no idea how much work it is for you. So I blindly ask for additional functions. Take them as brainstorm ideas, they may fit in your project or not. Maybe you already had that function and you have learned, it's useless... ;-)

About the graphs lenght, would be nice to be sure the "Market" graph is 60 days. If thats the case, don't mind about my question for longer graphs, it's already there ;-)

I would like to set, how much of the offered BTC I would like to ignore, say "60BTC". To override this big low offers of 40-200 BTC, which pop up every now and then.

Would be nice to be able to put a % value in "Bank" ...

What about making a mask for the "operation" log, preferably with correct numbers. For example "Recommended Rate: 0.00176200", that looks a bit strange, even it works ;-)

While watching PoloLen for hours till my head fell on the table, I noticed, that about a third of the time, the PoloLen offer is just 0.0001 too high, just sitting on a price together with a big offer. I would take off 0.0001% in general from your "Recommended Rate". Or have a tick box, where I can mark "-0.0001".

The "Deviation Calculations" window shows me, that you spent a lot of time with this problem. You're brain is so much tuned to that, that a new brain struggles to follow you, because you already built your own way of thinking.This window looks like it's made by Spok from Starship Enterprise, sure it is correct, but .... :-)

PS: ...if you can make a hot girl popping up after every profit, and telling me I'm the biggest and the best ;-)

I've posted a new version - 1.0.1.2. I recommend this version for all users as it has a couple of changes that I consider critical. I'm no longer linking downloads here - so please go over to the website at http://poloniexbitcoinlendingbot.com for the download link and instructions. Instructions for upgrading are in the FAQ. It's pretty easy, just a couple of files to move, but make sure you have a full backup of your folder in case you need it.

Changes:Critical:Changed order of operations in lending cycle to minimize the time between a loan being cancelled and a loan being offered.Changed order of operations in history cycle to prioritize credit checks. There was a situation that if the Poloniex history retrieval failed then the credit check for new credits wouldn't happen until the next cycle.

Important:Added manual overrides to make the app work more like a traditional bot, with a defined minimum rate and a defined duration, should the user want to go that route.Changed the text on the API tab to better match the Poloniex website.Updated handling of the BTC price retrieval. In prior versions if the API didn't return for some reason it set the price to 0. Now if we fail to retrieve a price we will use the last price retrieved until we are able to refresh it.

I am going to be fairly unavailable today so if you don't hear from me often don't worry I will be back.

I just posted a new build. There's no critical fixes in it so don't feel that you have to upgrade. I apologize for the quick turn between builds. There were some features I felt were needed for new users and I wanted to get them in there. If you want to upgrade please go over to the website to see updates regarding the UI, Max Loan Amounts, and manual offering loans, as well as cancelling them through the UI.

The short version:The UI is now in percent - ie 0.1234% rather than 0.00143400. I initially released it with the 0.00143400 format as that's the internal format that Poloniex uses and it was helpful for me to see exactly what was going to the API for debugging. This also fixes a bug where rates without a decimal point showed bad data. I also added some tool tip data over the controls.

Max Loan Amount - This allows you to cap the maximum amount to lend in a single loan. IE, if you have 10 BTC in your account and want to issue small loans and you set this to 0.5 it would offer one offer at a time for 0.5, ultimately resulting in 20 loans for 0.5 rather than 1 loan for 10. Remember, though, Pololen attempts to only have one loan open at a time so this will take a while. I don't recommend using this all the time and I don't recommend using it at all if you are manually lending at higher than market rates. It's very likely if you use it in that situation that only a portion of your funds will be leant at a time. There is also an increased chance of Pololen not being able to close offers that it opens if there is a problem with the server when using this functionality so if you are using it you should keep an eye on the loan offers you have out there.

Loan Offers are now visible - In part because of the above issue with offers being orphaned if Poloniex is overloaded or having a DDOS attack I went ahead and added a tab to show open offers. This will update each minute and has a cancel button so offers can be cancelled from here.

Loan Offers can be created manually - In part because I created a way to see open offers I figured the user should be able to create offers from here as well. Bear in mind that Pololen by default attempts to lend out all your funds so you'll need to use the bank function to keep some available in your account to be manually leant, should you choose to do so.

Version check - Pololen now checks every 12 hours to see if there is an update available and puts an unobtrusive note above the recommended rate on the lower left if there is a new version available.

Again my apologies for the short period between builds. This upgrade is only needed if the above sound like something you need.