craftblue / php-mtgox-api-v2
An API wrapper around MTGox API v2 that's slightly more sane than some alternatives.
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/craftblue/php-mtgox-api-v2
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-11-03 19:49:03 UTC
README
An API wrapper around MTGox API v2 that's slightly more sane than some alternatives. If you're interested in bitcoins, MTGox is the API for you.
By sane, I simply mean there's some internal method param validation that occurs to ensure you are passing valid values to the API.
Pre-reqs
Usage of Composer or direct inclusion of the library via require_once 'src/craftblue/mtgox.php'
Usage
There's two primary ways to make API calls that accomplish the same thing:
- Using PHP's internal magic method
__call(), allowing you to create human readable calls. - Using the built-in
request()method where you supply the API endpoint as a string.
It's personal preference!
<?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 Overview
I won't cover the broadness of the API, but rather link you to the docs and highlight the endpoints available with short descriptions:
https://bitbucket.org/nitrous/mtgox-api/ https://en.bitcoin.it/wiki/MtGox/API/HTTP/v2
Documented API Endpoints
-
money/currencyGet information for a given currency. Sample Response:{ "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/tickerGet the most recent information for a currency pair. Sample Response:{ "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_fastGet the most recent information for a currency pair. This method is similar to money/ticker, except it returns less information, and is supposedly lag-free. Sample Response:{ "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
Undocumented API Endpoints
If you have any information on these, please consider a PULL request.
money/bank/registerUndocumented.money/bank/listUndocumented.money/bitcoin/addprivUndocumented.money/bitcoin/addr_detailsUndocumented.money/bitcoin/addressUndocumented.money/bitcoin/block_list_txUndocumented.money/bitcoin/nullUndocumented.money/bitcoin/send_simpleUndocumented.money/bitcoin/tx_detailsUndocumented.money/bitcoin/vanity_lookupUndocumented.money/bitcoin/wallet_addUndocumented.money/bitinstant/feeUndocumented.money/bitinstant/quoteUndocumented.money/code/listUndocumented.money/code/redeemUndocumented.money/japan/lookup_bankUndocumented.money/japan/lookup_branchUndocumented.money/merchant/order/createUndocumented.money/merchant/order/payUndocumented.money/merchant/order/detailsUndocumented.money/merchant/order/paymentUndocumented.money/merchant/pos/order/createUndocumented.money/merchant/pos/order/closeUndocumented.money/merchant/pos/order/getUndocumented.money/merchant/pos/order/add_productUndocumented.money/merchant/pos/order/edit_productUndocumented.money/merchant/product/addUndocumented.money/merchant/product/delUndocumented.money/merchant/product/getUndocumented.money/merchant/product/editUndocumented.money/swift/detailsUndocumented.money/ticket/createUndocumented.money/token/processUndocumented.