This repository contains PHP Client for Opteck platform.
Opteck is a trading platform for binary options.
Install using Composer, doubtless.
$ composer require alexander-emelyanov/opteck-api-client
First, you need to create a client object to connect to the Opteck servers. You will need to acquire an Affiliate ID and Partner ID for your app first from broker website , then pass the credentials to the client object for logging in.
$client = new \Opteck\ApiClient(<Affiliate ID>, <Partner ID>);
Assuming your credentials is valid, you are good to go!
You can create lead on the Opteck platform using one request.
/** @var \Opteck\Requests\CreateLead $request */
$request = new \Opteck\Requests\CreateLead([
'email' => 'john.smith@gmail.com',
'password' => 'qwerty',
'firstName' => 'John',
'lastName' => 'Smith',
'language' => 'EN',
'country' => 'GB',
'phone' => '442088963321', // Pizza Hut Restaurant
'campaign' => 'test_campaign_1',
'subCampaign' => 'test_sub_campaign_1',
]);
/** @var \Opteck\Responses\CreateLead $response */
$response = $apiClient->createLead($request);
echo "Lead created successfully with ID: " . $response->getLeadId() . PHP_EOL;
You should use Lead Details for auto-login as well and for retrieving more information about lead.
/** @var \Opteck\Responses\GetLeadDetails $leadDetails */
$leadDetails = $apiClient->getLeadDetails($email);
/** @var \Opteck\Responses\Auth $authResponse */
$authResponse = $apiClient->auth('john.smith@gmail.com', 'qwerty');
echo "Lead authorized with token [" . $authResponse->getToken() . "] valid up to " . $authResponse->getExpiryTimestamp() . PHP_EOL;
Code bellow retrieves all deposits for last 7 days.
/** @var \Opteck\Entities\Deposit[] $deposits */
$deposits = $apiClient->getDeposits(time() - 2600 * 24 * 7, time());
/** @var \Opteck\Entities\OptionType[] $optionTypes */
$optionTypes = $apiClient->getOptionTypes();
/** @var \Opteck\Entities\Market[] $markets */
$markets = $apiClient->getMarkets();
/** @var \Opteck\Entities\Asset[] $assets */
$assets = $apiClient->getAssets();
/** @var \Opteck\Responses\GetAssetRate $assetRate */
$assetRate = $apiClient->getAssetRate(<Asset ID>);
This package provide special wrapper for Opteck logic. You can use it for easy trading.
$apiClient->openPosition('<Email>', '<Password>', '<Symbol>', <Direction>, <Amount>);
/** \Opteck\Entities\TradeAction[] $tradeActions */
$tradeActions = $apiClient->getTradeActions('<Email>');