I dot get why Im getting this error. Its a simple synthax error it seems
Code
Import libraries
import numpy as np
import pandas as pd
import statsmodels.api as sm
from pykalman import KalmanFilter
from numpy import log, polyfit, sqrt, std, subtract
Import blueshift libraries
from blueshift.pipeline import Pipeline
from blueshift.api import(
symbol,
order_target_percent,
schedule_function,
date_rules,
time_rules,
attach_pipeline,
pipeline_output,
get_datetime
)
def make_strategy_pipeline(context):
"""
A function to make the pipeline.
"""
pipe = Pipeline()
return pipe
def initialize(context):
context.lookback = 45
attach_pipeline(make_strategy_pipeline(context), name='strategy_pipeline')
Rebalance every day
schedule_function(rebalance,
date_rules.every_day(),
time_rules.market_open(hours=0, minutes=1))
def rebalance(context, data):
Get the pipeline results
pipeline_results = pipeline_output('strategy_pipeline')
Exclude the SPY ETF
#exclude_tickers = symbol('SPY')
Get the data for the pipeline output
try:
data = data.history(
pipeline_results.index, 'close', context.lookback, '1d')
except IndexError:
return
data.dropna(inplace=True, axis='columns')
data2 = data['Crypto(BTC/USDT [3])']
print("data2",data2.to_string())