Skip to content

FishTools/fishing-net

Fishing Net: Python MQL5 Terminal REST API Server

This project provides a Python-based REST API server for interacting with the MQL5 Terminal.

Overview

Fishing Net acts as a bridge between your applications and the MQL5 Terminal, a powerful environment for developing, testing, and deploying trading algorithms on MetaTrader platforms.

Through this API, you can send commands, retrieve data, and manage your MQL5 applications directly from your Python code or Programming language of your choice.

Runs on Any Computer (But MQL5 Needs Windows)

This program works on your computer, no matter Windows, Mac, or Linux, as long as you have Python. However, to connect to the MQL5 program (it only runs on Windows), you'll need a separate Windows machine. Once connected, Fishing Net uses regular web stuff (HTTP) to talk to MQL5, so you can use any coding language you like.

Installation

Requirements:

Instructions:

  1. Clone this repository:
git clone https://github.com/FishTools/Fishing-net
  1. Navigate to the project directory:
cd fishing-net
  1. Install dependencies using Poetry:
poetry install

Running the Program

Development Mode:

Start the server in development mode for interactive testing and debugging:

poetry run fastapi dev fishing_net/main.py

This will launch the API server and provide a user interface (Swagger) for exploring available endpoints at http://127.0.0.1:8000/docs.

Production Mode:

For production use, run the server in production mode:

poetry run fastapi run fishing_net/main.py

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contribution

We welcome contributions to this project! Please refer to the CONTRIBUTING.md file for guidelines on how to submit pull requests and report issues.

MQL5 Python Functions needs to implement

Note:

  • ✅ - Implemented and working
  • ❌ - Not yet implemented in the server
Completed
Function
Action
login
Connect to a trading account using specified parameters
version
Return the MetaTrader 5 terminal version
account_info
Get info on the current trading account
terminal_Info
Get status and parameters of the connected MetaTrader 5 terminal
symbols_total
Get the number of all financial instruments in the MetaTrader 5 terminal
symbols_get
Get all financial instruments from the MetaTrader 5 terminal
symbol_info
Get data on the specified financial instrument
symbol_info_tick
Get the last tick for the specified financial instrument
symbol_select
Select a symbol in the MarketWatch window or remove a symbol from the window
market_book_add
Subscribes the MetaTrader 5 terminal to the Market Depth change events for a specified symbol
market_book_get
Returns a tuple from BookInfo featuring Market Depth entries for the specified symbol
market_book_release
Cancels subscription of the MetaTrader 5 terminal to the Market Depth change events for a specified symbol
copy_rates_from
Get bars from the MetaTrader 5 terminal starting from the specified date
copy_rates_from_pos
Get bars from the MetaTrader 5 terminal starting from the specified index
copyrates_range
Get bars in the specified date range from the MetaTrader 5 terminal
copy_ticks_from
Get ticks from the MetaTrader 5 terminal starting from the specified date
copy_ticks_range
Get ticks for the specified date range from the MetaTrader 5 terminal
orders_total
Get the number of active orders.
orders_get
Get active orders with the ability to filter by symbol or ticket
order_calc_margin
Return margin in the account currency to perform a specified trading operation
order_calc_profit
Return profit in the account currency for a specified trading operation
order_check
Check funds sufficiency for performing a required trading operation
order_send
Send a request to perform a trading operation.
positions_total
Get the number of open positions
positions_get
Get open positions with the ability to filter by symbol or ticket
history_orders_total
Get the number of orders in trading history within the specified interval
history_orders_get
Get orders from trading history with the ability to filter by ticket or position
history_deals_total
Get the number of deals in trading history within the specified interval
history_deals_get
Get deals from trading history with the ability to filter by ticket or position

Roadmap

  • Implement support for additional MQL5 Terminal functionalities.
  • Enhance security features for production environments.
  • Integrate unit and integration testing frameworks.
  • Provide comprehensive documentation for API endpoints.

This roadmap is not exhaustive and may evolve based on community feedback and project needs.

About

A python REST API server for communicating with MQL5 Terminal

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages