Documentation ¶
Overview ¶
Package mtgox implements functions for sending and receiving data via Mt Gox API.
Index ¶
- Constants
- func Buy(c appengine.Context, login xgen.Credentials, price float64, amount float64) (x xgen.OpenOrders, err os.Error)
- func CancelOrder(c appengine.Context, login xgen.Credentials, oid string, orderType int8) (f interface{}, err os.Error)
- func GetBalance(c appengine.Context, login xgen.Credentials) (x xgen.Balance, err os.Error)
- func GetOpenOrders(c appengine.Context, login xgen.Credentials) (x xgen.OpenOrders, err os.Error)
- func GetOrderBook(c appengine.Context) (x xgen.OrderBook, err os.Error)
- func GetQuote(c appengine.Context) (x xgen.Quote, err os.Error)
- func Sell(c appengine.Context, login xgen.Credentials, price float64, amount float64) (x xgen.OpenOrders, err os.Error)
- type Balance
- type OpenOrders
- type OrderBook
- type Quote
- type RecentTrades
- type Trade
Constants ¶
const ( // Public Market Data JsonTicker = "https://mtgox.com/api/0/data/ticker.php" JsonDepth = "https://mtgox.com/api/0/data/getDepth.php" JsonRecent = "https://mtgox.com/api/0/data/getTrades.php" // Authenticated Trading Functions JsonBalance = "https://mtgox.com/api/0/getFunds.php" JsonOrders = "https://mtgox.com/api/0/getOrders.php" JsonBuy = "https://mtgox.com/api/0/buyBTC.php" JsonSell = "https://mtgox.com/api/0/sellBTC.php" JsonCancel = "https://mtgox.com/api/0/cancelOrder.php" )
Mt. Gox Trade API: https://mtgox.com/support/tradeAPI API documentation: https://en.bitcoin.it/wiki/MtGox/API
const ( Price = iota Amount )
Variables ¶
This section is empty.
Functions ¶
func Buy ¶
func Buy(c appengine.Context, login xgen.Credentials, price float64, amount float64) (x xgen.OpenOrders, err os.Error)
Buy opens a new order to buy BTC.
func CancelOrder ¶
func CancelOrder(c appengine.Context, login xgen.Credentials, oid string, orderType int8) (f interface{}, err os.Error)
CancelOrder cancels an open order.
func GetBalance ¶
GetBalance retrieves the account balance.
func GetOpenOrders ¶
func GetOpenOrders(c appengine.Context, login xgen.Credentials) (x xgen.OpenOrders, err os.Error)
GetOpenOrders retrieves a list of all open orders.
func GetOrderBook ¶
GetOrderBook retrieves the limit order book.
Types ¶
type OpenOrders ¶
type OpenOrders struct { Usds string Btcs string New_Usds newBalance New_btcs newBalance Orders []openOrder }
OpenOrders is a struct representing all our open buy and sell orders in the account.
type OrderBook ¶
type OrderBook struct { Asks [][2]float64 // Sell orders (price and amount) Bids [][2]float64 // Buy orders (price and amount) }
OrderBook is a struct representing a limit order book.
type Quote ¶
type Quote struct {
Ticker quote
}
Quote is a struct representing the best available buy and sell prices at the time.
type RecentTrades ¶
type RecentTrades struct {
Trades []Trade
}
RecentTrades is a struct representing a slice of historical trades.
type Trade ¶
type Trade struct { Date int64 // Unix timestamp of the trade Tid string // Trade id (big integer, which is in fact the trade timestamp in microseconds) Price_int string // Price per unit * 1E5 or 1E3 (1E5 for USD, 1E3 for JPY) // USD: multiply by 0.00001 to get the actual price of BTC in USD, JPY: multiply by 0.001 Amount_int string // Traded amount * 1E8 (multiply by 0.00000001 to get the actual number of BTC traded) Price_currency string // Currency in which trade was completed (USD? JPY?) Item string // What was this trade about (BTC?) Trade_type string // Did this trade result from the execution of a 'bid' or 'ask'? }
Trade is a struct representing a historical trade.