When attempting to write a market maker the slow movement of the feed can be difficult.
I would recommend the following:
if REAL_PRICE < MEDIAN and YOUR_PRICE > MEDIAN publish price
if REAL_PRICE > MEDIAN and abs( YOUR_PRICE - REAL_PRICE ) / REAL_PRICE > 0.005 publish price
The goal is to force the price down rapidly and allow it to creep up slowly.
By publishing prices more often it helps market makers maintain the peg and minimizes opportunity for shorts to sell USD below the peg that the market makers then have to absorb.
If we can get updates flowing smoothly then we can gradually reduce the spread in the market maker bots.
*note: all prices in USD per BTSX