Version: v0.0.0-...-c196a7d Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2012 License: GPL-3.0, MIT Imports: 8 Imported by: 0



Package mtgox implements functions for sending and receiving data via Mt Gox API.



View Source
const (
	// Public Market Data
	JsonTicker = ""
	JsonDepth  = ""
	JsonRecent = ""

	// Authenticated Trading Functions
	JsonBalance = ""
	JsonOrders  = ""
	JsonBuy     = ""
	JsonSell    = ""
	JsonCancel  = ""

Mt. Gox Trade API: API documentation:

View Source
const (
	Price = iota


This section is empty.


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

func GetBalance(c appengine.Context, login xgen.Credentials) (x xgen.Balance, err os.Error)

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

func GetOrderBook(c appengine.Context) (x xgen.OrderBook, err os.Error)

GetOrderBook retrieves the limit order book.

func GetQuote

func GetQuote(c appengine.Context) (x xgen.Quote, err os.Error)

GetQuote retrieves the "ticker" data.

func Sell

func Sell(c appengine.Context, login xgen.Credentials, price float64, amount float64) (x xgen.OpenOrders, err os.Error)

Sell opens a new order to sell BTC.


type Balance

type Balance struct {
	Usds string
	Btcs string

Balance contains the amount of each currency in the account.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL