alexander-emelyanov/opteck-api-client
Composer 安装命令:
composer require alexander-emelyanov/opteck-api-client
包简介
PHP Client for Opteck platform
README 文档
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>');
统计信息
- 总下载量: 1.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-12