PHP code example of alexander-emelyanov / tradologic-api-client

1. Go to this page and download the library: Download alexander-emelyanov/tradologic-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alexander-emelyanov / tradologic-api-client example snippets


$client = new \TradoLogic\ApiClient([
    'url' => 'https://b2b-api.tradologic.net',
]);

/** @var \TradoLogic\Entities\Country[] $countries */
$countries = $client->countries();

/** @var \TradoLogic\Entities\Language[] $languages */
$languages = $client->languages();

$client = new \TradoLogic\ApiClient([
    'url' => 'https://b2b-api.tradologic.net',
    'username' => '<YOUR_USERNAME>',
    'password' => '<YOUR_PASSWORD>',
    'accountId' => <YOUR_ACCOUNT_ID>,
]);

/** @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>',
]));

$request = new \TradoLogic\Requests\UserLogin([
    'email' => '[email protected]',
    '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);
}

/** @var $response \TradoLogic\Entities\Deposit[] */
$response = $client->deposits();

/** @var \TradoLogic\Entities\Options\Binary[] $options */
$options = $client->getBinaryOptions();

$client->createBinaryOption(new \TradoLogic\Requests\BinaryOptionCreate(<User ID>, <Option ID>, <Volume>, <Is Call>));

/**
 * @var \TradoLogic\Entities\Trades\Regular[]
 */
$trades = $client->getRegularUserTrades(new \TradoLogic\Requests\RegularUserTradesGet(<User ID>[, <Only open>]));