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

bugfixes: Backtester credentials, Binance ExecutionLimits, Mock recording #1539

Merged
merged 2 commits into from May 15, 2024

Conversation

gloriousCode
Copy link
Collaborator

@gloriousCode gloriousCode commented May 10, 2024

PR Description

David on Slack has been informing us of issues with the Backtester. This fix uses up-to-date credential checking functions instead of returning an error.

Before I could fix that I found Binance changed the json for SPOT/MARGIN execution limits to use [][]permissionSets

Upon fixing that I went to update our json mock data, and that showed that #1444 introduced a compatibility change with recording to the new path

I also came across duplicate errors right next to eachother and have addressed that

To test the Backtester

  • Modify /backtester/config/strategyexamples/dca-candles-live.strat
  • Change exchange to Binance and currency to BTC-USDT (or whatever)
  • Add your credentials
  • Set real-orders to true
  • I would also encourage you to set maximum-total to a tiny figure
  • open cmd in /backtester execute go run .
  • open another cmd in /backtester/btcli/ execute go run . executestrategyfromfile -p="config/strategyexamples/dca-candles-live.strat"
  • You should then get a success response instead of an error about credentials (if your credentials are correct ;)

Fixes # (issue)

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested

  • go test ./... -race
  • golangci-lint run

@gloriousCode gloriousCode added bug review me This pull request is ready for review labels May 10, 2024
@gloriousCode gloriousCode requested a review from a team May 10, 2024 06:35
@gloriousCode gloriousCode self-assigned this May 10, 2024
Copy link

codecov bot commented May 10, 2024

Codecov Report

Attention: Patch coverage is 64.28571% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 35.91%. Comparing base (095394f) to head (ce506f1).
Report is 4 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1539      +/-   ##
==========================================
- Coverage   36.03%   35.91%   -0.13%     
==========================================
  Files         412      409       -3     
  Lines      177779   177453     -326     
==========================================
- Hits        64060    63729     -331     
- Misses     105868   105871       +3     
- Partials     7851     7853       +2     
Files Coverage Δ
engine/exchange_manager.go 94.53% <100.00%> (ø)
exchanges/sharedtestvalues/sharedtestvalues.go 71.96% <ø> (ø)
backtester/engine/setup.go 58.24% <50.00%> (+0.04%) ⬆️
exchanges/binance/binance.go 45.08% <88.88%> (-0.12%) ⬇️
exchanges/mock/recording.go 21.15% <0.00%> (-0.63%) ⬇️

... and 19 files with indirect coverage changes

Copy link
Collaborator

@shazbert shazbert left a comment

Choose a reason for hiding this comment

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

Tested. ACK.

Copy link
Collaborator

@thrasher- thrasher- left a comment

Choose a reason for hiding this comment

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

Thanks for resolving this! Just one minor change and then this is a tACK:

image

base.API.AuthenticatedSupport = validated
if !validated {
return fmt.Errorf("%v %w", base.GetName(), errInvalidCredentials)
creds, err := base.GetCredentials(context.TODO())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
creds, err := base.GetCredentials(context.TODO())
_, err := base.GetCredentials(context.TODO())
if err != nil {
return err
}

And can drop the VerifyAPICredentials below since in this context GetCredentials will check them

Copy link
Collaborator

@thrasher- thrasher- left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes!

@thrasher- thrasher- merged commit 34ef09d into thrasher-corp:master May 15, 2024
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug high priority review me This pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants