alexander-emelyanov / opteck-api-client
PHP Client for Opteck platform
Installs: 1 584
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.0
- psr/log: ^1.0
Requires (Dev)
- codeclimate/php-test-reporter: ^0.3.0
- fzaninotto/faker: ~1.4
- monolog/monolog: ^1.18
- phpunit/phpunit: ^5.1
- dev-master
- v0.7.5
- v0.7.4
- v0.7.3
- v0.7.2
- v0.7.1
- v0.7.0
- 0.6.2
- v0.6.1
- v0.6.0
- v0.5.1
- v0.5.0
- v0.4.0
- v0.3.1
- v0.2.1
- v0.2.0
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-analysis-XkaQ61
- dev-analysis-87aZMV
- dev-analysis-8QMnAm
- dev-analysis-8jLAW7
- dev-analysis-zRvN07
- dev-analysis-qBMJ1r
- dev-analysis-qM1jov
- dev-analysis-qJ2VBa
This package is not auto-updated.
Last update: 2025-01-02 03:18:13 UTC
README
This repository contains PHP Client for Opteck platform.
Opteck is a trading platform for binary options.
Installation
Install using Composer, doubtless.
$ composer require alexander-emelyanov/opteck-api-client
Usage
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!
Create lead
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;
Get lead details
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);
Auth
/** @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;
Get deposits
Code bellow retrieves all deposits for last 7 days.
/** @var \Opteck\Entities\Deposit[] $deposits */ $deposits = $apiClient->getDeposits(time() - 2600 * 24 * 7, time());
Trading
Get option types
/** @var \Opteck\Entities\OptionType[] $optionTypes */ $optionTypes = $apiClient->getOptionTypes();
Get markets
/** @var \Opteck\Entities\Market[] $markets */ $markets = $apiClient->getMarkets();
Get assets
/** @var \Opteck\Entities\Asset[] $assets */ $assets = $apiClient->getAssets();
Get asset rate
/** @var \Opteck\Responses\GetAssetRate $assetRate */ $assetRate = $apiClient->getAssetRate(<Asset ID>);
Trade
This package provide special wrapper for Opteck logic. You can use it for easy trading.
$apiClient->openPosition('<Email>', '<Password>', '<Symbol>', <Direction>, <Amount>);
Trade actions report
/** \Opteck\Entities\TradeAction[] $tradeActions */ $tradeActions = $apiClient->getTradeActions('<Email>');