-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
Open
ksidenko
wants to merge
5
commits into
c9s:main
Choose a base branch
from
ksidenko:recreate-infinity-grid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b25c94
recreate infinity grid
ksidenko b9425e2
fix all fixedpoint issues
ksidenko dd01460
refactor initial order quantity, but it's not work
ksidenko 523e7df
fix merge conflict, revert original pkg import order
ksidenko 44cf48a
Merge branch 'c9s:main' into recreate-infinity-grid
ksidenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
sessions: | ||
binance: | ||
exchange: binance | ||
envVarPrefix: binance | ||
|
||
#max: | ||
# exchange: max | ||
# envVarPrefix: max | ||
|
||
riskControls: | ||
# This is the session-based risk controller, which let you configure different risk controller by session. | ||
sessionBased: | ||
# "max" is the session name that you want to configure the risk control | ||
max: | ||
# orderExecutor is one of the risk control | ||
orderExecutor: | ||
# symbol-routed order executor | ||
bySymbol: | ||
ETHUSDT: | ||
# basic risk control order executor | ||
basic: | ||
minQuoteBalance: 10.0 | ||
maxBaseAssetBalance: 3.0 | ||
minBaseAssetBalance: 0.0 | ||
maxOrderAmount: 1000.0 | ||
|
||
# example command: | ||
# godotenv -f .env.local -- go run ./cmd/bbgo backtest --sync-from 2020-11-01 --config config/grid.yaml --base-asset-baseline | ||
backtest: | ||
startTime: "2022-06-01" | ||
endTime: "2022-06-17" | ||
symbols: | ||
- ETHUSDT | ||
sessions: [binance] | ||
accounts: | ||
binance: | ||
balances: | ||
ETH: 0 | ||
USDT: 5000.0 | ||
|
||
exchangeStrategies: | ||
|
||
#- on: binance | ||
#grid: | ||
#symbol: BTCUSDT | ||
##quantity: 0.001 | ||
##amount: 50 | ||
#quantityScale: | ||
#byPrice: | ||
#exp: | ||
#domain: [20_000, 70_000] | ||
#range: [0.001, 0.0007] | ||
#gridNumber: 33 # 33: spread = 1785 | ||
#profitSpread: 2000.0 # The profit price spread that you want to add to your sell order when your buy order is executed | ||
#upperPrice: 70_000.0 | ||
#lowerPrice: 20_000.0 | ||
#long: true # The sell order is submitted in the same order amount as the filled corresponding buy order, rather than the same quantity. | ||
- on: binance | ||
infinity-grid: | ||
symbol: ETHUSDT | ||
interval: 1m | ||
quantity: 0.05 | ||
initialOrderQuantity: 1 | ||
gridNumber: 10 | ||
countOfMoreOrders: 3 # +2 | ||
margin: 0.030 | ||
lowerPrice: 700 | ||
long: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. You need also implement the same method for dnum fixedpoint. |
||
} | ||
|
||
func (a Value) NumIntDigits() int { | ||
digits := 0 | ||
target := int64(a) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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