Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.7.0 #37

Merged
merged 6 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading