mas


Namemas JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryMAS is a Python library for automated trading and backtesting on MetaTrader 5 with KPI reports and dynamic visualization.
upload_time2025-09-07 03:22:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
license# LICENSE-API ## 📜 API Terms of Use ### 1. Introduction These API Terms of Use (hereinafter referred to as "Terms") are established by Mas Intelligent Technology Ltd. (hereinafter referred to as "the Company") and apply to all individuals, corporations, or entities (hereinafter referred to as "Users") who use the API services provided by the Company. By accessing or using the API, Users acknowledge that they have read, understood, and agreed to these Terms. ### 2. License and Scope of Use * **License Type**: Non-exclusive, non-transferable, and revocable. * **Prohibited Activities**: * Using the API for illegal, improper, or unauthorized purposes. * Engaging in high-frequency trading (HFT) or activities that affect market fairness. * Reverse engineering, reselling, or redistributing the API. * Unauthorized access to or modification of data. * Activities causing system overload or interfering with other users. ### 3. API Key Management * Users must register and obtain an API key. * API keys must be kept confidential. If compromised, Users must notify the Company immediately. * The Company reserves the right to limit or revoke API access based on security assessments. ### 4. Billing and Fees * The API provides both free and paid plans. * Access may be suspended for overdue payments. * Invoices can be issued upon request. ### 5. Data Privacy and Protection * Users must comply with GDPR, CCPA, and other applicable data protection regulations. * API activity logs may be stored for compliance and security purposes. * Users may request data deletion by contacting support. ### 6. Risk and Disclaimer * The API is provided **"as is"** without any warranties, express or implied. * Market data provided via the API is for reference only and does not constitute investment advice. * Executable files (EXE) generated through the API are based on user strategies; the Company does not guarantee correct execution or bear responsibility for financial losses. * Users are responsible for thorough backtesting and simulation before using strategies in live trading and assume all associated risks. ### 7. Termination and Suspension * The Company may immediately terminate API access if these Terms are violated. * Users may terminate usage at any time; payments made are non-refundable. * The Company may suspend the API for maintenance or security concerns without prior notice. ### 8. Governing Law and Jurisdiction * These Terms are governed by the laws of the Republic of China (Taiwan). * In the event of disputes, the Taipei District Court of Taiwan shall be the court of first instance. ### 9. Amendments * The Company reserves the right to modify these Terms at any time. * Significant changes will be announced via the official website or email. * Continued use of the API constitutes acceptance of the revised Terms. --- © 2025 Mas Intelligent Technology Ltd.
keywords algorithmic trading automated trading backtesting forex kpi reports mt5 metatrader5 quantitative trading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MAS Trading Library

