go-binance icon indicating copy to clipboard operation
go-binance copied to clipboard

How to Implement the TestNet api for CreateOrderService

Open saintmalik opened this issue 2 years ago • 6 comments

Trust everyone is good, adding .Test(context.Background()) is not working

order, err := client.NewCreateOrderService().Symbol(model.Symbol).
			Side(binance.SideTypeBuy).Type(binance.OrderTypeLimit).
			TimeInForce(binance.TimeInForceTypeGTC).Quantity("5").
			Price("200").Do(context.Background())
		if err != nil {
			fmt.Println("gdgh", err)
			return
		}
		fmt.Println(order)

saintmalik avatar Jun 26 '22 19:06 saintmalik

Hi, what is the error return?

adshao avatar Jun 27 '22 01:06 adshao

Hi, what is the error return?

assignment mismatch: 2 variables but client.NewCreateOrderService().Symbol(model.Symbol).Side(binance.SideTypeBuy).Type(binance.OrderTypeLimit).TimeInForce(binance.TimeInForceTypeGTC).Quantity("5").Price("200").Test returns 1 value

saintmalik avatar Jun 27 '22 06:06 saintmalik

Hi, what is the error return?

assignment mismatch: 2 variables but client.NewCreateOrderService().Symbol(model.Symbol).Side(binance.SideTypeBuy).Type(binance.OrderTypeLimit).TimeInForce(binance.TimeInForceTypeGTC).Quantity("5").Price("200").Test returns 1 value

as the message said, Test() only return 1 value which is error, I think you use the statement:

order, err := client.NewCreateOrderService()....Test()

please try to fix it like this:

err := client.NewCreateOrderService()....Test()

adshao avatar Jul 01 '22 01:07 adshao

Thanks, it worked, but how do i check reponse of request validity?

saintmalik avatar Jul 01 '22 03:07 saintmalik

Thanks, it worked, but how do i check reponse of request validity?

what do you exactly mean for 'response'?

adshao avatar Jul 01 '22 12:07 adshao

just like there was fmt.Println(order), does that means i will check for error instead

saintmalik avatar Aug 01 '22 17:08 saintmalik