Laravel 8.x package wrapper library for Metatrader 5 Web API

Overview

Laravel MT5

This is Laravel 8.x package wrapper library for Metatrader 5 Web API

Documentation

Installing

To install the package, in terminal:

composer require aleedhillon/meta-five

Configure

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

AleeDhillon\MetaFive\MetaFiveProvider::class,

Copy the package config to your local config with the publish command:

php artisan vendor:publish --tag=meta-five-config

and then you can configure connection information to MT5 with this .env value

MT5_SERVER_IP=
MT5_SERVER_PORT=
MT5_SERVER_WEB_LOGIN=
MT5_SERVER_WEB_PASSWORD=

Usage

Create Deposit

You can withdraw money by giving negetive number to the same trade method.

setType(Trade::DEAL_BALANCE); $result = Client::trade($trade);">
use AleeDhillon\MetaFive\Entities\Trade;
use AleeDhillon\MetaFive\Facades\Client;

$trade = new Trade();
$trade->setLogin(6000189);
$trade->setAmount(100);
$trade->setComment("Deposit");
$trade->setType(Trade::DEAL_BALANCE);
$result = Client::trade($trade);

The result variable will return Trade class with ticket information, you can grab ticket number by calling $result->getTicket()

Create User

setEmail("[email protected]"); $user->setGroup("demo\demoforex"); $user->setLeverage("50"); $user->setPhone("0123456789"); $user->setAddress("Lahore"); $user->setCity("Lahore"); $user->setState("Punjab"); $user->setCountry("Pakistan"); $user->setZipCode(1470); $user->setMainPassword("secret"); $user->setInvestorPassword("secret"); $user->setPhonePassword("secret"); $result = Client::createUser($user);">
use AleeDhillon\MetaFive\Entities\User;
use AleeDhillon\MetaFive\Facades\Client;

$user = new User();
$user->setName("John Doe");
$user->setEmail("[email protected]");
$user->setGroup("demo\demoforex");
$user->setLeverage("50");
$user->setPhone("0123456789");
$user->setAddress("Lahore");
$user->setCity("Lahore");
$user->setState("Punjab");
$user->setCountry("Pakistan");
$user->setZipCode(1470);
$user->setMainPassword("secret");
$user->setInvestorPassword("secret");
$user->setPhonePassword("secret");

$result = Client::createUser($user);

Get Trading Account Information

use AleeDhillon\MetaFive\Facades\Client;

$user = Client::getTradingAccounts($login);

$balance = $user->Balance;
$equity = $user->Equity;
$freeMargin = $user->MarginFree;

Get Trading History By Login Number

Login.PHP_EOL; echo "TICKET : ".$trade->Order.PHP_EOL; }">
use AleeDhillon\MetaFive\Facades\Client;

// Get Closed Order Total and pagination
$total = Client::getOrderHistoryTotal($exampleLogin, $timestampfrom, $timestampto);
$trades = Client::getOrderHistoryPagination($exampleLogin, $timestampfrom, $timestampto, 0, $total);
foreach ($trades as $trade) {
    // see class MTOrder
    echo "LOGIN : ".$trade->Login.PHP_EOL;
    echo "TICKET : ".$trade->Order.PHP_EOL;
}

Open Order

use AleeDhillon\MetaFive\Facades\Client;
Client::dealerSend([
    'Login' => 8113,
    'Symbol' => 'XAUUSD',
    'Volume' => 100,
    'Type' => 0
});

The result variable will return User class with login information, you can grab login number by calling $result->getLogin()

Todo

  • Deposit or Withdrawal
  • Create Account
  • Open Order
  • Get Trading Account Information
  • Change Password
  • Create Group
  • Delete Group
  • Get Accounts
  • Remove Account
  • Get Trades
  • Get Group

This is work in progress, I will may be improve this package or rewrite the entire one with Laravel 9 and PHP 8 Support. In this revisioin I haven't touched much to the core in next I intend to rewrite the core.

Credits

Thanx to Tarikh Agustia who wrote the following two packges from which I have rewritten this current package with improvements like the Laravel singleton pattern for speed and reducing API calls to MT5.

Contributing

Thank you for considering contributing to the MetaFive! you can fork this repository and make pull request.

Security Vulnerabilities

