go-binance
go-binance copied to clipboard
Basic code example
Good day, followed the guide, however having this issue:
Please clarify on how to run basic command using your library. Execution is not even getting to level of main function execution.
go run test.go test.go:3:5: found packages binance (account_service.go) and main (test.go) in C:\Users\name\Downloads\go-binance-master\go-binance-master\v2
package main
import (
"github.com/adshao/go-binance/v2"
"fmt"
)
func main(){
fmt.Println("123")
var (
apiKey = "XX"
secretKey = "xxx"
)
order, err := client.NewCreateOrderService().Symbol("BNBETH").
Side(binance.SideTypeBuy).Type(binance.OrderTypeLimit).
TimeInForce(binance.TimeInForceTypeGTC).Quantity("5").
Price("0.0030000").Do(context.Background())
if err != nil {
fmt.Println(err)
return
}
fmt.Println(order)
do()
}
main()
```
`
Good day, followed the guide, however having this issue:
Please clarify on how to run basic command using your library. Execution is not even getting to level of main function execution.
go run test.go test.go:3:5: found packages binance (account_service.go) and main (test.go) in C:\Users\name\Downloads\go-binance-master\go-binance-master\v2
package main import ( "github.com/adshao/go-binance/v2" "fmt" ) func main(){ fmt.Println("123") var ( apiKey = "XX" secretKey = "xxx" ) order, err := client.NewCreateOrderService().Symbol("BNBETH"). Side(binance.SideTypeBuy).Type(binance.OrderTypeLimit). TimeInForce(binance.TimeInForceTypeGTC).Quantity("5"). Price("0.0030000").Do(context.Background()) if err != nil { fmt.Println(err) return } fmt.Println(order) do() } main()
`
As the error said, your should use package main
instead of binance
in your code.