craftblue / php-mtgox-api-v2
围绕MTGox API v2的API包装器,比一些替代品稍微合理一些。
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-23 13:55:35 UTC
README
围绕MTGox API v2的API包装器,比一些替代品稍微合理一些。如果你对比特币感兴趣,MTGox就是你的API。
这里的“合理”只是意味着存在一些内部方法参数验证,以确保你传递给API的值是有效的。
先决条件
使用Composer或通过require_once 'src/craftblue/mtgox.php'直接包含库
用法
有两种主要方式可以发出API调用,实现相同的功能
- 使用PHP的内部魔术方法
__call(),允许你创建人类可读的调用。 - 使用内置的
request()方法,其中你提供API端点作为字符串。
这是个人喜好!
<?php // include the composer autoloader require_once 'vendor/autoloader.php'; // use the namespace use Craftblue; // initialize the class with your public/private key pair // obtained from https://mtgox.com/security $mtgox = new MTGox('key', 'secret'); // make a call (both do the same thing) $mtgox->money_info(); $mtgox->query('money/info'); // make a call to an underscored endpoint (both do the same thing) $mtgox->stream_listPublic(); $mtgox->query('stream/list_public');
API概述
我不会涵盖API的广泛性,而是将您链接到文档,并突出显示带有简短描述的可用端点。
https://bitbucket.org/nitrous/mtgox-api/ https://en.bitcoin.it/wiki/MtGox/API/HTTP/v2
已记录的API端点
-
money/currency获取给定货币的信息。 示例响应:{ "result":"success", "data": { "currency":"USD", "name":"Dollar", "symbol":"$", "decimals":"5", "display_decimals":"2", "symbol_position":"before", "virtual":"N", "ticker_channel":"abc123-def456", "depth_channel":"abc123-def456" } }
-
money/depth/fetch -
money/depth/full -
money/idkey -
money/info -
money/order/add -
money/order/cancel -
money/order/lag -
money/order/result -
money/order/quote -
money/orders -
money/ticker获取货币对的最新信息。 示例响应:{ "result":"success", "data": { "high": **Currency Object - USD**, "low": **Currency Object - USD**, "avg": **Currency Object - USD**, "vwap": **Currency Object - USD**, "vol": **Currency Object - BTC**, "last_local": **Currency Object - USD**, "last_orig": **Currency Object - ???**, "last_all": **Currency Object - USD**, "last": **Currency Object - USD**, "buy": **Currency Object - USD**, "sell": **Currency Object - USD**, "now": "1364689759572564" } }
-
money/ticker_fast获取货币对的最新信息。此方法与money/ticker类似,但返回的信息更少,且据说无延迟。 示例响应:{ "result":"success", "data": { "last_local": **Currency Object - USD**, "last": **Currency Object - USD**, "last_orig": **Currency Object - EUR**, "last_all": **Currency Object - USD**, "buy": **Currency Object - USD**, "sell": **Currency Object - USD**, "now": "1366230242125772" } }
-
money/trades/fetch -
money/trades/cancelled -
money/wallet/history -
security/hotp/gen -
stream/list_public
未记录的API端点
如果您对这些有任何信息,请考虑提交一个PULL请求。
money/bank/register未记录。money/bank/list未记录。money/bitcoin/addpriv未记录。money/bitcoin/addr_details未记录。money/bitcoin/address未记录。money/bitcoin/block_list_tx未记录。money/bitcoin/null未记录。money/bitcoin/send_simple未记录。money/bitcoin/tx_details未记录。money/bitcoin/vanity_lookup未记录。money/bitcoin/wallet_add未记录。money/bitinstant/fee未记录。money/bitinstant/quote未记录。money/code/list未记录。money/code/redeem未记录。money/japan/lookup_bank未记录。money/japan/lookup_branch未记录。money/merchant/order/create未记录。money/merchant/order/pay未记录。money/merchant/order/details未记录。money/merchant/order/payment未记录。money/merchant/pos/order/create未记录。money/merchant/pos/order/close未记录。money/merchant/pos/order/get未记录。money/merchant/pos/order/add_product未记录。money/merchant/pos/order/edit_product未记录。money/merchant/product/add未记录。money/merchant/product/del未记录。money/merchant/product/get未记录。money/merchant/product/edit未记录。money/swift/details未记录。money/ticket/create未记录。money/token/process未记录。