You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying the RSI code in colab and desktop pc, but I'm getting this error.
#RSI KODLARIimportblanklydefprice_event(price, symbol, state: blankly.StrategyState):
""" This function will give an updated price every 15 seconds from our definition below """state.variables['history'].append(price) # appends to the deque of historical pricesrsi=blankly.indicators.rsi(state.variables['history'])
ifrsi[-1] <30andnotstate.variables['owns_position']:
buy=int(state.interface.cash/price)
state.interface.market_order(symbol, side='buy', size=buy)
state.variables['owns_position'] =Trueelifrsi[-1] >70andstate.variables['owns_position']:
curr_value=int(state.interface.account[state.base_asset].available)
state.interface.market_order(symbol, side='sell', size=curr_value)
state.variables['owns_position'] =Falsedefinit(symbol, state: blankly.StrategyState):
# Download price data to give context to the algostate.variables['history'] =state.interface.history(symbol, to=150, return_as='deque')['close']
state.variables['owns_position'] =Falseif__name__=="__main__":
exchange=blankly.Binance(portfolio_name="ATD Binance")
strategy=blankly.Strategy(exchange)
strategy.add_price_event(price_event, symbol='ETH-BUSD', resolution='15m', init=init)
# Start the strategy. This will begin each of the price event ticks# strategy.start()# Or backtest using thisresults=strategy.backtest(to='1y', initial_values={'BUSD': 1000})
print(results)
Description
I'm trying the RSI code in colab and desktop pc, but I'm getting this error.
Error (if applicable)
The text was updated successfully, but these errors were encountered: