diff --git a/catalyst/examples/buy_and_hodl.py b/catalyst/examples/buy_and_hodl.py index ede7e095..c20338f4 100644 --- a/catalyst/examples/buy_and_hodl.py +++ b/catalyst/examples/buy_and_hodl.py @@ -28,6 +28,8 @@ ASSET = 'USDT_BTC' TARGET_HODL_RATIO = 0.8 RESERVE_RATIO = 1.0 - TARGET_HODL_RATIO +UNITS_PER_COIN = 10.0 + def initialize(context): context.is_buying = True context.asset = symbol(ASSET) @@ -75,7 +77,7 @@ def analyze(context=None, results=None): ax2 = plt.subplot(512, sharex=ax1) ax2.set_ylabel('{asset} (USD)'.format(asset=ASSET)) - results[['price']].plot(ax=ax2) + (UNITS_PER_COIN * results[['price']]).plot(ax=ax2) trans = results.ix[[t != [] for t in results.transactions]] buys = trans.ix[ @@ -83,7 +85,7 @@ def analyze(context=None, results=None): ] ax2.plot( buys.index, - results.price[buys.index], + UNITS_PER_COIN * results.price[buys.index], '^', markersize=10, color='g', diff --git a/catalyst/examples/dual_vwap.py b/catalyst/examples/dual_vwap.py index b3794e2b..c177db26 100644 --- a/catalyst/examples/dual_vwap.py +++ b/catalyst/examples/dual_vwap.py @@ -37,6 +37,8 @@ TARGET_INVESTMENT_RATIO = 0.8 SHORT_WINDOW = 30 LONG_WINDOW = 100 +UNITS_PER_COIN = 10.0 + def initialize(context): context.i = 0 context.asset = symbol(ASSET) @@ -112,7 +114,7 @@ def analyze(context=None, results=None): ax2 = plt.subplot(512, sharex=ax1) ax2.set_ylabel('{asset} (USD)'.format(asset=ASSET)) - results[['price', 'short_mavg', 'long_mavg']].plot(ax=ax2) + (UNITS_PER_COIN*results[['price', 'short_mavg', 'long_mavg']]).plot(ax=ax2) trans = results.ix[[t != [] for t in results.transactions]] amounts = [t[0]['amount'] for t in trans.transactions] @@ -126,14 +128,14 @@ def analyze(context=None, results=None): ax2.plot( buys.index, - results.price[buys.index], + UNITS_PER_COIN * results.price[buys.index], '^', markersize=10, color='g', ) ax2.plot( sells.index, - results.price[sells.index], + UNITS_PER_COIN * results.price[sells.index], 'v', markersize=10, color='r',