[![PyPI version](https://img.shields.io/pypi/v/mas.svg)](https://pypi.org/project/mas/)
[![License](https://img.shields.io/github/license/yourname/mas-trading-lib.svg)](LICENSE)

> **PyPI Package Name:** `mas`
<!-- > **GitHub Repository:** `mas-trading-lib` -->

`mas` is a **Python trading library** built specifically for **MetaTrader 5 (MT5)** to quickly build, backtest, and deploy fully automated trading strategies.
It supports **real-time and historical market data access, order execution, strategy backtesting, static KPI reports, and dynamic trade visualization**, and can be integrated with **WinForm GUI desktop applications**.

This library is ideal for **Forex trading, Gold (XAUUSD), Indices, Stocks, and Cryptocurrencies**, offering a complete workflow for **quantitative traders, financial engineers, and automated strategy developers**. With the built-in **AI Trading Assistant**, even non-programmers can easily generate strategies and backtest reports.

---

## 📈 Key Features

* **MetaTrader 5 Python API Integration**: Fast access to MT5 real-time and historical market data.
* **Cross-Market Support**: Works for Forex, Gold, Indices, and Cryptocurrencies.
* **Full Automated Trading Workflow**: From data → strategy → backtest → KPI report → live deployment.
* **AI Strategy Generator**: Lowers the barrier to entry for automated trading by generating strategies quickly.
* **Dynamic Trading Visualization**: Displays trade signals, equity curves, and position changes in real-time.
* **KPI & Risk Reports**: Includes Sharpe Ratio, Profit Factor, Win Rate, Maximum Drawdown, and more.
* **Desktop App Integration**: Supports WinForm GUI for user-friendly desktop applications.
* **Highly Modular**: Designed for scalable quantitative trading systems and financial data analysis.

> 📌 **SEO Keywords**: MetaTrader5 Python Library, MT5 API, Automated Trading, Quantitative Trading, Backtesting, KPI Report, Forex Trading Bot, Algorithmic Trading SDK, AI Trading Assistant, MAS Trading Library, Python Quant Framework.

---

## 📦 Installation

### 1️⃣ Register an Account (Required)

Before installing and using `mas`, you must register on the official website to activate API and backtesting features.

🔗 [Register on the Official Website(Free)](https://mas.mindaismart.com/authentication/sign-up)

### 2️⃣ Install the Python Package

```bash
pip install mas
```

### 3️⃣ Install the MAS Data Analysis & Backtest Tool

This project requires the **MAS Backtest Tool** to generate complete KPI reports and dynamic analytics.

📥 [Download MAS Backtest Tool](https://mindaismart.com/product_lib)

After installation, ensure the tool is running and log in with your registered account. `mas` will then be able to connect and generate reports properly.

---

## 🚀 Quick Start

```python
import mas

class MASStrategy(mas):
    def __init__(self, toggle):
        super().__init__()
        self.index = 0
        self.hold = False
        self.ma = 0
        self.toggle = toggle
        self.order_id = None

    def receive_bars(self, symbol, data, is_end):
        single = self.index % self.ma

        if single == 0:
            if not self.hold:
                self.order_id = self.send_order({
                    "symbol": "EURUSD",
                    "order_type": "buy",
                    "volume": 0.1,
                    "backtest_toggle": self.toggle
                })
                self.hold = True
            else:
                self.send_order({
                    "symbol": "EURUSD",
                    "order_type": "sell",
                    "order_id": self.order_id,
                    "volume": 0.1,
                    "backtest_toggle": self.toggle
                })
                self.hold = False

        self.index += 1
        if is_end:
            data = self.generate_data_report()
            data_source = data.get("data")
            print(data_source)
            self.generate_kpi_report()
            self.generate_trade_chart()

def main():
    try:
        toggle = True
        mas_c = MASStrategy(toggle)
        params = {
            "account": YOUR_ACCOUNT,
            "password": YOUR_PASSWORD,
            "server": YOUR_SERVER
        }

        mas_c.login(params)
        params = {
            "symbol": "EURUSD",
            "from": '2020-01-01',
            "to": '2024-12-31',
            "timeframe": "D1",
            "backtest_toggle": mas_c.toggle
        }
        mas_c.ma = 50
        df = mas_c.subscribe_bars(params)
    except Exception as e:
        return {
            'status': False,
            'error': str(e)
        }

if __name__ == "__main__":
    main()
```

---

## 🌐 Online Documentation

📖 [View Full Documentation](https://doc.mindaismart.com/)

![Online Documentation Preview](https://github.com/ma2750335/mas-img/blob/main/lib/lib_1.jpg?raw=true)

---

## 📊 Report Previews

### Full Data Report

![Full Data Report Example](https://github.com/ma2750335/mas-img/blob/main/lib/lib_4.jpg?raw=true)

### KPI Report

![KPI Report Example](https://github.com/ma2750335/mas-img/blob/main/lib/lib_5.jpg?raw=true)

### Trade Signal Visualization

![Trade Signal Example](https://github.com/ma2750335/mas-img/blob/main/lib/lib_8.jpg?raw=true)

> 📌 **Note**: These images are for demonstration purposes only. Actual reports will be generated based on your strategies and backtest data.

---

## 🌍 Official Website & AI Trading Assistant

🔗 [Mas Intelligent Technology Official Website](https://mindaismart.com/)
🤖 [Use AI Trading Assistant (No Coding Required)](https://mindaismart.com/product_ai)

### AI Trading Workflow Previews

#### Input Your Strategy Ideas

![Input Strategy Ideas](https://github.com/ma2750335/mas-img/blob/main/ai/ai_1.jpg?raw=true)

#### Strategy Example Assistance

![Strategy Example Assistance](https://github.com/ma2750335/mas-img/blob/main/ai/ai_2.jpg?raw=true)

#### Confirm and Refine Logic

![Confirm and Refine Logic](https://github.com/ma2750335/mas-img/blob/main/ai/ai_3.jpg?raw=true)

#### Perform Data Analysis & Generate Reports

![Data Analysis & Reports](https://github.com/ma2750335/mas-img/blob/main/ai/ai_4.jpg?raw=true)

---

## 📚 Resources

* [Official Website](https://mindaismart.com/)
* [Official Website Registration](https://mas.mindaismart.com/authentication/sign-up)
* [Documentation](https://doc.mindaismart.com/)
* [Download MAS Backtest Tool](https://mindaismart.com/product_lib)
<!-- * [GitHub](https://github.com/ma2750335/mas-trading-lib) -->
* [PyPI](https://pypi.org/project/mas/)

---

## 📄 License

[API-License](https://mindaismart.com/terms_api)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mas",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "Algorithmic trading, Automated Trading, Backtesting, Forex, KPI Reports, MT5, MetaTrader5, Quantitative Trading",
    "author": null,
    "author_email": "Sam <mas@mindaismart.com>",
    "download_url": "https://files.pythonhosted.org/packages/3a/14/6876de133450bfb0e90c2710857878254b4f84edd5cf7a5338a511d7a19a/mas-0.2.3.tar.gz",
    "platform": null,
    "description": "# MAS Trading Library\n\n[![PyPI version](https://img.shields.io/pypi/v/mas.svg)](https://pypi.org/project/mas/)\n[![License](https://img.shields.io/github/license/yourname/mas-trading-lib.svg)](LICENSE)\n\n> **PyPI Package Name:** `mas`\n<!-- > **GitHub Repository:** `mas-trading-lib` -->\n\n`mas` is a **Python trading library** built specifically for **MetaTrader 5 (MT5)** to quickly build, backtest, and deploy fully automated trading strategies.\nIt supports **real-time and historical market data access, order execution, strategy backtesting, static KPI reports, and dynamic trade visualization**, and can be integrated with **WinForm GUI desktop applications**.\n\nThis library is ideal for **Forex trading, Gold (XAUUSD), Indices, Stocks, and Cryptocurrencies**, offering a complete workflow for **quantitative traders, financial engineers, and automated strategy developers**. With the built-in **AI Trading Assistant**, even non-programmers can easily generate strategies and backtest reports.\n\n---\n\n## \ud83d\udcc8 Key Features\n\n* **MetaTrader 5 Python API Integration**: Fast access to MT5 real-time and historical market data.\n* **Cross-Market Support**: Works for Forex, Gold, Indices, and Cryptocurrencies.\n* **Full Automated Trading Workflow**: From data \u2192 strategy \u2192 backtest \u2192 KPI report \u2192 live deployment.\n* **AI Strategy Generator**: Lowers the barrier to entry for automated trading by generating strategies quickly.\n* **Dynamic Trading Visualization**: Displays trade signals, equity curves, and position changes in real-time.\n* **KPI & Risk Reports**: Includes Sharpe Ratio, Profit Factor, Win Rate, Maximum Drawdown, and more.\n* **Desktop App Integration**: Supports WinForm GUI for user-friendly desktop applications.\n* **Highly Modular**: Designed for scalable quantitative trading systems and financial data analysis.\n\n> \ud83d\udccc **SEO Keywords**: MetaTrader5 Python Library, MT5 API, Automated Trading, Quantitative Trading, Backtesting, KPI Report, Forex Trading Bot, Algorithmic Trading SDK, AI Trading Assistant, MAS Trading Library, Python Quant Framework.\n\n---\n\n## \ud83d\udce6 Installation\n\n### 1\ufe0f\u20e3 Register an Account (Required)\n\nBefore installing and using `mas`, you must register on the official website to activate API and backtesting features.\n\n\ud83d\udd17 [Register on the Official Website(Free)](https://mas.mindaismart.com/authentication/sign-up)\n\n### 2\ufe0f\u20e3 Install the Python Package\n\n```bash\npip install mas\n```\n\n### 3\ufe0f\u20e3 Install the MAS Data Analysis & Backtest Tool\n\nThis project requires the **MAS Backtest Tool** to generate complete KPI reports and dynamic analytics.\n\n\ud83d\udce5 [Download MAS Backtest Tool](https://mindaismart.com/product_lib)\n\nAfter installation, ensure the tool is running and log in with your registered account. `mas` will then be able to connect and generate reports properly.\n\n---\n\n## \ud83d\ude80 Quick Start\n\n```python\nimport mas\n\nclass MASStrategy(mas):\n    def __init__(self, toggle):\n        super().__init__()\n        self.index = 0\n        self.hold = False\n        self.ma = 0\n        self.toggle = toggle\n        self.order_id = None\n\n    def receive_bars(self, symbol, data, is_end):\n        single = self.index % self.ma\n\n        if single == 0:\n            if not self.hold:\n                self.order_id = self.send_order({\n                    \"symbol\": \"EURUSD\",\n                    \"order_type\": \"buy\",\n                    \"volume\": 0.1,\n                    \"backtest_toggle\": self.toggle\n                })\n                self.hold = True\n            else:\n                self.send_order({\n                    \"symbol\": \"EURUSD\",\n                    \"order_type\": \"sell\",\n                    \"order_id\": self.order_id,\n                    \"volume\": 0.1,\n                    \"backtest_toggle\": self.toggle\n                })\n                self.hold = False\n\n        self.index += 1\n        if is_end:\n            data = self.generate_data_report()\n            data_source = data.get(\"data\")\n            print(data_source)\n            self.generate_kpi_report()\n            self.generate_trade_chart()\n\ndef main():\n    try:\n        toggle = True\n        mas_c = MASStrategy(toggle)\n        params = {\n            \"account\": YOUR_ACCOUNT,\n            \"password\": YOUR_PASSWORD,\n            \"server\": YOUR_SERVER\n        }\n\n        mas_c.login(params)\n        params = {\n            \"symbol\": \"EURUSD\",\n            \"from\": '2020-01-01',\n            \"to\": '2024-12-31',\n            \"timeframe\": \"D1\",\n            \"backtest_toggle\": mas_c.toggle\n        }\n        mas_c.ma = 50\n        df = mas_c.subscribe_bars(params)\n    except Exception as e:\n        return {\n            'status': False,\n            'error': str(e)\n        }\n\nif __name__ == \"__main__\":\n    main()\n```\n\n---\n\n## \ud83c\udf10 Online Documentation\n\n\ud83d\udcd6 [View Full Documentation](https://doc.mindaismart.com/)\n\n![Online Documentation Preview](https://github.com/ma2750335/mas-img/blob/main/lib/lib_1.jpg?raw=true)\n\n---\n\n## \ud83d\udcca Report Previews\n\n### Full Data Report\n\n![Full Data Report Example](https://github.com/ma2750335/mas-img/blob/main/lib/lib_4.jpg?raw=true)\n\n### KPI Report\n\n![KPI Report Example](https://github.com/ma2750335/mas-img/blob/main/lib/lib_5.jpg?raw=true)\n\n### Trade Signal Visualization\n\n![Trade Signal Example](https://github.com/ma2750335/mas-img/blob/main/lib/lib_8.jpg?raw=true)\n\n> \ud83d\udccc **Note**: These images are for demonstration purposes only. Actual reports will be generated based on your strategies and backtest data.\n\n---\n\n## \ud83c\udf0d Official Website & AI Trading Assistant\n\n\ud83d\udd17 [Mas Intelligent Technology Official Website](https://mindaismart.com/)\n\ud83e\udd16 [Use AI Trading Assistant (No Coding Required)](https://mindaismart.com/product_ai)\n\n### AI Trading Workflow Previews\n\n#### Input Your Strategy Ideas\n\n![Input Strategy Ideas](https://github.com/ma2750335/mas-img/blob/main/ai/ai_1.jpg?raw=true)\n\n#### Strategy Example Assistance\n\n![Strategy Example Assistance](https://github.com/ma2750335/mas-img/blob/main/ai/ai_2.jpg?raw=true)\n\n#### Confirm and Refine Logic\n\n![Confirm and Refine Logic](https://github.com/ma2750335/mas-img/blob/main/ai/ai_3.jpg?raw=true)\n\n#### Perform Data Analysis & Generate Reports\n\n![Data Analysis & Reports](https://github.com/ma2750335/mas-img/blob/main/ai/ai_4.jpg?raw=true)\n\n---\n\n## \ud83d\udcda Resources\n\n* [Official Website](https://mindaismart.com/)\n* [Official Website Registration](https://mas.mindaismart.com/authentication/sign-up)\n* [Documentation](https://doc.mindaismart.com/)\n* [Download MAS Backtest Tool](https://mindaismart.com/product_lib)\n<!-- * [GitHub](https://github.com/ma2750335/mas-trading-lib) -->\n* [PyPI](https://pypi.org/project/mas/)\n\n---\n\n## \ud83d\udcc4 License\n\n[API-License](https://mindaismart.com/terms_api)\n",
    "bugtrack_url": null,
    "license": "# LICENSE-API\n        \n        ## \ud83d\udcdc API Terms of Use\n        \n        ### 1. Introduction\n        \n        These API Terms of Use (hereinafter referred to as \"Terms\") are established by Mas Intelligent Technology Ltd. (hereinafter referred to as \"the Company\") and apply to all individuals, corporations, or entities (hereinafter referred to as \"Users\") who use the API services provided by the Company.\n        \n        By accessing or using the API, Users acknowledge that they have read, understood, and agreed to these Terms.\n        \n        ### 2. License and Scope of Use\n        \n        * **License Type**: Non-exclusive, non-transferable, and revocable.\n        * **Prohibited Activities**:\n        \n          * Using the API for illegal, improper, or unauthorized purposes.\n          * Engaging in high-frequency trading (HFT) or activities that affect market fairness.\n          * Reverse engineering, reselling, or redistributing the API.\n          * Unauthorized access to or modification of data.\n          * Activities causing system overload or interfering with other users.\n        \n        ### 3. API Key Management\n        \n        * Users must register and obtain an API key.\n        * API keys must be kept confidential. If compromised, Users must notify the Company immediately.\n        * The Company reserves the right to limit or revoke API access based on security assessments.\n        \n        ### 4. Billing and Fees\n        \n        * The API provides both free and paid plans.\n        * Access may be suspended for overdue payments.\n        * Invoices can be issued upon request.\n        \n        ### 5. Data Privacy and Protection\n        \n        * Users must comply with GDPR, CCPA, and other applicable data protection regulations.\n        * API activity logs may be stored for compliance and security purposes.\n        * Users may request data deletion by contacting support.\n        \n        ### 6. Risk and Disclaimer\n        \n        * The API is provided **\"as is\"** without any warranties, express or implied.\n        * Market data provided via the API is for reference only and does not constitute investment advice.\n        * Executable files (EXE) generated through the API are based on user strategies; the Company does not guarantee correct execution or bear responsibility for financial losses.\n        * Users are responsible for thorough backtesting and simulation before using strategies in live trading and assume all associated risks.\n        \n        ### 7. Termination and Suspension\n        \n        * The Company may immediately terminate API access if these Terms are violated.\n        * Users may terminate usage at any time; payments made are non-refundable.\n        * The Company may suspend the API for maintenance or security concerns without prior notice.\n        \n        ### 8. Governing Law and Jurisdiction\n        \n        * These Terms are governed by the laws of the Republic of China (Taiwan).\n        * In the event of disputes, the Taipei District Court of Taiwan shall be the court of first instance.\n        \n        ### 9. Amendments\n        \n        * The Company reserves the right to modify these Terms at any time.\n        * Significant changes will be announced via the official website or email.\n        * Continued use of the API constitutes acceptance of the revised Terms.\n        \n        ---\n        \n        \u00a9 2025 Mas Intelligent Technology Ltd.",
    "summary": "MAS is a Python library for automated trading and backtesting on MetaTrader 5 with KPI reports and dynamic visualization.",
    "version": "0.2.3",
    "project_urls": {
        "AI Trading Assistant": "https://mindaismart.com/product_ai",
        "Documentation": "https://doc.mindaismart.com/",
        "Homepage": "https://mindaismart.com/",
        "Register": "https://mas.mindaismart.com/"
    },
    "split_keywords": [
        "algorithmic trading",
        " automated trading",
        " backtesting",
        " forex",
        " kpi reports",
        " mt5",
        " metatrader5",
        " quantitative trading"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b888e7f8579803cc844dc3417bf01a6820fac695086ee8256bd7edb2ae330dd9",
                "md5": "00ed874c97147e7b088e5cf65a769b4a",
                "sha256": "eae52becef763bc13246476fcb9f7e5844229cefa6d73dc5b637da7e6f905894"
            },
            "downloads": -1,
            "filename": "mas-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "00ed874c97147e7b088e5cf65a769b4a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1847753,
            "upload_time": "2025-09-07T03:22:09",
            "upload_time_iso_8601": "2025-09-07T03:22:09.430969Z",
            "url": "https://files.pythonhosted.org/packages/b8/88/e7f8579803cc844dc3417bf01a6820fac695086ee8256bd7edb2ae330dd9/mas-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3a146876de133450bfb0e90c2710857878254b4f84edd5cf7a5338a511d7a19a",
                "md5": "d566e8e3d8d56d557c1aac6a9ef4b959",
                "sha256": "727920052538201e2c28fe0fe9d26b6eb5db3eabe4a07c222c3d83cec85e8a75"
            },
            "downloads": -1,
            "filename": "mas-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "d566e8e3d8d56d557c1aac6a9ef4b959",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1833953,
            "upload_time": "2025-09-07T03:22:11",
            "upload_time_iso_8601": "2025-09-07T03:22:11.726923Z",
            "url": "https://files.pythonhosted.org/packages/3a/14/6876de133450bfb0e90c2710857878254b4f84edd5cf7a5338a511d7a19a/mas-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-07 03:22:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mas"
}
        
Elapsed time: 0.91997s