If you discover a security vulnerability within MetaFive, please send an e-mail to Ali A. Dhillon via [email protected]. All security vulnerabilities will be promptly addressed.

License

The MetaFive packge is open-source software licensed under the MIT license.

You might also like...
The Official Vultr API PHP Wrapper

WIP - This is not the final API Client. Unstable release use with caution. Vultr API PHP Client. Getting Started Must have a PSR7, PSR17, and PSR18 Co

This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP
This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP

This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via PHP

laravel wrapper for dicom images services

laravel wrapper for dicom images services

Laravel wrapper for the Facebook Graph PHP 8 SDK

Laravel Facebook Graph SDK Installation Getting started with Laravel Facebook Graph is easy - first, install the package via composer composer require

OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

A PHP Stream wrapper for Amazon S3

S3StreamWrapper A simple stream wrapper for Amazon S3. Example ?php use S3StreamWrapper\S3StreamWrapper; S3StreamWrapper::register(); $options = a

An asynchronous ClamAV wrapper written in PHP with amphp/socket

amphp-clamav An asynchronous ClamAV wrapper written with amphp/socket Installing composer require pato05/amphp-clamav Examples Ping and scan of a fil

OVHcloud APIs lightweight PHP wrapper

Lightweight PHP wrapper for OVHcloud APIs - The easiest way to use OVHcloud APIs in your PHP applications - Compatible with PHP 7.4, 8.0, 8.1 - Not affiliated with OVHcloud

PSR-18 compliant Circuit Breaker wrapper

Interrupt PSR-18 compliant Circuit Breaker wrapper. Acknowledgement This library is heavily inspired by: ackintosh/ganesha PrestaShop/circuit-breaker

Releases(v1.1.0)
Owner
Ali A. Dhillon
PHP/Laravel | JS/Vue.js
Ali A. Dhillon
A PHP wrapper for Spotify's Web API.

Spotify Web API PHP This is a PHP wrapper for Spotify's Web API. It includes the following: Helper methods for all API endpoints: Information about ar

Jonathan Wilsson 796 Jan 8, 2023
A Laravel wrapper for thephpleague's Fractal package

laravel-api-response A Laravel wrapper for thephpleague's Fractal package Install Via Composer composer require lykegenes/laravel-api-response Then, a

Patrick Samson 3 Mar 15, 2021
Twitch Helix API PHP Wrapper for Laravel

Laravel Twitch PHP Twitch Helix API Wrapper for Laravel 5+ ⚠️ Changes on May 01, 2020 Since May 01, 2020, Twitch requires all requests to contain a va

Roman Zipp 87 Dec 7, 2022
Simple Curl based wrapper for Binance API for PHP scripts

Simple Curl based wrapper for Binance API for PHP scripts Feaures API support for SPOT data/trading FAPI/DAPI support for futures data/trading Curl-on

Mr Crypster 22 May 1, 2022
Google Drive Api Wrapper by PHP

GoogleDrive Api Wrapper usage at first you need to create oauth client on google cloud platform. so go to the your google console dashboard and create

Arash Abedi 2 Mar 24, 2022
An elegant wrapper around Google Vision API

STILL UNDER DEVELOPMENT - DO NOT USE IN PRODUCTION Requires PHP 8.0+ For feedback, please contact me. This package provides an elegant wrapper around

Ahmad Mayahi 24 Nov 20, 2022
Super-simple, minimum abstraction MailChimp API v3 wrapper, in PHP

MailChimp API Super-simple, minimum abstraction MailChimp API v3 wrapper, in PHP. I hate complex wrappers. This lets you get from the MailChimp API do

Drew McLellan 2k Dec 22, 2022
Google Translator Api Wrapper For Php Developers.

Google Translator Api Wrapper For Php Developers.

Roldex Stark 2 Oct 12, 2022
An unofficial wrapper client for lknpd.nalog.ru API

Unofficial MoyNalog API client An unofficial wrapper client for lknpd.nalog.ru API Install Via Composer $ composer require shoman4eg/moy-nalog Usage S

Artem Dubinin 18 Dec 14, 2022
A Gitlab API wrapper that helps to automate common actions on CI jobs

Gitlab CI client This is a Gitlab API wrapper that helps to automate common actions on CI jobs (eg: Open a merge request, Open or close an issue etc)

SparkFabrik 2 May 2, 2022