Error when the Oanda token or account ID is not set

This commit is contained in:
Luke Wilson
2024-10-31 20:30:22 -05:00
parent 5fc4a6e2d6
commit 5ee2df12b5
4 changed files with 28 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
package main
import (
"fmt"
"os"
auto "github.com/fivemoreminix/autotrader"
@@ -33,7 +34,11 @@ func main() {
panic(err)
}
*/
broker := oanda.NewOandaBroker(os.Getenv("OANDA_TOKEN"), os.Getenv("OANDA_ACCOUNT_ID"), true)
broker, err := oanda.NewOandaBroker(os.Getenv("OANDA_TOKEN"), os.Getenv("OANDA_ACCOUNT_ID"), true)
if err != nil {
fmt.Println("error:", err)
return
}
auto.Backtest(auto.NewTrader(auto.TraderConfig{
Broker: auto.NewTestBroker(broker /* data, */, nil, 10000, 50, 0.0002, 0),