Skip to main content

A private MetaTrader5 connection and management package

Project description

MT5 Connector

A Python package for connecting to and managing MetaTrader5 servers.

Installation

pip install fivitech-mt5-connector

Documentation

For detailed documentation, see DOCUMENTATION.md

Changelog

For changelog, see CHANGELOG.md

Usage

from fivitech_mt5_connector import MT5Pool

# Configure your MT5 servers
servers = [
    {
        "id": 1,
        "type": "demo",
        "name": "Demo Server",
        "username": "manager",
        "manager_password": "your_manager_password",
        "api_password": "your_api_password",
        "ips": ["127.0.0.1", "localhost"]
    }
]

# Initialize the pool
pool = MT5Pool(servers)

# Connect to all servers
connection_status = pool.connect_all()

# Or connect to specific server
pool.connect_server(1)

# Add a new server dynamically
pool.add_server({
    "id": 2,
    "type": "live",
    "name": "Live Server",
    "username": "manager",
    "manager_password": "your_manager_password",
    "api_password": "your_api_password",
    "ips": ["server1.domain.com", "server2.domain.com"]
})

# Connect to the new server
pool.connect_server(2)

# Update server configuration
pool.update_server(2, {
    "name": "Updated Live Server",
    "ips": ["new.server.com"]
})

# Disconnect specific server
pool.disconnect_server(2)

# Remove server from pool
pool.remove_server(2)

# Add custom callbacks if needed
def my_deal_callback(deal, server_info):
    print(f"New deal on {server_info.name}: {deal.Deal}")

pool.add_deal_callback('deal_add', my_deal_callback)

# Get a specific server connection
demo_server = pool.get_server(1)
live_server = pool.get_server(101)

# Disconnect all servers when done
pool.disconnect_all()

Features

  • Dynamic server management (add/remove/update servers)
  • Individual server connection control
  • Multiple server connections management
  • Account operations
  • Transaction handling
  • User management
  • Deal monitoring
  • Default and custom callbacks for deals and user events

Server Configuration

Each server in the configuration requires:

  • id: Unique integer identifier
  • type: Either 'demo' or 'live'
  • name: Server name
  • username: Manager username/login
  • manager_password: Manager password for server operations
  • api_password: API password for MT5 WebAPI access
  • ips: List of IP addresses for failover

Server Management Methods

Adding Servers

pool.add_server({
    "id": 1,
    "type": "demo",
    "name": "Demo Server",
    "username": "manager",
    "manager_password": "password",
    "api_password": "api_password",
    "ips": ["127.0.0.1"]
})

Updating Servers

pool.update_server(1, {
    "name": "Updated Name",
    "ips": ["new.ip.address"]
})

Removing Servers

pool.remove_server(1)

Connection Control

# Connect specific server
pool.connect_server(1)

# Disconnect specific server
pool.disconnect_server(1)

# Connect all servers
pool.connect_all()

# Disconnect all servers
pool.disconnect_all()

Requirements

  • Python 3.7+
  • MT5Manager>=5.0.3906
  • pandas>=1.0.0
  • numpy>=1.19.0
  • pytz>=2021.1
  • requests>=2.26.0
  • python-dateutil>=2.8.2

License

Proprietary - All rights reserved

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fivitech_mt5_connector-0.2.12.tar.gz (38.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fivitech_mt5_connector-0.2.12-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file fivitech_mt5_connector-0.2.12.tar.gz.

File metadata

  • Download URL: fivitech_mt5_connector-0.2.12.tar.gz
  • Upload date:
  • Size: 38.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for fivitech_mt5_connector-0.2.12.tar.gz
Algorithm Hash digest
SHA256 b3b008e709556d62ca3710ab9bfbb89f935728310849e90ff36ddbc1212dce4f
MD5 b7f2e92d8010fd8fa74a22db55244577
BLAKE2b-256 0b1ac8b0e20a16760d2bf173980b2eb65c22d880247e0c49df5086c4bdfdf2e8

See more details on using hashes here.

File details

Details for the file fivitech_mt5_connector-0.2.12-py3-none-any.whl.

File metadata

File hashes

Hashes for fivitech_mt5_connector-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 89e14859c3cc01536d4c7439d0be1cbdbb5c1783170dcfbb7079b40ccec6a93a
MD5 9067600850dada9b85aad4da3eefcf0c
BLAKE2b-256 91ec679e17aa463565d26cfb08b8284c65f8cda4421e03dfeba1a849271e9ac8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page