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: add autobuy strategy #1468

Merged
merged 1 commit into from Dec 28, 2023
Merged

FEATURE: add autobuy strategy #1468

merged 1 commit into from Dec 28, 2023

Conversation

narumiruna
Copy link
Collaborator

No description provided.

@bbgokarma-bot
Copy link

Welcome back! @narumiruna, This pull request may get 382 BBG.

Copy link

codecov bot commented Dec 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f4941be) 21.32% compared to head (687df81) 21.32%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1468   +/-   ##
=======================================
  Coverage   21.32%   21.32%           
=======================================
  Files         591      591           
  Lines       43482    43482           
=======================================
  Hits         9274     9274           
  Misses      33533    33533           
  Partials      675      675           

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 f4941be...687df81. Read the comment docs.

c9s
c9s previously approved these changes Dec 22, 2023
config/autobuy.yaml Outdated Show resolved Hide resolved

s.boll = session.Indicators(s.Symbol).BOLL(s.BollingerSetting.IntervalWindow, s.BollingerSetting.BandWidth)

session.UserDataStream.OnBalanceUpdate(func(balances types.BalanceMap) {
Copy link
Owner

Choose a reason for hiding this comment

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

BalanceUpdate could be triggered very fast, you will need to use rate limiter

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed to do this on order filled.

return
}

price := ticker.Buy
Copy link
Owner

Choose a reason for hiding this comment

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

it could also be "ticker.Sell - one tick" if we want to be filled faster?

Copy link
Owner

Choose a reason for hiding this comment

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

this could be an option

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How about

	var price fixedpoint.Value
	switch s.PriceType {
	case PriceTypeLast:
		price = ticker.Last
	case PriceTypeBuy:
		price = ticker.Buy
	case PriceTypeSell:
		price = ticker.Sell
	case PriceTypeMid:
		price = ticker.Buy.Add(ticker.Sell).Div(two)
	default:
		price = ticker.Buy
	}

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 482 BBG

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 497 BBG

@narumiruna narumiruna merged commit e357959 into main Dec 28, 2023
4 checks passed
@narumiruna narumiruna deleted the narumi/autobuy/init branch December 28, 2023 09:44
@bbgokarma-bot
Copy link

Hi @narumiruna,

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

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

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

3 participants