diff --git a/catalyst/examples/buy_low_sell_high_live.py b/catalyst/examples/buy_low_sell_high_live.py index bfd44a2f..a1fd326c 100644 --- a/catalyst/examples/buy_low_sell_high_live.py +++ b/catalyst/examples/buy_low_sell_high_live.py @@ -18,7 +18,7 @@ log = Logger('buy low sell high') def initialize(context): log.info('initializing algo') - context.ASSET_NAME = 'etc_btc' + context.ASSET_NAME = 'btc_usdt' context.asset = symbol(context.ASSET_NAME) context.TARGET_POSITIONS = 30 @@ -41,7 +41,7 @@ def _handle_data(context, data): context.asset, fields='price', bar_count=20, - frequency='15m' + frequency='1d' ) rsi = talib.RSI(prices.values, timeperiod=14)[-1] log.info('got rsi: {}'.format(rsi)) @@ -54,7 +54,7 @@ def _handle_data(context, data): elif rsi <= 70: buy_increment = 0.2 else: - buy_increment = None + buy_increment = 0.1 cash = context.portfolio.cash log.info('base currency available: {cash}'.format(cash=cash)) @@ -147,14 +147,14 @@ def analyze(context, stats): run_algorithm( - capital_base=1, + capital_base=100000, initialize=initialize, handle_data=handle_data, analyze=analyze, - exchange_name='bitfinex', + exchange_name='poloniex', start=pd.to_datetime('2017-5-01', utc=True), - end=pd.to_datetime('2017-10-01', utc=True), - base_currency='btc', + end=pd.to_datetime('2017-10-16', utc=True), + base_currency='usdt', data_frequency='daily' ) # run_algorithm( diff --git a/catalyst/exchange/exchange_bundle.py b/catalyst/exchange/exchange_bundle.py index ad014b8d..8152aac4 100644 --- a/catalyst/exchange/exchange_bundle.py +++ b/catalyst/exchange/exchange_bundle.py @@ -597,7 +597,7 @@ class ExchangeBundle: for asset_index, asset in enumerate(assets): asset_values = arrays[asset_index] - value_series = pd.Series(asset_values[0], index=periods) + value_series = pd.Series(asset_values.flatten(), index=periods) series[asset] = value_series return series diff --git a/tests/exchange/test_bundle.py b/tests/exchange/test_bundle.py index d7ef9ed7..c4575fe8 100644 --- a/tests/exchange/test_bundle.py +++ b/tests/exchange/test_bundle.py @@ -26,7 +26,7 @@ class ExchangeBundleTestCase: assets = [ exchange.get_asset('btc_usdt') ] - dt = pd.to_datetime('2017-9-29 23:59', utc=True) + dt = pd.to_datetime('2017-10-14', utc=True) values = exchange_bundle.get_spot_values( assets=assets,