承接 punksolid/bitso 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

punksolid/bitso

Composer 安装命令:

composer require punksolid/bitso

包简介

A PHP Wrapper for the Bitso API

README 文档

README

A php wrapper for the Bitso API.

Installation

To install the bitso php api wrapper: $ composer require punksolid/bitso:* or equivalently in your composer.json file:

{
    "require": {
        "punksolid/bitso": "dev-master"
    }
}

Public API Usage

require 'vendor/autoload.php'

$bitso = new BitsoAPI\Bitso();

The production API is set as default, to use Dev API:

require 'vendor/autoload.php'

$bitso = new BitsoAPI\Bitso('','',$url);

Private API Usage

require 'vendor/autoload.php'

$bitso = new BitsoAPI\Bitso(API_KEY, API_SECRET, URL);

See note above on how to use Dev API

Note on Parameters

Parameters must be arrays in the form of:

["arg1"=>"value","arg2"=>"value"]

Moreover, for methods such as lookup order, cancel order, there is no array of parameters, but there must be an array with order ids:

['id','id','id]

See specific calls for detailed examples.

Public Calls

Available Books

## Order books available on Bitso
$books = $bitso->available_books();

##sample usage for minimum amount of btc_mxn (0)
$books['payload'][0]->minimum_amount;
##for minimum amount of eth_mxn (1)
$books['payload'][1]->minimum_amount;

Ticker

## Ticker information
## Parameters
## [book] - Specifies which book to use
##                  - string
$ticker = $bitso->ticker(["book"=>"btc_mxn"]);

##sample usage for ask price of btc_mxn
$ticker['payload']->ask;

Order Book

## Public order book
## Parameters
## [book] - Specifies which book to use
##                  - string
## [aggregate = True] - Group orders with the same price
##                - boolean

$ob = $bitso->orderBook(["book"=>"btc_mxn","aggregate"=> "True"]);

## sample usage for array of asks for btc_mxn
$ob['payload']->asks;

Trades

## Public trades
## Parameters
## [book = 'btc_mxn'] - Specifies which book to use
##                    - str
## [marker = None] - Returns objects that are older or newer (depending on 'sort’) than the object with this ID
##                    - str
## [sort = 'desc'] - Specifies ordering direction of returned objects (asc, desc)
##                    - str
## [limit = '25'] - Specifies number of objects to return. (Max is 100)
##                    - str

$trades = $bitso->trades(["book"=>"btc_mxn"]);

##sample usage to get array of trades 
$trades['payload'];

Private calls

Private endpoints are used to manage your account and your orders. These requests must be signed with your Bitso credentials

Account Status

## Your account status
$status = $bitso->accountStatus();

##sample usage for account status array
$status['payload'];

Account Balances

## Your account balances
$balances = $bitso->balances();

##sample usage for account balances array
$balances['payload']->balances;

Fees

## Your trade fees
$fees = $bitso->fees();

##sample usage for fees array
$fees['payload'];

Ledger

## A ledger of your historic operations.
## Parameters
## [marker]    - Returns objects that are older or newer (depending on 'sort’) than the object with this ID
##                 - string
## [limit = 25]   - Limit result to that many transactions
##                 - int
## [sort = 'desc'] - Sorting by datetime
##                 - string - 'asc' or
##                 - 'desc'

$ledger = $bitso->ledger(["limit"=>"15"]);

##sample usage for ledger array of size determined by limit
$ledger['payload'];

Withdrawals

## Detailed info on your fund withdrawals.
## Parameters
## [wids]    - Specifies which withdrawal objects to return by IDs
##                 - list
## [marker]    - Returns objects that are older or newer (depending on 'sort’) than the object with this ID
##                 - string
## [limit = 25]   - Limit result to that many transactions
##                 - int
## [sort = 'desc'] - Sorting by datetime
##                 - string - 'asc' or
##                 - 'desc'

$withdrawals = $bitso->withdrawals(["limit"=>"20","wids"=>"ids"));

##sample usage for withdrawals array of size determined by limit
$withdrawals['payload'];

Fundings

## Detailed info on your fundings.
## Parameters
## [fids]    - Specifies which funding objects to return by IDs
##                 - list
## [marker]    - Returns objects that are older or newer (depending on 'sort’) than the object with this ID
##                 - string
## [limit = 25]   - Limit result to that many transactions
##                 - int
## [sort = 'desc'] - Sorting by datetime
##                 - string - 'asc' or
##                 - 'desc'

$fundings = $bitso->fundings(["limit"=>"20","fids"->"ids"));

##sample usage for fundings array of size determined by limit
$fundings['payload'];

User Trades

## Your trades
## Parameters
## [book = all]- Specifies which book to use
##                 - string
## [marker]    - Returns objects that are older or newer (depending on 'sort’) than the object with this ID
##                 - string
## [limit = 25]   - Limit result to that many transactions
##                 - int
## [sort = 'desc'] - Sorting by datetime
##                 - string - 'asc' or
##                 - 'desc'

$user_trades = $bitso->userTrades(['book'=>'btc_mxn']);

##sample usage for getting array of user trades
$user_trades['payload'];

Open Orders

## Returns a list of the user’s open orders
## Parameters
## [book] - Specifies which book to use
##                    - str
## [marker]    - Returns objects that are older or newer (depending on 'sort’) than the object with this ID
##                 - string
## [limit = 25]   - Limit result to that many transactions
##                 - int
## [sort = 'desc'] - Sorting by datetime
##                 - string - 'asc' or
##                 - 'desc'
$open_orders = $bitso->open_orders(['book'=>'btc_mxn']);

##sample usage for getting array of open orders
$open_orders['payload'];

Lookup Order

## Returns a list of details for 1 or more orders
## Parameters
## order_ids -  A list of Bitso Order IDs.
##          - string
$lookup_order = $bitso->lookup_order([oids]);

##sample usage for getting status of a specific order (if one oids is passed in)
$lookup_order['payload']->status;

##sample usage for getting status of a specific order (if more than one oids are passed in)
$lookup_order['payload'][i]->status;

Cancel Order

## Cancels an open order
## Parameters
## order_id -  A Bitso Order ID.
##          - string
$cancel_order =  $bitso->cancel_order([oids]);

Place Order

## Places a buy limit order.
## [book] - Specifies which book to use (btc_mxn, eth_mxn)
##                    - str
## [side] - the order side (buy, sell) 
##                    - str
## [order_type] - the order type (limit, market) 
##                    - str
## amount - Amount of major currency to buy.
##        - string
## major  - The amount of major currency for this order. An order must be specified in terms of major or minor, never both.
##        - string. Major denotes the cryptocurrency, in our case Bitcoin (BTC) or Ether (ETH).
## minor  - The amount of minor currency for this order. Minor denotes fiat currencies, in our case Mexican Peso (MXN)
##        - string
## price  - Price per unit of major. For use only with limit orders
##        - string

$place_order = $bitso->placeOrder(['book'  => 'btc_mxn', 'side'  => 'buy', 'major' => '.01', 'price' => '1000', type'  => 'limit']);

Funding Destination Address

## Gets a Funding destination address to fund your account
## fund_currency  - Specifies the currency you want to fund your account with (btc, eth, mxn)
##                            - str
$funding_destination = $bitso->fundingDestination(['fund_currency'=>'eth']);

Bitcoin Withdrawal

## Triggers a bitcoin withdrawal from your account
## amount  - The amount of BTC to withdraw from your account
##         - string
## address - The Bitcoin address to send the amount to
##         - string

$btc_withdrawal = $bitso->btc_withdrawal(['amount'=>'.05','address'  => '']);

Ether Withdrawal

## Triggers a bitcoin withdrawal from your account
## amount  - The amount of BTC to withdraw from your account
##         - string
## address - The Bitcoin address to send the amount to
##         - string

$eth_withdrawal = $bitso->eth_withdrawal(['amount'  => '.05','address'  => '']);

Ripple Withdrawal

## Triggers a ripple withdrawal from your account
## currency  - The currency to withdraw
##         - string
## amount  - The amount of BTC to withdraw from your account
##         - string
## address - The ripple address to send the amount to
##         - string

$ripple_withdrawal = $bitso->ripple_withdrawal(['currency'=>'MXN','amount'=> '.05','address'  => '']);

Bank Withdrawal (SPEI)

## Triggers a SPEI withdrawal from your account. These withdrawals are
##   immediate during banking hours (M-F 9:00AM - 5:00PM Mexico City Time).
##
## amount  - The amount of MXN to withdraw from your account
##         - string
## recipient_given_names - The recipient’s first and middle name(s)
##         - string
## recipient_family_names - The recipient’s last name)
##         - string
## clabe - The CLABE number where the funds will be sent to
##         - string
## notes_ref - The alpha-numeric reference number for this SPEI
##         - string
## numeric_ref - The numeric reference for this SPEI
##         - string

$spei_withdrawal = $bitso->spei_withdrawal(['amount'  => '105','recipient_given_names'  => 'Andre Pierre','recipient_family_names'=>'Gignac', 'clabe'=>'CLABE','notes_ref'=>'NOTES_REF','numeric_ref'=>'NUMERIC REF']);

Testing

To test the library, after installing, write in your API Keys in either the bitso.php file or the two test files, then go to the root folder of the repository and run:

./vendor/bin/phpunit

Remember to input API Keys to test with, as the test files have empty slots for keys.

punksolid/bitso 适用场景与选型建议

punksolid/bitso 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.98k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「crypto」 「trading」 「bitso」 「Open Banking」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 punksolid/bitso 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 punksolid/bitso 我们能提供哪些服务?
定制开发 / 二次开发

基于 punksolid/bitso 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-01