Docstring missing for
_count
313def _count_consecutive(data):
314 """Counts consecutive data (like cumsum() with reset on zeroes)"""
315
316 def _count(data):317 return data * (data.groupby((data != data.shift(1)).cumsum()).cumcount() + 1)
318
319 if isinstance(data, _pd.DataFrame):
Docstring missing for
download_returns
232 return data
233
234
235def download_returns(ticker, period="max", proxy=None):236 params = {
237 "tickers": ticker,
238 "proxy": proxy,
Docstring missing for
_pandas_current_month
50 return df[df.index.isin(dates)]
51
52
53def _pandas_current_month(df): 54 n = _dt.datetime.now()
55 daterange = _pd.date_range(_dt.date(n.year, n.month, 1), n)
56 return df[df.index.isin(daterange)]
Docstring missing for
_pandas_date
44 return df[df.index >= _dt.datetime.now().strftime("%Y-01-01")]
45
46
47def _pandas_date(df, dates): 48 if not isinstance(dates, list):
49 dates = [dates]
50 return df[df.index.isin(dates)]
Docstring missing for
_ytd
40 return df[df.index >= date.strftime("%Y-%m-01")]
41
42
43def _ytd(df): 44 return df[df.index >= _dt.datetime.now().strftime("%Y-01-01")]
45
46
Docstring missing for
_mtd
28from . import stats as _stats
29
30
31def _mtd(df): 32 return df[df.index >= _dt.datetime.now().strftime("%Y-%m-01")]
33
34
Docstring missing for
_embed_figure
1631 iDisplay(iHTML(jscode))
1632
1633
1634def _embed_figure(figfiles, figfmt):1635 if isinstance(figfiles, list):
1636 embed_string = "\n"
1637 for figfile in figfiles:
Docstring missing for
_open_html
1618 iDisplay(iHTML(jscode.replace("{{filename}}", filename)))
1619
1620
1621def _open_html(html):1622 jscode = _regex.sub(
1623 " +",
1624 " ",
Docstring missing for
_download_html
1600 return obj
1601
1602
1603def _download_html(html, filename="quantstats-tearsheet.html"):1604 jscode = _regex.sub(
1605 " +",
1606 " ",
Docstring missing for
_html_table
1586 return dd_stats.T
1587
1588
1589def _html_table(obj, showindex="default"):1590 obj = _tabulate(
1591 obj, headers="keys", tablefmt="html", floatfmt=".2f", showindex=showindex
1592 )
Docstring missing for
_calc_dd
1502 )
1503
1504
1505def _calc_dd(df, display=True, as_pct=False):1506 dd = _stats.to_drawdown_series(df)
1507 dd_info = _stats.drawdown_details(dd)
1508
Docstring missing for
plots
1233 return metrics
1234
1235
1236def plots(1237 returns,
1238 benchmark=None,
1239 grayscale=False,
Docstring missing for
metrics
723 )
724
725
726def metrics( 727 returns,
728 benchmark=None,
729 rf=0.0,
Docstring missing for
basic
645 )
646
647
648def basic( 649 returns,
650 benchmark=None,
651 rf=0.0,
Docstring missing for
full
496 f.write(tpl)
497
498
499def full( 500 returns,
501 benchmark=None,
502 rf=0.0,
Docstring missing for
html
59 return returns, benchmark
60
61
62def html( 63 returns,
64 benchmark=None,
65 rf=0.0,
Docstring missing for
_match_dates
48 return periods_per_year, half_year
49
50
51def _match_dates(returns, benchmark): 52 if isinstance(returns, _pd.DataFrame):
53 loc = max(returns[returns.columns[0]].ne(0).idxmax(), benchmark.ne(0).idxmax())
54 else:
Docstring missing for
_get_trading_periods
43 from IPython.core.display import display as iDisplay
44
45
46def _get_trading_periods(periods_per_year=252): 47 half_year = _ceil(periods_per_year / 2)
48 return periods_per_year, half_year
49
Docstring missing for
format_pct_axis
1197 return res.replace(".0", "")
1198
1199
1200def format_pct_axis(x, _):1201 x *= 100 # lambda x, loc: "{:,}%".format(int(x * 100))
1202 if x >= 1e12:
1203 res = "%1.1fT%%" % (x * 1e-12)
Docstring missing for
format_cur_axis
1180 return None
1181
1182
1183def format_cur_axis(x, _):1184 if x >= 1e12:
1185 res = "$%1.1fT" % (x * 1e-12)
1186 return res.replace(".0T", "T")
Docstring missing for
plot_table
1089 return None
1090
1091
1092def plot_table(1093 tbl,
1094 columns=None,
1095 title="",
Docstring missing for
plot_distribution
977 return None
978
979
980def plot_distribution( 981 returns,
982 figsize=(10, 6),
983 fontname="Arial",
Docstring missing for
plot_longest_drawdowns
863 return None
864
865
866def plot_longest_drawdowns( 867 returns,
868 periods=5,
869 lw=1.5,
Docstring missing for
plot_rolling_beta
717 return None
718
719
720def plot_rolling_beta( 721 returns,
722 benchmark,
723 window1=126,
Docstring missing for
plot_rolling_stats
589 return None
590
591
592def plot_rolling_stats( 593 returns,
594 benchmark=None,
595 title="",
Description
The module/function docstring is missing.
If you want to ignore this, you can configure this in the .deepsource.toml
file. Please refer to docs for available options.