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
/local/home/dshetyo/python-venvs/python3.7_venv/lib/python3.7/site-packages/TAcharts/indicators/renko.py in set_brick_size(self, brick_size, auto, atr_interval)
44 raise ValueError("ATR interval is longer than historical data.")
45
---> 46 self.brick_size = self._optimize_brick_size(auto, brick_size, atr_interval)
47 return self.brick_size
48
/local/home/dshetyo/python-venvs/python3.7_venv/lib/python3.7/site-packages/TAcharts/indicators/renko.py in _optimize_brick_size(self, auto, brick_size, atr_interval)
52 if auto and not brick_size:
53 average_true_range = atr(
---> 54 self.df["high"], self.df["low"], self.df["close"], n=atr_interval
55 )
56 brick_size = np.median(average_true_range)
/local/home/dshetyo/python-venvs/python3.7_venv/lib/python3.7/site-packages/TAcharts/indicators/atr.py in atr(high, low, close, n)
15 """ Returns the average true range from candlestick data """
16
---> 17 prev_close = np.insert(close[:-1], 0, 0)
18 # True range is largest of the following:
19 # a. Current high - current low
<array_function internals> in insert(*args, **kwargs)
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/numpy/lib/function_base.py in insert(arr, obj, values, axis)
4728 new[tuple(slobj)] = arr[tuple(slobj2)]
4729 if wrap:
-> 4730 return wrap(new)
4731 return new
4732 elif indices.size == 0 and not isinstance(obj, np.ndarray):
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/pandas/core/generic.py in array_wrap(self, result, context)
2023 # error: Argument 1 to "NDFrame" has incompatible type "ndarray";
2024 # expected "BlockManager"
-> 2025 return self._constructor(res, **d).finalize( # type: ignore[arg-type]
2026 self, method="array_wrap"
2027 )
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/pandas/core/series.py in init(self, data, index, dtype, name, copy, fastpath)
428 index = ibase.default_index(len(data))
429 elif is_list_like(data):
--> 430 com.require_length_match(data, index)
431
432 # create/copy the manager
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/pandas/core/common.py in require_length_match(data, index)
530 if len(data) != len(index):
531 raise ValueError(
--> 532 "Length of values "
533 f"({len(data)}) "
534 "does not match length of index "
ValueError: Length of values (2401) does not match length of index (2400)
The text was updated successfully, but these errors were encountered:
Trying to run this simple code an getting following error
Verifed that
ValueError Traceback (most recent call last)
/tmp/ipykernel_1319/1050412922.py in
1 r = Renko(df)
----> 2 r.set_brick_size(auto=True, atr_interval=2)
3 r.build()
4
5 r.plot()
/local/home/dshetyo/python-venvs/python3.7_venv/lib/python3.7/site-packages/TAcharts/indicators/renko.py in set_brick_size(self, brick_size, auto, atr_interval)
44 raise ValueError("ATR interval is longer than historical data.")
45
---> 46 self.brick_size = self._optimize_brick_size(auto, brick_size, atr_interval)
47 return self.brick_size
48
/local/home/dshetyo/python-venvs/python3.7_venv/lib/python3.7/site-packages/TAcharts/indicators/renko.py in _optimize_brick_size(self, auto, brick_size, atr_interval)
52 if auto and not brick_size:
53 average_true_range = atr(
---> 54 self.df["high"], self.df["low"], self.df["close"], n=atr_interval
55 )
56 brick_size = np.median(average_true_range)
/local/home/dshetyo/python-venvs/python3.7_venv/lib/python3.7/site-packages/TAcharts/indicators/atr.py in atr(high, low, close, n)
15 """ Returns the average true range from candlestick data """
16
---> 17 prev_close = np.insert(close[:-1], 0, 0)
18 # True range is largest of the following:
19 # a. Current high - current low
<array_function internals> in insert(*args, **kwargs)
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/numpy/lib/function_base.py in insert(arr, obj, values, axis)
4728 new[tuple(slobj)] = arr[tuple(slobj2)]
4729 if wrap:
-> 4730 return wrap(new)
4731 return new
4732 elif indices.size == 0 and not isinstance(obj, np.ndarray):
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/pandas/core/generic.py in array_wrap(self, result, context)
2023 # error: Argument 1 to "NDFrame" has incompatible type "ndarray";
2024 # expected "BlockManager"
-> 2025 return self._constructor(res, **d).finalize( # type: ignore[arg-type]
2026 self, method="array_wrap"
2027 )
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/pandas/core/series.py in init(self, data, index, dtype, name, copy, fastpath)
428 index = ibase.default_index(len(data))
429 elif is_list_like(data):
--> 430 com.require_length_match(data, index)
431
432 # create/copy the manager
/local/home/dshetyo/python-venvs/python3.7_venv/lib64/python3.7/site-packages/pandas/core/common.py in require_length_match(data, index)
530 if len(data) != len(index):
531 raise ValueError(
--> 532 "Length of values "
533 f"({len(data)}) "
534 "does not match length of index "
ValueError: Length of values (2401) does not match length of index (2400)
The text was updated successfully, but these errors were encountered: