kurisu/exincore-php-sdk

This package is abandoned and no longer maintained. No replacement package was suggested.

exincore sdk

1.0.8 2019-10-10 03:35 UTC

README

Requirement

  1. Composer
  2. PHP >= 7.0

Installation

$ composer require kurisu/exincore-php-sdk -vvv

使用

例示

// 配置文件格式例示
$config = [
    'mixin_id'      => '7000101633',
    'client_id'     => '982afd4e-92dd-4430-98cf-d308442ea04d',
    'client_secret' => 'b0a9adf1b358501b1fb6065c6292b09dbc675d5734225f86e0ec14a71d0fd38a',
    'pin'           => '125334',
    'pin_token'     => 'RzgyepFhLbMx+zLw6ogYzZ5k+kmlo8gQ2f4+1uwGMi1HgvMexGdFdeny0ffuBl7gXgPqi1GpUDPWPNrgAIjwGIFu+rHSre1G7JA5ET6tgIYoC+OI2dF0PmNK0qtkjK+qpGpSCt8nFbTfgyHjFENAp4hLZEIhuhzSPPmkkhXGlAU=',
    'session_id'    => '8a70b414-bdef-46f3-9738-186c1095da61',
    'private_key'   => <<<EOF
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCZAkpYA7eH38GbzIX653dxBAEanrSSdYbzQYIV/kKbULYSB43X
5hWfCFpNJ6FoIUjHAzrNyqJMvSS6LwAA+R4w5GYv8en1Ga1blKbziCMvZsRJ65bP
F2cPbPQUYNWZpZRsyFlMZCjVVytA1a+HWba5FzGBXiEEzd5BVo9truxGKQIDAQAB
AoGBAJHpVj4ipUWEgtvxKR9A1m1G9UqOaAJ2409cfBI/GwOD72y4GXL2rk2vKHYF
Qe3MN9vY353aC/YENV77bRSAfGF+lAuw3hQOFfMvKfRUmVaB5V4kEaF1+z9jPHwh
QcSpqyAsMClEnyMxbNrFih4tQGlGUydHI3xv1wK+53MjncwBAkEA98GvzldsLW7E
dhwXLba3KN/GvLZLcljLyHjctUxCU8EywD73UM1lJuayWvYdLfzFe0p9cDjvS8Gx
sbYg3eE2qQJBAJ4ZkqVbdCAyUBpjaIO9QzxsL77zCgayrQTvWv0QQgJputO7S2rs
i/iCmt1bZ3IAnfVnDUJfAaxSL6VU1T6Fw4ECQQCtUvrCx7YOMqeOWSh9+o04MxS9
gGpXnHcz0BnXW3orTcVLaMFr7cUN6eZsbDENswAUuI/4qlv+C4tcX6Wuk5fBAkA+
EggzB37GDTrJwXGNF0dId6kfLMgo7QlkwJxWcoWX8O66pfPsHMavYIdwlKw+Y+Og
Lz9TaX18rB+sp2u5SkcBAkBIsC/AJNhf1xILLAkkpycJ7rc864Y1JbmKk+I5fXid
vA4vKPqu2ZnD0O4YbGmciuTRPgeJqAt8bbHq/xOfL0lE
-----END RSA PRIVATE KEY-----
EOF
            ,  //import your private_key
];

$exincoreSdk = new \Kurisu\ExinCore\ExinCore($config);

// 1. 查询指定交易对的行情
$baseAsset     = 'c94ac88f-4671-3976-b60a-09064f1811e8';     // uuid
$exchangeAsset = '815b0b1a-2764-3736-8faa-42d694fa620a';     // uuid

$exincoreSdk->readExchangeList();                            // 查询全部交易对的行情
$exincoreSdk->readExchangeList($baseAsset);                  // 查询 baseAsset 为 $baseAsset 的交易对的行情
$exincoreSdk->readExchangeList($baseAsset, $exchangeAsset);  // 查询 baseAsset 为 $baseAsset , exchangeAsset 为 $exchangeAsset 的交易对的行情


// 2. 创建订单
$exincoreSdk->createOrder($baseAsset, $exchangeAsset, 1);

调用

code description
ExinCore::readExchangeList($baseAsset = null, $exchangeAsset = null) 查询指定交易对的行情
ExinCore::createOrder($baseAsset, $exchangeAsset, $amount) 创建订单

WARNING

有三个不太重要的可配置项

  1. 是否需要返回原始响应体

    $exincoreSdk = new \Kurisu\ExinCore\ExinCore($config);
    $exincoreSdk->setRaw(true);  // or false , 默认为 false
  2. 如果 Mixin Network Api 返回错误码,是否抛出异常

    $exincoreSdk = new \Kurisu\ExinCore\ExinCore($config);
    $exincoreSdk->setBoom(false);  // or true , 默认为 true
  3. 设置网络请求超时时间

    $exincoreSdk = new \Kurisu\ExinCore\ExinCore($config);
    $exincoreSdk->setTimeout(6);  //  默认为 10

Alternatives

[kurisu/laravel-exincore-sdk]

LICENSE

MIT