alexander-emelyanov / tradologic-api-client
PHP Client for TradoLogic platform
Installs: 1 795
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
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
- dev-master
- v2.0.2
- v2.0.1
- v2.0.0
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- v0.1.0
- dev-analysis-qJ2LJb
- dev-analysis-8nN7Y5
- dev-analysis-q5Zvly
- dev-analysis-8QMOGp
- dev-analysis-XWNyBE
- dev-analysis-zRvn6D
- dev-t1
- dev-analysis-XlK3yk
- dev-analysis-87an52
- dev-analysis-zYjkWv
This package is not auto-updated.
Last update: 2025-01-02 01:24:40 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/tradologic-api-client
Usage
First, you need to create a client object to connect to the TradoLogic 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 \TradoLogic\ApiClient([ 'url' => 'https://b2b-api.tradologic.net', ]);
Assuming your credentials is valid, you are good to go!
Get countries list
/** @var \TradoLogic\Entities\Country[] $countries */ $countries = $client->countries();
Get languages list
/** @var \TradoLogic\Entities\Language[] $languages */ $languages = $client->languages();
Create user
For ability to create user your IP should be added to whitelist. So, this operation requires authorization. You should provide username, password and account ID to \TradoLogic\ApiClient constructor. It should seems like this:
$client = new \TradoLogic\ApiClient([ 'url' => 'https://b2b-api.tradologic.net', 'username' => '<YOUR_USERNAME>', 'password' => '<YOUR_PASSWORD>', 'accountId' => <YOUR_ACCOUNT_ID>, ]);
Then you can register user.
/** @var \TradoLogic\Responses\UserCreate $response */ $response = $client->createUser(new \TradoLogic\Requests\UserCreate([ 'userPassword' => '<USER_PASSWORD>', 'userFirstName' => '<USER_FIRST_NAME>', 'userLastName' => '<USER_LAST_NAME>', 'phone' => '<USER_PHONE>', 'email' => '<USER_EMAIL>', ]));
Login user
For redirect user to TradoLogic base website you should get Session ID for this user.
$request = new \TradoLogic\Requests\UserLogin([ 'email' => 'alex.emelianov@gmail.com', 'password' => 'portal', 'userIpAddress' => '94.74.194.219', ]); /** @var $response \TradoLogic\Responses\UserLogin */ $response = $client->loginUser($request); if ($response->isSuccess()) { echo ("User logged successfully with Session ID: " . $response->getSessionId() . PHP_EOL); }
Get deposits
/** @var $response \TradoLogic\Entities\Deposit[] */ $response = $client->deposits();
Get active binary options
For trading integration you must get list of active binary options. You can do it really easy:
/** @var \TradoLogic\Entities\Options\Binary[] $options */ $options = $client->getBinaryOptions();
Trading
When active binary options are retrieved you can open positions (binary options) for your customers.
$client->createBinaryOption(new \TradoLogic\Requests\BinaryOptionCreate(<User ID>, <Option ID>, <Volume>, <Is Call>));
Trades
You can retrieve trades history for specified users.
/** * @var \TradoLogic\Entities\Trades\Regular[] */ $trades = $client->getRegularUserTrades(new \TradoLogic\Requests\RegularUserTradesGet(<User ID>[, <Only open>]));