github-vet / github-vet/rangeloop-pointer-findings
garyyu/algo-trading: order_track.go; 34 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [garyyu/algo-trading](https://www.github.com/garyyu/algo-trading) at [order_track.go](https://github.com/garyyu/algo-trading/blob/8668d611dbaedde589e6ab2aecba83c99e567d33/order_track.go#L217-L250)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.
> function call at line 245 may store a reference to openOrder
[Click here to see the code in its original context.](https://github.com/garyyu/algo-trading/blob/8668d611dbaedde589e6ab2aecba83c99e567d33/order_track.go#L217-L250)
Click here to show the 34 line(s) of Go which triggered the analyzer.
```go
for _, openOrder := range openOrderList {
if openOrder.IsDone {
continue
}
executedOrder, err := binanceSrv.QueryOrder(binance.QueryOrderRequest{
Symbol: openOrder.executedOrder.Symbol,
OrderID: openOrder.executedOrder.OrderID,
RecvWindow: 5 * time.Second,
Timestamp: time.Now(),
})
if err != nil {
level.Error(logger).Log("QueryOrder - fail! Symbol=", openOrder.executedOrder.Symbol,
"OrderID=", openOrder.executedOrder.OrderID)
return
}
openOrder.executedOrder = *executedOrder
// check if this order is done
if executedOrder.Status == binance.StatusPartiallyFilled ||
executedOrder.Status == binance.StatusNew {
openOrder.IsDone = false
} else if executedOrder.IsWorking {
openOrder.IsDone = true
}
if !UpdateOrder(&openOrder){
fmt.Println("UpdateOrder - Failed. openOrder=", openOrder)
}
//fmt.Println("QueryOrders - Result:", executedOrder)
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 8668d611dbaedde589e6ab2aecba83c99e567d33
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.