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.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

metatrader_sockets_client-0.0.4-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file metatrader_sockets_client-0.0.4.tar.gz.

File metadata

File hashes

Hashes for metatrader_sockets_client-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d5607236d475283b354e53b181b8ba493ce308553836997802bf312b64624907
MD5 22936ea0f9fde6b8386c880460d3ccf7
BLAKE2b-256 f0e2ba454be4e68bbfc292ecac20973abfdf7065aec68b5265f0a69cb288bfc4

See more details on using hashes here.

File details

Details for the file metatrader_sockets_client-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for metatrader_sockets_client-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1823d104dd20280d2961540dc849ff8e108670f08f4043ce6c32c28419847aec
MD5 7cdd9f0608f01353753ccff2afa90ffe
BLAKE2b-256 3657d79a902918820164061a5b68b62c6d80d9015543cbd1c1928104381e710a

See more details on using hashes here.

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