當前位置: 首頁>>代碼示例>>Golang>>正文


Golang restapi.PostJson函數代碼示例

本文整理匯總了Golang中restapi.PostJson函數的典型用法代碼示例。如果您正苦於以下問題:Golang PostJson函數的具體用法?Golang PostJson怎麽用?Golang PostJson使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了PostJson函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: CancelOrder

// CancelOrder cancels an open order.
func CancelOrder(c appengine.Context, login xgen.Credentials, oid string) (x xgen.OpenOrders, err os.Error) {
	defer func() {
		if e, ok := recover().(os.Error); ok {
			err = e
		}
	}()
	var openOrders OpenOrders
	err = restapi.PostJson(c, JsonCancel, map[string][]string{"name": {login.Username}, "pass": {login.Password}, "oid": {oid}}, &openOrders)
	check(err)
	x = openOrders.convert() // Note: Canceling an order may take up to 1 second. During that time the order is considered active and will be returned as active by GetOrders.
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:13,代碼來源:tradehillapi.go

示例2: GetOpenOrders

// GetOpenOrders retrieves a list of all open orders.
func GetOpenOrders(c appengine.Context, login xgen.Credentials) (x xgen.OpenOrders, err os.Error) {
	defer func() {
		if e, ok := recover().(os.Error); ok {
			err = e
		}
	}()
	var openOrders OpenOrders
	err = restapi.PostJson(c, JsonOrders, map[string][]string{"name": {login.Username}, "pass": {login.Password}}, &openOrders)
	check(err)
	x = openOrders.convert()
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:13,代碼來源:tradehillapi.go

示例3: Sell

// Sell opens a new order to sell BTC.
func Sell(c appengine.Context, login xgen.Credentials, price float64, amount float64) (x xgen.OpenOrders, err os.Error) {
	defer func() {
		if e, ok := recover().(os.Error); ok {
			err = e
		}
	}()
	var openOrders OpenOrders
	err = restapi.PostJson(c, JsonSell, map[string][]string{"name": {login.Username}, "pass": {login.Password},
		"price": {strconv.Ftoa64(price, 'f', -1)}, "amount": {strconv.Ftoa64(amount, 'f', -1)}}, &openOrders)
	check(err)
	x = openOrders.convert()
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:14,代碼來源:tradehillapi.go

示例4: GetBalance

// GetBalance retrieves the account balance.
func GetBalance(c appengine.Context, login xgen.Credentials) (x xgen.Balance, err os.Error) {
	defer func() {
		if e, ok := recover().(os.Error); ok {
			err = e
		}
	}()
	var b Balance
	err = restapi.PostJson(c, JsonBalance, map[string][]string{"name": {login.Username}, "pass": {login.Password}}, &b)
	check(err)
	x[xgen.BTC], err = strconv.Atof64(b.BTC)
	check(err)
	x[xgen.USD], err = strconv.Atof64(b.USD)
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:15,代碼來源:tradehillapi.go

示例5: CancelOrder

// CancelOrder cancels an open order.
func CancelOrder(c appengine.Context, login xgen.Credentials, oid string, orderType int8) (f interface{}, err os.Error) {
	err = restapi.PostJson(c, JsonCancel, map[string][]string{"name": {login.Username}, "pass": {login.Password}, "nonce": {strconv.Itoa64(time.Nanoseconds())},
		"oid": {oid}, "type": {strconv.Itoa(int(orderType))}}, &f)
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:6,代碼來源:mtgoxapi.go

示例6: Sell

// Sell opens a new order to sell BTC.
func Sell(c appengine.Context, login xgen.Credentials, price float64, amount float64) (f interface{}, err os.Error) {
	err = restapi.PostJson(c, JsonBuySell, map[string][]string{"user": {login.Username}, "pass": {login.Password}, "TradeMode": {"QuickSell"},
		"Price": {strconv.Ftoa64(price, 'f', -1)}, "Quantity": {strconv.Ftoa64(amount, 'f', -1)}}, &f)
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:6,代碼來源:campbxapi.go

示例7: CancelOrder

// CancelOrder cancels an open order.
func CancelOrder(c appengine.Context, login xgen.Credentials, oid string, orderType string) (f interface{}, err os.Error) {
	err = restapi.PostJson(c, JsonCancel, map[string][]string{"user": {login.Username}, "pass": {login.Password}, "Type": {orderType}, "OrderID": {oid}}, &f)
	return
}
開發者ID:adrianuswarmenhoven,項目名稱:ArBit,代碼行數:5,代碼來源:campbxapi.go


注:本文中的restapi.PostJson函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。