wwzeng1 / CoralME

A simple, fast and garbage-free matching engine order book that you can use as a starting point for your matching engines.
Apache License 2.0
0 stars 0 forks source link

Refactor Order-related enums into separate files #30

Closed sweep-nightly[bot] closed 3 weeks ago

sweep-nightly[bot] commented 3 weeks ago

Purpose

This pull request refactors the order-related enums from the Order class into separate files, improving code organization and maintainability.

This pull request was created to solve the following GitHub issue:

(Refactor) Move enums from Order.java to separate files and delete the enums from Order.java

Currently, several enums are defined within the Order.java file. To improve code organization and maintainability, move these enums to their own respective files.

Handle all imports and references in the files.

Enums to be moved (this is not an exhaustive list, please check for any additional enums): Remove the enums from the original Order.java file and move them to their own files.

  • CancelReason
  • ExecuteSide
  • RejectReason
  • Side
  • TimeInForce
  • Type

Currently, several enums are defined within the Order.java file. To improve code organization and maintainability, move these enums to their own respective files.

Handle all imports and references in the files.

Enums to be moved (this is not an exhaustive list, please check for any additional enums): Remove the enums from the original Order.java file and move them to their own files.

  • CancelReason
  • ExecuteSide
  • RejectReason
  • Side
  • TimeInForce
  • Type

Description

The following enums have been extracted from the Order class and placed into their own files:

Each enum now has its own file in the com.coralblocks.coralme package. The enums have been updated to implement the CharEnum interface and include a CharMap for efficient lookup. Additionally, some enums now include FIX protocol codes and utility methods.

The Order, OrderBook, and PriceLevel classes have been updated to use the new enum locations.

Summary

Fixes

Fixes #1. Continue the conversation here: http://localhost:3000/c/ce0c3577-095b-493b-b7aa-586c5fa6ff46.

To have Sweep make further changes, please add a comment to this PR starting with "Sweep:".

:book: For more information on how to use Sweep, please read our documentation.

Tracking ID: 3f9cfa39d6
sweep-nightly[bot] commented 3 weeks ago

❌ Error while fixing CI

Traceback (most recent call last):
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/backend/api.py", line 630, in commit_to_branch
    new_branch = create_branch_and_push_changes(repo=repo, repo_name=repo_name, access_token=access_token, branch=head_branch, file_changes=file_changes, base_branch=base_branch, title=commit_message, should_commit_to_branch=True)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/backend/api.py", line 709, in create_branch_and_push_changes
    commit_multi_file_changes(
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/core/github_utils.py", line 388, in commit_multi_file_changes
    blob = repo.create_git_blob(content, "utf-8")
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/github/Repository.py", line 1162, in create_git_blob
    headers, data = self._requester.requestJsonAndCheck("POST", f"{self.url}/git/blobs", input=post_parameters)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/github/Requester.py", line 537, in requestJsonAndCheck
    return self.__check(*self.requestJson(verb, url, parameters, headers, input, self.__customConnection(url)))
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/github/Requester.py", line 702, in requestJson
    return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/github/Requester.py", line 799, in __requestEncode
    status, responseHeaders, output = self.__requestRaw(cnx, verb, url, requestHeaders, encoded_input)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/github/Requester.py", line 833, in __requestRaw
    response = cnx.getresponse()
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/github/Requester.py", line 195, in getresponse
    r = verb(
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 537, in _make_request
    response = conn.getresponse()
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/.venv/lib/python3.10/site-packages/urllib3/connection.py", line 466, in getresponse
    httplib_response = super().getresponse()
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/http/client.py", line 1375, in getresponse
    response.begin()
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/ssl.py", line 1274, in recv_into
    return self.read(nbytes, buffer)
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/ssl.py", line 1130, in read
    return self._sslobj.read(len, buffer)
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/bdb.py", line 94, in trace_dispatch
    return self.dispatch_return(frame, arg)
  File "/Users/williamzeng/.local/share/uv/python/cpython-3.10.12-macos-aarch64-none/lib/python3.10/bdb.py", line 156, in dispatch_return
    if self.quitting: raise BdbQuit
bdb.BdbQuit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/handlers/fix_ci.py", line 442, in fix_ci_failures_once
    fix_issue_result = await fix_issue(
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/backend/api.py", line 1199, in fix_issue
    await commit_to_branch(
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/o11y/endpoint_wrapper.py", line 27, in wrapper
    raise http_exc
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/o11y/endpoint_wrapper.py", line 23, in wrapper
    result = await func(*args, **kwargs)
  File "/Users/williamzeng/Documents/GitHub/sweep-internal/sweepai/backend/api.py", line 649, in commit_to_branch
    raise HTTPException(
fastapi.exceptions.HTTPException: 500: 

500:

Sweep has encountered a runtime error unrelated to your request. Please let us know via this link or at support@sweep.dev directly.

:book: For more information on how to use Sweep, please read our documentation.

Tracking ID: 3f9cfa39d6-ci-1