-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
307 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from mplchart import utils\n", | ||
"\n", | ||
"from mplchart.chart import Chart\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Help on class Chart in module mplchart.chart:\n", | ||
"\n", | ||
"class Chart(builtins.object)\n", | ||
" | Chart(title=None, max_bars=None, start=None, end=None, figure=None, figsize=None, bgcolor=None, holidays=None, raw_dates=False, color_scheme=())\n", | ||
" | \n", | ||
" | Chart Object\n", | ||
" | \n", | ||
" | Args:\n", | ||
" | title (str) : the chart title\n", | ||
" | max_bars (int) : the maximum number of bars to plot\n", | ||
" | start, end (datetime | str) : the start and end date of the range to plot\n", | ||
" | figsize (tuple) : the size of the figure\n", | ||
" | \n", | ||
" | Example:\n", | ||
" | chart = Chart(title=tiltle, ...)\n", | ||
" | chart.plot(prices, indicators)\n", | ||
" | \n", | ||
" | Methods defined here:\n", | ||
" | \n", | ||
" | __init__(self, title=None, max_bars=None, start=None, end=None, figure=None, figsize=None, bgcolor=None, holidays=None, raw_dates=False, color_scheme=())\n", | ||
" | Initialize self. See help(type(self)) for accurate signature.\n", | ||
" | \n", | ||
" | add_legends(self)\n", | ||
" | adds legends to all axes\n", | ||
" | \n", | ||
" | calc_result(self, prices, indicator)\n", | ||
" | calculates indicator result saving last result\n", | ||
" | \n", | ||
" | config_axes(self, ax, root=False)\n", | ||
" | configures axes\n", | ||
" | \n", | ||
" | count_axes(self, include_root=False, include_twins=False)\n", | ||
" | \" counts axes that are neither root or twinx\n", | ||
" | \n", | ||
" | counter = <functools.cached_property object>\n", | ||
" | dump_axes(self)\n", | ||
" | \n", | ||
" | extract_df(self, data)\n", | ||
" | extract dataframe subset\n", | ||
" | \n", | ||
" | figure = <functools.cached_property object>\n", | ||
" | force_target(self, target)\n", | ||
" | force target for next get_axes\n", | ||
" | \n", | ||
" | get_axes(self, target=None, *, height_ratio=None)\n", | ||
" | selects existing axes or creates new axes depending on target\n", | ||
" | \n", | ||
" | Args:\n", | ||
" | target: one of \"main\", \"same\", twinx\", \"above\", \"below\"\n", | ||
" | \n", | ||
" | get_color(self, name, ax=None, indicator=None, *, fallback=None)\n", | ||
" | Lookup color through indicator and color_scheme\n", | ||
" | \n", | ||
" | get_target(self, indicator)\n", | ||
" | target axes for indicator\n", | ||
" | \n", | ||
" | init_axes(self)\n", | ||
" | create root axes\n", | ||
" | \n", | ||
" | init_mapper(self, data)\n", | ||
" | initalizes chart and mapper with price data\n", | ||
" | \n", | ||
" | main_axes(self)\n", | ||
" | returns main axes, usualy axes[1]\n", | ||
" | \n", | ||
" | map_date(self, date)\n", | ||
" | map date to value\n", | ||
" | \n", | ||
" | next_fill_color(self, ax)\n", | ||
" | Next cycled color for fill\n", | ||
" | \n", | ||
" | next_line_color(self, ax)\n", | ||
" | Next line color either text.color or cycled color\n", | ||
" | \n", | ||
" | plot(self, prices, indicators, *, target=None, rebase=False)\n", | ||
" | plots a list of indicators\n", | ||
" | \n", | ||
" | Parameters\n", | ||
" | ----------\n", | ||
" | prices: dataframe\n", | ||
" | the prices data frame\n", | ||
" | indicators: list of indicators\n", | ||
" | list of indciators to plot\n", | ||
" | \n", | ||
" | plot_indicator(self, data, indicator)\n", | ||
" | calculates and plots an indicator\n", | ||
" | \n", | ||
" | plot_result(self, result, indicator, ax=None)\n", | ||
" | last resort plot_result handler\n", | ||
" | \n", | ||
" | plot_vline(self, date)\n", | ||
" | plots a vertical line across all axes\n", | ||
" | \n", | ||
" | rebase_data(self, data)\n", | ||
" | \n", | ||
" | render(self, format='svg')\n", | ||
" | renders the chart to the specific format\n", | ||
" | \n", | ||
" | root_axes(self)\n", | ||
" | returns root axes, usualy axes[0]\n", | ||
" | \n", | ||
" | set_title(self, title)\n", | ||
" | Sets chart title on root axes. Must be called after init_axes!\n", | ||
" | \n", | ||
" | show(self)\n", | ||
" | shows the chart\n", | ||
" | \n", | ||
" | ----------------------------------------------------------------------\n", | ||
" | Static methods defined here:\n", | ||
" | \n", | ||
" | normalize(prices)\n", | ||
" | \n", | ||
" | valid_target(target)\n", | ||
" | whether the target bname is valid\n", | ||
" | \n", | ||
" | ----------------------------------------------------------------------\n", | ||
" | Data descriptors defined here:\n", | ||
" | \n", | ||
" | __dict__\n", | ||
" | dictionary for instance variables (if defined)\n", | ||
" | \n", | ||
" | __weakref__\n", | ||
" | list of weak references to the object (if defined)\n", | ||
" | \n", | ||
" | ----------------------------------------------------------------------\n", | ||
" | Data and other attributes defined here:\n", | ||
" | \n", | ||
" | DEFAULT_FIGSIZE = (12, 9)\n", | ||
" | \n", | ||
" | last_result = None\n", | ||
" | \n", | ||
" | layout = <class 'mplchart.layout.StandardLayout'>\n", | ||
" | Grispec Baeed Layout\n", | ||
" | \n", | ||
" | \n", | ||
" | mapper = None\n", | ||
" | \n", | ||
" | next_target = None\n", | ||
" | \n", | ||
" | source_data = None\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"help(Chart)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Help on module mplchart.utils in mplchart:\n", | ||
"\n", | ||
"NAME\n", | ||
" mplchart.utils - mplchart utils\n", | ||
"\n", | ||
"FUNCTIONS\n", | ||
" get_label(indicator)\n", | ||
" indicator label\n", | ||
" \n", | ||
" get_name(indicator)\n", | ||
" indicator name\n", | ||
" \n", | ||
" get_series(prices, item: str = None)\n", | ||
" extract column by name if applicable\n", | ||
" \n", | ||
" same_scale(indicator)\n", | ||
" Whether indicator uses the same scale as inputs\n", | ||
" \n", | ||
" series_data(data, item: str = None, *, default_item: str = None, strict: bool = False)\n", | ||
" \n", | ||
" series_xy(data, item=None, *, dropna=False)\n", | ||
" split data into x, y arrays\n", | ||
" \n", | ||
" short_repr(self)\n", | ||
" short repr based on __init__ signature\n", | ||
"\n", | ||
"DATA\n", | ||
" TALIB_SAME_SCALE = 'Output scale same as input'\n", | ||
"\n", | ||
"FILE\n", | ||
" /Users/frederic/Projects/mplchart/src/mplchart/utils.py\n", | ||
"\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"help(utils)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.19" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters