![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
github.com/Cryptocurrencies-AI/go-binance
To read full documentation, specs and find out which request params are required/optional, please visit the official documentation project.
var logger log.Logger
logger = log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))
logger = log.With(logger, "time", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
hmacSigner := &binance.HmacSigner{
Key: []byte("API secret"),
}
ctx, _ := context.WithCancel(context.Background())
// use second return value for cancelling request when shutting down the app
binanceService := binance.NewAPIService(
"https://www.binance.com",
"API key",
hmacSigner,
logger,
ctx,
)
b := binance.NewBinance(binanceService)
Following provides list of main usages of library. See example
package for testing application with more examples.
Each call has its own Request structure with data that can be provided. The library is not responsible for validating the input and if non-zero value is used, the param is sent to the API server.
In case of an standard error, instance of binance.Error
is returned with additional info.
newOrder, err := b.NewOrder(binance.NewOrderRequest{
Symbol: "BNBETH",
Quantity: 1,
Price: 999,
Side: binance.SideSell,
TimeInForce: binance.GTC,
Type: binance.TypeLimit,
Timestamp: time.Now(),
})
if err != nil {
panic(err)
}
fmt.Println(newOrder)
canceledOrder, err := b.CancelOrder(binance.CancelOrderRequest{
Symbol: "BNBETH",
OrderID: newOrder.OrderID,
Timestamp: time.Now(),
})
if err != nil {
panic(err)
}
fmt.Printf("%#v\n", canceledOrder)
kl, err := b.Klines(binance.KlinesRequest{
Symbol: "BNBETH",
Interval: binance.Hour,
})
if err != nil {
panic(err)
}
fmt.Printf("%#v\n", kl)
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
kech, done, err := b.TradeWebsocket(binance.TradeWebsocketRequest{
Symbol: "ETHBTC",
})
if err != nil {
panic(err)
}
go func() {
for {
select {
case ke := <-kech:
fmt.Printf("%#v\n", ke)
case <-done:
break
}
}
}()
fmt.Println("waiting for interrupt")
<-interrupt
fmt.Println("canceling context")
cancelCtx()
fmt.Println("waiting for signal")
<-done
fmt.Println("exit")
return
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.