alexander-emelyanov/tradologic-api-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alexander-emelyanov/tradologic-api-client

Composer 安装命令:

composer require alexander-emelyanov/tradologic-api-client

包简介

PHP Client for TradoLogic platform

README 文档

README

Build Status StyleCI Code Climate

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>]));

统计信息

  • 总下载量: 1.8k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固