func testHuobiAPI() { tradeAPI := huobi.NewHuobiTrade(SecretOption["huobi_access_key"], SecretOption["huobi_secret_key"]) accout_info, _ := tradeAPI.GetAccount() fmt.Println(accout_info) fmt.Println(tradeAPI.GetAccount()) if false { buyId := tradeAPI.BuyBTC("1000", "0.001") sellId := tradeAPI.SellBTC("10000", "0.001") if tradeAPI.Cancel_order(buyId) { fmt.Printf("cancel %s success \n", buyId) } else { fmt.Printf("cancel %s falied \n", buyId) } if tradeAPI.Cancel_order(sellId) { fmt.Printf("cancel %s success \n", sellId) } else { fmt.Printf("cancel %s falied \n", sellId) } } fmt.Println(tradeAPI.Get_orders()) }
func testHuobiAPI() { tradeAPI := huobi.NewHuobiTrade(SecretOption["huobi_access_key"], SecretOption["huobi_secret_key"]) accout_info, _ := tradeAPI.GetAccount() fmt.Println(accout_info) sellId := "14632531" buyId := tradeAPI.BuyBTC("1000", "0.001") fmt.Println(buyId) if tradeAPI.Cancel_order(sellId) { fmt.Printf("cancel %s success \n", sellId) } else { fmt.Printf("cancel %s falied \n", sellId) } // fmt.Println(tradeAPI.GetAccount()) if false { buyId := tradeAPI.BuyBTC("1000", "0.001") sellId := tradeAPI.SellBTC("10000", "0.001") //fmt.Println(tradeAPI.Get_delegations()) if tradeAPI.Cancel_order(buyId) { fmt.Printf("cancel %s success \n", buyId) } else { fmt.Printf("cancel %s falied \n", buyId) } if tradeAPI.Cancel_order(sellId) { fmt.Printf("cancel %s success \n", sellId) } else { fmt.Printf("cancel %s falied \n", sellId) } } _, orders := tradeAPI.Get_orders() for _, od := range orders { fmt.Println(od.Id, od.Type, od.Order_price, od.Order_amount, od.Processed_amount, od.Order_time, ) sellId = strconv.Itoa(od.Id) for { if tradeAPI.Cancel_order(sellId) { fmt.Printf("cancel %s success \n", sellId) break } else { fmt.Printf("cancel %s falied \n", sellId) } } } }