当前位置: 首页>>代码示例>>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;未经允许,请勿转载。