Sort:  

All this bot does is look at the last filled order price and creates orders at a spread around that price. If the last fill price moves more than the tolerance parameter viruses an open order that order is canceled and the funds returned to the pool of funds for the next round.

Any intelligence regarding the initial settings, additional logic to buy/sell certain orders and leave others alone, etc. are left as an exercise for the user.

When I get into these things I typically start with someone else's code and then modify it rather than starting from scratch. The purpose of this bot is to give people that starting point. It is by no means a finished bot - just a functional one.