Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add trade-engine example #82

Merged
merged 20 commits into from
Dec 5, 2023
Merged

add trade-engine example #82

merged 20 commits into from
Dec 5, 2023

Conversation

AR1011
Copy link
Contributor

@AR1011 AR1011 commented Dec 3, 2023

adding simple example

Also add .DS_Store to gitignore

@perbu
Copy link
Collaborator

perbu commented Dec 4, 2023

Thanks for this. This is pretty cool. Just briefly looking at it, I see that the trade engine spins off a goroutine as a long running process. This seems problematic as there is no locking involved and you have to goroutines which both operate on the same data.

Wouldn't it make more sense to do the work in the receiver? This will mean that there'll be times where you won't be able to process requests while it is working, but that is a problem anyways.

Have you tried running it with the race flag enabled?

@AR1011
Copy link
Contributor Author

AR1011 commented Dec 4, 2023

Thanks @perbu , I have fixed the race condition so it should be ok now.

Let me know if there is anything else needed 👍

@perbu
Copy link
Collaborator

perbu commented Dec 4, 2023

@anthdm I think we should merge this. We need a couple of non-trivial examples anyways. My suggestion would be that we merge this, then start moving the examples into a new repo. Maybe also merge one of the websocket examples while we're at it.

perbu and others added 15 commits December 4, 2023 14:58
The commit updates the trade engine by replacing Unix timestamp format with Go's native time.Time. This affects order expiry and price update time tracking in the system. It's a better practice for readability and consistency in Go, and will also handle different time zones effectively. A logging line deemed excessively verbose was also commented out for cleanliness.
Copy link
Collaborator

@perbu perbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@anthdm anthdm merged commit b6373b0 into anthdm:master Dec 5, 2023
1 check passed
@AR1011 AR1011 deleted the trade-engine branch December 5, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants