# Algorithm

### Introduction

This doc will explain how our algorithm works that determines the interest rate. For any questions regarding our algorithm, you can find us in the chat or e-mail us at support@marcopolobot.com.

### Approach

Our algorithm combines historical loan information combined with statistical calculation to determine an optimal interest rate. This is more efficient than conventional methods, where only a current snapshot of the order book is used (and loans are placed x currency deep (adjusted for the currency) in the order book). Here conventional algorithms fail to capture the potential gain there is due to the high volatility. Another conventional approach is to give the user freedom in setting input parameters himself. The problem lies however in the presupposition that the variables are constant. Our algorithm frequently reassesses input parameters (loan duration / order book volume).

### High bot polling speed

Given the short loan durations in margin funding, there is an obvious gain to be achieved by reoffering loans quickly when they return, because otherwise loans can sit idle for too long relative to their duration. As can be seen in Exhibit 1, the loan durations in Q4 2017 were distributed as followings:

More than 50% of the loans returned within 0.3 days (7.2 hours), and more than 20% already returned within 864 seconds (14.4 minutes). To solve for this we make sure that funds are reoffered at least every 10 minutes, and in the case of Bitfinex, instantly.

### Frequent parameter reassessment

As can be seen in exhibit 2 below, the average loan duration is far from constant, unlike is presupposed by conventional algorithms. Therefore it is important to reassess the input parameters frequently. We weigh recent loans heavier than loans longer ago as we've found a small memory effect in the duration of the loans. On average, the loan duration for Q4 2017 was 0.71 day (17 hours). The daily average however deviates quite strongly from day-to-day.

### Periodic replacement of idle loans

Lastly, we make sure to replace loans that sit idle for too long as a result of a strong sudden unexpected downward shift in market demand.