Replies: 2 comments
-
hello I reached out to you in order to have a better chat after seeing your article. |
Beta Was this translation helpful? Give feedback.
0 replies
-
In the data, try converting the values to the data type float |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am new to coding python and this is my first day doing backtesting, here is my code and my .csv is attached I think. Any help would be much appreciated.
And here is the response.
C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\backtesting\test_init_.py:8: FutureWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
return pd.read_csv(join(dirname(file), filename),
Traceback (most recent call last):
File "c:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\kernc-github.py", line 27, in
bt = Backtest(df, SmaCross,
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\backtesting\backtesting.py", line 1073, in init
if np.any(data['Close'] > cash):
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\pandas\core\ops\common.py", line 76, in new_method
return method(self, other)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\pandas\core\arraylike.py", line 56, in gt
return self._cmp_method(other, operator.gt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\pandas\core\series.py", line 6119, in _cmp_method
res_values = ops.comparison_op(lvalues, rvalues, op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\pandas\core\ops\array_ops.py", line 344, in comparison_op
res_values = comp_method_OBJECT_ARRAY(op, lvalues, rvalues)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\claym\Documents\GitHub\Python\Trading\Backtesting\venv\Lib\site-packages\pandas\core\ops\array_ops.py", line 129, in comp_method_OBJECT_ARRAY
result = libops.scalar_compare(x.ravel(), y, op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ops.pyx", line 107, in pandas._libs.ops.scalar_compare
TypeError: '>' not supported between instances of 'str' and 'int'
I can provide more clarification or upload more files if this is not enough information.
Gold Futures OHLC.csv
Beta Was this translation helpful? Give feedback.
All reactions