-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
strategy:irr: a mean reversion based on box of klines in same direction #989
Conversation
Welcome back! @austin362667, This pull request may get 289 BBG. |
Codecov Report
@@ Coverage Diff @@
## main #989 +/- ##
=======================================
Coverage 19.88% 19.88%
=======================================
Files 420 420
Lines 31961 31961
=======================================
Hits 6356 6356
Misses 24999 24999
Partials 606 606 Continue to review full report at Codecov.
|
b0bf1ac
to
8315cd8
Compare
Re-estimated karma: this pull request may get 360 BBG |
Re-estimated karma: this pull request may get 373 BBG |
Re-estimated karma: this pull request may get 384 BBG |
Re-estimated karma: this pull request may get 414 BBG |
Re-estimated karma: this pull request may get 395 BBG |
pkg/strategy/irr/draw.go
Outdated
return | ||
} | ||
bbgo.SendPhoto(&buffer) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the lint issue
s.currentTradePrice = atomic.NewFloat64(trade.Price.Float64()) | ||
}) | ||
|
||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part is not backtest-able
pkg/strategy/irr/strategy.go
Outdated
Quantity: s.Quantity, | ||
Type: types.OrderTypeLimitMaker, | ||
Price: fixedpoint.NewFromFloat(bestBid - s.Spread), | ||
Tag: "irr short: buy", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag format is like this irrShortBuy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I guess you mean irrShortClose here
pkg/strategy/irr/strategy.go
Outdated
@@ -398,3 +486,31 @@ func (s *Strategy) CalcAssetValue(price fixedpoint.Value) fixedpoint.Value { | |||
balances := s.session.GetAccount().Balances() | |||
return balances[s.Market.BaseCurrency].Total().Mul(price).Add(balances[s.Market.QuoteCurrency].Total()) | |||
} | |||
|
|||
func (s *Strategy) rebalancePosition(bestBid, bestAsk float64, w float64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to pass ctx to the function
646d2da
to
614209e
Compare
Re-estimated karma: this pull request may get 436 BBG |
1 similar comment
Re-estimated karma: this pull request may get 436 BBG |
71c9b22
to
1f27ed3
Compare
Re-estimated karma: this pull request may get 440 BBG |
1f27ed3
to
70e3074
Compare
Re-estimated karma: this pull request may get 445 BBG |
strategy:irr: clean up strategy:irr: clean up strategy:irr: clean up
70e3074
to
778a3d8
Compare
Re-estimated karma: this pull request may get 450 BBG |
Re-estimated karma: this pull request may get 455 BBG |
Hi @austin362667, Well done! 460 BBG has been sent to your polygon wallet. Please check the following tx: https://polygonscan.com/tx/0x6cf14db81c3ca27db323704f4327fa3a5704b33800c0378802a33780b9865695 Thank you for your contribution! |
Due to the severe "delay" issue in binance 1s kline stream.
We've refactored irr strategy into backtesting mode (consume KLine onClose), and real-time mode (consume bookTicker which triggered every interval via goroutine)Now we've redesigned the time ticker(goroutine) to consume aggerate trade market stream based on web socket .Rollback to interval time trigger for a much easier programming model and really small intervals.