mirror of
https://github.com/wassname/pandas-ta.git
synced 2026-08-19 12:30:41 +08:00
MAINT _time minor refactoring DOC update
This commit is contained in:
@@ -14,7 +14,7 @@ Pandas TA - A Technical Analysis Library in Python 3
|
||||
[](https://pypistats.org/packages/pandas_ta)
|
||||
[](#stars)
|
||||
[](#forks)
|
||||
[](#usedby)
|
||||
[](#usedby)
|
||||
[](#contributors)
|
||||
[](#issues)
|
||||
[](#closed-issues)
|
||||
@@ -48,6 +48,7 @@ _Pandas Technical Analysis_ (**Pandas TA**) is an easy to use library that lever
|
||||
* [Pandas TA Strategy](#pandas-ta-strategy)
|
||||
* [Pandas TA Strategies](#pandas-ta-strategies)
|
||||
* [Types of Strategies](#types-of-strategies)
|
||||
* [Multiprocessing](#multiprocessing)
|
||||
* [DataFrame Properties](#dataframe-properties)
|
||||
* [DataFrame Methods](#dataframe-methods)
|
||||
* [Indicators by Category](#indicators-by-category)
|
||||
@@ -81,7 +82,7 @@ _Pandas Technical Analysis_ (**Pandas TA**) is an easy to use library that lever
|
||||
* **BETA** Also Pandas TA will run TA Lib's version, this includes TA Lib's 63 Chart Patterns.
|
||||
* Indicators are tightly correlated with the de facto [TA Lib](https://mrjbq7.github.io/ta-lib/) if they share common indicators.
|
||||
* Example Jupyter Notebook with **vectorbt** Portfolio Backtesting with Pandas TA's ```ta.tsignals``` method.
|
||||
* Have the need for speed? By using the DataFrame _strategy_ method, you get **multiprocessing** for free!
|
||||
* Have the need for speed? By using the DataFrame _strategy_ method, you get **multiprocessing** for free! __Conditions permitting__.
|
||||
* Easily add _prefixes_ or _suffixes_ or _both_ to columns names. Useful for Custom Chained Strategies.
|
||||
* Example Jupyter Notebooks under the [examples](https://github.com/twopirllc/pandas-ta/tree/main/examples) directory, including how to create Custom Strategies using the new [__Strategy__ Class](https://github.com/twopirllc/pandas-ta/tree/main/examples/PandaTA_Strategy_Examples.ipynb)
|
||||
* Potential Data Leaks: **ichimoku** and **dpo**. See indicator list below for details.
|
||||
@@ -103,14 +104,15 @@ _Pandas Technical Analysis_ (**Pandas TA**) is an easy to use library that lever
|
||||
|
||||
Stable
|
||||
------
|
||||
The ```pip``` version is the last most stable release. Version: *0.2.45b*
|
||||
The ```pip``` version is the last stable release. Version: *0.2.45b*
|
||||
```sh
|
||||
$ pip install pandas_ta
|
||||
```
|
||||
|
||||
Latest Version
|
||||
--------------
|
||||
Best choice! Version: *0.2.94b*
|
||||
Best choice! Version: *0.2.95b*
|
||||
* Includes all fixes and updates between **pypi** and what is covered in this README.
|
||||
```sh
|
||||
$ pip install -U git+https://github.com/twopirllc/pandas-ta
|
||||
```
|
||||
@@ -208,7 +210,7 @@ Thanks for using **Pandas TA**!
|
||||
|
||||
_Thank you for your contributions!_
|
||||
|
||||
[AbyssAlora](https://github.com/AbyssAlora) | [alexonab](https://github.com/alexonab) | [allahyarzadeh](https://github.com/allahyarzadeh) | [CMobley7](https://github.com/CMobley7) | [codesutras](https://github.com/codesutras) | [DrPaprikaa](https://github.com/DrPaprikaa) | [daikts](https://github.com/daikts) | [dorren](https://github.com/dorren) | [edwardwang1](https://github.com/edwardwang1) | [ffhirata](https://github.com/ffhirata) | [FGU1](https://github.com/FGU1) | [floatinghotpot](https://github.com/floatinghotpot) | [GSlinger](https://github.com/gslinger) | [JoeSchr](https://github.com/JoeSchr) | [lluissalord](https://github.com/lluissalord) | [luisbarrancos](https://github.com/luisbarrancos) | [M6stafa](https://github.com/M6stafa) | [maxdignan](https://github.com/maxdignan) | [mchant](https://github.com/mchant) | [moritzgun](https://github.com/moritzgun) | [nicoloridulfo](https://github.com/nicoloridulfo) [NkosenhleDuma](https://github.com/NkosenhleDuma) | [pbrumblay](https://github.com/pbrumblay) | [RajeshDhalange](https://github.com/RajeshDhalange) | [rengel8](https://github.com/rengel8) | [rluong003](https://github.com/rluong003) | [SoftDevDanial](https://github.com/SoftDevDanial) | [tg12](https://github.com/tg12) | [twrobel](https://github.com/twrobel) | [WellMaybeItIs](https://github.com/WellMaybeItIs) | [whubsch](https://github.com/whubsch) | [witokondoria](https://github.com/witokondoria) | [wouldayajustlookatit](https://github.com/wouldayajustlookatit) | [YuvalWein](https://github.com/YuvalWein)
|
||||
[AbyssAlora](https://github.com/AbyssAlora) | [alexonab](https://github.com/alexonab) | [allahyarzadeh](https://github.com/allahyarzadeh) | [bizso09](https://github.com/bizso09) | [CMobley7](https://github.com/CMobley7) | [codesutras](https://github.com/codesutras) | [DrPaprikaa](https://github.com/DrPaprikaa) | [daikts](https://github.com/daikts) | [dorren](https://github.com/dorren) | [edwardwang1](https://github.com/edwardwang1) | [ffhirata](https://github.com/ffhirata) | [FGU1](https://github.com/FGU1) | [floatinghotpot](https://github.com/floatinghotpot) | [GSlinger](https://github.com/gslinger) | [JoeSchr](https://github.com/JoeSchr) | [lluissalord](https://github.com/lluissalord) | [luisbarrancos](https://github.com/luisbarrancos) | [M6stafa](https://github.com/M6stafa) | [maxdignan](https://github.com/maxdignan) | [mchant](https://github.com/mchant) | [moritzgun](https://github.com/moritzgun) | [nicoloridulfo](https://github.com/nicoloridulfo) [NkosenhleDuma](https://github.com/NkosenhleDuma) | [pbrumblay](https://github.com/pbrumblay) | [RajeshDhalange](https://github.com/RajeshDhalange) | [rengel8](https://github.com/rengel8) | [rluong003](https://github.com/rluong003) | [SoftDevDanial](https://github.com/SoftDevDanial) | [tg12](https://github.com/tg12) | [twrobel](https://github.com/twrobel) | [WellMaybeItIs](https://github.com/WellMaybeItIs) | [whubsch](https://github.com/whubsch) | [witokondoria](https://github.com/witokondoria) | [wouldayajustlookatit](https://github.com/wouldayajustlookatit) | [YuvalWein](https://github.com/YuvalWein)
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@ def df_dates(df: DataFrame, dates: Tuple[str, list] = None) -> DataFrame:
|
||||
|
||||
def df_month_to_date(df: DataFrame) -> DataFrame:
|
||||
"""Yields the Month-to-Date (MTD) DataFrame"""
|
||||
return df[df.index >= Timestamp.now().strftime("%Y-%m-01")]
|
||||
in_mtd = df.index >= Timestamp.now().strftime("%Y-%m-01")
|
||||
if any(in_mtd): return df[in_mtd]
|
||||
return df
|
||||
|
||||
|
||||
def df_quarter_to_date(df: DataFrame) -> DataFrame:
|
||||
@@ -27,13 +29,16 @@ def df_quarter_to_date(df: DataFrame) -> DataFrame:
|
||||
now = Timestamp.now()
|
||||
for m in [1, 4, 7, 10]:
|
||||
if now.month <= m:
|
||||
return df[df.index >= datetime(now.year, m, 1).strftime("%Y-%m-01")]
|
||||
in_qtr = df.index >= datetime(now.year, m, 1).strftime("%Y-%m-01")
|
||||
if any(in_qtr): return df[in_qtr]
|
||||
return df[df.index >= now.strftime("%Y-%m-01")]
|
||||
|
||||
|
||||
def df_year_to_date(df: DataFrame) -> DataFrame:
|
||||
"""Yields the Year-to-Date (YTD) DataFrame"""
|
||||
return df[df.index >= Timestamp.now().strftime("%Y-01-01")]
|
||||
in_ytd = df.index >= Timestamp.now().strftime("%Y-01-01")
|
||||
if any(in_ytd): return df[in_ytd]
|
||||
return df
|
||||
|
||||
|
||||
def final_time(stime: float) -> str:
|
||||
@@ -105,6 +110,6 @@ def to_utc(df: DataFrame) -> DataFrame:
|
||||
|
||||
|
||||
# Aliases
|
||||
mtd_df = df_month_to_date
|
||||
qtd_df = df_quarter_to_date
|
||||
ytd_df = df_year_to_date
|
||||
mtd = df_month_to_date
|
||||
qtd = df_quarter_to_date
|
||||
ytd = df_year_to_date
|
||||
@@ -2,7 +2,7 @@
|
||||
from pandas import DataFrame
|
||||
from pandas_ta import Imports, RATE, version
|
||||
from .._core import _camelCase2Title
|
||||
from .._time import ytd_df
|
||||
from .._time import ytd
|
||||
|
||||
|
||||
def yf(ticker: str, **kwargs):
|
||||
@@ -280,7 +280,7 @@ def yf(ticker: str, **kwargs):
|
||||
if kind in _all + ["recommendations", "rec"]:
|
||||
recdf = yfd.recommendations
|
||||
if recdf is not None:
|
||||
recdf = ytd_df(recdf)
|
||||
recdf = ytd(recdf)
|
||||
# recdf_grade = recdf["To Grade"].value_counts().T
|
||||
# recdf_grade.name = "Grades"
|
||||
if kind not in _all: print(f"\n{ticker_info['symbol']}")
|
||||
|
||||
Reference in New Issue
Block a user