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

* fix mock recording, binance, backtester

* minor credential streamlining
This commit is contained in:
Scott
2024-05-15 12:00:33 +10:00
committed by GitHub
parent 4cd4fb06b4
commit 34ef09dad6
9 changed files with 191581 additions and 38820 deletions

View File

@@ -47,9 +47,21 @@ func HTTPRecord(res *http.Response, service string, respContents []byte) error {
}
service = strings.ToLower(service)
fileout := filepath.Join(DefaultDirectory, service, service+".json")
outputFilePath := filepath.Join(DefaultDirectory, service, service+".json")
_, err := os.Stat(outputFilePath)
if err != nil {
if os.IsExist(err) {
return err
}
// check alternative path to add compatibility with /internal/testing/exchange/exchange.go MockHTTPInstance
outputFilePath = filepath.Join("..", service, "testdata", "http.json")
_, err = os.Stat(outputFilePath)
if err != nil {
return err
}
}
contents, err := os.ReadFile(fileout)
contents, err := os.ReadFile(outputFilePath)
if err != nil {
return err
}
@@ -227,7 +239,7 @@ func HTTPRecord(res *http.Response, service string, respContents []byte) error {
return err
}
return file.Write(fileout, payload)
return file.Write(outputFilePath, payload)
}
// GetFilteredHeader filters excluded http headers for insertion into a mock