mirror of
https://github.com/kernc/backtesting.py.git
synced 2024-01-28 15:29:30 +03:00
REF: Add Straetgy.data.<array>.to_series() method
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from numbers import Number
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def _as_str(value):
|
||||
@@ -52,6 +53,9 @@ class _Array(np.ndarray):
|
||||
except IndexError:
|
||||
return super().__float__()
|
||||
|
||||
def to_series(self):
|
||||
return pd.Series(self, index=self._opts['data'].index, name=self.name)
|
||||
|
||||
|
||||
class _Indicator(_Array):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user