-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
WIP: Recreate infinity grid #735
base: main
Are you sure you want to change the base?
Conversation
Welcome back! @ksidenko, This pull request may get 824 BBG. |
order := types.SubmitOrder{ | ||
Symbol: s.Symbol, | ||
Side: types.SideTypeBuy, | ||
Type: types.OrderTypeLimit, |
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.
@c9s if I set market order, backtest fail with error:
can you help me to fix it?
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.
maybe you forgot to sync first?
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.
yes, you're missing the kline data, you need to sync first.
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.
I tried, but have the same error:
go run ./cmd/bbgo backtest -v --sync --config config/infinity-grid.yaml --base-asset-baseline --output output --subdir
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.
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.
check if your db loaded all the binance klines, also you might need to rebase to the latest main branch.
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.
I already rebase my branch, make some fixes, but error not left.
Can you pls debug locally? just run
go run ./cmd/bbgo backtest -v --sync --config config/infinity-grid.yaml --base-asset-baseline --output output --subdir
I think it's bug, couse I have last price https://github.com/c9s/bbgo/pull/735/files#diff-378c135c835046a31b907fc9e387f6d6a287d76248e6261d87689b4147772108R138 and use it in this stage, but I can evaluates market order in stream onStart stage.
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.
If the post order action happens in OnStart, you should get the error "SubmitOrders should be called after UserDataStream been initialized"
👍 |
@@ -186,7 +186,7 @@ const ordersToMarkets = (interval: string, orders: Array<Order> | void): Array<M | |||
position: 'aboveBar', | |||
color: '#e91e63', | |||
shape: 'arrowDown', | |||
text: ''+order.price | |||
text: ''+order.price.toFixed(0), |
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 might truncate the precision for price like 1.0003355
Orders []types.SubmitOrder `json:"orders,omitempty"` | ||
FilledBuyGrids map[fixedpoint.Value]struct{} `json:"filledBuyGrids"` | ||
FilledSellGrids map[fixedpoint.Value]struct{} `json:"filledSellGrids"` | ||
Position *types.Position `json:"position,omitempty"` |
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.
You can check how to use the persistence tag, it's a new feature.
it's applied in the bollmaker strategy.
👍👍👍 |
@c9s i have such output There are many records like this:
|
Re-estimated karma: this pull request may get 985 BBG |
Re-estimated karma: this pull request may get 1049 BBG |
@@ -430,6 +430,10 @@ func (a Value) MulExp(exp int) Value { | |||
return Value(int64(float64(a) * math.Pow(10, float64(exp)))) | |||
} | |||
|
|||
func (a Value) MulPow(v Value, exp Value) Value { | |||
return Value(int64(float64(a) * math.Pow(v.Float64(), exp.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.
You need also implement the same method for dnum fixedpoint.
Otherwise strategies compiled using dnum tag won't be able to pass the compilation
Re-estimated karma: this pull request may get 1075 BBG |
|
Fix & Rewrite code from https://github.com/jnlin/bbgo-strategy-infinite-grid/blob/main/strategy.go
Addition features: