Esempio n. 1
0
func testOkcoinLTCAPI() {
	tradeAPI := okcoin.NewOkcoinTrade(SecretOption["ok_partner"], SecretOption["ok_secret_key"])

	buyret := tradeAPI.BuyMarketLTC("100", "0.1")
	fmt.Println(buyret)

	time.Sleep(2000 * time.Millisecond)

	sellret := tradeAPI.SellMarketLTC("150", "0.1")
	fmt.Println(sellret)

	time.Sleep(2000 * time.Millisecond)

	buyret = tradeAPI.BuyLTC("100", "0.1")
	fmt.Println(buyret)

	time.Sleep(2000 * time.Millisecond)

	sellret = tradeAPI.SellLTC("150", "0.1")
	fmt.Println(sellret)

	ret, orderTable := tradeAPI.Get_LTCorder("-1")
	fmt.Println(ret, orderTable)

	ret = tradeAPI.Cancel_LTCorder("100253")
	fmt.Println(ret)
}
Esempio n. 2
0
func testOkcoinBTCAPI() {
	tradeAPI := okcoin.NewOkcoinTrade(SecretOption["ok_partner"], SecretOption["ok_secret_key"])
	accout_info, _ := tradeAPI.GetAccount()
	fmt.Println(accout_info)

	buyret := tradeAPI.BuyBTC("1000", "0.01")
	fmt.Println(buyret)
	sellret := tradeAPI.SellBTC("10000", "0.01")
	fmt.Println(sellret)

	var orderTable okcoin.OKOrderTable
	ret, orderTable := tradeAPI.Get_BTCorder("-1")
	fmt.Println(ret, orderTable)

	time.Sleep(2000 * time.Millisecond)

	ret, orderTable = tradeAPI.Get_LTCorder("-1")
	fmt.Println(ret, orderTable)

	ret = tradeAPI.Cancel_BTCorder("-1")
	fmt.Println(ret)

	time.Sleep(2000 * time.Millisecond)

	ret = tradeAPI.Cancel_LTCorder("-1")
	fmt.Println(ret)
}