The algorithm is published (see my feed). It looks at the average HIVE price from top exchanges (because that is more liquid and the price quotes more stable compared to HBD prices) and then compares that with the internal market price in HBD.
If it is returning the HBD, that means it wasn't able to immediately buy more than $1 worth of HIVE for 1 HBD.
Another strategy would be to hold on the HDB for a while to try to get a better price, but that isn't being done. I wanted to minimize the trust factor of holding funds.
The mismatch may be a result of how coinmarketcap (which I think is where you got that chart) calculates prices and/or there may still be an opportunity to arbitrage between internal and external markets. I know there are several bots doing so already, but perhaps there could be more. If so, then I would encourage people to take advantage of the opportunity.
Thanks for the explanation. I understand now the logic behind the code. Even without the bot there are still arbitrage possibilities although they are more difficult to execute with the thin orderbook of the internal market and the price swings that BTC is experiencing.
I ported my old market maker bot from Steem and it is now forcing much tighter spreads on the internal market (usually well under 1/2%). This has a synergy with the stabilizer since the tighter spreads mean that internal and external prices are kept much closer by arbitrage.
I noticed since last night that you were running the trading bot. This should help alot with the peg.