{"action":"created","issue":{"url":"https://api.github.com/repos/thrasher-/gocryptotrader/issues/182","repository_url":"https://api.github.com/repos/thrasher-/gocryptotrader","labels_url":"https://api.github.com/repos/thrasher-/gocryptotrader/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/thrasher-/gocryptotrader/issues/182/comments","events_url":"https://api.github.com/repos/thrasher-/gocryptotrader/issues/182/events","html_url":"https://github.com/thrasher-/gocryptotrader/issues/182","id":360689078,"node_id":"MDU6SXNzdWUzNjA2ODkwNzg=","number":182,"title":"Unique OrderID?","user":{"login":"kempeng","id":39567537,"node_id":"MDQ6VXNlcjM5NTY3NTM3","avatar_url":"https://avatars3.githubusercontent.com/u/39567537?v=4","gravatar_id":"","url":"https://api.github.com/users/kempeng","html_url":"https://github.com/kempeng","followers_url":"https://api.github.com/users/kempeng/followers","following_url":"https://api.github.com/users/kempeng/following{/other_user}","gists_url":"https://api.github.com/users/kempeng/gists{/gist_id}","starred_url":"https://api.github.com/users/kempeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kempeng/subscriptions","organizations_url":"https://api.github.com/users/kempeng/orgs","repos_url":"https://api.github.com/users/kempeng/repos","events_url":"https://api.github.com/users/kempeng/events{/privacy}","received_events_url":"https://api.github.com/users/kempeng/received_events","type":"User","site_admin":false},"labels":[{"id":142390129,"node_id":"MDU6TGFiZWwxNDIzOTAxMjk=","url":"https://api.github.com/repos/thrasher-/gocryptotrader/labels/bug","name":"bug","color":"fc2929","default":true},{"id":142390132,"node_id":"MDU6TGFiZWwxNDIzOTAxMzI=","url":"https://api.github.com/repos/thrasher-/gocryptotrader/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-16T23:21:08Z","updated_at":"2018-12-02T21:15:51Z","closed_at":null,"author_association":"NONE","body":"I had a look at the code below in orders/orders.go: if OrderID is intented to be unique, and assigned by OrderID = len(Orders), would this not create orders with same ID's after an order is deleted from the Orders slice?\r\n\r\n// Orders variable holds an array of pointers to order structs\r\nvar Orders []*Order\r\n\r\n// Order struct holds order values\r\ntype Order struct {\r\n\tOrderID  int\r\n\tExchange string\r\n\tType     int\r\n\tAmount   decimal.Decimal\r\n\tPrice    decimal.Decimal\r\n}\r\n\r\n// NewOrder creates a new order and returns a an orderID\r\nfunc NewOrder(Exchange string, amount, price decimal.Decimal) int {\r\n\torder := &Order{}\r\n\tif len(Orders) == 0 {\r\n\t\torder.OrderID = 0\r\n\t} else {\r\n\t\t**order.OrderID = len(Orders)**\r\n\t}\r\n\r\n\torder.Exchange = Exchange\r\n\torder.Amount = amount\r\n\torder.Price = price\r\n\tOrders = append(Orders, order)\r\n\treturn order.OrderID\r\n}\r\n\r\n// DeleteOrder deletes orders by ID and returns state\r\nfunc DeleteOrder(orderID int) bool {\r\n\tfor i := range Orders {\r\n\t\tif Orders[i].OrderID == orderID {\r\n\t\t\t**Orders = append(Orders[:i], Orders[i+1:]...)**\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n"},"comment":{"url":"https://api.github.com/repos/thrasher-/gocryptotrader/issues/comments/443542798","html_url":"https://github.com/thrasher-/gocryptotrader/issues/182#issuecomment-443542798","issue_url":"https://api.github.com/repos/thrasher-/gocryptotrader/issues/182","id":443542798,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzU0Mjc5OA==","user":{"login":"gloriousCode","id":9261323,"node_id":"MDQ6VXNlcjkyNjEzMjM=","avatar_url":"https://avatars1.githubusercontent.com/u/9261323?v=4","gravatar_id":"","url":"https://api.github.com/users/gloriousCode","html_url":"https://github.com/gloriousCode","followers_url":"https://api.github.com/users/gloriousCode/followers","following_url":"https://api.github.com/users/gloriousCode/following{/other_user}","gists_url":"https://api.github.com/users/gloriousCode/gists{/gist_id}","starred_url":"https://api.github.com/users/gloriousCode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gloriousCode/subscriptions","organizations_url":"https://api.github.com/users/gloriousCode/orgs","repos_url":"https://api.github.com/users/gloriousCode/repos","events_url":"https://api.github.com/users/gloriousCode/events{/privacy}","received_events_url":"https://api.github.com/users/gloriousCode/received_events","type":"User","site_admin":false},"created_at":"2018-12-02T21:15:51Z","updated_at":"2018-12-02T21:15:51Z","author_association":"COLLABORATOR","body":"We do need a way of uniquely identifying each order, orderID shouldn't be that thing though as we get orderIDs back from exchanges. \r\n\r\nI agree that a uuid would be a good way to resolve it, but I think orders.go may be getting removed when the [engine branch](https://github.com/thrasher-/gocryptotrader/tree/engine) is merged\r\n\r\n"}}
{"actor":{"display_login":"gloriousCode"}}