alexander-emelyanov / tradesmarter-api-client
PHP Client for TradeSmarter platform
Installs: 1 863
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.0
- psr/log: ^1.0
Requires (Dev)
- fzaninotto/faker: ~1.4
- monolog/monolog: ^1.18
- phpunit/phpunit: ^5.1
This package is not auto-updated.
Last update: 2025-01-04 20:20:24 UTC
README
This repository contains PHP Client for TradeSmarter platform.
TradeSmarter is a trading platform for binary options.
Installation
Install using Composer, doubtless.
$ composer require alexander-emelyanov/tradesmarter-api-client
Usage
First, you need to create a client object to connect to the TradeSmarter servers. You will need to acquire an API username and API password for your app first from broker, then pass the credentials to the client object for logging in.
$client = new \TradeSmarter\ApiClient("https://<username>:<password>@<hostname>");
Assuming your credentials is valid, you are good to go!
Get countries list
/** @var \TradeSmarter\Responses\Country[] $countries */ $countries = $client->countries();
Register new customer
$request = new TradeSmarter\Requests\Register([ 'firstName' => 'John', 'lastName' => 'Smith', 'email' => 'john.smith@gmail.com', 'confirmed' => 1, 'password' => 'qwerty', 'phone' => '+123456789', 'country' => 'gb', 'locale' => 'en-GB', 'params' => [], 'lead' => 0, ]); /** @var \TradeSmarter\Responses\Register $response */ $response = $client->register($request);
Login user
$request = new \TradeSmarter\Requests\Login([ 'email' => 'john.smith@gmail.com', 'password' => 'qwerty', ]); /** @var \TradeSmarter\Responses\Login $response */ $response = $client->login($request);
Get user info
$request = new \TradeSmarter\Requests\Login([ 'email' => 'john.smith@gmail.com', 'password' => 'qwerty', ]); /** @var \TradeSmarter\Responses\UserInfo $response */ $response = $client->getUserInfo($request);
Contribution
You are welcome!
Running tests
You can run unit tests via PHPUnit:
$ vendor/bin/phpunit tests
Note: you should install dev dependencies for this package using
$ composer update --dev