tradeo


Nametradeo JSON
Version 0.23.0 PyPI version JSON
download
home_pageNone
SummaryThis library contains a series of tools to create a trading bot for Forex trading using Metatrader.
upload_time2025-02-12 16:38:41
maintainerNone
docs_urlNone
authorCayetano Romero Vargas
requires_python>=3.10.0
licenseMIT
keywords trading forex metatrader bot investment finance trading-bot trading-strategy
VCS
bugtrack_url
requirements certifi charset-normalizer idna numpy pandas psutil python-dateutil pytz requests six tzdata urllib3
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TRADEO - A forex trading framework using MetaTrader
![Logo](docs/images/logo.PNG "Title")

This library contains a series of tools to create a trading bot for Forex trading. It uses the [DWX Connect](https://github.com/darwinex/dwxconnect/) (modified) to send commands and receive information of MetaTrader.
This library is created **based on a linux installation of MetaTrader**.

![Test](https://github.com/sorul/tradeo/actions/workflows/testing_coverage.yml/badge.svg?branch=master)
![codecov.io](https://codecov.io/github/sorul/tradeo/coverage.svg?branch=master)

## Installation

### Install the library

#### PIP
```shell
pip install tradeo
```

#### POETRY
```shell
poetry add tradeo
```

Or you can add manually in *pyproject.toml* file if you want download it from a specific branch:

```shell
tradeo = { git = "git@github.com:sorul/tradeo.git", branch = "develop" }
```

## Usage

- You can create strategies inheriting *tradeo.strategies.strategy.Strategy* class. An example of this it would be [basic_strategy.py](tradeo/strategies/basic_strategy.py)

- You can customize the handler of metatrader responses inheriting *tradeo.event_handlers.event_handler.EventHandler* class. An example of this it would be [basic_handler.py](tradeo/event_handlers/basic_event_handler.py)

- An example of a main script using this library would be [basic_forex.py](tradeo/tradeo/executable/basic_forex.py) that inheriting *tradeo.executable.executable.Executable*.

> [!NOTE]  
> **The configuration of Metatrader is necessary for the functioning of Tradeo.** There is an example of both the configuration and the use of the library in a real project: [sorul_tradingbot](https://github.com/sorul/sorul_tradingbot)



## Execution of your project if you import this library

It's necessary to export certain environment variables before running the bot.

```bash
# Timezone configuration
export TB_LOCAL_TIMEZONE=Europe/Madrid
export TB_BROKER_TIMEZONE=Etc/GMT-2

# Trading configuration
export TB_SYMBOLS=EURUSD,USDCAD,USDCHF
export TB_ACCOUNT_CURRENCY=EUR
export TB_TIMEFRAME=M5
export TB_LOOKBACK_DAYS=10

# Forex-Client configuration
export TB_CHECK_MESSAGES_THREAD=true
export TB_CHECK_MARKET_DATA_THREAD=false
export TB_CHECK_BAR_DATA_THREAD=false
export TB_CHECK_OPEN_ORDERS_THREAD=true
export TB_CHECK_HISTORICAL_DATA_THREAD=true
export TB_CHECK_HISTORICAL_TRADES_THREAD=false

# Metatrader configuration
export TB_WINE_HOME="${HOME}/.wine"
export TB_MT_FILES_PATH="${TB_WINE_HOME}/drive_c/.../MQL5/Files"

# Logging configuration
export TB_ACTIVATE_SYSLOG=false
export TB_LOG_LEVEL=INFO
export TB_SYSLOG_ADDRESS=logs2.papertrailapp.com
export TB_SYSLOG_PORT=12345

# Telegram configuration
export TB_ACTIVATE_TELEGRAM=false
export TB_TG_LOG_LEVEL=INFO
export TB_TG_FOREX_TOKEN=0000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
export TB_TG_FOREX_CHAT_ID=-999999999
```

The different possibilities for exporting environment variables depend on
the user's preference. For example, we can place all the variables in a
".env" file and then execute the command using a Makefile and poetry:

*Makefile*
```makefile
run_forex:
	source .env && ~/.local/bin/poetry run run_forex
```

Edit the crontab (crontab -e):

```console
@reboot cd <path_to_your_project> && make start_metatrader

*/5 * * * 0-5  cd <path_to_your_project> && make run_forex
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tradeo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10.0",
    "maintainer_email": null,
    "keywords": "trading, forex, metatrader, bot, investment, finance, trading-bot, trading-strategy",
    "author": "Cayetano Romero Vargas",
    "author_email": "cromerovargas2d@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/36/20/391d0493b21151fc3f084495058a1872fba391e1299cbd16f97985a58c46/tradeo-0.23.0.tar.gz",
    "platform": null,
    "description": "# TRADEO - A forex trading framework using MetaTrader\n![Logo](docs/images/logo.PNG \"Title\")\n\nThis library contains a series of tools to create a trading bot for Forex trading. It uses the [DWX Connect](https://github.com/darwinex/dwxconnect/) (modified) to send commands and receive information of MetaTrader.\nThis library is created **based on a linux installation of MetaTrader**.\n\n![Test](https://github.com/sorul/tradeo/actions/workflows/testing_coverage.yml/badge.svg?branch=master)\n![codecov.io](https://codecov.io/github/sorul/tradeo/coverage.svg?branch=master)\n\n## Installation\n\n### Install the library\n\n#### PIP\n```shell\npip install tradeo\n```\n\n#### POETRY\n```shell\npoetry add tradeo\n```\n\nOr you can add manually in *pyproject.toml* file if you want download it from a specific branch:\n\n```shell\ntradeo = { git = \"git@github.com:sorul/tradeo.git\", branch = \"develop\" }\n```\n\n## Usage\n\n- You can create strategies inheriting *tradeo.strategies.strategy.Strategy* class. An example of this it would be [basic_strategy.py](tradeo/strategies/basic_strategy.py)\n\n- You can customize the handler of metatrader responses inheriting *tradeo.event_handlers.event_handler.EventHandler* class. An example of this it would be [basic_handler.py](tradeo/event_handlers/basic_event_handler.py)\n\n- An example of a main script using this library would be [basic_forex.py](tradeo/tradeo/executable/basic_forex.py) that inheriting *tradeo.executable.executable.Executable*.\n\n> [!NOTE]  \n> **The configuration of Metatrader is necessary for the functioning of Tradeo.** There is an example of both the configuration and the use of the library in a real project: [sorul_tradingbot](https://github.com/sorul/sorul_tradingbot)\n\n\n\n## Execution of your project if you import this library\n\nIt's necessary to export certain environment variables before running the bot.\n\n```bash\n# Timezone configuration\nexport TB_LOCAL_TIMEZONE=Europe/Madrid\nexport TB_BROKER_TIMEZONE=Etc/GMT-2\n\n# Trading configuration\nexport TB_SYMBOLS=EURUSD,USDCAD,USDCHF\nexport TB_ACCOUNT_CURRENCY=EUR\nexport TB_TIMEFRAME=M5\nexport TB_LOOKBACK_DAYS=10\n\n# Forex-Client configuration\nexport TB_CHECK_MESSAGES_THREAD=true\nexport TB_CHECK_MARKET_DATA_THREAD=false\nexport TB_CHECK_BAR_DATA_THREAD=false\nexport TB_CHECK_OPEN_ORDERS_THREAD=true\nexport TB_CHECK_HISTORICAL_DATA_THREAD=true\nexport TB_CHECK_HISTORICAL_TRADES_THREAD=false\n\n# Metatrader configuration\nexport TB_WINE_HOME=\"${HOME}/.wine\"\nexport TB_MT_FILES_PATH=\"${TB_WINE_HOME}/drive_c/.../MQL5/Files\"\n\n# Logging configuration\nexport TB_ACTIVATE_SYSLOG=false\nexport TB_LOG_LEVEL=INFO\nexport TB_SYSLOG_ADDRESS=logs2.papertrailapp.com\nexport TB_SYSLOG_PORT=12345\n\n# Telegram configuration\nexport TB_ACTIVATE_TELEGRAM=false\nexport TB_TG_LOG_LEVEL=INFO\nexport TB_TG_FOREX_TOKEN=0000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nexport TB_TG_FOREX_CHAT_ID=-999999999\n```\n\nThe different possibilities for exporting environment variables depend on\nthe user's preference. For example, we can place all the variables in a\n\".env\" file and then execute the command using a Makefile and poetry:\n\n*Makefile*\n```makefile\nrun_forex:\n\tsource .env && ~/.local/bin/poetry run run_forex\n```\n\nEdit the crontab (crontab -e):\n\n```console\n@reboot cd <path_to_your_project> && make start_metatrader\n\n*/5 * * * 0-5  cd <path_to_your_project> && make run_forex\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This library contains a series of tools to create a trading bot for Forex trading using Metatrader.",
    "version": "0.23.0",
    "project_urls": {
        "Changelog": "https://github.com/sorul/tradeo/blob/master/CHANGELOG.md",
        "Repository": "https://github.com/sorul/tradeo"
    },
    "split_keywords": [
        "trading",
        " forex",
        " metatrader",
        " bot",
        " investment",
        " finance",
        " trading-bot",
        " trading-strategy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a1afac94e5cdcf80b2a1bc1612b88c6ba680a47a271b54023b2ad84908f54b61",
                "md5": "864d85925597b88efd6c3b7edaccdd2f",
                "sha256": "ba90a98a5359d02d598d7b37324d43828475734c665d91805789aa3bcccd3ae4"
            },
            "downloads": -1,
            "filename": "tradeo-0.23.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "864d85925597b88efd6c3b7edaccdd2f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10.0",
            "size": 43458,
            "upload_time": "2025-02-12T16:38:40",
            "upload_time_iso_8601": "2025-02-12T16:38:40.141944Z",
            "url": "https://files.pythonhosted.org/packages/a1/af/ac94e5cdcf80b2a1bc1612b88c6ba680a47a271b54023b2ad84908f54b61/tradeo-0.23.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3620391d0493b21151fc3f084495058a1872fba391e1299cbd16f97985a58c46",
                "md5": "1ab4f7d7c7872833eaa0b6edfbfdee4b",
                "sha256": "54ae32ab683f6e4e5fd6d19e8ad0f02c84c4fc97b6a60039d3276049d9f0d776"
            },
            "downloads": -1,
            "filename": "tradeo-0.23.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ab4f7d7c7872833eaa0b6edfbfdee4b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10.0",
            "size": 36531,
            "upload_time": "2025-02-12T16:38:41",
            "upload_time_iso_8601": "2025-02-12T16:38:41.711666Z",
            "url": "https://files.pythonhosted.org/packages/36/20/391d0493b21151fc3f084495058a1872fba391e1299cbd16f97985a58c46/tradeo-0.23.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-12 16:38:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sorul",
    "github_project": "tradeo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2025.1.31"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.4.1"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "psutil",
            "specs": [
                [
                    "==",
                    "6.1.1"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    "==",
                    "2024.2"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.17.0"
                ]
            ]
        },
        {
            "name": "tzdata",
            "specs": [
                [
                    "==",
                    "2025.1"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.3.0"
                ]
            ]
        }
    ],
    "lcname": "tradeo"
}
        
Elapsed time: 1.29312s