Skip to content

Commit

Permalink
Merge pull request #37 from binance/rc-v0.7.0
Browse files Browse the repository at this point in the history
Release v0.7.0
  • Loading branch information
alplabin authored Aug 23, 2024
2 parents a8207fc + b6d6d3d commit d37282f
Show file tree
Hide file tree
Showing 22 changed files with 634 additions and 75 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Change log

## v0.7.0 - 2024-08-23

### Added
- SPOT `FIAT` Endpoints:
- `GET /sapi/v1/fiat/orders` - Get Fiat Deposit/Withdraw History
- `GET /sapi/v1/fiat/payments` - Get Fiat Payments History
- Websocket Stream:
- `<symbol>@miniTicker` - Individual Symbol Mini Ticker Stream

### Updated
- Updated `SymbolInfo` and `SymbolFilter` types

### Fixed
- Fixed issue with `stopCh` not stopping the WebSocket connection
- Fixed the `stop` method for `userDataStream`
- Fixed symbols method for `NewTicker24hrService`

## v0.6.0 - 2024-06-19

### Fixed
Expand Down
8 changes: 8 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,3 +767,11 @@ func (c *Client) NewPingUserStream() *PingUserStream {
func (c *Client) NewCloseUserStream() *CloseUserStream {
return &CloseUserStream{c: c}
}

func (c *Client) NewGetFiatDepositWithdrawHistoryService() *GetFiatDepositWithdrawHistoryService {
return &GetFiatDepositWithdrawHistoryService{c: c}
}

func (c *Client) NewGetFiatPaymentHistoryService() *GetFiatPaymentHistoryService {
return &GetFiatPaymentHistoryService{c: c}
}
2 changes: 1 addition & 1 deletion consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package binance_connector

const Name = "binance-connector-go"

const Version = "0.6.0"
const Version = "0.7.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main

import (
"context"
"fmt"

binance_connector "github.com/binance/binance-connector-go"
)

func main() {
GetFiatDepositWithdrawHistory()
}

func GetFiatDepositWithdrawHistory() {
apiKey := "your api key"
secretKey := "your secret key"
baseURL := "https://api.binance.com"

client := binance_connector.NewClient(apiKey, secretKey, baseURL)

// GetFiatDepositWithdrawHistoryService - /sapi/v1/fiat/orders
getFiatDepositWithdrawHistory, err := client.NewGetFiatDepositWithdrawHistoryService().
TransactionType("0").
Do(context.Background())
if err != nil {
fmt.Println(err)
return
}
fmt.Println(binance_connector.PrettyPrint(getFiatDepositWithdrawHistory))
}
30 changes: 30 additions & 0 deletions examples/fiat/GetFiatPaymentHistory/GetFiatPaymentHistory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main

import (
"context"
"fmt"

binance_connector "github.com/binance/binance-connector-go"
)

func main() {
GetFiatPaymentHistory()
}

func GetFiatPaymentHistory() {
apiKey := "your api key"
secretKey := "your secret key"
baseURL := "https://api.binance.com"

client := binance_connector.NewClient(apiKey, secretKey, baseURL)

// GetFiatPaymentHistoryService - /sapi/v1/fiat/payments
getFiatPaymentHistory, err := client.NewGetFiatPaymentHistoryService().
TransactionType("0").
Do(context.Background())
if err != nil {
fmt.Println(err)
return
}
fmt.Println(binance_connector.PrettyPrint(getFiatPaymentHistory))
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)
Expand All @@ -18,10 +19,15 @@ func WsAllMarketMiniTickers() {
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, _, err := websocketStreamClient.WsAllMarketMiniTickersStatServe(wsAllMarketMiniTickersHandler, errHandler)
doneCh, stopCh, err := websocketStreamClient.WsAllMarketMiniTickersStatServe(wsAllMarketMiniTickersHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
8 changes: 7 additions & 1 deletion examples/websocket/AllMarketTickers/AllMarketTickers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)
Expand All @@ -18,10 +19,15 @@ func WsAllMarketTickersExample() {
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, _, err := websocketStreamClient.WsAllMarketTickersStatServe(wsAllMarketTickersHandler, errHandler)
doneCh, stopCh, err := websocketStreamClient.WsAllMarketTickersStatServe(wsAllMarketTickersHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
2 changes: 1 addition & 1 deletion examples/websocket/CombinedDepth/CombinedDepth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func WsCombinedDepthHandlerExample() {
}
// use stopCh to exit
go func() {
time.Sleep(5 * time.Second)
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
// remove this if you do not want to be blocked here
Expand Down
33 changes: 33 additions & 0 deletions examples/websocket/MarketMiniTickers/MarketMiniTickers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)

func main() {
WsMarketMiniTickers()
}

func WsMarketMiniTickers() {
websocketStreamClient := binance_connector.NewWebsocketStreamClient(false)
wsMarketMiniTickersHandler := func(event binance_connector.WsMarketMiniTickerStatEvent) {
fmt.Println(binance_connector.PrettyPrint(event))
}
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, stopCh, err := websocketStreamClient.WsMarketMiniTickersStatServe("BNBBTC", wsMarketMiniTickersHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
8 changes: 7 additions & 1 deletion examples/websocket/aggtrades/aggtrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)
Expand All @@ -20,10 +21,15 @@ func AggTradesExample() {
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, _, err := websocketStreamClient.WsAggTradeServe("BTCUSDT", wsAggTradeHandler, errHandler)
doneCh, stopCh, err := websocketStreamClient.WsAggTradeServe("BTCUSDT", wsAggTradeHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
8 changes: 7 additions & 1 deletion examples/websocket/bookticker/bookticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)
Expand All @@ -18,10 +19,15 @@ func WsBookTickerExample() {
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, _, err := websocketStreamClient.WsBookTickerServe("LTCBTC", wsBookTickerHandler, errHandler)
doneCh, stopCh, err := websocketStreamClient.WsBookTickerServe("LTCBTC", wsBookTickerHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
2 changes: 1 addition & 1 deletion examples/websocket/depth/depth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func WsDepthHandlerExample() {
}
// use stopCh to exit
go func() {
time.Sleep(5 * time.Second)
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
// remove this if you do not want to be blocked here
Expand Down
8 changes: 7 additions & 1 deletion examples/websocket/kline/kline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)
Expand All @@ -18,10 +19,15 @@ func WsKlineExample() {
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, _, err := websocketStreamClient.WsKlineServe("LTCBTC", "1m", wsKlineHandler, errHandler)
doneCh, stopCh, err := websocketStreamClient.WsKlineServe("LTCBTC", "1m", wsKlineHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
8 changes: 7 additions & 1 deletion examples/websocket/trades/trades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"time"

binance_connector "github.com/binance/binance-connector-go"
)
Expand All @@ -18,10 +19,15 @@ func WsTradeExample() {
errHandler := func(err error) {
fmt.Println(err)
}
doneCh, _, err := websocketStreamClient.WsTradeServe("LTCBTC", wsTradeHandler, errHandler)
doneCh, stopCh, err := websocketStreamClient.WsTradeServe("LTCBTC", wsTradeHandler, errHandler)
if err != nil {
fmt.Println(err)
return
}
// use stopCh to exit
go func() {
time.Sleep(10 * time.Second)
stopCh <- struct{}{}
}()
<-doneCh
}
Loading

0 comments on commit d37282f

Please sign in to comment.