Inner Workings - Part 2

Published on Jun 09, 2018

This is a second part about BeePlus's inner workings. You can read part 1 about investing into primary market items from the blog.

Second part will be about BeePlus's functionality of investing into Bondora's secondary market items. This is an unique feature of BeePlus compared to Bondora's own automatic investment solutions, since it does not have any limitations when it comes in investing into secondary market items. Bondora's Portfolio Manager offers partial support and Portfolio Pro does not buy anything from secondary market.

Operating on a secondary market is technically much more complicated than on a primary market for BeePlus since it needs even more finely-orchestrated ever-running background jobs.

Logic for the end-user is similar when investing into primary market items - when user has created any rule with at least one filter (and BeePlus has been authorized), then that rule is participating in investing into any loans offered by Bondora on the secondary market.

Also, as for primary market, so called background jobs exist which do all the heavy-lifting and are not visible to the user directly. For secondary market there exists four forever-running jobs - one for investing into most recent secondary market items, one for fetching longer-term secondary market items (there are a lot of these!), one for investing into these longer-term items and one for updating bought items statuses.

Buying Loans

BeePlus fetches currently available items on secondary market from Bondora as often as possible. It would do it even more often, but Bondora has set up many different documented and undocumented rate limits. BeePlus looks for different items in parallel - recent items and longer-term items. Recent items are looked more often since there are less of them and there might be better offers than for longer-term items (otherwise they might be already been bought, right?). Fetching longer-term items takes considerable amount of time, thus fetching and investing into them are kept as a separate actions. After getting some available items, it will cycle through all of the users who has any enabled rules for secondary market investing. It does it in random order to make everything as "fair" as possible for its users.

As with primary market, each rule will be matched against an item by looking at its attributes one by one. Most of the matching is done by comparing rule's filter field value with the item's actual value, but there's also some more complicated algorithms involved when values are choices, ranges or time-based. After any rule with all matching filters has been found and user daily limits are not exceeded, a purchase order is sent to Bondora.

Purchase Status

To be sure that purchase was successful, BeePlus performs periodically requests to Bondora to get all the recently purchased loans statuses so that to set each item's status either to purchased or failed in the user interface.

Technical Challenges

While writing this post, everything seems to be quite simple, but it's far from reality. In reality there has been many undocumented API features, throttling rules have been changed during BeePlus's operation, API itself has been changed with very brief notice period (or without any notice), API is technically unstable at times and so on. It's not like a walk in the park even if it seems so from using BeePlus. One of the biggest problems for me as a developer has been working with Bondora's API throttling rules - basically, the more requests I need to perform against their API, the more I will hit against throttling rules. And there's quite many requests to perform to keep everything running for primary and secondary market at all time.


I hope this post has given some overview of how BeePlus operates when buying from secondary market. Next post will be about the functionality of selling to the secondary market.