Skip to main content

Client SDK of MetaTrader Sockets API

Project description

MetaTrader Sockets API Client

Client SDK of MetaTrader Sockets API

Run

import asyncio
from metatrader import (
    TerminalClient,
)


async def main():
    client = await TerminalClient.create(verbose=False)

    async def fetch_account_info():
        account_info = await client.get_account()
        if account_info:
            print(f"Account Info: {account_info}")
        else:
            print("Failed to fetch account info.")

    async def fetch_exchange_info():
        exchange_info = await client.get_exchange_info()
        if exchange_info:
            print(f"Exchange Info: {exchange_info}")
        else:
            print("Failed to fetch exchange info.")

    await fetch_account_info()
    # OR
    tasks = [fetch_account_info, fetch_exchange_info]
    await client._run(tasks)


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    try:
        loop.run_until_complete(main())
    finally:
        loop.close()

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

metatrader_sockets_client-0.0.2.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

metatrader_sockets_client-0.0.2-py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 3

Supported by

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