diff --git a/README.rst b/README.rst index d39a6918..fdf4f2b2 100644 --- a/README.rst +++ b/README.rst @@ -69,7 +69,7 @@ The following code implements a simple buy and hodl algorithm. The full source RESERVE_RATIO = 1.0 - TARGET_HODL_RATIO def initialize(context): - context.is_hodling = True + context.is_buying = True context.asset = symbol(ASSET) def handle_data(context, data): @@ -82,15 +82,15 @@ The following code implements a simple buy and hodl algorithm. The full source for order in orders: cancel_order(order) - # Stop hodling after passing reserve threshold + # Stop buying after passing reserve threshold if cash <= reserve_value: - context.is_hodling = False + context.is_buying = False # Retrieve current price from pricing data price = data[context.asset].price - # Check if still hodling and could (approximately) afford another purchase - if context.is_hodling and cash > price: + # Check if still buying and could (approximately) afford another purchase + if context.is_buying and cash > price: # Place order to make position in asset equal to target_hodl_value order_target_value( context.asset, diff --git a/catalyst/examples/buy_and_hodl.py b/catalyst/examples/buy_and_hodl.py index 35701a6e..52295e83 100644 --- a/catalyst/examples/buy_and_hodl.py +++ b/catalyst/examples/buy_and_hodl.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import numpy as np - from catalyst.api import ( order_target_value, symbol, @@ -30,7 +28,7 @@ TARGET_HODL_RATIO = 0.8 RESERVE_RATIO = 1.0 - TARGET_HODL_RATIO def initialize(context): - context.is_hodling = True + context.is_buying = True context.asset = symbol(ASSET) def handle_data(context, data): @@ -43,15 +41,15 @@ def handle_data(context, data): for order in orders: cancel_order(order) - # Stop hodling after passing the reserve threshold + # Stop buying after passing the reserve threshold if cash <= reserve_value: - context.is_hodling = False + context.is_buying = False # Retrieve current asset price from pricing data price = data[context.asset].price - # Check if still hodling and could (approximately) afford another purchase - if context.is_hodling and cash > price: + # Check if still buying and could (approximately) afford another purchase + if context.is_buying and cash > price: # Place order to make position in asset equal to target_hodl_value order_target_value( context.asset, diff --git a/catalyst/examples/dual_vwap.py b/catalyst/examples/dual_vwap.py index 947f3b75..61c2caa8 100644 --- a/catalyst/examples/dual_vwap.py +++ b/catalyst/examples/dual_vwap.py @@ -19,12 +19,9 @@ from catalyst.api import ( record, symbol, get_open_orders, - set_commission, - set_slippage, set_max_leverage, schedule_function, date_rules, - time_rules, attach_pipeline, pipeline_output, )