BUG: accounting for daily historical bars with minute freq algo

This commit is contained in:
fredfortier
2017-11-02 20:18:34 -04:00
parent a9a422c892
commit 5e4ad9b338
5 changed files with 162 additions and 28 deletions
+13 -11
View File
@@ -16,26 +16,28 @@ def handle_data(context, data):
price = data.current(context.asset, 'close')
print('got price {price}'.format(price=price))
# prices = data.history(
# context.asset,
# fields='price',
# bar_count=20,
# frequency='1T'
# )
# rsi = talib.RSI(prices.values, timeperiod=14)[-1]
# print('got rsi: {}'.format(rsi))
pass
try:
prices = data.history(
context.asset,
fields='price',
bar_count=16,
frequency='1D'
)
rsi = talib.RSI(prices.values, timeperiod=14)[-1]
print('got rsi: {}'.format(rsi))
except Exception as e:
print(e)
run_algorithm(
capital_base=250,
start=pd.to_datetime('2017-1-1', utc=True),
end=pd.to_datetime('2017-10-22', utc=True),
data_frequency='daily',
data_frequency='minute',
initialize=initialize,
handle_data=handle_data,
analyze=None,
exchange_name='poloniex',
exchange_name='bitfinex',
algo_namespace='simple_loop',
base_currency='btc'
)