Repository: twelvedata/twelvedata-python Branch: master Commit: 717b47a53578 Files: 38 Total size: 711.3 KB Directory structure: gitextract_6rx84ncj/ ├── .coveragerc ├── .github/ │ ├── CONTRIBUTING.md │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── feature_request.md │ │ └── question.md │ └── dependabot.yml ├── .gitignore ├── .travis.yml ├── AUTHORS.rst ├── CHANGELOG.rst ├── CODE_OF_CONDUCT.md ├── LICENSE.txt ├── Pipfile ├── README.md ├── docs/ │ ├── Makefile │ ├── _static/ │ │ └── .gitignore │ ├── authors.rst │ ├── changelog.rst │ ├── conf.py │ ├── index.rst │ └── license.rst ├── pyproject.toml ├── requirements.txt ├── setup.cfg ├── setup.py ├── src/ │ └── twelvedata/ │ ├── __init__.py │ ├── client.py │ ├── context.py │ ├── endpoints.py │ ├── exceptions.py │ ├── http_client.py │ ├── mixins.py │ ├── renders.py │ ├── time_series.py │ ├── utils.py │ └── websocket.py └── tests/ ├── conftest.py └── test_client.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .coveragerc ================================================ # .coveragerc to control coverage.py [run] branch = True source = tdclient # omit = bad_file.py [paths] source = src/ */site-packages/ [report] # Regexes for lines to exclude from consideration exclude_lines = # Have to re-enable the standard pragma pragma: no cover # Don't complain about missing debug-only code: def __repr__ if self\.debug # Don't complain if tests don't hit defensive assertion code: raise AssertionError raise NotImplementedError # Don't complain if non-runnable code isn't run: if 0: if __name__ == .__main__.: ================================================ FILE: .github/CONTRIBUTING.md ================================================ # Contributing This document describes how you can contribute to Twelve Data API. Please read it carefully. **Table of Contents** * [What contributions are accepted](#what-contributions-are-accepted) * [Pull upstream changes into your fork regularly](#pull-upstream-changes-into-your-fork-regularly) * [How to get your pull request accepted](#how-to-get-your-pull-request-accepted) * [Keep your pull requests limited to a single issue](#keep-your-pull-requests-limited-to-a-single-issue) * [Squash your commits to a single commit](#squash-your-commits-to-a-single-commit) * [Don't mix code changes with whitespace cleanup](#dont-mix-code-changes-with-whitespace-cleanup) * [Keep your code simple!](#keep-your-code-simple) * [Test your changes!](#test-your-changes) * [Write a good commit message](#write-a-good-commit-message) ## What contributions are accepted We highly appreciate your contributions in the matter of fixing bugs, optimizing and new feature implementations for the Twelve Data API source code and its documentation. In case of fixing the existing user experience please push to your fork and [submit a pull request][pr]. Wait for us. We try to review your pull requests as fast as possible. If we find issues with your pull request, we may suggest some changes and improvements. ## Pull upstream changes into your fork regularly Twelve Data API is advancing quickly. It is therefore critical that you pull upstream changes into your fork on a regular basis. Nothing is worse than putting in a days of hard work into a pull request only to have it rejected because it has diverged too far from upstream. To pull in upstream changes: git remote add upstream https://github.com/twelvedata/twelvedata-python.git git fetch upstream master Check the log to be sure that you actually want the changes, before merging: git log upstream/master Then rebase your changes on the latest commits in the `master` branch: git rebase upstream/master After that, you have to force push your commits: git push --force For more info, see [GitHub Help][help_fork_repo]. ## How to get your pull request accepted We want to improve Twelve Data API with your contributions. But we also want to provide a stable experience for our users and the community. Follow these rules and you should succeed without a problem! ### Keep your pull requests limited to a single issue Pull requests should be as small/atomic as possible. Some examples: * If you are making spelling corrections in the docs, don't modify other files. * If you are adding new functions don't '*cleanup*' unrelated functions. That cleanup belongs in another pull request. #### Squash your commits to a single commit To keep the history of the project clean, you should make one commit per pull request. If you already have multiple commits, you can add the commits together (squash them) with the following commands in Git Bash: 1. Open `Git Bash` (or `Git Shell`) 2. Enter following command to squash the recent {N} commits: `git reset --soft HEAD~{N} && git commit` (replace `{N}` with the number of commits you want to squash) 3. Press i to get into Insert-mode 4. Enter the commit message of the new commit 5. After adding the message, press ESC to get out of the Insert-mode 6. Write `:wq` and press Enter to save the new message or write `:q!` to discard your changes 7. Enter `git push --force` to push the new commit to the remote repository For example, if you want to squash the last 5 commits, use `git reset --soft HEAD~5 && git commit` ### Don't mix code changes with whitespace cleanup If you change two lines of code and correct 200 lines of whitespace issues in a file the diff on that pull request is functionally unreadable and will be **rejected**. Whitespace cleanups need to be in their own pull request. ### Keep your code simple! Please keep your code as clean and straightforward as possible. Furthermore, the pixel shortage is over. We want to see: * `opacity` instead of `o` * `placeholder` instead of `ph` * `myFunctionThatDoesThings()` instead of `mftdt()` ### Test your changes! Before you submit a pull request, please test your changes. Verify that Twelve Data API still works and your changes don't cause other issue or crashes. ### Write a good commit message * Explain why you make the changes. [More infos about a good commit message.][commit_message] * If you fix an issue with your commit, please close the issue by [adding one of the keywords and the issue number][closing-issues-via-commit-messages] to your commit message. For example: `Fix #545` [//]: # (LINKS) [help_fork_repo]: https://help.github.com/articles/fork-a-repo/ [commit_message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html [pr]: https://github.com/twelvedata/twelvedata-python/compare [closing-issues-via-commit-messages]: https://help.github.com/articles/closing-issues-via-commit-messages/ ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Report errors or unexpected behavior. title: "[Bug]" labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea. title: "[Feature Request]" labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/ISSUE_TEMPLATE/question.md ================================================ --- name: Question about: Ask a question. title: "[Question]" labels: '' assignees: '' --- ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: pip directory: "/" schedule: interval: daily open-pull-requests-limit: 10 ignore: - dependency-name: bleach versions: - 3.3.0 ================================================ FILE: .gitignore ================================================ # Temporary and binary files *~ *.py[cod] *.so *.cfg !.isort.cfg !setup.cfg *.orig *.log *.pot __pycache__/* .cache/* .*.swp */.ipynb_checkpoints/* # Project files .ropeproject .project .pydevproject .settings .idea .vscode tags src/twelvedata/_version.py # Package files *.egg *.eggs/ .installed.cfg *.egg-info # Unittest and coverage htmlcov/* .coverage .tox junit.xml coverage.xml .pytest_cache/ self_test/ # Build and docs folder/files build/* dist/* sdist/* docs/api/* docs/_rst/* docs/_build/* cover/* MANIFEST # Per-project virtualenvs .venv*/ ================================================ FILE: .travis.yml ================================================ dist: xenial language: python cache: pip python: - "3.6" - "3.7" install: - pip install pipenv - pipenv install - pip install pytest-cov script: - pytest ================================================ FILE: AUTHORS.rst ================================================ ============ Contributors ============ ================================================ FILE: CHANGELOG.rst ================================================ ========= Changelog ========= Version 0.1 =========== - Initial commit ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@twelvedata.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq ================================================ FILE: LICENSE.txt ================================================ The MIT License (MIT) Copyright (c) 2019 twelvedata Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Pipfile ================================================ [packages] twelvedata = {path = "./",extras = ["pandas", "matplotlib", "plotly", "websocket-client", "mplfinance"],editable = true} [dev-packages] jupyter = "*" twine = "*" [pipenv] allow_prereleases = true ================================================ FILE: README.md ================================================

Build Status Open Issues Latest Stable Version License

