Closed sunglim closed 9 months ago
set token 2023-11-07 00:56:57.503127584 +0000 UTC m=+1.120199106: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6ImU1M2ZhM2Y0LWJiMTgtNDNiNi04ZWUzLWM4NjliNjU5MjY4NyIsImlzcyI6InVub2d3IiwiZXhwIjoxNjk5NDA1MDE3LCJpYXQiOjE2OTkzMTg2MTcsImp0aSI6IlBTcnV3SUE2Q1hoczNUWFo3QzRLcEYwYXk5alZxN1laWXRGeiJ9.Vj5pKiwnIPYRKC8i381eab_EhNOz5yMJOTgE4EvdW4d0axQKVuYmHggeOzZHgnuP1OYxXIgpsyeWp8sWvGt21Q Initialize Korea investment trading. ProductionUrl[https://openapi.koreainvestment.com:9443], AppKey[PSruwIA6CXhs3TXZ7C4KpF0ay9jVq7YZYtFz], AppSecret[qd8xN0+0Gj/nTE+JyYMwr2zs++ZwXrbuCU0r5mx27sDWoBzDit8BK6+ccnvTEjM8ZIIHMiBPPFpRW8WJCLk9zRIwcFE2a7M91p+gaubTGAxJEgqag26sLlQJxplqXe0A3/29QybgaGVghbHtnDwiDiKDdlocgoZkerJwyXksJFbTWYlXRXg=], AccountInfo[{72660787 22}] tradingbotlog.go:34: [Start cron jobs] 2023/11/07 00:56:58 set token 2023-11-07 00:56:58.092723787 +0000 UTC m=+1.709795312: [Buy if average is below] log.go:34: [start new stragegy] [Buy if average is lower than] log.go:22: Triggered panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x89d265] goroutine 51 [running]: github.com/sunglim/systemtrading/order.order({0xc000474f60, 0x4, 0x4}, 0xe53ac0) /app/order/strategy_buy_everyday_if_below_average.go:23 +0x245 reflect.Value.call({0x9102c0?, 0xa22428?, 0x7f79995c9e00?}, {0x9c9704, 0x4}, {0xc000462000, 0x2, 0x0?}) /usr/local/go/src/reflect/value.go:596 +0xce7 reflect.Value.Call({0x9102c0?, 0xa22428?, 0xc0001d7bb8?}, {0xc000462000?, 0xc0001361e0?, 0xf0?}) /usr/local/go/src/reflect/value.go:380 +0xb9 github.com/go-co-op/gocron.callJobFuncWithParams({0x9102c0?, 0xa22428?}, {0xc0003d4000, 0x2, 0x1?}) /go/pkg/mod/github.com/go-co-op/gocron@v1.27.0/gocron.go:106 +0x1c5 github.com/go-co-op/gocron.runJob({{{0x0, 0x0}, {0x0, 0x0}}, {0x9102c0, 0xa22428}, {0xc0003d4000, 0x2, 0x2}, 0x0, ...}) /go/pkg/mod/github.com/go-co-op/gocron@v1.27.0/executor.go:75 +0x65 github.com/go-co-op/gocron.(*executor).runJob(_, {{{0x0, 0x0}, {0x0, 0x0}}, {0x9102c0, 0xa22428}, {0xc0003d4000, 0x2, 0x2}, ...}) /go/pkg/mod/github.com/go-co-op/gocron@v1.27.0/executor.go:160 +0x1b8 github.com/go-co-op/gocron.(*executor).run.func1() /go/pkg/mod/github.com/go-co-op/gocron@v1.27.0/executor.go:224 +0x385 created by github.com/go-co-op/gocron.(*executor).run in goroutine 45 /go/pkg/mod/github.com/go-co-op/gocron@v1.27.0/executor.go:192 +0x19d
Fixed by https://github.com/sunglim/systemtrading/pull/71
Why it failed: Korea investment API returns nil if the API is called again within 1 minutes. Therefore, nil is set.