MAINT minor refactoring ENH sample json strategy

This commit is contained in:
Kevin Johnson
2021-10-15 12:39:15 -07:00
parent 8dadb574c7
commit fc4a04af26
8 changed files with 29 additions and 8 deletions
+13
View File
@@ -0,0 +1,13 @@
{
"name": "Sample JSON Strategy",
"description": "Sample JSON Strategy",
"ta": [
{"kind": "ema", "length": 8, "sma": true},
{"kind": "ema", "length": 21, "talib": true},
{"kind": "sma", "length": 50, "talib": true},
{"kind": "sma", "length": 200, "talib": true},
{"kind": "sma", "close": "volume", "length": 20, "talib": true},
{"kind": "rsi", "talib": true},
{"kind": "obv"}
]
}
+10 -1
View File
@@ -23,7 +23,16 @@ ALL_PATTERNS = [
]
def cdl_pattern(open_, high, low, close, name: Union[str, Sequence[str]]="all", scalar=None, offset=None, **kwargs) -> DataFrame:
def cdl_pattern(
open_,
high,
low,
close,
name: Union[str, Sequence[str]]="all",
scalar=None,
offset=None,
**kwargs
) -> DataFrame:
"""TA Lib Candle Patterns
A wrapper around all TA Lib's candle patterns.
+1 -1
View File
@@ -53,7 +53,7 @@ class Strategy:
name: str # = None # Required.
ta: List = field(default_factory=list) # Required.
# Helpful. More descriptive version or notes or w/e.
description: str = "TA Description"
description: str = ""
# Optional. Gets Exchange Time and Local Time execution time
created: str = get_time(to_string=True)
-1
View File
@@ -70,7 +70,6 @@ def inv_norm(value: Tuple[float, int]) -> Tuple[float, None]:
If the user has package "statsmodels" installed, the method will call and
return norm().ppf(value)
Source: https://github.com/scipy/scipy/blob/701ffcc8a6f04509d115aac5e5681c538b5265a2/scipy/special/cephes/ndtri.c
"""
+2 -2
View File
@@ -97,8 +97,8 @@ def total_time(df: DataFrame, tf: str = "years") -> float:
def to_utc(df: DataFrame) -> DataFrame:
"""Either localizes the DataFrame Index to UTC or it applies
tz_convert to set the Index to UTC.
"""Either localizes the DataFrame Index to UTC or it applies tz_convert to
set the Index to UTC.
"""
if not df.empty:
try:
+2 -2
View File
@@ -36,8 +36,8 @@ class sample(object):
This is a Numpy and stochastics package wrapper Class that easily creates
stochastic process realization with or without stochastic noise.
To get the most out of sample(), install the _stochastic_
package: pip install stochastic.
To get the most out of sample(), install the 'stochastic' package:
$ pip install stochastic
The following stochastic package noise and processes have been implemented:
* Noise[9]: Blue "b", Brownian "br, Fractal Gaussian "fg", Gaussian "g",
View File
+1 -1
View File
@@ -18,7 +18,7 @@ sample_data = read_csv(
)
sample_data.set_index(DatetimeIndex(sample_data["date"]), inplace=True, drop=True)
sample_data.drop("date", axis=1, inplace=True)
sample_data = sample_data[:200]
# sample_data = sample_data[:200]
def error_analysis(df, kind, msg, icon=INFO, newline=True):