# Twelve Data Python Client for financial API & WebSocket Official python library for [Twelve Data](https://twelvedata.com). This package supports all main features of the service: * Get stock, forex, cryptocurrency, ETF, and index OHLC time series. * Companies' profiles, financials, and much more fundamentals data. * Get over 100+ technical indicators. * Output data as: `json`, `csv`, `pandas` * Full support for static and dynamic charts. * Real-time WebSocket data stream. **API key** is required. If you don't have it yet, get it by signing up [here](https://twelvedata.com/pricing). ## Installation Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Twelve Data API library (without optional dependencies): ```bash pip install twelvedata ``` Or install with pandas support: ```bash pip install twelvedata[pandas] ``` Or install with pandas, matplotlib, plotly, and websocket support: ``` pip install twelvedata[pandas,matplotlib,plotly,websocket-client] ``` ## Usage * [Core data](#Time-series) * [Fundamentals](#Fundamentals) * [Technical indicators](#Technical-indicators) * [Batch requests](#Batch-requests) * [Charts](#Charts) * [WebSocket](#Websocket) * [Advanced](#Advanced) ##### Supported parameters | Parameter | Description | Type | Required | | ---------- | :----------------------------------------------------------- | ------ | -------- | | symbol | stock ticker (e.g. AAPL, MSFT);
physical currency pair (e.g. EUR/USD, CNY/JPY);
digital currency pair (BTC/USD, XRP/ETH) | string | yes | | interval | time frame: 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 8h, 1day, 1week, 1month | string | yes | | apikey | your personal API Key, if you don't have one - get it [here](https://twelvedata.com/pricing) | string | yes | | exchange | if symbol is traded in multiple exchanges specify the desired one, valid for both stocks and cryptocurrencies | string | no | | mic_code | Market Identifier Code (MIC) under ISO 10383 standard, valid for stocks | string | no | | country | if symbol is traded in multiple countries specify the desired one, valid for stocks | string | no | | outputsize | number of data points to retrieve | int | no | | timezone | timezone at which output datetime will be displayed, supports: `UTC`, `Exchange` or according to IANA Time Zone Database | string | no | | start_date | start date and time of sampling period, accepts `yyyy-MM-dd` or `yyyy-MM-dd hh:mm:ss` format | string | no | | end_date | end date and time of sampling period, accepts `yyyy-MM-dd` or `yyyy-MM-dd hh:mm:ss` format | string | no | | order | sorting order of the time series output, supports `desc` or `asc` | string | no | | date | Could be the exact date, e.g. `2021-10-27`, or in human language `today` or `yesterday` | string | no | The basis for all methods is the `TDClient` object that takes the required `apikey` parameter. ### Time series * `TDClient.time_series()` accepts all common parameters. Time series may be converted to several formats: * `ts.as_json()` - will return JSON array * `ts.as_csv()` - will return CSV with header * `ts.as_pandas()` - will return pandas.DataFrame * `ts.as_url()` - will return list of URLs used ```python from twelvedata import TDClient # Initialize client - apikey parameter is requiered td = TDClient(apikey="YOUR_API_KEY_HERE") # Construct the necessary time series ts = td.time_series( symbol="AAPL", interval="1min", outputsize=10, timezone="America/New_York", ) # Returns pandas.DataFrame ts.as_pandas() ``` Other core data endpoints: * Exchange rate - `TDClient.exchange_rate(symbol)` * Currency conversion - `TDClient.currency_conversion(symbol, amount)` * Quote - `TDClient.quote()` takes parameters as `.time_series()` * Real-time price - `TDClient.price()` takes parameters as `.time_series()` * End of day price - `TDClient.eod()` takes parameters as `.time_series()` ### Fundamentals All fundamentals are supported across global markets. Refer to API documentation [here](https://twelvedata.com/docs#fundamentals) and find out which countries support which fundamentals by visiting [this](https://support.twelvedata.com/en/articles/5621131-fundamentals-coverage) page. * `.get_logo(symbol, exchange, country, type)` * `.get_profile(symbol, exchange, country, type)` * `.get_dividends(symbol, exchange, country, type)` * `.get_splits(symbol, exchange, country, type)` * `.get_earnings(symbol, exchange, country, type, period, outputsize, start_date, end_date)` * `.get_earnings_calendar(symbol, exchange, country, period, start_date, end_date)` * `.get_ipo_calendar(symbol, exchange, country, start_date, end_date)` * `.get_statistics(symbol, exchange, country, type)` * `.get_insider_transactions(symbol, exchange, country, type)` * `.get_income_statement(symbol, exchange, country, type, period, start_date, end_date)` * `.get_balance_sheet(symbol, exchange, country, type, period, start_date, end_date)` * `.get_cash_flow(symbol, exchange, country, type, period, start_date, end_date)` * `.get_key_executives(symbol, exchange, country, type)` * `.get_institutional_holders(symbol, exchange, country, type)` * `.get_fund_holders(symbol, exchange, country, type)` Only JSON format is supported accessible via `.as_json()` ```python from twelvedata import TDClient td = TDClient(apikey="YOUR_API_KEY_HERE") # Get last dividends for AAPL dividends = td.get_dividends( symbol="AAPL", ).as_json() ``` ### Technical indicators This Python library supports all indicators implemented by Twelve Data. Full list of 100+ technical indicators may be found in [API documentation](https://twelvedata.com/docs). * Technical indicators are part of `TDClient.time_series()` object. * It shares the universal format `TDClient.time_series().with_{Technical Indicator Name}`, e.g. `.with_bbands()`, `.with_percent_b()`, `.with_macd()` * Indicator object accepts all parameters according to its specification in [API documentation](https://twelvedata.com/docs), e.g. `.with_bbands()` accepts: `series_type`, `time_period`, `sd`, `ma_type`. If parameter is not provided it will be set to default value. * Indicators may be used in arbitrary order and conjugated, e.g. `TDClient.time_series().with_aroon().with_adx().with_ema()` * By default, technical indicator will output with OHLC values. If you do not need OHLC, specify `TDClient.time_series().without_ohlc()` ```python from twelvedata import TDClient td = TDClient(apikey="YOUR_API_KEY_HERE") ts = td.time_series( symbol="ETH/BTC", exchange="Huobi", interval="5min", outputsize=22, timezone="America/New_York", ) # Returns: OHLC, BBANDS(close, 20, 2, EMA), PLUS_DI(9), WMA(20), WMA(40) ts.with_bbands(ma_type="EMA").with_plus_di().with_wma(time_period=20).with_wma(time_period=40).as_pandas() # Returns: STOCH(14, 1, 3, SMA, SMA), TSF(close, 9) ts.without_ohlc().with_stoch().with_tsf().as_json() ``` ### Batch requests With batch requests up to 120 symbols might be returned per single API call. There are two options on how to do this: ```python # 1. Pass instruments symbols as a string delimited by comma (,) ts = td.time_series( symbol="V, RY, AUD/CAD, BTC/USD:Huobi" ) # 2. Pass as a list of symbols ts = td.time_series( symbol=["V", "RY", "AUD/CAD", "BTC/USD:Huobi"] ) ``` **Important.** Batch requests are only supported with `.as_json()` and `.as_pandas()` formats. With `.as_json()` the output will be a dictionary with passed symbols as keys. The value will be a tuple with quotes, just the same as with a single request. ```python ts = td.time_series(symbol='AAPL,MSFT', interval="1min", outputsize=3) df = ts.with_macd().with_macd(fast_period=10).with_stoch().as_json() { "AAPL": ({'datetime': '2020-04-23 15:59:00', 'open': '275.23001', 'high': '275.25000', 'low': '274.92999', 'close': '275.01001', 'volume': '393317', 'macd_1': '-0.33538', 'macd_signal_1': '-0.24294', 'macd_hist_1': '-0.09244', 'macd_2': '-0.40894', 'macd_signal_2': '-0.29719', 'macd_hist_2': '-0.11175', 'slow_k': '4.52069', 'slow_d': '7.92871'}, {'datetime': '2020-04-23 15:58:00', 'open': '275.07001', 'high': '275.26999', 'low': '275.00000', 'close': '275.25000', 'volume': '177685', 'macd_1': '-0.31486', 'macd_signal_1': '-0.21983', 'macd_hist_1': '-0.09503', 'macd_2': '-0.38598', 'macd_signal_2': '-0.26925', 'macd_hist_2': '-0.11672', 'slow_k': '14.70578', 'slow_d': '6.82079'}, {'datetime': '2020-04-23 15:57:00', 'open': '275.07001', 'high': '275.16000', 'low': '275.00000', 'close': '275.07751', 'volume': '151169', 'macd_1': '-0.30852', 'macd_signal_1': '-0.19607', 'macd_hist_1': '-0.11245', 'macd_2': '-0.38293', 'macd_signal_2': '-0.24007', 'macd_hist_2': '-0.14286', 'slow_k': '4.55965', 'slow_d': '2.75237'}), "MSFT": ({'datetime': '2020-04-23 15:59:00', 'open': '171.59000', 'high': '171.64000', 'low': '171.22000', 'close': '171.42000', 'volume': '477631', 'macd_1': '-0.12756', 'macd_signal_1': '-0.10878', 'macd_hist_1': '-0.01878', 'macd_2': '-0.15109', 'macd_signal_2': '-0.12915', 'macd_hist_2': '-0.02193', 'slow_k': '20.95244', 'slow_d': '26.34919'}, {'datetime': '2020-04-23 15:58:00', 'open': '171.41000', 'high': '171.61000', 'low': '171.33501', 'close': '171.61000', 'volume': '209594', 'macd_1': '-0.12440', 'macd_signal_1': '-0.10408', 'macd_hist_1': '-0.02032', 'macd_2': '-0.14786', 'macd_signal_2': '-0.12367', 'macd_hist_2': '-0.02419', 'slow_k': '39.04785', 'slow_d': '23.80945'}, {'datetime': '2020-04-23 15:57:00', 'open': '171.34500', 'high': '171.48000', 'low': '171.25999', 'close': '171.39999', 'volume': '142450', 'macd_1': '-0.13791', 'macd_signal_1': '-0.09900', 'macd_hist_1': '-0.03891', 'macd_2': '-0.16800', 'macd_signal_2': '-0.11762', 'macd_hist_2': '-0.05037', 'slow_k': '19.04727', 'slow_d': '14.92063'}) } ``` With `.as_pandas()` the output will be a 3D DataFrame with MultiIndex for (symbol, datetime). ```python ts = td.time_series(symbol='AAPL,MSFT', interval="1min", outputsize=3) df = ts.with_macd().with_macd(fast_period=10).with_stoch().as_pandas() # open high ... slow_k slow_d # AAPL 2020-04-23 15:59:00 275.23001 275.25000 ... 4.52069 7.92871 # 2020-04-23 15:58:00 275.07001 275.26999 ... 14.70578 6.82079 # 2020-04-23 15:57:00 275.07001 275.16000 ... 4.55965 2.75237 # MSFT 2020-04-23 15:59:00 171.59000 171.64000 ... 20.95244 26.34919 # 2020-04-23 15:58:00 171.41000 171.61000 ... 39.04785 23.80945 # 2020-04-23 15:57:00 171.34500 171.48000 ... 19.04727 14.92063 # # [6 rows x 13 columns] df.loc['AAPL'] # open high ... slow_k slow_d # 2020-04-23 15:59:00 275.23001 275.25000 ... 4.52069 7.92871 # 2020-04-23 15:58:00 275.07001 275.26999 ... 14.70578 6.82079 # 2020-04-23 15:57:00 275.07001 275.16000 ... 4.55965 2.75237 # # [3 rows x 13 columns] df.columns # Index(['open', 'high', 'low', 'close', 'volume', 'macd1', 'macd_signal1', # 'macd_hist1', 'macd2', 'macd_signal2', 'macd_hist2', 'slow_k', # 'slow_d'], # dtype='object') ``` ### Charts * [Static](#Static) * [Interactive](#Interactive) Charts support OHLC, technical indicators and custom bars. #### Static Static charts are based on `matplotlib` library and require `mplfinance` package to be installed. ![static chart example](https://res.cloudinary.com/dnz8pwg9r/image/upload/v1601394338/matplotlib_chart.png) * Use `.as_pyplot_figure()` ```python from twelvedata import TDClient td = TDClient(apikey="YOUR_API_KEY_HERE") ts = td.time_series( symbol="MSFT", outputsize=75, interval="1day", ) # 1. Returns OHLCV chart ts.as_pyplot_figure() # 2. Returns OHLCV + BBANDS(close, 20, 2, SMA) + %B(close, 20, 2 SMA) + STOCH(14, 3, 3, SMA, SMA) ts.with_bbands().with_percent_b().with_stoch(slow_k_period=3).as_pyplot_figure() ``` #### Interactive Interactive charts are built on top of `plotly` library. ![interactive chart example](https://res.cloudinary.com/dnz8pwg9r/image/upload/v1599349681/plotly-chart.gif) * Use `.as_plotly_figure().show()` ```python from twelvedata import TDClient td = TDClient(apikey="YOUR_API_KEY_HERE") ts = td.time_series( symbol="DNR", outputsize=50, interval="1week", ) # 1. Returns OHLCV chart ts.as_plotly_figure() # 2. Returns OHLCV + EMA(close, 7) + MAMA(close, 0.5, 0.05) + MOM(close, 9) + MACD(close, 12, 26, 9) ts.with_ema(time_period=7).with_mama().with_mom().with_macd().as_plotly_figure().show() ``` ### WebSocket With the WebSocket, a duplex communication channel with the server is established. Make sure to have `websocket_client` package [installed](https://pypi.org/project/websocket_client/). ![websocket example](https://res.cloudinary.com/dnz8pwg9r/image/upload/v1599349899/ws-example.gif) #### Features * Real-time low latency stream of financial quotes. * You might subscribe to stocks, forex, and crypto. #### Example ```python import time from twelvedata import TDClient messages_history = [] def on_event(e): # do whatever is needed with data print(e) messages_history.append(e) td = TDClient(apikey="YOUR_API_KEY_HERE") ws = td.websocket(symbols="BTC/USD", on_event=on_event) ws.subscribe(['ETH/BTC', 'AAPL']) ws.connect() while True: print('messages received: ', len(messages_history)) ws.heartbeat() time.sleep(10) ``` Parameters accepted by the `.websocket()` object: * **symbols** list of symbols to subscribe * **on_event** function that invokes when event from server is received * **logger** instance of logger, otherwise set to default * **max_queue_size** maximum size of queue, default `12000` * **log_level** accepts `debug` or `info`, otherwise not set Applicable methods on `.websocket()` object: * `ws.subscribe([list of symbols])`: get data from the symbols passed * `ws.unsubscribe([list of symbols])`: stop receiving data from the symbols passed * `ws.reset()`: unsubscribe from all symbols * `ws.connect()`: establish connection with WebSocket server * `ws.disconnect()`: close connection with WebSocket server * `ws.heartbeat()`: send heartbeat to server **Important**. Do not forget that WebSockets are only available for Twelve Data users on the [Pro plan](https://twelvedata.com/pricing) and above. Checkout the trial [here](https://support.twelvedata.com/en/articles/5335783-trial). ### Advanced #### Custom endpoint This method is used to request unrepresented endpoints on this package, but which are available at Twelve Data. ```python endpoint = td.custom_endpoint( name="quote", symbol="AAPL", ) endpoint.as_json() ``` The only required parameter is `name` which should be identical to the endpoint used at Twelve Data. All others can be custom and will vary according to the method. #### Debugging When the method doesn't return the desired data or throws an error, it might be helpful to understand and analyze the API query behind it. Add `.as_url()` to any method or chain of methods, and it will return the list of used URLs. ```python ts = td.time_series( symbol="AAPL", interval="1min", outputsize=10, timezone="America/New_York", ).with_bbands().with_ema() ts.as_url() # ['https://api.twelvedata.com/time_series?symbol=AAPL&interval=1min&outputsize=10&dp=5&timezone=America/New_York&order=desc&prepost=false&format=JSON&apikey=demo', # 'https://api.twelvedata.com/bbands?symbol=AAPL&interval=1min&series_type=close&time_period=20&sd=2&ma_type=SMA&outputsize=10&dp=5&timezone=America/New_York&order=desc&prepost=false&format=JSON&apikey=demo', # 'https://api.twelvedata.com/ema?symbol=AAPL&interval=1min&series_type=close&time_period=9&outputsize=10&dp=5&timezone=America/New_York&order=desc&prepost=false&format=JSON&apikey=demo'] ``` #### API usage This method gives an overview of the current API credits consumption. ```python api = td.api_usage() ``` ## Support Visit our official website [contact page](https://twelvedata.com/contact) or [support center](https://support.twelvedata.com/). ## Announcements Follow us for announcements and updates about this library. * [Twitter](https://twitter.com/TwelveData) * [Telegram](https://t.me/twelvedata) ## Roadmap - [x] Fundamentals - [x] WebSocket - [x] Batch requests - [x] Custom plots coloring - [x] Interactive charts (plotly) - [x] Static charts (matplotlib) - [x] Pandas support ## Contributing 1. Clone repo and create a new branch: `$ git checkout https://github.com/twelvedata/twelvedata -b name_for_new_branch`. 2. Make changes and test. 3. Submit Pull Request with comprehensive description of changes. ## License This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). ================================================ FILE: docs/Makefile ================================================ # Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build AUTODOCDIR = api AUTODOCBUILD = sphinx-apidoc PROJECT = twelvedata MODULEDIR = ../src/twelvedata # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext doc-requirements help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* $(AUTODOCDIR) $(AUTODOCDIR): $(MODULEDIR) mkdir -p $@ $(AUTODOCBUILD) -f -o $@ $^ doc-requirements: $(AUTODOCDIR) html: doc-requirements $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: doc-requirements $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: doc-requirements $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: doc-requirements $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: doc-requirements $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: doc-requirements $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: doc-requirements $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(PROJECT).qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(PROJECT).qhc" devhelp: doc-requirements $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $HOME/.local/share/devhelp/$(PROJECT)" @echo "# ln -s $(BUILDDIR)/devhelp $HOME/.local/share/devhelp/$(PROJEC)" @echo "# devhelp" epub: doc-requirements $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." patch-latex: find _build/latex -iname "*.tex" | xargs -- \ sed -i'' 's~includegraphics{~includegraphics\[keepaspectratio,max size={\\textwidth}{\\textheight}\]{~g' latex: doc-requirements $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex $(MAKE) patch-latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: doc-requirements $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex $(MAKE) patch-latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: doc-requirements $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: doc-requirements $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: doc-requirements $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: doc-requirements $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: doc-requirements $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: doc-requirements $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: doc-requirements $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: doc-requirements $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: doc-requirements $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: doc-requirements $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: doc-requirements $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." ================================================ FILE: docs/_static/.gitignore ================================================ # Empty directory ================================================ FILE: docs/authors.rst ================================================ .. _authors: .. include:: ../AUTHORS.rst ================================================ FILE: docs/changelog.rst ================================================ .. _changes: .. include:: ../CHANGELOG.rst ================================================ FILE: docs/conf.py ================================================ # -*- coding: utf-8 -*- # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import sys import inspect import shutil __location__ = os.path.join(os.getcwd(), os.path.dirname( inspect.getfile(inspect.currentframe()))) # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.join(__location__, '../src')) # -- Run sphinx-apidoc ------------------------------------------------------ # This hack is necessary since RTD does not issue `sphinx-apidoc` before running # `sphinx-build -b html . _build/html`. See Issue: # https://github.com/rtfd/readthedocs.org/issues/1139 # DON'T FORGET: Check the box "Install your project inside a virtualenv using # setup.py install" in the RTD Advanced Settings. # Additionally it helps us to avoid running apidoc manually try: # for Sphinx >= 1.7 from sphinx.ext import apidoc except ImportError: from sphinx import apidoc output_dir = os.path.join(__location__, "api") module_dir = os.path.join(__location__, "../src/twelvedata") try: shutil.rmtree(output_dir) except FileNotFoundError: pass try: import sphinx from pkg_resources import parse_version cmd_line_template = "sphinx-apidoc -f -o {outputdir} {moduledir}" cmd_line = cmd_line_template.format(outputdir=output_dir, moduledir=module_dir) args = cmd_line.split(" ") if parse_version(sphinx.__version__) >= parse_version('1.7'): args = args[1:] apidoc.main(args) except Exception as e: print("Running `sphinx-apidoc` failed!\n{}".format(e)) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.autosummary', 'sphinx.ext.viewcode', 'sphinx.ext.coverage', 'sphinx.ext.doctest', 'sphinx.ext.ifconfig', 'sphinx.ext.mathjax', 'sphinx.ext.napoleon'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'twelvedata' copyright = u'2019, twelvedata' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '' # Is set by calling `setup.py docs` # The full version, including alpha/beta/rc tags. release = '' # Is set by calling `setup.py docs` # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { 'sidebar_width': '300px', 'page_width': '1200px' } # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". try: from twelvedata import __version__ as version except ImportError: pass else: release = version # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = "" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'twelvedata-doc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'user_guide.tex', u'twelvedata Documentation', u'gtors', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = "" # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- External mapping ------------------------------------------------------------ python_version = '.'.join(map(str, sys.version_info[0:2])) intersphinx_mapping = { 'sphinx': ('http://www.sphinx-doc.org/en/stable', None), 'python': ('https://docs.python.org/' + python_version, None), 'matplotlib': ('https://matplotlib.org', None), 'numpy': ('https://docs.scipy.org/doc/numpy', None), 'sklearn': ('http://scikit-learn.org/stable', None), 'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None), 'scipy': ('https://docs.scipy.org/doc/scipy/reference', None), } ================================================ FILE: docs/index.rst ================================================ .. include:: ../README.rst Contents ======== .. toctree:: :maxdepth: 2 License Authors Changelog Module Reference Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ================================================ FILE: docs/license.rst ================================================ .. _license: ======= License ======= .. include:: ../LICENSE.txt ================================================ FILE: pyproject.toml ================================================ [build-system] requires = ["setuptools>=45,<75", "wheel", "setuptools-scm[toml]>=6.2"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "src/twelvedata/_version.py" ================================================ FILE: requirements.txt ================================================ pytimeparse requests setuptools ================================================ FILE: setup.cfg ================================================ # This file is used to configure your project. # Read more about the various options under: # http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files [metadata] name = twelvedata description = Python client for Twelve Data author = Twelve Data author_email = info@twelvedata.com license = MIT url = https://github.com/twelvedata/twelvedata-python long_description = file: README.md long_description_content_type = text/markdown platforms = any classifiers = Development Status :: 4 - Beta Programming Language :: Python [options] zip_safe = False packages = find: include_package_data = True package_dir = =src install_requires = pytimeparse>=1.1,<2 requests>=2.22,<3 python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* [options.packages.find] where = src exclude = tests [options.extras_require] pandas = pandas>=0.24,<0.25;python_version<"3" pandas>=0.24;python_version>="3" matplotlib = matplotlib>=2.2,<3;python_version<"3" matplotlib>=2.2;python_version>="3" plotly = plotly>=4.2.1 websocket = websocket-client>=1.2.1 mplfinance = mplfinance>=0.12 testing = pytest pytest-cov [options.entry_points] # Add here console scripts like: # console_scripts = # script_name = twelvedata.module:function # For example: # console_scripts = # fibonacci = twelvedata.skeleton:run # And any other entry points, for example: # pyscaffold.cli = # awesome = pyscaffoldext.awesome.extension:AwesomeExtension [test] # py.test options when running `python setup.py test` # addopts = --verbose extras = True [tool:pytest] # Options for py.test: # Specify command line options as you would do when invoking py.test directly. # e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml # in order to write a coverage file that can be read by Jenkins. addopts = --cov twelvedata --cov-report term-missing --verbose norecursedirs = dist build .tox testpaths = tests [aliases] build = bdist_wheel release = build upload [bdist_wheel] [build_sphinx] source_dir = docs build_dir = docs/_build [devpi:upload] # Options for the devpi: PyPI server and packaging tool # VCS export must be deactivated since we are using setuptools-scm no-vcs = 1 formats = bdist_wheel [flake8] # Some sane defaults for the code style checker flake8 exclude = .tox build dist .eggs docs/conf.py ================================================ FILE: setup.py ================================================ #!/usr/bin/env python # -*- coding: utf-8 -*- """ Setup file for twelvedata. Use setup.cfg to configure your project. """ from setuptools import setup if __name__ == "__main__": setup() ================================================ FILE: src/twelvedata/__init__.py ================================================ # -*- coding: utf-8 -*- from .client import TDClient try: from ._version import version as __version__ except ImportError: try: import importlib.metadata __version__ = importlib.metadata.version(__name__) except Exception: __version__ = "unknown" ================================================ FILE: src/twelvedata/client.py ================================================ from .context import Context from .endpoints import ( CustomEndpoint, StocksListEndpoint, StockExchangesListEndpoint, ForexPairsListEndpoint, ETFListEndpoint, IndicesListEndpoint, FundsListEndpoint, BondsListEndpoint, CommoditiesListEndpoint, ExchangesListEndpoint, CryptocurrenciesListEndpoint, CryptocurrencyExchangesListEndpoint, TechnicalIndicatorsListEndpoint, SymbolSearchEndpoint, EarliestTimestampEndpoint, ExchangeRateEndpoint, CurrencyConversionEndpoint, QuoteEndpoint, PriceEndpoint, EODEndpoint, LogoEndpoint, ProfileEndpoint, DividendsEndpoint, DividendsCalendarEndpoint, SplitsEndpoint, SplitsCalendarEndpoint, EarningsEndpoint, EarningsCalendarEndpoint, IPOCalendarEndpoint, StatisticsEndpoint, InsiderTransactionsEndpoint, IncomeStatementEndpoint, BalanceSheetEndpoint, CashFlowEndpoint, OptionsExpirationEndpoint, OptionsChainEndpoint, KeyExecutivesEndpoint, InstitutionalHoldersEndpoint, FundHoldersEndpoint, APIUsageEndpoint, MarketStateEndpoint, ) from .http_client import DefaultHttpClient from .time_series import TimeSeries from .utils import patch_endpoints_meta from .websocket import TDWebSocket class TDClient: def __init__(self, apikey, http_client=None, base_url=None, self_heal_time_s=None, **defaults): self.ctx = Context() self.ctx.apikey = apikey self.ctx.self_heal_time_s = self_heal_time_s self.ctx.base_url = base_url or "https://api.twelvedata.com" self.ctx.http_client = http_client or DefaultHttpClient(self.ctx.base_url) self.ctx.defaults = defaults patch_endpoints_meta(self.ctx) def websocket(self, **defaults): ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return TDWebSocket(ctx) def custom_endpoint(self, **defaults): """ Creates request builder for custom endpoint This method can request any GET endpoint available at Twelve Data with a custom set of parameters :returns: request builder instance :rtype: CustomEndpointRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return CustomEndpoint(ctx, **ctx.defaults) def get_stocks_list(self, **defaults): """ Creates request builder for Stocks List This API call return array of symbols available at twelvedata API. This list is daily updated. :returns: request builder instance :rtype: StocksListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return StocksListEndpoint(ctx, **ctx.defaults) def get_stock_exchanges_list(self): """ Creates request builder for Stock Exchanges List This API call return array of stock exchanges available at twelvedata API. This list is daily updated. :returns: request builder instance :rtype: StockExchangesListRequestBuilder """ return StockExchangesListEndpoint(ctx=self.ctx) def get_forex_pairs_list(self, **defaults): """ Creates request builder for Forex Pairs List This API call return array of forex pairs available at twelvedata API. This list is daily updated. :returns: request builder instance :rtype: ForexPairsListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return ForexPairsListEndpoint(ctx, **ctx.defaults) def get_cryptocurrencies_list(self, **defaults): """ Creates request builder for Cryptocurrencies List This API call return array of cryptocurrency pairs available at twelvedata API. This list is daily updated. :returns: request builder instance :rtype: CryptocurrenciesListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return CryptocurrenciesListEndpoint(ctx, **ctx.defaults) def get_etf_list(self, **defaults): """ Creates request builder for ETF List This API call return array of ETFs available at Twelve Data API. This list is daily updated. :returns: request builder instance :rtype: ETFListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return ETFListEndpoint(ctx, **ctx.defaults) def get_indices_list(self, **defaults): """ Creates request builder for Indices List This API call return array of indices available at Twelve Data API. This list is daily updated. :returns: request builder instance :rtype: IndicesListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return IndicesListEndpoint(ctx, **ctx.defaults) def get_funds_list(self, **defaults): """ Creates request builder for Funds List This API call return array of funds available at Twelve Data API. This list is daily updated. :returns: request builder instance :rtype: FundsListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return FundsListEndpoint(ctx, **ctx.defaults) def get_bonds_list(self, **defaults): """ Creates request builder for Bonds List This API call return array of bonds available at Twelve Data API. This list is daily updated. :returns: request builder instance :rtype: BondsListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return BondsListEndpoint(ctx, **ctx.defaults) def get_commodities_list(self, **defaults): """ Creates request builder for Commodities List This API call return array of commodities available at Twelve Data API. This list is daily updated. :returns: request builder instance :rtype: CommoditiesListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return CommoditiesListEndpoint(ctx, **ctx.defaults) def get_exchanges_list(self, **defaults): """ Creates request builder for Exchanges List This API call return array of stock, ETF or index exchanges available at Twelve Data API. This list is daily updated. :returns: request builder instance :rtype: ExchangesListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return ExchangesListEndpoint(ctx, **ctx.defaults) def get_cryptocurrency_exchanges_list(self, **defaults): """ Creates request builder for Cryptocurrency Exchanges List This API call return array of cryptocurrency exchanges available at twelvedata API. This list is daily updated. :returns: request builder instance :rtype: CryptocurrencyExchangesListRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return CryptocurrencyExchangesListEndpoint(ctx, **ctx.defaults) def get_technical_indicators_list(self): """ Creates request builder for Technical Indicators List This API call return array of objects with available technical indicators. This endpoint might be used to build an abstract interface to make more convenient API calls from the application. :returns: request builder instance :rtype: TechnicalIndicatorsListRequestBuilder """ return TechnicalIndicatorsListEndpoint(ctx=self.ctx) def symbol_search(self, **defaults): """ Creates request builder for Symbol Search This method helps to find the best matching symbol. It can be used as the base for custom lookups. The response is returned in descending order, with the most relevant instrument at the beginning. :returns: request builder instance :rtype: SymbolSearchRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return SymbolSearchEndpoint(ctx, **ctx.defaults) def get_earliest_timestamp(self, **defaults): """ Creates request builder for Earliest Timestamp This method returns the first available DateTime for a given instrument at the specific interval. :returns: request builder instance :rtype: EarliestTimestampRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return EarliestTimestampEndpoint(ctx, **ctx.defaults) def get_market_state(self, **defaults): """ Creates request builder for Market State Check the state of all available exchanges, time to open, and time to close. Returns all available stock exchanges by default. :returns: request builder instance :rtype: MarketStateRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return MarketStateEndpoint(ctx, **ctx.defaults) def time_series(self, **defaults): """ Creates factory for time series requests. :returns: request factory instance :rtype: TimeSeries """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return TimeSeries(ctx) def exchange_rate(self, **defaults): """ Creates factory for exchange rate requests. :returns: request factory instance :rtype: ExchangeRate """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return ExchangeRateEndpoint(ctx, **ctx.defaults) def currency_conversion(self, **defaults): """ Creates factory for exchange rate requests. :returns: request factory instance :rtype: CurrencyConversion """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return CurrencyConversionEndpoint(ctx, **ctx.defaults) def quote(self, **defaults): """ Creates factory for exchange rate requests. :returns: request factory instance :rtype: Quote """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return QuoteEndpoint(ctx, **ctx.defaults) def price(self, **defaults): """ Creates factory for exchange rate requests. :returns: request factory instance :rtype: Price """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return PriceEndpoint(ctx, **ctx.defaults) def eod(self, **defaults): """ Creates factory for exchange rate requests. :returns: request factory instance :rtype: EOD """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return EODEndpoint(ctx, **ctx.defaults) def get_logo(self, **defaults): """ Creates request builder for Logo Returns logo of the company. :returns: request builder instance :rtype: LogoRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return LogoEndpoint(ctx, **ctx.defaults) def get_profile(self, **defaults): """ Creates request builder for Profile Returns general information about the company. :returns: request builder instance :rtype: ProfileRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return ProfileEndpoint(ctx, **ctx.defaults) def get_dividends(self, **defaults): """ Creates request builder for Dividends Returns the amount of dividends paid out for the last 10+ years. :returns: request builder instance :rtype: DividendsRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return DividendsEndpoint(ctx, **ctx.defaults) def get_dividends_calendar(self, **defaults): """ Creates request builder for Dividends Calendar Returns the dividend data as a calendar for a given date range. To call custom period, use start_date and end_date parameters. :returns: request builder instance :rtype: DividendsCalendarRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return DividendsCalendarEndpoint(ctx, **ctx.defaults) def get_splits(self, **defaults): """ Creates request builder for Splits Returns the date and the split factor of shares of the company for the last 10+ years. :returns: request builder instance :rtype: SplitsRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return SplitsEndpoint(ctx, **ctx.defaults) def get_splits_calendar(self, **defaults): """ Creates request builder for Splits Calendar Returns split data as a calendar for a given date range. To call custom period, use start_date and end_date parameters. :returns: request builder instance :rtype: SplitsCalendarRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return SplitsCalendarEndpoint(ctx, **ctx.defaults) def get_earnings(self, **defaults): """ Creates request builder for Earnings This API call returns earnings data for a given company, including EPS estimate and EPS actual. Earnings are available for complete company history. :returns: request builder instance :rtype: EarningsRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return EarningsEndpoint(ctx, **ctx.defaults) def get_earnings_calendar(self, **defaults): """ Creates request builder for Earnings Calendar This API method returns earning data as a calendar for a given date range. By default today's earning is returned. To call custom period, use start_date and end_date parameters. :returns: request builder instance :rtype: EarningsCalendarRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return EarningsCalendarEndpoint(ctx, **ctx.defaults) def get_ipo_calendar(self, **defaults): """ Creates request builder for IPO Calendar This endpoint returns past, today, or upcoming IPOs. :returns: request builder instance :rtype: IPOCalendarRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return IPOCalendarEndpoint(ctx, **ctx.defaults) def get_statistics(self, **defaults): """ Creates request builder for Statistics Returns current overview of company’s main statistics including valuation metrics and financials. :returns: request builder instance :rtype: StatisticsRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return StatisticsEndpoint(ctx, **ctx.defaults) def get_insider_transactions(self, **defaults): """ Creates request builder for Insider Transactions Returns trading information performed by insiders. :returns: request builder instance :rtype: InsiderTransactionsRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return InsiderTransactionsEndpoint(ctx, **ctx.defaults) def get_income_statement(self, **defaults): """ Creates request builder for Income Statement Returns complete income statement of a company and shows the company’s revenues and expenses during a period (annual or quarter). :returns: request builder instance :rtype: IncomeStatementRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return IncomeStatementEndpoint(ctx, **ctx.defaults) def get_balance_sheet(self, **defaults): """ Creates request builder for Balance Sheet Returns complete balance sheet of a company showing the summary of assets, liabilities, and shareholders’ equity. :returns: request builder instance :rtype: BalanceSheetRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return BalanceSheetEndpoint(ctx, **ctx.defaults) def get_cash_flow(self, **defaults): """ Creates request builder for Cash Flow Returns complete cash flow of a company showing net the amount of cash and cash equivalents being transferred into and out of a business. :returns: request builder instance :rtype: CashFlowRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return CashFlowEndpoint(ctx, **ctx.defaults) def get_options_expiration(self, **defaults): """ Creates request builder for Options Expiration Return the expiration dates of an option contract. :returns: request builder instance :rtype: OptionsExpirationRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return OptionsExpirationEndpoint(ctx, **ctx.defaults) def get_options_chain(self, **defaults): """ Creates request builder for Options Chain Returns a listing of all available options contracts for given security. It shows all listed puts, calls, their expiration, strike prices, and pricing information for a single underlying asset within a given maturity period. :returns: request builder instance :rtype: OptionsChainRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return OptionsChainEndpoint(ctx, **ctx.defaults) def get_key_executives(self, **defaults): """ Creates request builder for Key Executives Returns individuals at the highest level of management of an organization. :returns: request builder instance :rtype: KeyExecutivesRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return KeyExecutivesEndpoint(ctx, **ctx.defaults) def get_institutional_holders(self, **defaults): """ Creates request builder for Institutional Holders Returns the amount of the company’s available stock owned by institutions (pension funds, insurance companies, investment firms, private foundations, endowments, or other large entities that manage funds on behalf of others). :returns: request builder instance :rtype: InstitutionalHoldersRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return InstitutionalHoldersEndpoint(ctx, **ctx.defaults) def get_fund_holders(self, **defaults): """ Creates request builder for Fund Holders Returns the amount of the company’s available stock owned by mutual fund holders. :returns: request builder instance :rtype: FundHoldersRequestBuilder """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return FundHoldersEndpoint(ctx, **ctx.defaults) def api_usage(self, **defaults): """ Creates request builder for API usage This endpoint will provide information on the current usage of Twelve Data API. :returns: request builder instance :rtype: APIUsage """ ctx = Context.from_context(self.ctx) ctx.defaults.update(defaults) return APIUsageEndpoint(ctx, **ctx.defaults) ================================================ FILE: src/twelvedata/context.py ================================================ # coding: utf-8 class Context: """ Context which used by all request builders :ivar http_client: Default HTTP client :ivar apikey: API key for access to the Twelvedata API :ivar base_url: Base URL for Twelvedata API :ivar defaults: Default parameters that will be used by request builders. :ivar self_heal_time_s: time in seconds for retrying """ http_client = None apikey = None base_url = None defaults = None self_heal_time_s = None @classmethod def from_context(cls, ctx): """ Creates copy of specified Context """ instance = cls() instance.http_client = ctx.http_client instance.apikey = ctx.apikey instance.base_url = ctx.base_url instance.self_heal_time_s = ctx.self_heal_time_s instance.defaults = dict(ctx.defaults or {}) return instance ================================================ FILE: src/twelvedata/endpoints.py ================================================ import itertools from .mixins import AsMixin __all__ = ( "ADOSCEndpoint", "ADEndpoint", "ADXREndpoint", "ADXEndpoint", "APIUsageEndpoint", "APOEndpoint", "AROONOSCEndpoint", "AROONEndpoint", "ATREndpoint", "AVGPRICEEndpoint", "BBANDSEndpoint", "BETAEndpoint", "BOPEndpoint", "BondsListEndpoint", "CCIEndpoint", "CEILEndpoint", "CMOEndpoint", "COPPOCKEndpoint", "CommoditiesListEndpoint", "CryptocurrenciesListEndpoint", "CryptocurrencyExchangesListEndpoint", "CurrencyConversionEndpoint", "DEMAEndpoint", "DividendsCalendarEndpoint", "DXEndpoint", "EarliestTimestampEndpoint", "EarningsCalendarEndpoint", "EarningsEndpoint", "EMAEndpoint", "EODEndpoint", "ETFListEndpoint", "ExchangeRateEndpoint", "ExchangesListEndpoint", "EXPEndpoint", "FLOOREndpoint", "ForexPairsListEndpoint", "FundsListEndpoint", "HEIKINASHICANDLESEndpoint", "HLC3Endpoint", "HT_DCPERIODEndpoint", "HT_DCPHASEEndpoint", "HT_PHASOREndpoint", "HT_SINEEndpoint", "HT_TRENDLINEEndpoint", "HT_TRENDMODEEndpoint", "ICHIMOKUEndpoint", "IndicesListEndpoint", "KAMAEndpoint", "KELTNEREndpoint", "KSTEndpoint", "LINEARREGANGLEEndpoint", "LINEARREGINTERCEPTEndpoint", "LINEARREGEndpoint", "LINEARREGSLOPEEndpoint", "LNEndpoint", "LOG10Endpoint", "MACDEndpoint", "MACDSlopeEndpoint", "MACDEXTEndpoint", "MAMAEndpoint", "MAEndpoint", "MAXINDEXEndpoint", "MAXEndpoint", "MarketStateEndpoint", "McGinleyDynamicEndpoint", "MEDPRICEEndpoint", "MFIEndpoint", "MIDPOINTEndpoint", "MIDPRICEEndpoint", "MININDEXEndpoint", "MINMAXINDEXEndpoint", "MINMAXEndpoint", "MINEndpoint", "MINUS_DIEndpoint", "MINUS_DMEndpoint", "MOMEndpoint", "NATREndpoint", "OBVEndpoint", "PLUS_DIEndpoint", "PLUS_DMEndpoint", "PPOEndpoint", "PercentBEndpoint", "PivotPointsHLEndpoint", "PriceEndpoint", "QuoteEndpoint", "ROCPEndpoint", "ROCR100Endpoint", "ROCREndpoint", "ROCEndpoint", "RSIEndpoint", "RVOLEndpoint", "SAREndpoint", "SMAEndpoint", "SQRTEndpoint", "STDDEVEndpoint", "STOCHFEndpoint", "STOCHRSIEndpoint", "STOCHEndpoint", "SplitsCalendarEndpoint", "SymbolSearchEndpoint", "StockExchangesListEndpoint", "StocksListEndpoint", "SuperTrendEndpoint", "T3MAEndpoint", "TEMAEndpoint", "TRANGEEndpoint", "TRIMAEndpoint", "TSFEndpoint", "TYPPRICEEndpoint", "TechIndicatorsMetaEndpoint", "TimeSeriesEndpoint", "ULTOSCEndpoint", "VAREndpoint", "VWAPEndpoint", "WCLPRICEEndpoint", "WILLREndpoint", "WMAEndpoint", ) def purify_symbol(symbol): return "".join(symbol.split()).strip(',') def get_symbol(symbol) -> (str, bool): if isinstance(symbol, str): purified_symbol = purify_symbol(symbol) if ',' in symbol and len(purified_symbol.split(',')) > 1: return purified_symbol, True return purified_symbol, False elif isinstance(symbol, list) or isinstance(symbol, tuple): if len(symbol) == 1: return symbol[0], False elif len(symbol) > 1: return ','.join(symbol), True else: raise TypeError('The type of argument "symbol" can be only: str, list, tuple') def build_url(base, endpoint, params): query_params = '&'.join(['{}={}'.format(k, v) for k, v in params.items()]) return '{}{}?{}'.format(base, endpoint, query_params) class Endpoint(object): # This flag indicates that the current endpoint is a price chart is_price = False # This flag indicates that the current endpoint is a technical indicator is_indicator = False # This flag indicates that the chart should be drawn on the price chart is_overlay = False # This flag indicates that the current request is a batch request is_batch = False # Colors for chart colormap = {} # The fill between lines fill_area = {} def render_matplotlib(self, **kwargs): import matplotlib.dates as mdates from .renders import RENDERS_MAPPING, RenderContext df = kwargs.pop('df', None) if df is None: df = self.as_pandas() df = df.iloc[::-1] df.reset_index(level=0, inplace=True) df.set_index("datetime", inplace=True) ctx = RenderContext() ctx.colormap = self.colormap ctx.fill_area = self.fill_area ctx.interval_minutes = kwargs.pop("interval_minutes", 1) ctx.postfix = kwargs.pop("postfix", "") for render in RENDERS_MAPPING[self.__class__]: render.render_matplotlib(ctx, df, **kwargs) def render_plotly(self, **kwargs): from .renders import RENDERS_MAPPING, RenderContext ctx = RenderContext() ctx.colormap = self.colormap ctx.fill_area = self.fill_area ctx.fig = kwargs.pop("fig", None) ctx.interval_minutes = kwargs.pop("interval_minutes", 1) ctx.postfix = kwargs.pop("postfix", "") df = kwargs.pop('df', None) if df is None: df = self.as_pandas() return tuple( itertools.chain( *( render.render_plotly(ctx, df, **kwargs) for render in RENDERS_MAPPING[self.__class__] ) ) ) class CustomEndpoint(AsMixin, Endpoint): _name = "custom_endpoint" def __init__( self, ctx, name, **kwargs ): self.ctx = ctx self.name = name self.params = kwargs def execute(self, format="JSON", debug=False): self.params["format"] = format self.params["apikey"] = self.ctx.apikey endpoint = "/" + self.name if debug: return build_url(self.ctx.base_url, endpoint, self.params) return self.ctx.http_client.get(endpoint, params=self.params) class TimeSeriesEndpoint(AsMixin, Endpoint): _name = "time_series" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", date=None, mic_code=None, previous_close=None, adjust=None, ): self.is_price = True self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.date = date self.mic_code = mic_code self.previous_close = previous_close self.adjust = adjust def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code if self.date is not None: params["date"] = self.date if self.previous_close is not None: params["previous_close"] = self.previous_close if self.adjust is not None: params["adjust"] = self.adjust params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/time_series" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ExchangeRateEndpoint(AsMixin, Endpoint): _name = "exchange_rate" def __init__(self, ctx, symbol, date=None, dp=None, timezone=None ): self.ctx = ctx self.symbol = symbol self.date = date self.dp = dp self.timezone = timezone def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.date is not None: params["date"] = self.date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/exchange_rate" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CurrencyConversionEndpoint(AsMixin, Endpoint): _name = "currency_conversion" def __init__(self, ctx, symbol, amount=None, date=None, dp=None, timezone=None ): self.ctx = ctx self.symbol = symbol self.amount = amount self.date = date self.dp = dp self.timezone = timezone def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.amount is not None: params["amount"] = self.amount if self.date is not None: params["date"] = self.date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/currency_conversion" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class QuoteEndpoint(AsMixin, Endpoint): _name = "quote" def __init__(self, ctx, symbol, interval="1day", exchange=None, country=None, volume_time_period=None, type=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, eod=None, rolling_period=None, ): self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.volume_time_period = volume_time_period self.type = type self.dp = dp self.timezone = timezone self.prepost = prepost self.mic_code = mic_code self.eod = eod self.rolling_period = rolling_period def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) # Batch mode is not supported for this endpoint self.is_batch = False if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.volume_time_period is not None: params["volume_time_period"] = self.volume_time_period if self.type is not None: params["type"] = self.type if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code if self.eod is not None: params["eod"] = self.eod if self.rolling_period is not None: params["rolling_period"] = self.rolling_period params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/quote" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class PriceEndpoint(AsMixin, Endpoint): _name = "price" def __init__(self, ctx, symbol, exchange=None, country=None, type=None, dp=5, prepost="false", mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.type = type self.dp = dp self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.dp is not None: params["dp"] = self.dp if self.prepost is not None: params["prepost"] = self.prepost params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/price" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class EODEndpoint(AsMixin, Endpoint): _name = "eod" def __init__(self, ctx, symbol, exchange=None, country=None, type=None, dp=5, prepost="false", mic_code=None, date=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.type = type self.dp = dp self.prepost = prepost self.mic_code = mic_code self.date = date def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.dp is not None: params["dp"] = self.dp if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code if self.date is not None: params["date"] = self.date params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/eod" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TechIndicatorsMetaEndpoint(AsMixin, Endpoint): _name = "technical_indicators" def __init__(self, ctx): self.ctx = ctx def execute(self, format="JSON", debug=False): params = {} params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/technical_indicators" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class StocksListEndpoint(AsMixin, Endpoint): _name = "stocks" def __init__(self, ctx, symbol=None, exchange=None, country=None, type=None, mic_code=None, show_plan=None, include_delisted=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.type = type self.mic_code = mic_code self.show_plan = show_plan self.include_delisted = include_delisted def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.mic_code is not None: params["mic_code"] = self.mic_code if self.show_plan is not None: params["show_plan"] = self.show_plan if self.include_delisted is not None: params["include_delisted"] = self.include_delisted params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/stocks" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class StockExchangesListEndpoint(AsMixin, Endpoint): _name = "stock_exchanges" def __init__(self, ctx): self.ctx = ctx def execute(self, format="JSON", debug=False): params = {} params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/stock_exchanges" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ForexPairsListEndpoint(AsMixin, Endpoint): _name = "forex_pairs" def __init__(self, ctx, symbol=None, currency_base=None, currency_quote=None, ): self.ctx = ctx self.symbol = symbol self.currency_base = currency_base self.currency_quote = currency_quote def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.currency_base is not None: params["currency_base"] = self.currency_base if self.currency_quote is not None: params["currency_quote"] = self.currency_quote params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/forex_pairs" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CryptocurrenciesListEndpoint(AsMixin, Endpoint): _name = "cryptocurrencies" def __init__(self, ctx, symbol=None, exchange=None, currency_base=None, currency_quote=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.currency_base = currency_base self.currency_quote = currency_quote def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.currency_base is not None: params["currency_base"] = self.currency_base if self.currency_quote is not None: params["currency_quote"] = self.currency_quote params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/cryptocurrencies" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ETFListEndpoint(AsMixin, Endpoint): _name = "etf" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, show_plan=None, include_delisted=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.show_plan = show_plan self.include_delisted = include_delisted def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code if self.show_plan is not None: params["show_plan"] = self.show_plan if self.include_delisted is not None: params["include_delisted"] = self.include_delisted params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/etf" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class IndicesListEndpoint(AsMixin, Endpoint): _name = "indices" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, show_plan=None, include_delisted=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.show_plan = show_plan self.include_delisted = include_delisted def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code if self.show_plan is not None: params["show_plan"] = self.show_plan if self.include_delisted is not None: params["include_delisted"] = self.include_delisted params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/indices" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class FundsListEndpoint(AsMixin, Endpoint): _name = "funds" def __init__(self, ctx, symbol=None, exchange=None, country=None, type=None, show_plan=None, include_delisted=None, page=None, outputsize=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.type = type self.show_plan = show_plan self.include_delisted = include_delisted self.page = page self.outputsize = outputsize def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.show_plan is not None: params["show_plan"] = self.show_plan if self.include_delisted is not None: params["include_delisted"] = self.include_delisted if self.page is not None: params["page"] = self.page if self.outputsize is not None: params["outputsize"] = self.outputsize params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/funds" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class BondsListEndpoint(AsMixin, Endpoint): _name = "bonds" def __init__(self, ctx, symbol=None, exchange=None, country=None, type=None, show_plan=None, include_delisted=None, page=None, outputsize=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.type = type self.show_plan = show_plan self.include_delisted = include_delisted self.page = page self.outputsize = outputsize def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.show_plan is not None: params["show_plan"] = self.show_plan if self.include_delisted is not None: params["include_delisted"] = self.include_delisted if self.page is not None: params["page"] = self.page if self.outputsize is not None: params["outputsize"] = self.outputsize params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/bonds" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CommoditiesListEndpoint(AsMixin, Endpoint): _name = "commodities" def __init__(self, ctx, symbol=None, category=None, ): self.ctx = ctx self.symbol = symbol self.category = category def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.category is not None: params["category"] = self.category params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/commodities" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ExchangesListEndpoint(AsMixin, Endpoint): _name = "exchanges" def __init__(self, ctx, name=None, code=None, country=None, type=None, show_plan=None, ): self.ctx = ctx self.name = name self.code = code self.country = country self.type = type self.show_plan = show_plan def execute(self, format="JSON", debug=False): params = {} if self.name is not None: params["name"] = self.name if self.code is not None: params["code"] = self.code if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.show_plan is not None: params["show_plan"] = self.show_plan params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/exchanges" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CryptocurrencyExchangesListEndpoint(AsMixin, Endpoint): _name = "cryptocurrency_exchanges" def __init__(self, ctx): self.ctx = ctx def execute(self, format="JSON", debug=False): params = {} params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/cryptocurrency_exchanges" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TechnicalIndicatorsListEndpoint(AsMixin, Endpoint): _name = "technical_indicators" def __init__(self, ctx): self.ctx = ctx def execute(self, format="JSON", debug=False): params = {} params["apikey"] = self.ctx.apikey endpoint = "/technical_indicators" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SymbolSearchEndpoint(AsMixin, Endpoint): _name = "symbol_search" def __init__(self, ctx, symbol=None, outputsize=None, show_plan=None, ): self.ctx = ctx self.symbol = symbol self.outputsize = outputsize self.show_plan = show_plan def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.outputsize is not None: params["outputsize"] = self.outputsize if self.show_plan is not None: params["show_plan"] = self.show_plan params["format"] = "JSON" params["apikey"] = self.ctx.apikey endpoint = "/symbol_search" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class EarliestTimestampEndpoint(AsMixin, Endpoint): _name = "earliest_timestamp" def __init__(self, ctx, symbol=None, interval=None, exchange=None, mic_code=None, timezone=None, ): self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.mic_code = mic_code self.timezone = timezone def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.mic_code is not None: params["mic_code"] = self.mic_code if self.timezone is not None: params["timezone"] = self.timezone params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/earliest_timestamp" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MarketStateEndpoint(AsMixin, Endpoint): _name = "market_state" def __init__(self, ctx, exchange=None, code=None, country=None, ): self.ctx = ctx self.exchange = exchange self.code = code self.country = country def execute(self, format="JSON", debug=False): params = {} if self.exchange is not None: params["exchange"] = self.exchange if self.code is not None: params["code"] = self.code if self.country is not None: params["country"] = self.country params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/market_state" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LogoEndpoint(AsMixin, Endpoint): _name = "logo" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "logo" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/logo" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ProfileEndpoint(AsMixin, Endpoint): _name = "profile" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "profile" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/profile" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class DividendsEndpoint(AsMixin, Endpoint): _name = "dividends" def __init__(self, ctx, symbol=None, exchange=None, country=None, range=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.range = range self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "dividends" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.range is not None: params["range"] = self.range if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/dividends" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class DividendsCalendarEndpoint(AsMixin, Endpoint): _name = "dividends_calendar" def __init__(self, ctx, symbol=None, exchange=None, country=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "dividends_calendar" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/dividends_calendar" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SplitsEndpoint(AsMixin, Endpoint): _name = "splits" def __init__(self, ctx, symbol=None, exchange=None, country=None, range=None, start_date=None, end_date=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.range = range self.start_date = start_date self.end_date = end_date self.method = "splits" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.range is not None: params["range"] = self.range if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/splits" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SplitsCalendarEndpoint(AsMixin, Endpoint): _name = "splits_calendar" def __init__(self, ctx, symbol=None, exchange=None, country=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "splits_calendar" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/splits_calendar" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class EarningsEndpoint(AsMixin, Endpoint): _name = "earnings" def __init__(self, ctx, symbol=None, exchange=None, country=None, period=None, outputsize=None, start_date=None, end_date=None, mic_code=None, dp=None, type=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.period = period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.dp = dp self.type = type self.method = "earnings" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.period is not None: params["period"] = self.period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code if self.dp is not None: params["dp"] = self.dp if self.type is not None: params["type"] = self.type params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/earnings" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class EarningsCalendarEndpoint(AsMixin, Endpoint): _name = "earnings_calendar" def __init__(self, ctx, symbol=None, exchange=None, country=None, period=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.period = period self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "earnings_calendar" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.period is not None: params["period"] = self.period if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/earnings_calendar" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class IPOCalendarEndpoint(AsMixin, Endpoint): _name = "ipo_calendar" def __init__(self, ctx, symbol=None, exchange=None, country=None, start_date=None, end_date=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.start_date = start_date self.end_date = end_date self.method = "ipo_calendar" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ipo_calendar" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class StatisticsEndpoint(AsMixin, Endpoint): _name = "statistics" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "statistics" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/statistics" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class InsiderTransactionsEndpoint(AsMixin, Endpoint): _name = "insider_transactions" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "insider_transactions" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/insider_transactions" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class IncomeStatementEndpoint(AsMixin, Endpoint): _name = "income_statement" def __init__(self, ctx, symbol=None, exchange=None, country=None, period=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.period = period self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "income_statement" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.period is not None: params["period"] = self.period if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/income_statement" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class BalanceSheetEndpoint(AsMixin, Endpoint): _name = "balance_sheet" def __init__(self, ctx, symbol=None, exchange=None, country=None, period=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.period = period self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "balance_sheet" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.period is not None: params["period"] = self.period if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/balance_sheet" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CashFlowEndpoint(AsMixin, Endpoint): _name = "cash_flow" def __init__(self, ctx, symbol=None, exchange=None, country=None, period=None, start_date=None, end_date=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.period = period self.start_date = start_date self.end_date = end_date self.mic_code = mic_code self.method = "cash_flow" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.period is not None: params["period"] = self.period if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/cash_flow" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class OptionsExpirationEndpoint(AsMixin, Endpoint): _name = "options_expiration" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "options_expiration" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/options/expiration" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class OptionsChainEndpoint(AsMixin, Endpoint): _name = "options_chain" def __init__(self, ctx, symbol=None, exchange=None, country=None, expiration_date=None, option_id=None, side=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.expiration_date = expiration_date self.option_id = option_id self.side = side self.mic_code = mic_code self.method = "options_chain" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.expiration_date is not None: params["expiration_date"] = self.expiration_date if self.option_id is not None: params["option_id"] = self.option_id if self.side is not None: params["side"] = self.side if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/options/chain" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class KeyExecutivesEndpoint(AsMixin, Endpoint): _name = "key_executives" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "key_executives" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/key_executives" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class InstitutionalHoldersEndpoint(AsMixin, Endpoint): _name = "institutional_holders" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "institutional_holders" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/institutional_holders" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class FundHoldersEndpoint(AsMixin, Endpoint): _name = "fund_holders" def __init__(self, ctx, symbol=None, exchange=None, country=None, mic_code=None, ): self.ctx = ctx self.symbol = symbol self.exchange = exchange self.country = country self.mic_code = mic_code self.method = "fund_holders" def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"] = self.symbol if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/fund_holders" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class APIUsageEndpoint(AsMixin, Endpoint): _name = "api_usage" def __init__(self, ctx): self.ctx = ctx def execute(self, format="JSON", debug=False): params = {} params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/api_usage" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ADEndpoint(AsMixin, Endpoint): _name = "ad" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ad" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ad" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ADOSCEndpoint(AsMixin, Endpoint): _name = "adosc" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, fast_period=12, slow_period=26, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "adosc" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.fast_period = fast_period self.slow_period = slow_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.fast_period is not None: params["fast_period"] = self.fast_period if self.slow_period is not None: params["slow_period"] = self.slow_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/adosc" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ADXEndpoint(AsMixin, Endpoint): _name = "adx" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "adx" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/adx" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ADXREndpoint(AsMixin, Endpoint): _name = "adxr" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "adxr" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/adxr" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class APOEndpoint(AsMixin, Endpoint): _name = "apo" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=9, fast_period=12, slow_period=26, ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "apo" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.fast_period = fast_period self.slow_period = slow_period self.ma_type = ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.fast_period is not None: params["fast_period"] = self.fast_period if self.slow_period is not None: params["slow_period"] = self.slow_period if self.ma_type is not None: params["ma_type"] = self.ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/apo" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class AROONEndpoint(AsMixin, Endpoint): _name = "aroon" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "aroon" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/aroon" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class AROONOSCEndpoint(AsMixin, Endpoint): _name = "aroonosc" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "aroonosc" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/aroonosc" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ATREndpoint(AsMixin, Endpoint): _name = "atr" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "atr" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/atr" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class AVGPRICEEndpoint(AsMixin, Endpoint): _name = "avgprice" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "avgprice" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/avgprice" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class BBANDSEndpoint(AsMixin, Endpoint): _name = "bbands" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=20, sd="2", ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "bbands" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.sd = sd self.ma_type = ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.sd is not None: params["sd"] = self.sd if self.ma_type is not None: params["ma_type"] = self.ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/bbands" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class BETAEndpoint(AsMixin, Endpoint): _name = "beta" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type_1="open", series_type_2="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "beta" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type_1 = series_type_1 self.series_type_2 = series_type_2 self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type_1 is not None: params["series_type_1"] = self.series_type_1 if self.series_type_2 is not None: params["series_type_2"] = self.series_type_2 if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/beta" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class PercentBEndpoint(AsMixin, Endpoint): _name = "percent_b" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=20, sd="2", ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "percent_b" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.sd = sd self.ma_type = ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.sd is not None: params["sd"] = self.sd if self.ma_type is not None: params["ma_type"] = self.ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/percent_b" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class PivotPointsHLEndpoint(AsMixin, Endpoint): _name = "pivot_points_hl" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=10, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "pivot_points_hl" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/pivot_points_hl" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class BOPEndpoint(AsMixin, Endpoint): _name = "bop" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "bop" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/bop" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CCIEndpoint(AsMixin, Endpoint): _name = "cci" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=20, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "cci" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/cci" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CEILEndpoint(AsMixin, Endpoint): _name = "ceil" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ceil" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ceil" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CMOEndpoint(AsMixin, Endpoint): _name = "cmo" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "cmo" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/cmo" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class COPPOCKEndpoint(AsMixin, Endpoint): _name = "coppock" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", long_roc_period=14, short_roc_period=11, wma_period=0, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "cmo" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.long_roc_period = long_roc_period self.short_roc_period = short_roc_period self.wma_period = wma_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.long_roc_period is not None: params["long_roc_period"] = self.long_roc_period if self.short_roc_period is not None: params["short_roc_period"] = self.short_roc_period if self.wma_period is not None: params["wma_period"] = self.wma_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/coppock" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class CEILEndpoint(AsMixin, Endpoint): _name = "ceil" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ceil" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ceil" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class DEMAEndpoint(AsMixin, Endpoint): _name = "dema" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "dema" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/dema" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class DXEndpoint(AsMixin, Endpoint): _name = "dx" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "dx" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/dx" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class EMAEndpoint(AsMixin, Endpoint): _name = "ema" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ema" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ema" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class EXPEndpoint(AsMixin, Endpoint): _name = "exp" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "exp" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/exp" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class FLOOREndpoint(AsMixin, Endpoint): _name = "floor" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "floor" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/floor" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HEIKINASHICANDLESEndpoint(AsMixin, Endpoint): _name = "heikinashicandles" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_price = True self.meta_name = "heikinashicandles" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/heikinashicandles" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HLC3Endpoint(AsMixin, Endpoint): _name = "hlc3" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_price = True self.meta_name = "hlc3" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/hlc3" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HT_DCPERIODEndpoint(AsMixin, Endpoint): _name = "ht_dcperiod" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ht_dcperiod" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ht_dcperiod" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HT_DCPHASEEndpoint(AsMixin, Endpoint): _name = "ht_dcphase" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ht_dcphase" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ht_dcphase" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HT_PHASOREndpoint(AsMixin, Endpoint): _name = "ht_phasor" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ht_phasor" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ht_phasor" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HT_SINEEndpoint(AsMixin, Endpoint): _name = "ht_sine" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ht_sine" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ht_sine" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HT_TRENDLINEEndpoint(AsMixin, Endpoint): _name = "ht_trendline" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ht_trendline" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ht_trendline" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class HT_TRENDMODEEndpoint(AsMixin, Endpoint): _name = "ht_trendmode" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ht_trendmode" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ht_trendmode" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ICHIMOKUEndpoint(AsMixin, Endpoint): _name = "ichimoku" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, conversion_line_period=9, base_line_period=26, leading_span_b_period=52, lagging_span_period=26, include_ahead_span_period=True, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "vwap" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.conversion_line_period = conversion_line_period self.base_line_period = base_line_period self.leading_span_b_period = leading_span_b_period self.lagging_span_period = lagging_span_period self.include_ahead_span_period = include_ahead_span_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.conversion_line_period is not None: params["conversion_line_period"] = self.conversion_line_period if self.base_line_period is not None: params["base_line_period"] = self.base_line_period if self.leading_span_b_period is not None: params["leading_span_b_period"] = self.leading_span_b_period if self.lagging_span_period is not None: params["lagging_span_period"] = self.lagging_span_period if self.include_ahead_span_period is not None: params["include_ahead_span_period"] = self.include_ahead_span_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ichimoku" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class KAMAEndpoint(AsMixin, Endpoint): _name = "kama" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "kama" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/kama" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class KELTNEREndpoint(AsMixin, Endpoint): _name = "keltner" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=20, atr_time_period=10, multiplier=2, ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "keltner" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.atr_time_period = atr_time_period self.multiplier = multiplier self.ma_type = ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.atr_time_period is not None: params["atr_time_period"] = self.atr_time_period if self.multiplier is not None: params["multiplier"] = self.multiplier if self.ma_type is not None: params["ma_type"] = self.ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/keltner" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class KSTEndpoint(AsMixin, Endpoint): _name = "kst" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, roc_period_1=10, roc_period_2=15, roc_period_3=20, roc_period_4=30, signal_period=9, sma_period_1=10, sma_period_2=10, sma_period_3=10, sma_period_4=15, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "kst" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.roc_period_1 = roc_period_1 self.roc_period_2 = roc_period_2 self.roc_period_3 = roc_period_3 self.roc_period_4 = roc_period_4 self.signal_period = signal_period self.sma_period_1 = sma_period_1 self.sma_period_2 = sma_period_2 self.sma_period_3 = sma_period_3 self.sma_period_4 = sma_period_4 self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.roc_period_1 is not None: params["roc_period_1"] = self.roc_period_1 if self.roc_period_2 is not None: params["roc_period_2"] = self.roc_period_2 if self.roc_period_3 is not None: params["roc_period_3"] = self.roc_period_3 if self.roc_period_4 is not None: params["roc_period_4"] = self.roc_period_4 if self.signal_period is not None: params["signal_period"] = self.signal_period if self.sma_period_1 is not None: params["sma_period_1"] = self.sma_period_1 if self.sma_period_2 is not None: params["sma_period_2"] = self.sma_period_2 if self.sma_period_3 is not None: params["sma_period_3"] = self.sma_period_3 if self.sma_period_4 is not None: params["sma_period_4"] = self.sma_period_4 if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/kst" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LINEARREGEndpoint(AsMixin, Endpoint): _name = "linearreg" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "linearreg" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/linearreg" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LINEARREGANGLEEndpoint(AsMixin, Endpoint): _name = "linearregangle" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "linearregangle" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/linearregangle" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LINEARREGINTERCEPTEndpoint(AsMixin, Endpoint): _name = "linearregintercept" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "linearregintercept" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/linearregintercept" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LINEARREGSLOPEEndpoint(AsMixin, Endpoint): _name = "linearregslope" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "linearregslope" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/linearregslope" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LNEndpoint(AsMixin, Endpoint): _name = "ln" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ln" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ln" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class LOG10Endpoint(AsMixin, Endpoint): _name = "log10" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "log10" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/log10" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MAEndpoint(AsMixin, Endpoint): _name = "ma" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ma" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.ma_type = ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.ma_type is not None: params["ma_type"] = self.ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ma" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MACDEndpoint(AsMixin, Endpoint): _name = "macd" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", fast_period=12, slow_period=26, signal_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "macd" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.fast_period = fast_period self.slow_period = slow_period self.signal_period = signal_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.fast_period is not None: params["fast_period"] = self.fast_period if self.slow_period is not None: params["slow_period"] = self.slow_period if self.signal_period is not None: params["signal_period"] = self.signal_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/macd" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MACDSlopeEndpoint(AsMixin, Endpoint): _name = "macd_slope" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", fast_period=12, slow_period=26, signal_period=9, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "macd_slope" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.fast_period = fast_period self.slow_period = slow_period self.signal_period = signal_period self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.fast_period is not None: params["fast_period"] = self.fast_period if self.slow_period is not None: params["slow_period"] = self.slow_period if self.signal_period is not None: params["signal_period"] = self.signal_period if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/macd_slope" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MACDEXTEndpoint(AsMixin, Endpoint): _name = "macdext" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", fast_period=12, fast_ma_type="SMA", slow_period=26, slow_ma_type="SMA", signal_period=9, signal_ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "macdext" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.fast_period = fast_period self.fast_ma_type = fast_ma_type self.slow_period = slow_period self.slow_ma_type = slow_ma_type self.signal_period = signal_period self.signal_ma_type = signal_ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.fast_period is not None: params["fast_period"] = self.fast_period if self.fast_ma_type is not None: params["fast_ma_type"] = self.fast_ma_type if self.slow_period is not None: params["slow_period"] = self.slow_period if self.slow_ma_type is not None: params["slow_ma_type"] = self.slow_ma_type if self.signal_period is not None: params["signal_period"] = self.signal_period if self.signal_ma_type is not None: params["signal_ma_type"] = self.signal_ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/macdext" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MAMAEndpoint(AsMixin, Endpoint): _name = "mama" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", fast_limit="0.5", slow_limit="0.05", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "mama" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.fast_limit = fast_limit self.slow_limit = slow_limit self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.fast_limit is not None: params["fast_limit"] = self.fast_limit if self.slow_limit is not None: params["slow_limit"] = self.slow_limit if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/mama" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MAXEndpoint(AsMixin, Endpoint): _name = "max" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "max" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/max" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MAXINDEXEndpoint(AsMixin, Endpoint): _name = "maxindex" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "maxindex" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/maxindex" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class McGinleyDynamicEndpoint(AsMixin, Endpoint): _name = "mcginley_dynamic" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "mcginley_dynamic" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/mcginley_dynamic" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MEDPRICEEndpoint(AsMixin, Endpoint): _name = "medprice" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "medprice" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/medprice" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MFIEndpoint(AsMixin, Endpoint): _name = "mfi" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "mfi" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/mfi" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MIDPOINTEndpoint(AsMixin, Endpoint): _name = "midpoint" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "midpoint" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/midpoint" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MIDPRICEEndpoint(AsMixin, Endpoint): _name = "midprice" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "midprice" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/midprice" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MINEndpoint(AsMixin, Endpoint): _name = "min" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "min" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/min" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MININDEXEndpoint(AsMixin, Endpoint): _name = "minindex" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "minindex" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/minindex" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MINMAXEndpoint(AsMixin, Endpoint): _name = "minmax" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "minmax" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/minmax" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MINMAXINDEXEndpoint(AsMixin, Endpoint): _name = "minmaxindex" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "minmaxindex" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/minmaxindex" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MINUS_DIEndpoint(AsMixin, Endpoint): _name = "minus_di" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "minus_di" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/minus_di" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MINUS_DMEndpoint(AsMixin, Endpoint): _name = "minus_dm" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "minus_dm" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/minus_dm" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class MOMEndpoint(AsMixin, Endpoint): _name = "mom" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "mom" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/mom" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class NATREndpoint(AsMixin, Endpoint): _name = "natr" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "natr" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/natr" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class OBVEndpoint(AsMixin, Endpoint): _name = "obv" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "obv" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/obv" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class PLUS_DIEndpoint(AsMixin, Endpoint): _name = "plus_di" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "plus_di" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/plus_di" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class PLUS_DMEndpoint(AsMixin, Endpoint): _name = "plus_dm" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "plus_dm" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/plus_dm" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class PPOEndpoint(AsMixin, Endpoint): _name = "ppo" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", fast_period=10, slow_period=21, ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ppo" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.fast_period = fast_period self.slow_period = slow_period self.ma_type = ma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.fast_period is not None: params["fast_period"] = self.fast_period if self.slow_period is not None: params["slow_period"] = self.slow_period if self.ma_type is not None: params["ma_type"] = self.ma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ppo" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ROCEndpoint(AsMixin, Endpoint): _name = "roc" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "roc" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/roc" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ROCPEndpoint(AsMixin, Endpoint): _name = "rocp" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "rocp" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/rocp" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ROCREndpoint(AsMixin, Endpoint): _name = "rocr" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "rocr" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/rocr" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ROCR100Endpoint(AsMixin, Endpoint): _name = "rocr100" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "rocr100" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/rocr100" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class RSIEndpoint(AsMixin, Endpoint): _name = "rsi" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "rsi" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/rsi" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class RVOLEndpoint(AsMixin, Endpoint): _name = "rvol" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "rvol" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/rvol" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SAREndpoint(AsMixin, Endpoint): _name = "sar" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, acceleration="0.02", maximum="0.2", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "sar" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.acceleration = acceleration self.maximum = maximum self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.acceleration is not None: params["acceleration"] = self.acceleration if self.maximum is not None: params["maximum"] = self.maximum if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/sar" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SMAEndpoint(AsMixin, Endpoint): _name = "sma" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "sma" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/sma" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SQRTEndpoint(AsMixin, Endpoint): _name = "sqrt" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "sqrt" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/sqrt" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class STDDEVEndpoint(AsMixin, Endpoint): _name = "stddev" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, sd="2", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "stddev" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.sd = sd self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.sd is not None: params["sd"] = self.sd if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/stddev" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class STOCHEndpoint(AsMixin, Endpoint): _name = "stoch" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, fast_k_period=14, slow_k_period=1, slow_d_period=3, slow_kma_type="SMA", slow_dma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "stoch" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.fast_k_period = fast_k_period self.slow_k_period = slow_k_period self.slow_d_period = slow_d_period self.slow_kma_type = slow_kma_type self.slow_dma_type = slow_dma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.fast_k_period is not None: params["fast_k_period"] = self.fast_k_period if self.slow_k_period is not None: params["slow_k_period"] = self.slow_k_period if self.slow_d_period is not None: params["slow_d_period"] = self.slow_d_period if self.slow_kma_type is not None: params["slow_kma_type"] = self.slow_kma_type if self.slow_dma_type is not None: params["slow_dma_type"] = self.slow_dma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/stoch" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class STOCHFEndpoint(AsMixin, Endpoint): _name = "stochf" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, fast_k_period=14, fast_d_period=3, fast_dma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "stochf" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.fast_k_period = fast_k_period self.fast_d_period = fast_d_period self.fast_dma_type = fast_dma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.fast_k_period is not None: params["fast_k_period"] = self.fast_k_period if self.fast_d_period is not None: params["fast_d_period"] = self.fast_d_period if self.fast_dma_type is not None: params["fast_dma_type"] = self.fast_dma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/stochf" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class STOCHRSIEndpoint(AsMixin, Endpoint): _name = "stochrsi" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=14, fast_k_period=3, fast_d_period=3, fast_dma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "stochrsi" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.fast_k_period = fast_k_period self.fast_d_period = fast_d_period self.fast_dma_type = fast_dma_type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.fast_k_period is not None: params["fast_k_period"] = self.fast_k_period if self.fast_d_period is not None: params["fast_d_period"] = self.fast_d_period if self.fast_dma_type is not None: params["fast_dma_type"] = self.fast_dma_type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/stochrsi" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class SuperTrendEndpoint(AsMixin, Endpoint): _name = "supertrend" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, multiplier=3, period=10, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "supertrend" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.multiplier = multiplier self.period = period self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.multiplier is not None: params["multiplier"] = self.multiplier if self.period is not None: params["period"] = self.period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/supertrend" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class T3MAEndpoint(AsMixin, Endpoint): _name = "t3ma" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, v_factor="0.7", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "t3ma" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.v_factor = v_factor self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.v_factor is not None: params["v_factor"] = self.v_factor if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/t3ma" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TEMAEndpoint(AsMixin, Endpoint): _name = "tema" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "tema" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/tema" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TRANGEEndpoint(AsMixin, Endpoint): _name = "trange" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "trange" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/trange" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TRIMAEndpoint(AsMixin, Endpoint): _name = "trima" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "trima" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/trima" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TSFEndpoint(AsMixin, Endpoint): _name = "tsf" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "tsf" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/tsf" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class TYPPRICEEndpoint(AsMixin, Endpoint): _name = "typprice" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "typprice" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/typprice" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class ULTOSCEndpoint(AsMixin, Endpoint): _name = "ultosc" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period_1=7, time_period_2=14, time_period_3=28, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "ultosc" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period_1 = time_period_1 self.time_period_2 = time_period_2 self.time_period_3 = time_period_3 self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period_1 is not None: params["time_period_1"] = self.time_period_1 if self.time_period_2 is not None: params["time_period_2"] = self.time_period_2 if self.time_period_3 is not None: params["time_period_3"] = self.time_period_3 if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/ultosc" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class VAREndpoint(AsMixin, Endpoint): _name = "var" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "var" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/var" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class VWAPEndpoint(AsMixin, Endpoint): _name = "vwap" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "vwap" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/vwap" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class WCLPRICEEndpoint(AsMixin, Endpoint): _name = "wclprice" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "wclprice" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/wclprice" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class WILLREndpoint(AsMixin, Endpoint): _name = "willr" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "willr" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/willr" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) class WMAEndpoint(AsMixin, Endpoint): _name = "wma" def __init__( self, ctx, symbol, interval, exchange=None, country=None, type=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", order="desc", prepost="false", mic_code=None, ): self.is_indicator = True self.meta_name = "wma" self.ctx = ctx self.symbol = symbol self.interval = interval self.exchange = exchange self.country = country self.type = type self.series_type = series_type self.time_period = time_period self.outputsize = outputsize self.start_date = start_date self.end_date = end_date self.dp = dp self.timezone = timezone self.order = order self.prepost = prepost self.mic_code = mic_code def execute(self, format="JSON", debug=False): params = {} if self.symbol is not None: params["symbol"], self.is_batch = get_symbol(self.symbol) if self.interval is not None: params["interval"] = self.interval if self.exchange is not None: params["exchange"] = self.exchange if self.country is not None: params["country"] = self.country if self.type is not None: params["type"] = self.type if self.series_type is not None: params["series_type"] = self.series_type if self.time_period is not None: params["time_period"] = self.time_period if self.outputsize is not None: params["outputsize"] = self.outputsize if self.start_date is not None: params["start_date"] = self.start_date if self.end_date is not None: params["end_date"] = self.end_date if self.dp is not None: params["dp"] = self.dp if self.timezone is not None: params["timezone"] = self.timezone if self.order is not None: params["order"] = self.order if self.prepost is not None: params["prepost"] = self.prepost if self.mic_code is not None: params["mic_code"] = self.mic_code params["format"] = format params["apikey"] = self.ctx.apikey endpoint = "/wma" if debug: return build_url(self.ctx.base_url, endpoint, params) return self.ctx.http_client.get(endpoint, params=params) ================================================ FILE: src/twelvedata/exceptions.py ================================================ # coding: utf-8 __all__ = ( "TwelveDataError", "BadRequestError", "InternalServerError", "InvalidApiKeyError", ) class TwelveDataError(RuntimeError): pass class BadRequestError(TwelveDataError): pass class InternalServerError(TwelveDataError): pass class InvalidApiKeyError(TwelveDataError): pass ================================================ FILE: src/twelvedata/http_client.py ================================================ # coding: utf-8 from requests import Session from json import JSONDecodeError from .exceptions import ( BadRequestError, InternalServerError, InvalidApiKeyError, TwelveDataError, ) __all__ = ("DefaultHttpClient",) class DefaultHttpClient(object): def __init__(self, base_url): self.base_url = base_url self.session = Session() def get(self, relative_url, *args, **kwargs): # For the sake of monitoring, we add a "source" parameter params = kwargs.get("params", {}) params["source"] = "python" kwargs["params"] = params resp = self.session.get("{}{}".format(self.base_url, relative_url), timeout=30, *args, **kwargs) if ('Is_batch' in resp.headers and resp.headers['Is_batch'] == 'true') or \ ('Content-Type' in resp.headers and resp.headers['Content-Type'] == 'text/csv'): return resp if not resp.ok: self._raise_error(resp.status_code, resp.text) json_resp = resp.json() if 'status' not in json_resp: return resp status = json_resp['status'] if status == 'error': error_code = json_resp['code'] else: return resp try: message = json_resp["message"] except ValueError: message = resp.text self._raise_error(error_code, message) @staticmethod def _raise_error(error_code, message): if error_code == 401: raise InvalidApiKeyError(message) if error_code == 400: raise BadRequestError(message) if error_code >= 500: raise InternalServerError(message) raise TwelveDataError(message) ================================================ FILE: src/twelvedata/mixins.py ================================================ # coding: utf-8 import csv from .utils import convert_collection_to_pandas, convert_collection_to_pandas_multi_index, convert_pandas_to_plotly __all__ = ("AsJsonMixin", "AsCsvMixin", "AsPandasMixin", "AsUrlMixin", "AsMixin") class AsJsonMixin(object): def as_json(self): resp = self.execute(format="JSON") json = resp.json() if hasattr(self, 'is_batch') and self.is_batch: return json if isinstance(json, dict) and json.get("status") == "ok": if 'result' in json and isinstance(json['result'], dict) and 'list' in json['result'] \ and isinstance(json['result']['list'], list): return json['result']['list'] return json.get("data") or json.get("values") or json.get("earnings") or [] return json def as_raw_json(self): resp = self.execute(format="JSON") return resp.text class AsCsvMixin(object): def as_csv(self, **kwargs): resp = self.execute(format="CSV") lines = resp.text.strip().split("\n") delimiter = "," if "," in lines[0] else ";" kwargs["delimiter"] = kwargs.get("delimiter", delimiter) return tuple(map(tuple, csv.reader(lines, **kwargs))) def as_raw_csv(self): resp = self.execute(format="CSV") return resp.text class AsPandasMixin(object): def as_pandas(self, **kwargs): import pandas as pd assert hasattr(self, "as_json") data = self.as_json() if hasattr(self, "is_batch") and self.is_batch: df = convert_collection_to_pandas_multi_index(data) elif hasattr(self, "method") and self.method == "earnings": df = self.create_basic_df(data, pd, index_column="date", **kwargs) elif hasattr(self, "method") and self.method == "earnings_calendar": modified_data = [] for date, row in data.items(): for earning in row: earning["date"] = date modified_data.append(earning) df = self.create_basic_df(modified_data, pd, index_column="date", **kwargs) else: df = self.create_basic_df(data, pd, **kwargs) return df @staticmethod def create_basic_df(data, pd, index_column="datetime", **kwargs): df = convert_collection_to_pandas(data, **kwargs) df = df.set_index(index_column) df.index = pd.to_datetime(df.index) for col in df.columns: try: df[col] = pd.to_numeric(df[col]) except (ValueError, TypeError): df[col] = df[col] return df class AsUrlMixin(object): def as_url(self, **kwargs): return self.execute(debug=True) class AsMixin(AsJsonMixin, AsCsvMixin, AsPandasMixin, AsUrlMixin, object): pass ================================================ FILE: src/twelvedata/renders.py ================================================ # coding: utf-8 from .endpoints import * VOL_CHART_HEIGHT = 0.15 CANDLE_WIDTH = 0.0002 BAR_WIDTH = 0.0002 COLOR_UP = "#26a69a" COLOR_DOWN = "#ef5350" class RenderContext(object): fig = None interval_minutes = 1 fill_area = None colormap = {} postfix = "" class ChartRender(object): def render(self, backend, df, **kwargs): getattr(self, "render_{}".format(backend))(df, **kwargs) def _slice(self, df): if getattr(self, "cols", None): df = df.loc[:, self.cols] return df def _label(self, ctx, col): return "{}{}".format(col, ctx.postfix) class CandlestickRender(ChartRender): def __init__(self, opens, highs, lows, closes, volume=None): self.volume = volume self.ohlc = (opens, highs, lows, closes) def render_plotly(self, ctx, df, **kwargs): import plotly.graph_objects as go fig = ctx.fig (opens, highs, lows, closes) = self.ohlc data = [ go.Candlestick( x=df.index, open=df[opens], high=df[highs], low=df[lows], close=df[closes], increasing=go.candlestick.Increasing( line=go.candlestick.increasing.Line(color=COLOR_UP) ), decreasing=go.candlestick.Decreasing( line=go.candlestick.decreasing.Line(color=COLOR_DOWN) ), name="Price", ) ] if self.volume and self.volume in df: volume_colors = [ COLOR_UP if i != 0 and df[closes][i] > df[opens][i] else COLOR_DOWN for i in range(len(df[closes])) ] # Visually separate the price chart from the volume chart ymin = min( df[opens].min(), df[highs].min(), df[lows].min(), df[closes].min() ) ymax = max( df[opens].max(), df[highs].max(), df[lows].max(), df[closes].max() ) fig.layout["yaxis"].range = [ymin - (ymax - ymin) * VOL_CHART_HEIGHT, ymax] data.append( go.Bar( x=df.index, y=df[self.volume], marker=go.bar.Marker(color=volume_colors), name="Volume", yaxis="y666", ) ) y_scaler = 1.0 / VOL_CHART_HEIGHT fig.layout["yaxis666"] = go.layout.YAxis( range=[0, df[self.volume].max() * y_scaler], overlaying="y1", anchor="x1", showgrid=False, showticklabels=False, ) return data def render_matplotlib(self, ctx, df, ax, **kwargs): import mplfinance as mpf import pandas as pd df.index = pd.to_datetime(df.index) if self.volume and self.volume in df: mc = mpf.make_marketcolors(up=COLOR_UP, down=COLOR_DOWN, edge='inherit', wick='black', ohlc='i', volume='in') s = mpf.make_mpf_style(marketcolors=mc) mpf.plot(df, type='candle', volume=True, style=s) else: mc = mpf.make_marketcolors(up=COLOR_UP, down=COLOR_DOWN, edge='inherit', wick='black', ohlc='i') s = mpf.make_mpf_style(marketcolors=mc) mpf.plot(df, type='candle', volume=False, style=s) class LineRender(ChartRender): def __init__(self, *cols): self.cols = cols def render_plotly(self, ctx, df, **kwargs): import plotly.graph_objects as go df = self._slice(df) return [ go.Scatter( x=df.index, y=df[col], name=self._label(ctx, col), line={"color": ctx.colormap.get(col)}, ) for col in df.columns ] def render_matplotlib(self, ctx, df, ax, **kwargs): kwargs.pop("candle_width", None) df = self._slice(df) for col in df.columns: df[col].plot( ax=ax, color=ctx.colormap.get(col), label=self._label(ctx, col), **kwargs ) class PointsRender(ChartRender): def __init__(self, *cols): self.cols = cols def render_plotly(self, ctx, df, **kwargs): import plotly.graph_objects as go df = self._slice(df) return [ go.Scatter( x=df.index, y=df[col], name=self._label(ctx, col), mode="markers", marker={"color": ctx.colormap.get(col)}, ) for col in df.columns ] def render_matplotlib(self, ctx, df, ax, **kwargs): df = self._slice(df) for col in df.columns: tmp_df = df.loc[:, [col]].reset_index() tmp_df.plot.scatter( x=df.index.name, y=col, ax=ax, color=ctx.colormap.get(col), label=self._label(ctx, col), **kwargs ) class HistogramRender(ChartRender): def __init__(self, col): self.cols = (col,) def render_plotly(self, ctx, df, **kwargs): import plotly.graph_objects as go df = self._slice(df) return [ go.Bar( x=df.index, y=df[col], name=self._label(ctx, col), marker={"color": ctx.colormap.get(col)}, ) for col in df.columns ] def render_matplotlib(self, ctx, df, ax, **kwargs): df = self._slice(df) col = self.cols[0] ax.bar( df.index, df[col], align="center", width=BAR_WIDTH * ctx.interval_minutes, color=ctx.colormap.get(col), label=self._label(ctx, col), ) class FillAreaRender(ChartRender): def _prepare_bound(self, df, bound): if isinstance(bound, (int, float)): bound = [bound] * len(df) elif bound in df: bound = df[bound] else: bound = None return bound def _extract_variables(self, df, fill_area): color = fill_area.get("color") opacity = fill_area.get("transparency") lower = fill_area.get("lower_bound") lower = self._prepare_bound(df, lower) upper = fill_area.get("upper_bound") upper = self._prepare_bound(df, upper) return (color, lower, upper, opacity) def render_plotly(self, ctx, df, **kwargs): import plotly.graph_objs as go if not ctx.fill_area: return () color, lower, upper, opacity = self._extract_variables(df, ctx.fill_area) if not (color and lower is not None and upper is not None and opacity): return () trace0 = go.Scatter( x=df.index, y=lower, fill=None, mode="lines", opacity=opacity, showlegend=False, line={"color": color, "width": 0}, ) trace1 = go.Scatter( x=df.index, y=upper, fill="tonexty", mode="lines", opacity=opacity, showlegend=False, line={"color": color, "width": 0}, ) return (trace0, trace1) def render_matplotlib(self, ctx, df, ax, **kwargs): import matplotlib.pyplot as plt if not ctx.fill_area: return color, lower, upper, alpha = self._extract_variables(df, ctx.fill_area) if not (color and lower is not None and upper is not None and alpha): return ax.fill_between(df.index, lower, upper, facecolor=color, alpha=alpha) LR = LineRender() FAR = FillAreaRender() RENDER_BY_NAME = { "candle": CandlestickRender, "points": PointsRender, "histogram": HistogramRender, "line": LineRender, } RENDERS_MAPPING = { ADOSCEndpoint: [LR], ADEndpoint: [LR], ADXREndpoint: [LR], ADXEndpoint: [LR], APOEndpoint: [LR], AROONOSCEndpoint: [LR], AROONEndpoint: [LR], ATREndpoint: [LR], AVGPRICEEndpoint: [LR], BBANDSEndpoint: [LR, FAR], BETAEndpoint: [LR], BOPEndpoint: [LR], CCIEndpoint: [LR, FAR], CEILEndpoint: [LR], CMOEndpoint: [LR], COPPOCKEndpoint: [LR], DEMAEndpoint: [LR], DXEndpoint: [LR], EMAEndpoint: [LR], EXPEndpoint: [LR], FLOOREndpoint: [LR], HEIKINASHICANDLESEndpoint: [ CandlestickRender("heikinopens", "heikinhighs", "heikinlows", "heikincloses") ], HLC3Endpoint: [LR], HT_DCPERIODEndpoint: [LR], HT_DCPHASEEndpoint: [LR], HT_PHASOREndpoint: [LR], HT_SINEEndpoint: [LR], HT_TRENDLINEEndpoint: [LR], HT_TRENDMODEEndpoint: [LR], ICHIMOKUEndpoint: [LR], KAMAEndpoint: [LR], KELTNEREndpoint: [LR], KSTEndpoint: [LR], LINEARREGANGLEEndpoint: [LR], LINEARREGINTERCEPTEndpoint: [LR], LINEARREGEndpoint: [LR], LINEARREGSLOPEEndpoint: [LR], LNEndpoint: [LR], LOG10Endpoint: [LR], MACDEndpoint: [LineRender("macd", "macd_signal"), HistogramRender("macd_hist"), ], MACDSlopeEndpoint: [LR], MACDEXTEndpoint: [LR], MAMAEndpoint: [LR], MAEndpoint: [LR], MAXINDEXEndpoint: [LR], MAXEndpoint: [LR], McGinleyDynamicEndpoint: [LR], MEDPRICEEndpoint: [LR], MFIEndpoint: [LR], MIDPOINTEndpoint: [LR], MIDPRICEEndpoint: [LR], MININDEXEndpoint: [LR], MINMAXINDEXEndpoint: [LR], MINMAXEndpoint: [LR], MINEndpoint: [LR], MINUS_DIEndpoint: [LR], MINUS_DMEndpoint: [LR], MOMEndpoint: [LR], NATREndpoint: [LR], OBVEndpoint: [LR], PLUS_DIEndpoint: [LR], PLUS_DMEndpoint: [LR], PPOEndpoint: [LR], PercentBEndpoint: [LR, FAR], PivotPointsHLEndpoint: [PointsRender("pivot_point_h", "pivot_point_l")], ROCPEndpoint: [LR], ROCR100Endpoint: [LR], ROCREndpoint: [LR], ROCEndpoint: [LR], RSIEndpoint: [LR, FAR], RVOLEndpoint: [LR], SAREndpoint: [PointsRender("sar")], SMAEndpoint: [LR], SQRTEndpoint: [LR], STDDEVEndpoint: [LR], STOCHFEndpoint: [LR, FAR], STOCHRSIEndpoint: [LR, FAR], STOCHEndpoint: [LR, FAR], SuperTrendEndpoint: [LR], T3MAEndpoint: [LR], TEMAEndpoint: [LR], TRANGEEndpoint: [LR], TRIMAEndpoint: [LR], TSFEndpoint: [LR], TYPPRICEEndpoint: [LR], TimeSeriesEndpoint: [CandlestickRender("open", "high", "low", "close", "volume")], ULTOSCEndpoint: [LR], VAREndpoint: [LR], VWAPEndpoint: [LR], WCLPRICEEndpoint: [LR], WILLREndpoint: [LR, FAR], WMAEndpoint: [LR], } ================================================ FILE: src/twelvedata/time_series.py ================================================ # coding: utf-8 import time import pytimeparse import re import itertools from collections import OrderedDict, Counter from .endpoints import * from .utils import apply_context_defaults, force_use_kwargs, parse_interval_in_minutes __all__ = ("TimeSeries",) class TimeSeries(object): def __init__( self, ctx, endpoints=(), price_endpoint=None, price_endpoint_enabled=True ): self.ctx = ctx self.price_endpoint_enabled = price_endpoint_enabled self.price_endpoint = price_endpoint or TimeSeriesEndpoint( self.ctx, **self.ctx.defaults ) self.endpoints = endpoints def clone(self): return TimeSeries( ctx=self.ctx, endpoints=self.endpoints, price_endpoint=self.price_endpoint, price_endpoint_enabled=self.price_endpoint_enabled, ) def as_json(self): out = OrderedDict() is_batch = False postfixes = self._generate_postfixes() error_symbols = [] if self.price_endpoint_enabled: time_series_json = self.price_endpoint.as_json() is_batch = self.price_endpoint.is_batch for row_symbol in time_series_json: if self.price_endpoint.is_batch: values = OrderedDict() if time_series_json[row_symbol]['status'] == 'error': error_symbols.append(row_symbol) continue for v in time_series_json[row_symbol]['values']: values.setdefault(v["datetime"], {}).update(v) out[row_symbol] = values else: out.setdefault(row_symbol["datetime"], {}).update(row_symbol) for ep in self.endpoints: postfix = str(next(postfixes[ep.__class__])) indicator_json = ep.as_json() for row in indicator_json: if ep.is_batch: if row.upper() in error_symbols: continue values = out[row] for v in indicator_json[row]['values']: if postfix: v = { (k if k == "datetime" else "{}_{}".format(k, postfix)): v for k, v in v.items() } values.setdefault(v["datetime"], {}).update(v) out[row] = values else: if postfix: row = { (k if k == "datetime" else "{}_{}".format(k, postfix)): v for k, v in row.items() } out.setdefault(row["datetime"], {}).update(row) if is_batch: for k, v in out.items(): out[k] = tuple(v.values()) return dict(out) return tuple(out.values()) def as_csv(self, **kwargs): out = OrderedDict() postfixes = self._generate_postfixes() if self.price_endpoint_enabled: for row in self.price_endpoint.as_csv(): out.setdefault(row[0], []).extend(row) for ep in self.endpoints: postfix = str(next(postfixes[ep.__class__])) for row in ep.as_csv(**kwargs): if row[0] == "datetime": row = ["{}{}".format(header, postfix) for header in row[1:]] row.insert(0, "datetime") if not out: out.setdefault(row[0], []).extend(row) else: out.setdefault(row[0], []).extend(row[1:]) return tuple(out.values()) def as_pandas(self, **kwargs): import pandas postfixes = self._generate_postfixes() if self.price_endpoint_enabled: df = self.price_endpoint.as_pandas() else: df = None for ep in self.endpoints: tmp_df = ep.as_pandas(**kwargs) tmp_df = tmp_df.add_suffix(str(next(postfixes[ep.__class__]))) if df is None: df = tmp_df continue df = pandas.merge( df, tmp_df, how="left", left_index=True, right_index=True ) return df def as_url(self, **kwargs): urls = list() if self.price_endpoint_enabled: urls.append(self.price_endpoint.as_url()) for ep in self.endpoints: urls.append(ep.as_url()) return urls def _has_overlays(self): return any(ep.is_overlay for ep in self.endpoints) def _count_subplots(self): """Count how many charts should be displayed""" if self.price_endpoint_enabled or self._has_overlays(): subplots_count = 1 else: subplots_count = 0 for ep in self.endpoints: subplots_count += ep.is_indicator and not ep.is_overlay return subplots_count def _chart_title(self): return "{} - {}".format( self.ctx.defaults.get("symbol").upper(), self.ctx.defaults.get("interval") ) def _generate_postfixes(self): # If user specified multiple same endpoints we should add postfixes postfixes = {} empty = itertools.cycle(("",)) for cls, n in Counter(ep.__class__ for ep in self.endpoints).items(): if n > 1: postfixes[cls] = itertools.count(1) else: postfixes[cls] = empty return postfixes def as_pyplot_figure(self, figsize=(16, 8), candle_width=0.0002, df=None): import matplotlib.dates as mdates import matplotlib.pyplot as plt import matplotlib.ticker as mticker from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() plt.rcParams["figure.figsize"] = figsize subplots_count = self._count_subplots() def mark_xaxis_as_date(x): x.xaxis_date() x.xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d %H:%M")) x.xaxis.set_major_locator(mticker.MaxNLocator(10)) for label in x.xaxis.get_ticklabels(): label.set_rotation(45) x.grid(True) # All subplots should be %25 from height of main plot if self.price_endpoint_enabled: gridspec = { "width_ratios": [1], "height_ratios": [4] + ([1] * (subplots_count - 1)), } else: gridspec = {"width_ratios": [1], "height_ratios": [1] * subplots_count} # Create multiple plots with shared X-axis fig, axs = plt.subplots(subplots_count, 1, sharex=True, gridspec_kw=gridspec) fig.suptitle(self._chart_title(), x=0.44, y=0.95) ax_iter = iter((axs,)) if subplots_count == 1 else iter(axs) # Binding a width of the candles to the interval, otherwise # the candles will be too thin interval = self.ctx.defaults.get("interval", "1min") interval_minutes = parse_interval_in_minutes(interval) or 1 # Render price chart first price_ax = None if self.price_endpoint_enabled: price_ax = next(ax_iter) self.price_endpoint.render_matplotlib( ax=price_ax, candle_width=candle_width, interval_minutes=interval_minutes, df=df, ) price_ax.yaxis.tick_right() price_ax.yaxis.set_label_position("right") mark_xaxis_as_date(price_ax) elif self._has_overlays(): price_ax = next(ax_iter) # Render tech indicators # postfixes = self._generate_postfixes() # for ep in self.endpoints: # if ep.is_overlay: # ax = price_ax # else: # ax = next(ax_iter) # ax.margins(0.25) # # ax.yaxis.tick_right() # ax.yaxis.set_label_position("right") # # postfix = next(postfixes[ep.__class__]) # ep.render_matplotlib( # ax=ax, interval_minutes=interval_minutes, postfix=postfix # ) # # if not ep.is_overlay: # mark_xaxis_as_date(ax) # # ax.legend(loc="upper left") plt.subplots_adjust(wspace=0, hspace=0, left=0.1, right=0.8) plt.xlabel("Time") return fig def show_pyplot(self, figsize=(20, 10), candle_width=0.002): import matplotlib as mpl import matplotlib.pyplot as plt mpl.use("WebAgg") self.as_pyplot_figure(figsize=figsize, candle_width=candle_width) plt.show() def as_plotly_figure(self, df=None): from plotly.subplots import make_subplots import plotly.graph_objs as go subplots_count = self._count_subplots() # All subplots should have %25 height from the main plot if self.price_endpoint_enabled: row_width = [1] row_width.extend([0.25] * (subplots_count - 1)) else: row_width = [1] * subplots_count fig = make_subplots( rows=subplots_count, cols=1, shared_xaxes=True, vertical_spacing=0, row_width=row_width[::-1], ) # Draw main plot if self.price_endpoint_enabled: price_traces = self.price_endpoint.render_plotly(fig=fig, df=df) fig.add_trace(price_traces[0], 1, 1) for trace in price_traces[1:]: fig.add_trace(trace) # Draw other subplots postfixes = self._generate_postfixes() overlay_endpoints = (ep for ep in self.endpoints if ep.is_overlay) for ep in overlay_endpoints: postfix = next(postfixes[ep.__class__]) for ep_trace in ep.render_plotly(postfix=postfix, df=df): fig.add_trace(ep_trace) if self.price_endpoint_enabled or self._has_overlays(): start_index = 2 else: start_index = 1 separate_endpoints = (ep for ep in self.endpoints if not ep.is_overlay) for idx, ep in enumerate(separate_endpoints, start=start_index): postfix = next(postfixes[ep.__class__]) for ep_trace in ep.render_plotly(postfix=postfix): fig.add_trace(ep_trace, idx, 1) # Move all ticks on Y-axis to the right for yaxis in (fig.layout[attr] for attr in fig.layout if attr[:5] == "yaxis"): yaxis.side = "right" yaxis.mirror = "allticks" # Set title and remove rangeslider fig.update( layout_title={ "text": self._chart_title(), "x": 0.5, "xanchor": "center", "y": 0.9, "yanchor": "top", }, layout_xaxis_rangeslider_visible=False, ) return fig def show_plotly(self): fig = self.as_plotly_figure() fig.show() def _with_endpoint(self, ep): ts = self.clone() ts.endpoints += (ep,) return ts def _with_price_endpoint(self, ep): ts = self.clone() ts.price_endpoint = ep return ts def without_ohlc(self): """ Disable price data/chart """ ts = self.clone() ts.price_endpoint_enabled = False return ts def with_ohlc(self): """ Enable price data/chart """ ts = self.clone() ts.price_endpoint_enabled = True return ts @force_use_kwargs @apply_context_defaults def with_ad( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of AD to chart builder Chaikin A/D Line(AD) calculates Advance/Decline of an asset. This indicator belongs to the group of Volume Indicators. This API call returns meta and time series values of AD. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Name of instrument you want to request For preffered stocks use dot(.) delimiterE.g. BRK.A or BRK.B will be correct :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :returns: chart builder :rtype: ChartEndpoint """ ep = ADEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_adosc( self, exchange=None, country=None, fast_period=12, slow_period=26, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ADOSC to chart builder Chaikin A/D Oscillator(ADOSC) is an indicator of indicator which has an idea to find relationship between increasing and deacreasing volume with price fluctuations. The Chaikin Oscillator measures the momentum of the Accumulation/Distribution Line(ADL) using two Exponential Moving Averages of varying length to the line(MACD). This API call returns meta and time series values of ADOSC. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Name of instrument you want to request For preffered stocks use dot(.) delimiter. E.g. BRK.A or BRK.B will be correct :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored. Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param fast_period: Number of periods for fast moving average. Must be at least 1 :param slow_period: Number of periods for slow moving average. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ADOSCEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, fast_period=fast_period, slow_period=slow_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_adx( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ADX to chart builder Average Directional Movement Index(ADX) is used to decide if the price trend is strong. This API call returns meta and time series values of ADX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency. E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ADXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_adxr( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ADXR to chart builder Average Directional Movement Index Rating(ADXR) is a smoothed version of ADX indicator. ADXR quantifies momentum change in the ADX. This API call returns meta and time series values of ADXR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency. E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ADXREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_apo( self, exchange=None, country=None, time_period=9, fast_period="12", slow_period="26", ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of APO to chart builder Absolute Price Oscillator(APO) calculates the difference between two price moving averages. This API call returns meta and time series values of APO. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency. E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param fast_period: Number of periods for fast moving average. Must be at least 1 :param slow_period: Number of periods for slow moving average. Must be at least 1 :param ma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = APOEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, fast_period=fast_period, slow_period=slow_period, ma_type=ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_aroon( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of AROON to chart builder Aroon Indicator(AROON) is used to identify if the price is trending. It can also spot beginning of new trend and it's strength. This API call returns meta and time series values of AROON. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = AROONEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_aroonosc( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of AROONOSC to chart builder Aroon Oscillator(AROONOSC) uses classic Aroon(Aroon Up and Aroon down) to measure the strength of persisting trend and it's chances to persist. This API call returns meta and time series values of AROONOSC. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = AROONOSCEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_atr( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ATR to chart builder Average True Range(ATR) is used to measure market volatility by decomposing all asset prices over specified time period. This API call returns meta and time series values of ATR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ATREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_avgprice( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of AVGPRICE to chart builder Average Price(AVGPRICE) uses formula: (open + high + low + close) / 4. This API call returns meta and time series values of AVGPRICE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = AVGPRICEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_bbands( self, exchange=None, country=None, series_type="close", time_period=20, sd="2", ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of BBANDS to chart builder Bollinger Bands(BBANDS) are volatility bands located above and below a moving average. Volatility size parameter depends on standard deviation. This API call returns meta and time series values of BBANDS. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param sd: Number of standard deviations. Must be at least 1 :param ma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = BBANDSEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, sd=sd, ma_type=ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_beta( self, exchange=None, country=None, series_type_1="open", series_type_2="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of BETA to chart builder Statistic Beta function. This API call returns meta and time series values of BBANDS. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type_1: Price type used as the first part of technical indicator :param series_type_2: Price type used as the second part of technical indicator :param time_period: Number of periods to average over. Takes values in the range from 1 to 800 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = BETAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type_1=series_type_1, series_type_2=series_type_2, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_percent_b( self, exchange=None, country=None, series_type="close", time_period=20, sd="2", ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Creates request builder for %B %B Indicator(%B) measures position of an asset price relative to upper and lower Bollinger Bands. This API call returns meta and time series values of %B. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param sd: Number of standard deviations. Must be at least 1 :param ma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = PercentBEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, sd=sd, ma_type=ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_pivot_points_hl( self, exchange=None, country=None, time_period=10, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Creates request builder for Pivot Points (High/Low) Pivot Points (High/Low) (PIVOT_POINTS_HL) are typically used to foresee potential price reversals. This API call returns meta and time series values of PIVOT_POINTS_HL. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time descending updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = PivotPointsHLEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_bop( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of BOP to chart builder Balance Of Power(BOP) measures relative strength between buyers and sellers by assessing the ability of move price to an extreme level. This API call returns meta and time series values of BOP. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = BOPEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_cci( self, exchange=None, country=None, time_period=20, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of CCI to chart builder Commodity Channel Index(CCI) is a universal indicator that can help to identify new trend and assess current critical conditions. This API call returns meta and time series values of CCI. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = CCIEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ceil( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of CEIL to chart builder Vector CEIL(CEIL) transform input data with mathematical ceil function. This API call returns meta and time series values of CEIL. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = CEILEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_cmo( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of CMO to chart builder Chande Momentum Oscillator(CMO) is used to show overbought and oversold conditions. This API call returns meta and time series values of CMO. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = CMOEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_coppock( self, exchange=None, country=None, series_type="close", long_roc_period=14, short_roc_period=11, wma_period=10, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of COPPOCK to chart builder Coppock Curve(COPPOCK) is usually used to detect long-term trend changes, typically on monthly charts. This API call returns meta and time series values of CMO. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param long_roc_period: Number of periods for long term rate of change. Takes values in the range from 1 to 500 :param short_roc_period: Number of periods for short term rate of change. Takes values in the range from 1 to 500 :param wma_period: Number of periods for weighted moving average. Takes values in the range from 1 to 500 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = COPPOCKEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, long_roc_period=long_roc_period, short_roc_period=short_roc_period, wma_period=wma_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ceil( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of CEIL to chart builder Vector CEIL(CEIL) transform input data with mathematical ceil function. This API call returns meta and time series values of CEIL. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = CEILEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_dema( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of DEMA to chart builder Double Exponential Moving Average(DEMA) it used to eliminate lag. It does this by taking two Exponential Moving Averages(EMA)). This API call returns meta and time series values of DEMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = DEMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_dx( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of DX to chart builder Directional Movement Index(DX) identifies in which direction the price is moving. This API call returns meta and time series values of DX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = DXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ema( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of EMA to chart builder Exponential Moving Average(EMA) it places greater importance on recent data points than the normal Moving Average(MA). This API call returns meta and time series values of EMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = EMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_exp( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of EXP to chart builder Exponential(EXP) transform input data with mathematical exponent function. This API call returns meta and time series values of EXP. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = EXPEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_floor( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of FLOOR to chart builder Vector FLOOR(FLOOR) transform input data with mathematical floor function. This API call returns meta and time series values of FLOOR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = FLOOREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_heikinashicandles( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HEIKINASHICANDLES to chart builder Heikin-Ashi Candles(HEIKINASHICANDLES) translating from Japanese it means "average bar". It can be used detect market trends and predict future price fluctuations.. This API call returns meta and time series values of HEIKINASHICANDLES. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HEIKINASHICANDLESEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_price_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_hlc3( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HLC3 to chart builder High, Low, Close Average(HLC3) gives alternative candlesticks patter. Every element is defined as follows: (high + low + close) / 3. This API call returns meta and time series values of HLC3. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HLC3Endpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_price_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ht_dcperiod( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HT_DCPERIOD to chart builder Hilbert Transform Dominant Cycle Period(HT_DCPERIOD) is part of Hilbert Transforms concepts. You can reed more about it in the Rocket Science for Traders book by John F. Ehlers. This API call returns meta and time series values of HT_DCPERIOD. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HT_DCPERIODEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ht_dcphase( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HT_DCPHASE to chart builder Hilbert Transform Dominant Cycle Phase(HT_DCPHASE) is part of Hilbert Transforms concepts. You can reed more about it in the Rocket Science for Traders book by John F. Ehlers. This API call returns meta and time series values of HT_DCPHASE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HT_DCPHASEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ht_phasor( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HT_PHASOR to chart builder Hilbert Transform Phasor Components(HT_PHASOR) is part of Hilbert Transforms concepts. You can reed more about it in the Rocket Science for Traders book by John F. Ehlers. This API call returns meta and time series values of HT_PHASOR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HT_PHASOREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ht_sine( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HT_SINE to chart builder Hilbert Transform SineWave(HT_SINE) is part of Hilbert Transforms concepts. You can reed more about it in the Rocket Science for Traders book by John F. Ehlers. This API call returns meta and time series values of HT_SINE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HT_SINEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ht_trendline( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HT_TRENDLINE to chart builder Hilbert Transform Instantaneous Trendline(HT_TRENDLINE) comes from the concept of Digital Signal Processing (DSP). It creates complex signals from the simple chart data. You can reed more about it in the Rocket Science for Traders book by John F. Ehlers. This API call returns meta and time series values of HT_TRENDLINE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HT_TRENDLINEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ht_trendmode( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of HT_TRENDMODE to chart builder Hilbert Transform Trend vs Cycle Mode(HT_TRENDMODE) is part of Hilbert Transforms concepts. You can reed more about it in the Rocket Science for Traders book by John F. Ehlers. This API call returns meta and time series values of HT_TRENDMODE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = HT_TRENDMODEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ichimoku( self, exchange=None, country=None, conversion_line_period=9, base_line_period=26, leading_span_b_period=52, lagging_span_period=26, include_ahead_span_period=True, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ICHIMOKU to chart builder Ichimoku Kinkō Hyō(ICHIMOKU) is a group of technical indicators that shows trend direction, momentum, and support & resistance levels. Overall it tends to improve the accuracy of forecasts. This API call returns meta and time series values of HT_TRENDLINE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param conversion_line_period: Takes values in the range from 1 to 800 :param base_line_period: Takes values in the range from 1 to 800 :param leading_span_b_period: Takes values in the range from 1 to 800 :param lagging_span_period: Takes values in the range from 1 to 800 :param include_ahead_span_period: Specifies if the span values ahead the current moment should be returned :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ICHIMOKUEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, conversion_line_period=conversion_line_period, base_line_period=base_line_period, leading_span_b_period=leading_span_b_period, lagging_span_period=lagging_span_period, include_ahead_span_period=include_ahead_span_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_kama( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of KAMA to chart builder Kaufman's Adaptive Moving Average(KAMA) is a type of Moving Average(MA) that incorporates market noise and volatility. This API call returns meta and time series values of KAMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = KAMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_keltner( self, exchange=None, country=None, series_type="close", time_period=20, atr_time_period=10, multiplier=2, ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of KELTNER to chart builder Keltner Channels(KELTNER) is a volatility indicator used to spot trend changes and accelerations. This API call returns meta and time series values of KELTNER. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param atr_time_period: Takes values in the range from 1 to 800 :param multiplier: Multiplier is the number by which the range is shifted :param ma_type: Type of Moving Average to be used :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = KELTNEREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, atr_time_period=atr_time_period, multiplier=multiplier, ma_type=ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_kst( self, exchange=None, country=None, roc_period_1=10, roc_period_2=15, roc_period_3=20, roc_period_4=30, signal_period=9, sma_period_1=10, sma_period_2=10, sma_period_3=10, sma_period_4=15, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of KST to chart builder Know Sure Thing(KST) calculates price momentum for four distinct price cycles(ROC). This API call returns meta and time series values of KST. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param roc_period_1: :param roc_period_2: :param roc_period_3: :param roc_period_4: :param signal_period: :param sma_period_1: :param sma_period_2: :param sma_period_3: :param sma_period_4: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = KSTEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, roc_period_1=roc_period_1, roc_period_2=roc_period_2, roc_period_3=roc_period_3, roc_period_4=roc_period_4, signal_period=signal_period, sma_period_1=sma_period_1, sma_period_2=sma_period_2, sma_period_3=sma_period_3, sma_period_4=sma_period_4, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_linearreg( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of LINEARREG to chart builder Linear Regression(LINEARREG) is used to determine trend direction by a straight line. This API call returns meta and time series values of LINEARREG. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = LINEARREGEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_linearregangle( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of LINEARREGANGLE to chart builder Linear Regression Angle(LINEARREGANGLE) calculates the angle of the linear regression trendline. This API call returns meta and time series values of LINEARREGANGLE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = LINEARREGANGLEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_linearregintercept( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of LINEARREGINTERCEPT to chart builder Linear Regression Intercept(LINEARREGINTERCEPT) calculates the intercept for the linear regression trendline for each data point. This API call returns meta and time series values of LINEARREGINTERCEPT. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = LINEARREGINTERCEPTEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_linearregslope( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of LINEARREGSLOPE to chart builder Linear Regression Slope(LINEARREGSLOPE) calculates the slope for the linear regression trendline for each data point. This API call returns meta and time series values of LINEARREGSLOPE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = LINEARREGSLOPEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ln( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of LN to chart builder Natural Logarithm to the base of constant e(LN) transforms all data points with natural logarithm. This API call returns meta and time series values of LN. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = LNEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_log10( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of LOG10 to chart builder Logarithm to base 10(LOG10) transforms all data points with logarithm to base 10. This API call returns meta and time series values of LOG10. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = LOG10Endpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ma( self, exchange=None, country=None, series_type="close", time_period=9, ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MA to chart builder Moving Average(MA) is used to smooth out price fluctuations and get rid of market noise. This API call returns meta and time series values of MA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param ma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, ma_type=ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_macd( self, exchange=None, country=None, series_type="close", fast_period="12", slow_period="26", signal_period="9", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MACD to chart builder Moving Average Convergence Divergence(MACD) is a trend following momentum indicator which works by subtracting the longer moving average from the shorter one. MACD has an unstable period ~ 100. This API call returns meta and time series values of MACD. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param fast_period: Number of periods for fast moving average. Must be at least 1 :param slow_period: Number of periods for slow moving average. Must be at least 1 :param signal_period: Number of periods to be plotted on MACD line. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MACDEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, fast_period=fast_period, slow_period=slow_period, signal_period=signal_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_macd_slope( self, exchange=None, country=None, series_type="close", fast_period="12", slow_period="26", signal_period="9", time_period="9", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MACD_SLOPE to chart builder Moving Average Convergence Divergence Regression Slope(MACD_SLOPE) shows slopes of macd line, signal line, and histogram. A negative and rising slope shows improvement within a downtrend. A positive and falling slope shows deterioration within an uptrend. MACD has an unstable period of ~ 100. This API call returns meta and time series values of MACD SLOPE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param fast_period: Number of periods for fast moving average. Must be at least 1 :param slow_period: Number of periods for slow moving average. Must be at least 1 :param signal_period: Number of periods to be plotted on MACD line. Must be at least 1 :param time_period: Number of periods to average over. Takes values in the range from 1 to 800. :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MACDSlopeEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, fast_period=fast_period, slow_period=slow_period, signal_period=signal_period, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_macdext( self, exchange=None, country=None, series_type="close", fast_period="12", fast_ma_type="SMA", slow_period="26", slow_ma_type="SMA", signal_period="9", signal_ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MACDEXT to chart builder Moving Average Convergence Divergence Extended(MACDEXT) gives greater control over MACD input parameters. MACDEXT has an unstable period ~ 100. This API call returns meta and time series values of MACDEXT. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param fast_period: Number of periods for fast moving average. Must be at least 1 :param fast_ma_type: :param slow_period: Number of periods for slow moving average. Must be at least 1 :param slow_ma_type: :param signal_period: Number of periods to be plotted on MACD line. Must be at least 1 :param signal_ma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MACDEXTEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, fast_period=fast_period, fast_ma_type=fast_ma_type, slow_period=slow_period, slow_ma_type=slow_ma_type, signal_period=signal_period, signal_ma_type=signal_ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_mama( self, exchange=None, country=None, series_type="close", fast_limit="0.5", slow_limit="0.05", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MAMA to chart builder MESA Adaptive Moving Average(MAMA) adapts to price fluctuations based on the rate of change of Hilbert Transform Discriminator. More about MAMA can be read here. This API call returns meta and time series values of MAMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param fast_limit: :param slow_limit: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MAMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, fast_limit=fast_limit, slow_limit=slow_limit, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_max( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MAX to chart builder Highest value over period(MAX). This API call returns meta and time series values of MAX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MAXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_maxindex( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MAXINDEX to chart builder Index of highest value over period(MAXINDEX). This API call returns meta and time series values of MAXINDEX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MAXINDEXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_mcginley_dynamic( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MCGINLEY_DYNAMIC to chart builder McGinley Dynamic(MCGINLEY_DYNAMIC) keeps all the benefits from the moving averages but adds an adjustment to market speed. This API call returns meta and time series values of MCGINLEY_DYNAMIC. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = McGinleyDynamicEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_medprice( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MEDPRICE to chart builder Median Price(MEDPRICE). This API call returns meta and time series values of MEDPRICE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MEDPRICEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_mfi( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MFI to chart builder Money Flow Index(MFI) is used to identify overbought and oversold levels in an asset. In some cases, it can be used to detect divergences, which might be a sign of upcoming trend changes. This API call returns "meta" and "time_series" values of MFI. "meta" object consist of general information about the requested technical indicator. "time_series" is the array of objects ordered by time descending updated in real-time. :param symbol: Name of instrument you want to request For preffered stocks use dot(.) delimiter. E.g. BRK.A or BRK.B will be correct :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MFIEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_midpoint( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MIDPOINT to chart builder MidPoint over period(MIDPOINT) is calculated as: (highest value + lowest value) / 2. This API call returns meta and time series values of MIDPOINT. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MIDPOINTEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_midprice( self, exchange=None, country=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MIDPRICE to chart builder Midpoint Price over period(MIDPRICE) is calculated as: (highest high + lowest low) / 2. This API call returns meta and time series values of MIDPRICE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MIDPRICEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_min( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MIN to chart builder Lowest value over period(MIN). This API call returns meta and time series values of MIN. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MINEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_minindex( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MININDEX to chart builder Index of lowest value over period(MININDEX). This API call returns meta and time series values of MININDEX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MININDEXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_minmax( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MINMAX to chart builder Lowest and highest values over period(MINMAX). This API call returns meta and time series values of MINMAX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MINMAXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_minmaxindex( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MINMAXINDEX to chart builder Indexes of lowest and highest values over period(MINMAXINDEX). This API call returns meta and time series values of MINMAXINDEX. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MINMAXINDEXEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_minus_di( self, exchange=None, country=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MINUS_DI to chart builder Minus Directional Indicator(MINUS_DI) is a component of the Average Directional Index(ADX) and it measures the existence of downtrend. This API call returns meta and time series values of MINUS_DI. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MINUS_DIEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_minus_dm( self, exchange=None, country=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MINUS_DM to chart builder Minus Directional Movement(MINUS_DM) is calculated as: Previous Low - Low. This API call returns meta and time series values of MINUS_DM. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MINUS_DMEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_mom( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of MOM to chart builder Momentum(MOM) compares current price with the previous price N timeperiods ago. This API call returns meta and time series values of MOM. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = MOMEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_natr( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of NATR to chart builder Normalized Average True Range(NATR) is used to compare and analyze across different price levels due to its normalized quality, which might be more effective than the original ATR. This API call returns meta and time series values of NATR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = NATREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_obv( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of OBV to chart builder On Balance Volume(OBV) is a momentum indicator which uses volume flow to forecast upcoming price changes. This API call returns meta and time series values of OBV. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Name of instrument you want to request For preffered stocks use dot(.) delimiterE.g. BRK.A or BRK.B will be correct :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = OBVEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_plus_di( self, exchange=None, country=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of PLUS_DI to chart builder Plus Directional Indicator(PLUS_DI) is a component of the Average Directional Index(ADX) and it measures the existence of uptrend. This API call returns meta and time series values of PLUS_DI. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = PLUS_DIEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_plus_dm( self, exchange=None, country=None, time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of PLUS_DM to chart builder Plus Directional Movement(PLUS_DM) is calculated as: High - Previous High. This API call returns meta and time series values of PLUS_DM. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = PLUS_DMEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ppo( self, exchange=None, country=None, series_type="close", fast_period="10", slow_period="21", ma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of PPO to chart builder Percentage Price Oscillator(PPO) shows relationship between two Moving Averages(MA) as a percentage. This API call returns meta and time series values of PPO. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param fast_period: Number of periods for fast moving average. Must be at least 1 :param slow_period: Number of periods for slow moving average. Must be at least 1 :param ma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = PPOEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, fast_period=fast_period, slow_period=slow_period, ma_type=ma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_roc( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ROC to chart builder Rate of change(ROC) calculates rate of change between current price and price n timeperiods ago. Formula: ((price / prevPrice) - 1) * 100. This API call returns meta and time series values of ROC. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ROCEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_rocp( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ROCP to chart builder Rate of change percentage(ROCP) calculates rate of change in % between current price and price n timeperiods ago. Formula: (price - prevPrice) / prevPrice. This API call returns meta and time series values of ROCP. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ROCPEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_rocr( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ROCR to chart builder Rate of change ratio(ROCR) calculates ratio between current price and price n timeperiods ago. Formula: (price / prevPrice). This API call returns meta and time series values of ROCR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ROCREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_rocr100( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ROCR100 to chart builder Rate of change ratio 100 scale(ROCR100) calculates ratio with 100 scale between current price and price n timeperiods ago. Formula: (price / prevPrice) * 100. This API call returns meta and time series values of ROCR100. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ROCR100Endpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_rsi( self, exchange=None, country=None, series_type="close", time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of RSI to chart builder Relative Strength Index(RSI) is a momentum indicator which calculates the magnitude of a price changes to assess the overbought and oversold conditions in the price of an asset. This API call returns meta and time series values of RSI. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = RSIEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_rvol( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of RVOL to chart builder Relative Volume Indicator(RVOL) shows how the current trading volume is compared to past volume over a given period. This API call returns meta and time series values of RVOL. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = RVOLEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_sar( self, acceleration="0.02", maximum="0.2", exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of SAR to chart builder Parabolic SAR(SAR) is used to identify and spot upcoming asset momentum. This API call returns meta and time series values of SAR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param acceleration: :param maximum: :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = SAREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], acceleration=acceleration, maximum=maximum, exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_sma( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of SMA to chart builder Simple Moving Average(SMA) is an arithmetic moving average calculated by adding latest closing prices and them dividing them by number of time periods. This API call returns meta and time series values of SMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = SMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_sqrt( self, exchange=None, country=None, series_type="close", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of SQRT to chart builder Square Root(SQRT) transform input data with square root. This API call returns meta and time series values of SQRT. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = SQRTEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_stddev( self, exchange=None, country=None, series_type="close", time_period=9, sd="2", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of STDDEV to chart builder Standard Deviation(STDDEV) is used to measure volatility. Might be important when assessing risks. This API call returns meta and time series values of STDDEV. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param sd: Number of standard deviations. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = STDDEVEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, sd=sd, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_stoch( self, exchange=None, country=None, fast_k_period="14", slow_k_period="1", slow_d_period="3", slow_kma_type="SMA", slow_dma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of STOCH to chart builder Stochastic Oscillator(STOCH) is used to decide if the price trend is strong. This API call returns meta and time series values of STOCH. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param fast_k_period: :param slow_k_period: :param slow_d_period: :param slow_kma_type: :param slow_dma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = STOCHEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, fast_k_period=fast_k_period, slow_k_period=slow_k_period, slow_d_period=slow_d_period, slow_kma_type=slow_kma_type, slow_dma_type=slow_dma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_stochf( self, exchange=None, country=None, fast_k_period="14", fast_d_period="3", fast_dma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of STOCHF to chart builder Stochastic Fast(STOCHF) is more sensitive to price changes, therefore it changes direction more quickly. This API call returns meta and time series values of STOCHF. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param fast_k_period: :param fast_d_period: :param fast_dma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = STOCHFEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, fast_k_period=fast_k_period, fast_d_period=fast_d_period, fast_dma_type=fast_dma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_stochrsi( self, exchange=None, country=None, series_type="close", time_period=14, fast_k_period="3", fast_d_period="3", fast_dma_type="SMA", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of STOCHRSI to chart builder Stochastic RSI(STOCHRSI) this indicator takes advantages of both indicators STOCH and RSI. It is used to determine level of overbought and oversold as well as current market trend of an asset. This API call returns meta and time series values of STOCHRSI. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param fast_k_period: :param fast_d_period: :param fast_dma_type: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = STOCHRSIEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, fast_k_period=fast_k_period, fast_d_period=fast_d_period, fast_dma_type=fast_dma_type, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_supertrend( self, exchange=None, country=None, multiplier=3, period=10, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of SuperTrend to chart builder SuperTrend Indicator(SUPERTREND) is mostly used on intraday timeframes to detect the price upward or downward direction in the trending market. This API call returns meta and time series values of SuperTrend. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param multiplier: Multiplier is the number by which the range is multiplied :param period: Period of the ATR indicator :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = SuperTrendEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, multiplier=multiplier, period=period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_t3ma( self, exchange=None, country=None, series_type="close", time_period=9, v_factor="0.7", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of T3MA to chart builder T3MA(T3MA). This API call returns meta and time series values of T3MA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param v_factor: :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = T3MAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, v_factor=v_factor, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_tema( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of TEMA to chart builder Triple Exponential Moving Average(TEMA) it smooths out price fluctuations, making it more trend detection more transparent without the lag. This API call returns meta and time series values of TEMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = TEMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_trange( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of TRANGE to chart builder True Range(TRANGE) usually is used as the base when calculating other indicators. TRANGE determines the normal trading range of an asset. This API call returns meta and time series values of TRANGE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = TRANGEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_trima( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of TRIMA to chart builder Triangular Moving Average(TRIMA) it smooths out price fluctuations, but places more weight on the prices in middle of the time period. This API call returns meta and time series values of TRIMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = TRIMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_tsf( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of TSF to chart builder Time Series Forecast(TSF) calculates trend based on last points of multiple regression trendlines. This API call returns meta and time series values of TSF. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = TSFEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_typprice( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of TYPPRICE to chart builder Typical Price(TYPPRICE). This API call returns meta and time series values of TYPPRICE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = TYPPRICEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_ultosc( self, exchange=None, country=None, time_period_1="7", time_period_2="14", time_period_3="28", outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of ULTOSC to chart builder Ultimate Oscillator(ULTOSC) takes into account three different time periods to enhance quality of overbought and oversold signals. This API call returns meta and time series values of ULTOSC. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period_1: Number of periods to average over. Must be at least 1 :param time_period_2: Number of periods to average over. Must be at least 1 :param time_period_3: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = ULTOSCEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period_1=time_period_1, time_period_2=time_period_2, time_period_3=time_period_3, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_var( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of VAR to chart builder Variance(VAR) calculates the spread between data points to determine how far are they from the mean. This API call returns meta and time series values of VAR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = VAREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_vwap( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of VWAP to chart builder Volume Weighted Average Price(VWAP) is commonly used as a trading benchmark that gives an average price at which the instrument has been trading during the day. This API call returns meta and time series values of VWAP. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = VWAPEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_wclprice( self, exchange=None, country=None, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of WCLPRICE to chart builder Weighted Close Price(WCLPRICE) usually is used as the base for other indicators for smoothness. Formula: (high + low + close * 2) / 4. This API call returns meta and time series values of WCLPRICE. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :returns: chart builder :rtype: ChartEndpoint """ ep = WCLPRICEEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_willr( self, exchange=None, country=None, time_period=14, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of WILLR to chart builder Williams %R(WILLR) calculates overbought and oversold levels. It can also be used to find entry and exit signals. This API call returns meta and time series values of WILLR. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = WILLREndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) @force_use_kwargs @apply_context_defaults def with_wma( self, exchange=None, country=None, series_type="close", time_period=9, outputsize=30, start_date=None, end_date=None, dp=5, timezone="Exchange", prepost="false", mic_code=None, ): """ Add request builder of WMA to chart builder Weighted Moving Average(WMA) it smooths out price fluctuations, it puts more weight on recent data points and less on past. This API call returns meta and time series values of WMA. Meta object consists of general information about requested technical indicator. Time series is the array of objects ordered by time desceding updated realtime. :param symbol: Instrument symbol, can be any stock, forex or cryptocurrency E.g. AAPL, EUR/USD, ETH/BTC, ... :param interval: Interval between two consecutive points in time series :param exchange: Only is applicable to stocks and cryptocurrencies otherwise is ignored Exchange where instrument is traded :param country: Only is applicable to stocks otherwise is ignored Country where instrument is traded :param series_type: Price type on which technical indicator is calculated :param time_period: Number of periods to average over. Must be at least 1 :param outputsize: Number of last datapoints to retrieve :param start_date: Start date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param end_date: End date of selection, accepts "yyyy-MM-dd hh:mm:ss" and "yyyy-MM-dd" formats :param dp: Specifies number of decimal places for floating values :param timezone: Timezone at which output datetime will be displayed Exchange for local exchange time2. UTC for datetime at universal UTC standard3. Timezone name according to IANA Time Zone Database. E.g. America/New_York, Asia/Singapore. Full list of timezones can be found here.Take note that IANA Timezone name is case-sensitive. :param prepost: Available at the 1min, 5min, 15min, and 30min intervals for all US equities. :param mic_code: Mic code value for filter. :returns: chart builder :rtype: ChartEndpoint """ ep = WMAEndpoint( ctx=self.ctx, symbol=self.ctx.defaults["symbol"], interval=self.ctx.defaults["interval"], exchange=exchange, country=country, series_type=series_type, time_period=time_period, outputsize=outputsize, start_date=start_date, end_date=end_date, dp=dp, timezone=timezone, prepost=prepost, mic_code=mic_code, ) return self._with_endpoint(ep) ================================================ FILE: src/twelvedata/utils.py ================================================ # coding: utf-8 import inspect import operator import functools import textwrap import pytimeparse from .exceptions import BadRequestError def patch_endpoints_meta(ctx): """ Loads technical indicators metadata from the remote source and patches endpoint classes according to the loaded metadata. """ from . import endpoints if hasattr(patch_endpoints_meta, "patched"): return meta_ep = endpoints.TechIndicatorsMetaEndpoint(ctx) all_meta = meta_ep.as_json() for ep in (getattr(endpoints, attr) for attr in endpoints.__all__): meta = all_meta.get(ep._name) if meta is None: continue else: ep.is_indicator = True if "overlay" in meta: ep.is_overlay = meta["overlay"] if "output_values" in meta: ep.colormap = { k: v["default_color"] for k, v in meta["output_values"].items() if "default_color" in v } if "tinting" in meta: fill_area = meta["tinting"].get("area") or {} ep.fill_area = fill_area setattr(patch_endpoints_meta, "patched", True) def force_use_kwargs(func): @functools.wraps(func) def wrapper(self, *args, **kwargs): if args: raise RuntimeError("Use kwargs only, please") return func(self, **kwargs) return wrapper def apply_context_defaults(func): @functools.wraps(func) def wrapper(self, *args, **kwargs): func_args = inspect.getargs(func.__code__).args func_args.remove("self") _kwargs = {k: v for k, v in self.ctx.defaults.items() if k in func_args} _kwargs.update(kwargs) return func(self, *args, **_kwargs) return wrapper def convert_pandas_to_plotly(df, **kwargs): """ Converts pandas DataFrame to plotly figure :param df: pandas DataFrame """ try: import plotly.graph_objs as go except ImportError: raise ImportError( textwrap.dedent( """ No module named 'plotly'. You can install it with follow command: > pip install twelvedata[pandas, plotly] or > pip install plotly """ ).strip() ) traces = [ go.Scatter(x=df.index, y=df[col], mode="lines", name=col) for col in df.columns ] return go.Figure(traces) def add_null_obj_values(obj, columns) -> dict: for col in columns: if col not in obj: obj[col] = None return obj def convert_collection_to_pandas(val, indexing_type=None): """ Converts list/dict to DataFrame :param val: list or dict :returns: pandas DataFrame """ try: import pandas except ImportError: raise ImportError( textwrap.dedent( """ No module named 'pandas'. You can install it with follow command: > pip install twelvedata[pandas] or > pip install pandas """ ).strip() ) if isinstance(val, (list, tuple)): if len(val) == 0: return pandas.DataFrame() else: columns_beg = tuple(val[0].keys()) columns_end = tuple(val[-1].keys()) get_row = operator.itemgetter(*columns_end) data = [get_row(add_null_obj_values(obj, columns_end)) if columns_beg != columns_end else get_row(obj) for obj in val] return pandas.DataFrame(data, columns=columns_end) elif isinstance(val, dict): try: return pandas.DataFrame.from_dict(val, orient="index", dtype="float") except ValueError: return pandas.DataFrame.from_dict( {'data_key': val}, orient="index", dtype="object" ) else: raise ValueError("Expected list, tuple or dict, but {} found".format(type(val))) def convert_collection_to_pandas_multi_index(val): try: import pandas except ImportError: raise ImportError( textwrap.dedent( """ No module named 'pandas'. You can install it with follow command: > pip install twelvedata[pandas] or > pip install pandas """ ).strip() ) columns = () for symbol, data in val.items(): if data['status'] == 'error': raise BadRequestError(data['message']) keys = list(data['values'][-1].keys())[1:] if len(keys) > len(columns): columns = keys arr = [] multi_index = [] for symbol, data in val.items(): if 'values' in data: values = data['values'] for quote in values: candle = tuple(quote.values()) multi_index.append((symbol, candle[0])) arr.append(candle[1:]) idx = pandas.MultiIndex.from_tuples(multi_index) return pandas.DataFrame(arr, index=idx, columns=columns) def parse_interval_in_minutes(interval): """ Parses the interval and tries to return its value as minutes. :param interval: string such as 1min, 5min, 10h, 12week and etc. :returns: int or None """ # Pytimeparse can't handle months, so we replace 1 month with 5 weeks. # The value is not exact, but it is quite acceptable for our needs if 'month' in interval: tmp = interval.replace('month', '').strip() if tmp.isnumeric(): interval = "{}week".format(5 * int(tmp)) secs = pytimeparse.parse(interval) if secs is not None: return secs / 60 else: return None ================================================ FILE: src/twelvedata/websocket.py ================================================ import time import threading import json import logging import queue MAX_QUEUE_SIZE = 12000 class TDWebSocket: def __init__(self, ctx): self.apikey = ctx.apikey self.self_heal_time_s = 1 if ctx.self_heal_time_s is None else ctx.self_heal_time_s self.defaults = ctx.defaults self.ws = None self.ready = False self.event_receiver = None self.event_handler = None self.last_queue_warning_time = 0 self.subscribed_symbols = set() self.logger = self.set_default_logger() self.symbols = self.set_default_symbols() self.events = self.set_default_events_queue() self.on_event = self.set_default_event_function() self.url = "wss://ws.twelvedata.com/v1/quotes/price?apikey={}".format(self.apikey) EventHandler(self).start() def set_default_logger(self): if "logger" in self.defaults: return self.defaults["logger"] formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") handler = logging.StreamHandler() handler.setFormatter(formatter) logger = logging.getLogger("ws-twelvedata") if "log_level" in self.defaults: log_level = self.defaults["log_level"] if log_level == "debug": logger.setLevel(logging.DEBUG) elif log_level == "info": logger.setLevel(logging.INFO) else: logger.setLevel(logging.NOTSET) logger.addHandler(handler) return logger def set_default_symbols(self): if "symbols" in self.defaults: if isinstance(self.defaults["symbols"], str): return {self.defaults["symbols"].upper()} return set(self.normalize_symbols(self.defaults["symbols"])) return set() def set_default_events_queue(self): if "max_queue_size" in self.defaults: return queue.Queue(maxsize=self.defaults["max_queue_size"]) return queue.Queue(maxsize=MAX_QUEUE_SIZE) def set_default_event_function(self): if "on_event" in self.defaults: if not callable(self.defaults["on_event"]): raise ValueError("Parameter 'on_event' must be a function") else: return self.defaults["on_event"] return None def connect(self): self.logger.info("Connecting...") self.ready = False self.subscribed_symbols = set() if self.ws: self.ws.close() time.sleep(1) while True: try: self.refresh_websocket() break except Exception as e: self.logger.error("Cannot connect: {}. Retrying...".format(e)) time.sleep(self.self_heal_time_s) def disconnect(self): self.ready = False self.subscribed_symbols = set() if self.ws: self.ws.close() time.sleep(1) def keep_alive(self): self.logger.info('Method keep_alive is deprecated, use heartbeat method instead') self.heartbeat() def heartbeat(self): if not self.ready: return try: self.ws.send('{"action": "heartbeat"}') except Exception as e: self.logger.error("Error calling heartbeat method: {}".format(e)) def refresh_websocket(self): self.event_receiver = EventReceiver(self) self.event_receiver.start() def self_heal(self): time.sleep(self.self_heal_time_s) self.connect() def on_connect(self): self.ready = True self.update_subscription_symbols() def on_queue_full(self): if time.time() - self.last_queue_warning_time > 1: self.logger.error("Event queue is full. New events are not added.") self.last_queue_warning_time = time.time() def subscribe(self, symbols): if isinstance(symbols, str): symbols = [symbols.upper()] else: symbols = self.normalize_symbols(symbols) self.symbols = self.symbols | set(symbols) self.update_subscription_symbols() def unsubscribe(self, symbols): if isinstance(symbols, str): symbols = [symbols.upper()] else: symbols = self.normalize_symbols(symbols) self.symbols = self.symbols - set(symbols) self.update_subscription_symbols() def reset(self): self.symbols = set() self.subscribed_symbols = set() self.ws.send('{"action": "reset"}') def update_subscription_symbols(self): if not self.ready: return # Subscribe new_symbols = self.symbols - self.subscribed_symbols if len(new_symbols) > 0: self.logger.debug("New symbols: {}".format(new_symbols)) ev = self.subscribe_event(new_symbols) self.ws.send(json.dumps(ev)) # Unsubscribe remove_symbols = self.subscribed_symbols - self.symbols if len(remove_symbols) > 0: self.logger.debug("Removed symbols: {}".format(remove_symbols)) ev = self.unsubscribe_event(remove_symbols) self.ws.send(json.dumps(ev)) self.subscribed_symbols = self.symbols.copy() self.logger.debug("Current symbols: {}".format(self.subscribed_symbols)) @staticmethod def normalize_symbols(s): return set([el.upper() for el in s]) @staticmethod def subscribe_event(symbols): return { "action": "subscribe", "params": { "symbols": ",".join(list(symbols)) } } @staticmethod def unsubscribe_event(symbols): return { "action": "unsubscribe", "params": { "symbols": ",".join(list(symbols)) } } class EventReceiver(threading.Thread): def __init__(self, client, ping_interval=15, ping_timeout=10): threading.Thread.__init__(self) self.daemon = True self.client = client self.enabled = True self.ping_interval = ping_interval self.ping_timeout = ping_timeout def run(self): import websocket self.client.ws = websocket.WebSocketApp( self.client.url, on_open=self.on_open, on_close=self.on_close, on_message=self.on_message, on_error=self.on_error ) self.client.logger.debug("EventReceiver ready") self.client.ws.run_forever( ping_interval=self.ping_interval, ping_timeout=self.ping_timeout, ping_payload='ping', ) self.client.logger.debug("EventReceiver exiting") def on_open(self, _): self.client.logger.info("TDWebSocket opened!") self.client.on_connect() def on_close(self, _, close_status_code, close_msg): self.client.logger.info( "TDWebSocket closed! Close status code: {0}, close message: {1}".format(close_status_code, close_msg) ) def on_error(self, _, error): self.client.logger.error("TDWebSocket ERROR: {}".format(error)) self.client.self_heal() def on_message(self, _, message): event = json.loads(message) self.client.logger.debug("Received event: {}".format(event)) try: self.client.events.put_nowait(event) except queue.Full: self.client.on_queue_full() class EventHandler(threading.Thread): def __init__(self, client): threading.Thread.__init__(self) self.daemon = True self.client = client def run(self): self.client.logger.debug("EventHandler ready") while True: data = self.client.events.get() if callable(self.client.on_event): try: self.client.on_event(data) except Exception as e: self.client.logger.error(e) ================================================ FILE: tests/conftest.py ================================================ #!/usr/bin/env python # coding: utf-8 ================================================ FILE: tests/test_client.py ================================================ #!/usr/bin/env python # coding: utf-8 import json import pytest from requests import Response from unittest.mock import patch, MagicMock, PropertyMock from matplotlib import pyplot as plt from twelvedata import TDClient from twelvedata.http_client import DefaultHttpClient from twelvedata.exceptions import ( BadRequestError, InternalServerError, InvalidApiKeyError, TwelveDataError, ) _cache = {} API_URL = 'https://api.twelvedata.com' class CachedHttpClient(DefaultHttpClient, object): def get(self, *args, **kwargs): global _cache h = "{}{}".format(args, kwargs) if h in _cache: return _cache[h] else: resp = super(CachedHttpClient, self).get(*args, **kwargs) _cache[h] = resp return resp def _fake_resp(status_code): resp = Response() resp.status_code = status_code return resp def _fake_json_resp(json_content): resp = MagicMock(spec=Response) type(resp).ok = PropertyMock(return_value=True) resp.json = MagicMock(return_value=json_content) type(resp).headers = PropertyMock(return_value={}) resp.status_code = 200 return resp def _init_client(): return TDClient( "demo", http_client=CachedHttpClient(API_URL), ) def _init_ts(): td = _init_client() return td.time_series(symbol="AAPL", interval="1min", outputsize=1) def _init_batch_ts(symbols): td = _init_client() return td.time_series(symbol=symbols, interval="1min", outputsize=1) def test_get_stocks_list(): td = _init_client() td.get_stocks_list(exchange='NASDAQ').as_json() td.get_stocks_list(exchange='NASDAQ').as_csv() td.get_stocks_list(exchange='NASDAQ').as_url() def test_get_stock_exchanges_list(): td = _init_client() td.get_stock_exchanges_list().as_json() td.get_stock_exchanges_list().as_csv() td.get_stock_exchanges_list().as_url() def test_get_forex_pairs_list(): td = _init_client() td.get_forex_pairs_list().as_json() td.get_forex_pairs_list().as_csv() td.get_forex_pairs_list().as_url() def test_get_cryptocurrencies_list(): td = _init_client() td.get_cryptocurrencies_list().as_json() td.get_cryptocurrencies_list().as_csv() td.get_cryptocurrencies_list().as_url() def test_get_funds_list(): td = _init_client() params = {'outputsize': 10, 'page': 0} l = td.get_funds_list(**params).as_json() assert len(l) > 0 td.get_funds_list(**params).as_csv() td.get_funds_list(**params).as_url() def test_get_bonds_list(): td = _init_client() l = td.get_bonds_list().as_json() assert len(l) > 0 td.get_bonds_list().as_csv() td.get_bonds_list().as_url() def test_get_etf_list(): td = _init_client() td.get_etf_list().as_json() td.get_etf_list().as_csv() td.get_etf_list().as_url() def test_get_indices_list(): td = _init_client() td.get_indices_list().as_json() td.get_indices_list().as_csv() td.get_indices_list().as_url() def test_get_technical_indicators_list(): td = _init_client() td.get_technical_indicators_list().as_json() td.get_technical_indicators_list().as_url() def test_get_exchanges_list(): td = _init_client() td.get_exchanges_list().as_json() td.get_exchanges_list().as_csv() td.get_exchanges_list().as_url() def test_symbol_search(): td = _init_client() td.symbol_search().as_json() td.symbol_search().as_url() def test_earliest_timestamp(): td = _init_client() td.get_earliest_timestamp(symbol="AAPL", interval="1day").as_json() td.get_earliest_timestamp(symbol="AAPL", interval="1day").as_url() def test_market_state(): td = _init_client() td.get_market_state().as_json() td.get_market_state().as_url() def test_exchange_rate(): td = _init_client() td.exchange_rate(symbol="EUR/USD").as_json() td.exchange_rate(symbol="EUR/USD").as_url() def test_currency_conversion(): td = _init_client() td.currency_conversion(symbol="EUR/USD", amount=100).as_json() td.currency_conversion(symbol="EUR/USD", amount=100).as_url() def test_quote(): td = _init_client() td.quote(symbol="AAPL").as_json() td.quote(symbol="AAPL").as_url() def test_price(): td = _init_client() td.price(symbol="AAPL").as_json() td.price(symbol="AAPL").as_url() def test_eod(): td = _init_client() td.eod(symbol="AAPL").as_json() td.eod(symbol="AAPL").as_url() def test_api_usage(): td = _init_client() td.api_usage().as_json() td.api_usage().as_url() def test_logo(): td = _init_client() td.get_logo(symbol="AAPL").as_json() td.get_logo(symbol="AAPL").as_url() def test_profile(): td = _init_client() td.get_profile(symbol="AAPL").as_json() td.get_profile(symbol="AAPL").as_url() def test_dividends(): td = _init_client() td.get_dividends(symbol="AAPL").as_json() td.get_dividends(symbol="AAPL").as_url() def test_dividends_calendar(): td = _init_client() td.get_dividends_calendar(symbol="AAPL").as_json() td.get_dividends_calendar(symbol="AAPL").as_url() def test_splits(): td = _init_client() td.get_splits(symbol="AAPL").as_json() td.get_splits(symbol="AAPL").as_url() def test_splits_calendar(): td = _init_client() td.get_splits_calendar(symbol="AAPL").as_json() td.get_splits_calendar(symbol="AAPL").as_url() def test_earnings(): td = _init_client() td.get_earnings(symbol="AAPL").as_json() td.get_earnings(symbol="AAPL").as_url() def test_statistics(): td = _init_client() td.get_statistics(symbol="AAPL").as_json() td.get_statistics(symbol="AAPL").as_url() def test_insider_transactions(): td = _init_client() td.get_insider_transactions(symbol="AAPL").as_json() td.get_insider_transactions(symbol="AAPL").as_url() def test_income_statement(): td = _init_client() td.get_income_statement(symbol="AAPL").as_json() td.get_income_statement(symbol="AAPL").as_url() def test_balance_sheet(): td = _init_client() td.get_balance_sheet(symbol="AAPL").as_json() td.get_balance_sheet(symbol="AAPL").as_url() def test_cash_flow(): td = _init_client() td.get_cash_flow(symbol="AAPL").as_json() td.get_cash_flow(symbol="AAPL").as_url() def test_options_expiration(): td = _init_client() td.get_options_expiration(symbol="AAPL").as_json() td.get_options_expiration(symbol="AAPL").as_url() def test_options_chain(): td = _init_client() expiration_date = td.get_options_expiration(symbol="AAPL").as_json()['dates'][0] td.get_options_chain(symbol="AAPL", expiration_date=expiration_date).as_json() td.get_options_chain(symbol="AAPL", expiration_date=expiration_date).as_url() def test_key_executives(): td = _init_client() td.get_key_executives(symbol="AAPL").as_json() td.get_key_executives(symbol="AAPL").as_url() def test_institutional_holders(): td = _init_client() td.get_institutional_holders(symbol="AAPL").as_json() td.get_institutional_holders(symbol="AAPL").as_url() def test_fund_holders(): td = _init_client() td.get_fund_holders(symbol="AAPL").as_json() td.get_fund_holders(symbol="AAPL").as_url() def test_time_series(): ts = _init_ts() ts.as_json() ts.as_csv() df = ts.as_pandas() ts.as_plotly_figure() ts.as_plotly_figure(df=df) ts.as_url() plt.close() def test_time_series_get_ad(): ts = _init_ts() ts.with_ad().as_json() ts.with_ad().as_csv() df = ts.with_ad().as_pandas() ts.with_ad().as_plotly_figure() ts.with_ad().as_plotly_figure(df=df) ts.with_ad().as_url() plt.close() def test_time_series_get_adosc(): ts = _init_ts() ts.with_adosc().as_json() ts.with_adosc().as_csv() ts.with_adosc().as_pandas() ts.with_adosc().as_plotly_figure() ts.with_adosc().as_url() plt.close() def test_time_series_get_adx(): ts = _init_ts() ts.with_adx().as_json() ts.with_adx().as_csv() ts.with_adx().as_pandas() ts.with_adx().as_plotly_figure() ts.with_adx().as_url() plt.close() def test_time_series_get_adxr(): ts = _init_ts() ts.with_adxr().as_json() ts.with_adxr().as_csv() ts.with_adxr().as_pandas() ts.with_adxr().as_plotly_figure() ts.with_adxr().as_url() plt.close() def test_time_series_get_apo(): ts = _init_ts() ts.with_apo().as_json() ts.with_apo().as_csv() ts.with_apo().as_pandas() ts.with_apo().as_plotly_figure() ts.with_apo().as_url() plt.close() def test_time_series_get_aroon(): ts = _init_ts() ts.with_aroon().as_json() ts.with_aroon().as_csv() ts.with_aroon().as_pandas() ts.with_aroon().as_plotly_figure() ts.with_aroon().as_url() plt.close() def test_time_series_get_aroonosc(): ts = _init_ts() ts.with_aroonosc().as_json() ts.with_aroonosc().as_csv() ts.with_aroonosc().as_pandas() ts.with_aroonosc().as_plotly_figure() ts.with_aroonosc().as_url() plt.close() def test_time_series_get_atr(): ts = _init_ts() ts.with_atr().as_json() ts.with_atr().as_csv() ts.with_atr().as_pandas() ts.with_atr().as_plotly_figure() ts.with_atr().as_url() plt.close() def test_time_series_get_avgprice(): ts = _init_ts() ts.with_avgprice().as_json() ts.with_avgprice().as_csv() ts.with_avgprice().as_pandas() ts.with_avgprice().as_plotly_figure() ts.with_avgprice().as_url() plt.close() def test_time_series_get_bbands(): ts = _init_ts() ts.with_bbands().as_json() ts.with_bbands().as_csv() ts.with_bbands().as_pandas() ts.with_bbands().as_plotly_figure() ts.with_bbands().as_url() plt.close() def test_time_series_get_beta(): ts = _init_ts() ts.with_beta().as_json() ts.with_beta().as_pandas() ts.with_beta().as_plotly_figure() ts.with_beta().as_url() plt.close() def test_time_series_get_percent_b(): ts = _init_ts() ts.with_percent_b().as_json() ts.with_percent_b().as_csv() ts.with_percent_b().as_pandas() ts.with_percent_b().as_plotly_figure() ts.with_percent_b().as_url() plt.close() def test_time_series_get_bop(): ts = _init_ts() ts.with_bop().as_json() ts.with_bop().as_csv() ts.with_bop().as_pandas() ts.with_bop().as_plotly_figure() ts.with_bop().as_url() plt.close() def test_time_series_get_cci(): ts = _init_ts() ts.with_cci().as_json() ts.with_cci().as_csv() ts.with_cci().as_pandas() ts.with_cci().as_plotly_figure() ts.with_cci().as_url() plt.close() def test_time_series_get_ceil(): ts = _init_ts() ts.with_ceil().as_json() ts.with_ceil().as_csv() ts.with_ceil().as_pandas() ts.with_ceil().as_plotly_figure() ts.with_ceil().as_url() plt.close() def test_time_series_get_cmo(): ts = _init_ts() ts.with_cmo().as_json() ts.with_cmo().as_csv() ts.with_cmo().as_pandas() ts.with_cmo().as_plotly_figure() ts.with_cmo().as_url() plt.close() def test_time_series_get_coppock(): ts = _init_ts() ts.with_coppock().as_json() ts.with_coppock().as_csv() ts.with_coppock().as_pandas() ts.with_coppock().as_plotly_figure() ts.with_coppock().as_url() plt.close() def test_time_series_get_dema(): ts = _init_ts() ts.with_dema().as_json() ts.with_dema().as_csv() ts.with_dema().as_pandas() ts.with_dema().as_plotly_figure() ts.with_dema().as_url() plt.close() def test_time_series_get_dx(): ts = _init_ts() ts.with_dx().as_json() ts.with_dx().as_csv() ts.with_dx().as_pandas() ts.with_dx().as_plotly_figure() ts.with_dx().as_url() plt.close() def test_time_series_get_ema(): ts = _init_ts() ts.with_ema().as_json() ts.with_ema().as_csv() ts.with_ema().as_pandas() ts.with_ema().as_plotly_figure() ts.with_ema().as_url() plt.close() def test_time_series_get_exp(): ts = _init_ts() ts.with_exp().as_json() ts.with_exp().as_csv() ts.with_exp().as_pandas() ts.with_exp().as_plotly_figure() ts.with_exp().as_url() plt.close() def test_time_series_get_floor(): ts = _init_ts() ts.with_floor().as_json() ts.with_floor().as_csv() ts.with_floor().as_pandas() ts.with_floor().as_plotly_figure() ts.with_floor().as_url() plt.close() def test_time_series_get_heikinashicandles(): ts = _init_ts() ts.with_heikinashicandles().as_json() ts.with_heikinashicandles().as_csv() ts.with_heikinashicandles().as_pandas() ts.with_heikinashicandles().as_plotly_figure() ts.with_heikinashicandles().as_url() plt.close() def test_time_series_get_hlc3(): ts = _init_ts() ts.with_hlc3().as_json() ts.with_hlc3().as_csv() ts.with_hlc3().as_pandas() ts.with_hlc3().as_plotly_figure() ts.with_hlc3().as_url() plt.close() def test_time_series_get_ht_dcperiod(): ts = _init_ts() ts.with_ht_dcperiod().as_json() ts.with_ht_dcperiod().as_csv() ts.with_ht_dcperiod().as_pandas() ts.with_ht_dcperiod().as_plotly_figure() ts.with_ht_dcperiod().as_url() plt.close() def test_time_series_get_ht_dcphase(): ts = _init_ts() ts.with_ht_dcphase().as_json() ts.with_ht_dcphase().as_csv() ts.with_ht_dcphase().as_pandas() ts.with_ht_dcphase().as_plotly_figure() ts.with_ht_dcphase().as_url() plt.close() def test_time_series_get_ht_phasor(): ts = _init_ts() ts.with_ht_phasor().as_json() ts.with_ht_phasor().as_csv() ts.with_ht_phasor().as_pandas() ts.with_ht_phasor().as_plotly_figure() ts.with_ht_phasor().as_url() plt.close() def test_time_series_get_ht_sine(): ts = _init_ts() ts.with_ht_sine().as_json() ts.with_ht_sine().as_csv() ts.with_ht_sine().as_pandas() ts.with_ht_sine().as_plotly_figure() ts.with_ht_sine().as_url() plt.close() def test_time_series_get_ht_trendline(): ts = _init_ts() ts.with_ht_trendline().as_json() ts.with_ht_trendline().as_csv() ts.with_ht_trendline().as_pandas() ts.with_ht_trendline().as_plotly_figure() ts.with_ht_trendline().as_url() plt.close() def test_time_series_get_ht_trendmode(): ts = _init_ts() ts.with_ht_trendmode().as_json() ts.with_ht_trendmode().as_csv() ts.with_ht_trendmode().as_pandas() ts.with_ht_trendmode().as_plotly_figure() ts.with_ht_trendmode().as_url() plt.close() def test_time_series_get_ichimoku(): ts = _init_ts() ts.with_ichimoku().as_json() ts.with_ichimoku().as_csv() ts.with_ichimoku().as_pandas() ts.with_ichimoku().as_plotly_figure() ts.with_ichimoku().as_url() plt.close() def test_time_series_get_kama(): ts = _init_ts() ts.with_kama().as_json() ts.with_kama().as_csv() ts.with_kama().as_pandas() ts.with_kama().as_plotly_figure() ts.with_kama().as_url() plt.close() def test_time_series_get_keltner(): ts = _init_ts() ts.with_keltner().as_json() ts.with_keltner().as_csv() ts.with_keltner().as_pandas() ts.with_keltner().as_plotly_figure() ts.with_keltner().as_url() plt.close() def test_time_series_get_kst(): ts = _init_ts() ts.with_kst().as_json() ts.with_kst().as_csv() ts.with_kst().as_pandas() ts.with_kst().as_plotly_figure() ts.with_kst().as_url() plt.close() def test_time_series_get_linearreg(): ts = _init_ts() ts.with_linearreg().as_json() ts.with_linearreg().as_csv() ts.with_linearreg().as_pandas() ts.with_linearreg().as_plotly_figure() ts.with_linearreg().as_url() plt.close() def test_time_series_get_linearregangle(): ts = _init_ts() ts.with_linearregangle().as_json() ts.with_linearregangle().as_csv() ts.with_linearregangle().as_pandas() ts.with_linearregangle().as_plotly_figure() ts.with_linearregangle().as_url() plt.close() def test_time_series_get_linearregintercept(): ts = _init_ts() ts.with_linearregintercept().as_json() ts.with_linearregintercept().as_csv() ts.with_linearregintercept().as_pandas() ts.with_linearregintercept().as_plotly_figure() ts.with_linearregintercept().as_url() plt.close() def test_time_series_get_linearregslope(): ts = _init_ts() ts.with_linearregslope().as_json() ts.with_linearregslope().as_csv() ts.with_linearregslope().as_pandas() ts.with_linearregslope().as_plotly_figure() ts.with_linearregslope().as_url() plt.close() def test_time_series_get_ln(): ts = _init_ts() ts.with_ln().as_json() ts.with_ln().as_csv() ts.with_ln().as_pandas() ts.with_ln().as_plotly_figure() ts.with_ln().as_url() plt.close() def test_time_series_get_log10(): ts = _init_ts() ts.with_log10().as_json() ts.with_log10().as_csv() ts.with_log10().as_pandas() ts.with_log10().as_plotly_figure() ts.with_log10().as_url() plt.close() def test_time_series_get_ma(): ts = _init_ts() ts.with_ma().as_json() ts.with_ma().as_csv() ts.with_ma().as_pandas() ts.with_ma().as_plotly_figure() ts.with_ma().as_url() plt.close() def test_time_series_get_macd(): ts = _init_ts() ts.with_macd().as_json() ts.with_macd().as_csv() ts.with_macd().as_pandas() ts.with_macd().as_plotly_figure() ts.with_macd().as_url() plt.close() def test_time_series_get_macdext(): ts = _init_ts() ts.with_macdext().as_json() ts.with_macdext().as_csv() ts.with_macdext().as_pandas() ts.with_macdext().as_plotly_figure() ts.with_macdext().as_url() plt.close() def test_time_series_get_mama(): ts = _init_ts() ts.with_mama().as_json() ts.with_mama().as_csv() ts.with_mama().as_pandas() ts.with_mama().as_plotly_figure() ts.with_mama().as_url() plt.close() def test_time_series_get_max(): ts = _init_ts() ts.with_max().as_json() ts.with_max().as_csv() ts.with_max().as_pandas() ts.with_max().as_plotly_figure() ts.with_max().as_url() plt.close() def test_time_series_get_maxindex(): ts = _init_ts() ts.with_maxindex().as_json() ts.with_maxindex().as_csv() ts.with_maxindex().as_pandas() ts.with_maxindex().as_plotly_figure() ts.with_maxindex().as_url() plt.close() def test_time_series_get_mcginley_dynamic(): ts = _init_ts() ts.with_mcginley_dynamic().as_json() ts.with_mcginley_dynamic().as_csv() ts.with_mcginley_dynamic().as_pandas() ts.with_mcginley_dynamic().as_plotly_figure() ts.with_mcginley_dynamic().as_url() plt.close() def test_time_series_get_medprice(): ts = _init_ts() ts.with_medprice().as_json() ts.with_medprice().as_csv() ts.with_medprice().as_pandas() ts.with_medprice().as_plotly_figure() ts.with_medprice().as_url() plt.close() def test_time_series_get_mfi(): ts = _init_ts() ts.with_mfi().as_json() ts.with_mfi().as_csv() ts.with_mfi().as_pandas() ts.with_mfi().as_plotly_figure() ts.with_mfi().as_url() plt.close() def test_time_series_get_midpoint(): ts = _init_ts() ts.with_midpoint().as_json() ts.with_midpoint().as_csv() ts.with_midpoint().as_pandas() ts.with_midpoint().as_plotly_figure() ts.with_midpoint().as_url() plt.close() def test_time_series_get_midprice(): ts = _init_ts() ts.with_midprice().as_json() ts.with_midprice().as_csv() ts.with_midprice().as_pandas() ts.with_midprice().as_plotly_figure() ts.with_midprice().as_url() plt.close() def test_time_series_get_min(): ts = _init_ts() ts.with_min().as_json() ts.with_min().as_csv() ts.with_min().as_pandas() ts.with_min().as_plotly_figure() ts.with_min().as_url() plt.close() def test_time_series_get_minindex(): ts = _init_ts() ts.with_minindex().as_json() ts.with_minindex().as_csv() ts.with_minindex().as_pandas() ts.with_minindex().as_plotly_figure() ts.with_minindex().as_url() plt.close() def test_time_series_get_minmax(): ts = _init_ts() ts.with_minmax().as_json() ts.with_minmax().as_csv() ts.with_minmax().as_pandas() ts.with_minmax().as_plotly_figure() ts.with_minmax().as_url() plt.close() def test_time_series_get_minmaxindex(): ts = _init_ts() ts.with_minmaxindex().as_json() ts.with_minmaxindex().as_csv() ts.with_minmaxindex().as_pandas() ts.with_minmaxindex().as_plotly_figure() ts.with_minmaxindex().as_url() plt.close() def test_time_series_get_minus_di(): ts = _init_ts() ts.with_minus_di().as_json() ts.with_minus_di().as_csv() ts.with_minus_di().as_pandas() ts.with_minus_di().as_plotly_figure() ts.with_minus_di().as_url() plt.close() def test_time_series_get_minus_dm(): ts = _init_ts() ts.with_minus_dm().as_json() ts.with_minus_dm().as_csv() ts.with_minus_dm().as_pandas() ts.with_minus_dm().as_plotly_figure() ts.with_minus_dm().as_url() plt.close() def test_time_series_get_mom(): ts = _init_ts() ts.with_mom().as_json() ts.with_mom().as_csv() ts.with_mom().as_pandas() ts.with_mom().as_plotly_figure() ts.with_mom().as_url() plt.close() def test_time_series_get_natr(): ts = _init_ts() ts.with_natr().as_json() ts.with_natr().as_csv() ts.with_natr().as_pandas() ts.with_natr().as_plotly_figure() ts.with_natr().as_url() plt.close() def test_time_series_get_obv(): ts = _init_ts() ts.with_obv().as_json() ts.with_obv().as_csv() ts.with_obv().as_pandas() ts.with_obv().as_plotly_figure() ts.with_obv().as_url() plt.close() def test_time_series_get_plus_di(): ts = _init_ts() ts.with_plus_di().as_json() ts.with_plus_di().as_csv() ts.with_plus_di().as_pandas() ts.with_plus_di().as_plotly_figure() ts.with_plus_di().as_url() plt.close() def test_time_series_get_plus_dm(): ts = _init_ts() ts.with_plus_dm().as_json() ts.with_plus_dm().as_csv() ts.with_plus_dm().as_pandas() ts.with_plus_dm().as_plotly_figure() ts.with_plus_dm().as_url() plt.close() def test_time_series_get_ppo(): ts = _init_ts() ts.with_ppo().as_json() ts.with_ppo().as_csv() ts.with_ppo().as_pandas() ts.with_ppo().as_plotly_figure() ts.with_ppo().as_url() plt.close() def test_time_series_get_roc(): ts = _init_ts() ts.with_roc().as_json() ts.with_roc().as_csv() ts.with_roc().as_pandas() ts.with_roc().as_plotly_figure() ts.with_roc().as_url() plt.close() def test_time_series_get_rocp(): ts = _init_ts() ts.with_rocp().as_json() ts.with_rocp().as_csv() ts.with_rocp().as_pandas() ts.with_rocp().as_plotly_figure() ts.with_rocp().as_url() plt.close() def test_time_series_get_rocr(): ts = _init_ts() ts.with_rocr().as_json() ts.with_rocr().as_csv() ts.with_rocr().as_pandas() ts.with_rocr().as_plotly_figure() ts.with_rocr().as_url() plt.close() def test_time_series_get_rocr100(): ts = _init_ts() ts.with_rocr100().as_json() ts.with_rocr100().as_csv() ts.with_rocr100().as_pandas() ts.with_rocr100().as_plotly_figure() ts.with_rocr100().as_url() plt.close() def test_time_series_get_rsi(): ts = _init_ts() ts.with_rsi().as_json() ts.with_rsi().as_csv() ts.with_rsi().as_pandas() ts.with_rsi().as_plotly_figure() ts.with_rsi().as_url() plt.close() def test_time_series_get_sar(): ts = _init_ts() ts.with_sar().as_json() ts.with_sar().as_csv() ts.with_sar().as_pandas() ts.with_sar().as_plotly_figure() ts.with_sar().as_url() plt.close() def test_time_series_get_sma(): ts = _init_ts() ts.with_sma().as_json() ts.with_sma().as_csv() ts.with_sma().as_pandas() ts.with_sma().as_plotly_figure() ts.with_sma().as_url() plt.close() def test_time_series_get_sqrt(): ts = _init_ts() ts.with_sqrt().as_json() ts.with_sqrt().as_csv() ts.with_sqrt().as_pandas() ts.with_sqrt().as_plotly_figure() ts.with_sqrt().as_url() plt.close() def test_time_series_get_stddev(): ts = _init_ts() ts.with_stddev().as_json() ts.with_stddev().as_csv() ts.with_stddev().as_pandas() ts.with_stddev().as_plotly_figure() ts.with_stddev().as_url() plt.close() def test_time_series_get_stoch(): ts = _init_ts() ts.with_stoch().as_json() ts.with_stoch().as_csv() ts.with_stoch().as_pandas() ts.with_stoch().as_plotly_figure() ts.with_stoch().as_url() plt.close() def test_time_series_get_stochf(): ts = _init_ts() ts.with_stochf().as_json() ts.with_stochf().as_csv() ts.with_stochf().as_pandas() ts.with_stochf().as_plotly_figure() ts.with_stochf().as_url() plt.close() def test_time_series_get_stochrsi(): ts = _init_ts() ts.with_stochrsi().as_json() ts.with_stochrsi().as_csv() ts.with_stochrsi().as_pandas() ts.with_stochrsi().as_plotly_figure() ts.with_stochrsi().as_url() plt.close() def test_time_series_get_supertrend(): ts = _init_ts() ts.with_supertrend().as_json() ts.with_supertrend().as_csv() ts.with_supertrend().as_pandas() ts.with_supertrend().as_plotly_figure() ts.with_supertrend().as_url() plt.close() def test_time_series_get_t3ma(): ts = _init_ts() ts.with_t3ma().as_json() ts.with_t3ma().as_csv() ts.with_t3ma().as_pandas() ts.with_t3ma().as_plotly_figure() ts.with_t3ma().as_url() plt.close() def test_time_series_get_tema(): ts = _init_ts() ts.with_tema().as_json() ts.with_tema().as_csv() ts.with_tema().as_pandas() ts.with_tema().as_plotly_figure() ts.with_tema().as_url() plt.close() def test_time_series_get_trange(): ts = _init_ts() ts.with_trange().as_json() ts.with_trange().as_csv() ts.with_trange().as_pandas() ts.with_trange().as_plotly_figure() ts.with_trange().as_url() plt.close() def test_time_series_get_trima(): ts = _init_ts() ts.with_trima().as_json() ts.with_trima().as_csv() ts.with_trima().as_pandas() ts.with_trima().as_plotly_figure() ts.with_trima().as_url() plt.close() def test_time_series_get_tsf(): ts = _init_ts() ts.with_tsf().as_json() ts.with_tsf().as_csv() ts.with_tsf().as_pandas() ts.with_tsf().as_plotly_figure() ts.with_tsf().as_url() plt.close() def test_time_series_get_typprice(): ts = _init_ts() ts.with_typprice().as_json() ts.with_typprice().as_csv() ts.with_typprice().as_pandas() ts.with_typprice().as_plotly_figure() ts.with_typprice().as_url() plt.close() def test_time_series_get_ultosc(): ts = _init_ts() ts.with_ultosc().as_json() ts.with_ultosc().as_csv() ts.with_ultosc().as_pandas() ts.with_ultosc().as_plotly_figure() ts.with_ultosc().as_url() plt.close() def test_time_series_get_var(): ts = _init_ts() ts.with_var().as_json() ts.with_var().as_csv() ts.with_var().as_pandas() ts.with_var().as_plotly_figure() ts.with_var().as_url() plt.close() def test_time_series_get_vwap(): ts = _init_ts() ts.with_vwap().as_json() ts.with_vwap().as_csv() ts.with_vwap().as_pandas() ts.with_vwap().as_plotly_figure() ts.with_vwap().as_url() plt.close() def test_time_series_get_wclprice(): ts = _init_ts() ts.with_wclprice().as_json() ts.with_wclprice().as_csv() ts.with_wclprice().as_pandas() ts.with_wclprice().as_plotly_figure() ts.with_wclprice().as_url() plt.close() def test_time_series_get_willr(): ts = _init_ts() ts.with_willr().as_json() ts.with_willr().as_csv() ts.with_willr().as_pandas() ts.with_willr().as_plotly_figure() ts.with_willr().as_url() plt.close() def test_time_series_get_wma(): ts = _init_ts() ts.with_wma().as_json() ts.with_wma().as_csv() ts.with_wma().as_pandas() ts.with_wma().as_plotly_figure() ts.with_wma().as_url() plt.close() def _init_chart(): td = _init_client() return ( td.time_series(symbol="AAPL", interval="1min") .with_ad() .with_adosc() .with_adx() .with_adxr() .with_apo() .with_aroon() .with_aroonosc() .with_atr() .with_avgprice() .with_bbands() .with_beta() .with_percent_b() .with_bop() .with_cci() .with_ceil() .with_cmo() .with_coppock() .with_ceil() .with_dema() .with_dx() .with_ema() .with_exp() .with_floor() .with_heikinashicandles() .with_hlc3() .with_ht_dcperiod() .with_ht_dcphase() .with_ht_phasor() .with_ht_sine() .with_ht_trendline() .with_ht_trendmode() .with_ichimoku() .with_kama() .with_keltner() .with_kst() .with_linearreg() .with_linearregangle() .with_linearregintercept() .with_linearregslope() .with_ln() .with_log10() .with_ma() .with_macd() .with_macdext() .with_mama() .with_max() .with_maxindex() .with_mcginley_dynamic() .with_medprice() .with_midpoint() .with_midprice() .with_min() .with_minindex() .with_minmax() .with_minmaxindex() .with_minus_di() .with_minus_dm() .with_mom() .with_natr() .with_obv() .with_plus_di() .with_plus_dm() .with_ppo() .with_roc() .with_rocp() .with_rocr() .with_rocr100() .with_rsi() .with_sar() .with_sma() .with_sqrt() .with_stddev() .with_stoch() .with_stochf() .with_stochrsi() .with_supertrend() .with_t3ma() .with_tema() .with_trange() .with_trima() .with_tsf() .with_typprice() .with_ultosc() .with_var() .with_vwap() .with_wclprice() .with_willr() .with_wma() ) def test_chart_json(): chart = _init_chart() chart.as_json() def test_chart_csv(): chart = _init_chart() chart.as_csv() def test_chart_pandas(): chart = _init_chart() chart.as_pandas() def test_chart_url(): chart = _init_chart() chart.as_url() # def test_chart_plot(): # chart = _init_chart() # chart.as_plotly_figure() # plt.close() def test_string_batch(): batch_ts = _init_batch_ts('AAPL,QQQ,IXIC,EUR/USD,BTC/USD,') batch_ts.with_macd().with_stoch().as_json() batch_ts.with_ema().with_bbands().as_pandas() batch_ts.with_ema().with_bbands().as_url() def test_list_batch(): batch_ts = _init_batch_ts(['AAPL', 'QQQ', 'IXIC', 'EUR/USD', 'BTC/USD']) batch_ts.with_macd().with_stoch().as_json() batch_ts.with_ema().with_bbands().as_pandas() batch_ts.with_ema().with_bbands().as_url() def test_tuple_batch(): batch_ts = _init_batch_ts(('AAPL', 'QQQ', 'IXIC', 'EUR/USD', 'BTC/USD')) batch_ts.with_macd().with_stoch().as_json() batch_ts.with_ema().with_bbands().as_pandas() batch_ts.with_ema().with_bbands().as_url() def test_tuple_batch_one_symbol(): batch_ts = _init_batch_ts(('AAPL',)) batch_ts.with_macd().with_stoch().as_json() batch_ts.with_ema().with_bbands().as_pandas() batch_ts.with_ema().with_bbands().as_url() @patch('twelvedata.http_client.Session.get', return_value=_fake_resp(500)) def test_http_internal_server_error_response(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(InternalServerError): http_client.get('/fake_url') mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_json_resp( json.loads('{"status": "error", "code": 500, "message": "error message"}')), ) def test_http_internal_server_error_response_in_json(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(InternalServerError) as err: http_client.get('/fake_url') assert str(err) == 'error message' mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_resp(400)) def test_http_bad_request_error_response(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(BadRequestError): http_client.get('/fake_url') mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_json_resp( json.loads('{"status": "error", "code": 400, "message": "error message"}')), ) def test_http_bad_request_error_response_in_json(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(BadRequestError) as err: http_client.get('/fake_url') assert str(err) == 'error message' mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_resp(401)) def test_http_invalid_api_key_response(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(InvalidApiKeyError): http_client.get('/fake_url') mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_json_resp( json.loads('{"status": "error", "code": 401, "message": "error message"}')), ) def test_http_invalid_api_key_response_in_json(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(InvalidApiKeyError) as err: http_client.get('/fake_url') assert str(err) == 'error message' mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_resp(520)) def test_http_other_invalid_response(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(TwelveDataError): http_client.get('/fake_url') mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'}) @patch('twelvedata.http_client.Session.get', return_value=_fake_json_resp( json.loads('{"status": "error", "code": 520, "message": "error message"}')), ) def test_http_other_invalid_response_in_json(mock_get): http_client = DefaultHttpClient(API_URL) with pytest.raises(TwelveDataError) as err: http_client.get('/fake_url') assert str(err) == 'error message' mock_get.assert_called_once_with(API_URL + '/fake_url', timeout=30, params={'source': 'python'})