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

FEATURE: [bybit] to periodically fetch the fee rate #1397

Merged
merged 1 commit into from Nov 7, 2023

Conversation

bailantaotao
Copy link
Collaborator

@bailantaotao bailantaotao commented Nov 6, 2023

To periodically fetch the fee rate.

The feeRatePoller.getAllFeeRates are copied from stream.getAllFeeRates

@bbgokarma-bot
Copy link

Welcome back! @bailantaotao, This pull request may get 696 BBG.

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #1397 (82ac8f1) into main (e773bb0) will increase coverage by 0.00%.
The diff coverage is 48.80%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1397   +/-   ##
=======================================
  Coverage   21.12%   21.13%           
=======================================
  Files         568      569    +1     
  Lines       40956    41008   +52     
=======================================
+ Hits         8653     8668   +15     
- Misses      31667    31703   +36     
- Partials      636      637    +1     
Files Coverage Δ
pkg/exchange/bybit/stream.go 25.55% <11.11%> (-6.53%) ⬇️
pkg/exchange/bybit/market_info_poller.go 53.33% <53.33%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e773bb0...82ac8f1. Read the comment docs.

}

stream.SetEndpointCreator(stream.createEndpoint)
stream.SetParser(stream.parseWebSocketEvent)
stream.SetDispatcher(stream.dispatchEvent)
stream.SetHeartBeat(stream.ping)
stream.SetBeforeConnect(stream.getAllFeeRates)
stream.SetBeforeConnect(func(ctx context.Context) error {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question, is it BeforeConnect or BeforeStart? because we trigger OnStart only once, and OnConnect many times (disconnect and reconnect)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We call the BeforeConnect before DialAndConnect

// Connect starts the stream and create the websocket connection
func (s *StandardStream) Connect(ctx context.Context) error {
	if s.beforeConnect != nil {
		if err := s.beforeConnect(ctx); err != nil {
			return err
		}
	}
	err := s.DialAndConnect(ctx)
	if err != nil {
		return err
	}

	// start one re-connector goroutine with the base context
	// reconnector goroutine does not exit when the connection is closed
	go s.reconnector(ctx)

	s.EmitStart()
	return nil
}

@bailantaotao bailantaotao merged commit 61bbc22 into main Nov 7, 2023
4 checks passed
@bailantaotao bailantaotao deleted the edwin/bybit/periodly-fetch-market-info branch November 7, 2023 01:25
@bbgokarma-bot
Copy link

Hi @bailantaotao,

Well done! 726 BBG has been sent to your polygon wallet. Please check the following tx:

https://polygonscan.com/tx/0xc70b45efc0c6005b875971f142588e59fdd94ef49e152137f18b63ee2947a08c

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants