mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-13 09:56:31 +08:00
Testing related adjustments
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pandas as pd
|
||||
import talib
|
||||
|
||||
from catalyst import run_algorithm
|
||||
from catalyst.api import symbol
|
||||
@@ -15,11 +16,20 @@ 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=50,
|
||||
frequency='1m'
|
||||
)
|
||||
rsi = talib.RSI(prices.values, timeperiod=14)[-1]
|
||||
print('got rsi: {}'.format(rsi))
|
||||
|
||||
|
||||
run_algorithm(
|
||||
capital_base=250,
|
||||
start=pd.to_datetime('2017-5-1', utc=True),
|
||||
end=pd.to_datetime('2017-5-31', utc=True),
|
||||
start=pd.to_datetime('2017-9-5', utc=True),
|
||||
end=pd.to_datetime('2017-9-30', utc=True),
|
||||
data_frequency='minute',
|
||||
initialize=initialize,
|
||||
handle_data=handle_data,
|
||||
|
||||
Reference in New Issue
Block a user