MtGox/API: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Seventoes (talk | contribs)
No edit summary
Neofutur (talk | contribs)
No edit summary
Line 5: Line 5:
* [[MtGox/API/HTTP|HTTP API]]  
* [[MtGox/API/HTTP|HTTP API]]  
* [[MtGox/API/Streaming|Streaming websocket API]]
* [[MtGox/API/Streaming|Streaming websocket API]]
__TOC__


==Number Formats==
==Number Formats==

Revision as of 00:36, 8 September 2012

The MtGox API provides methods to access information from the market, place orders, and more.

Two APIs are currently available:

Number Formats

In the "old API", currency- and amount-values (price, volume,...) were given as float. These values are likely being deprecated and replaced by fields of the same name with "_int" as suffix. These are fixed-decimal, so you have to move the decimal point yourself (divide). The exponent differs based on the kind of the value.

In order to convert the int to a decimal you can...

kind of field ...divide by ...multiply by
BTC (volume, amount) 1E8 (100,000,000) 0.00000001
USD (price) 1E5 (100,000) 0.00001
JPY (price) 1E3 (1,000) 0.001

Implementation advice: it's probably best to use int or Decimal (if your language/db offers such a type) in your clients. Using float will likely lead to nasty rounding problems.

Currency Symbols

List of the currency symbols available with the API:

USD, AUD, CAD, CHF, CNY, DKK, EUR, GBP, HKD, JPY, NZD, PLN, RUB, SEK, SGD, THB