Repository navigation
daytrader-go: trading - #8
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the trading area of DayTrader 3 to the Go + PostgreSQL target: buy, sell, portfolio and order completion. Only
daytrader-go/internal/features/trading/,daytrader-go/templates/trading_*.htmlandgo.mod/go.sum(AWS SDK v2 for SQS) are touched.What was ported
TradeServletAction.doBuy/doSell/doPortfoliobuy,sell,portfolioinhandlers.go, registered forbuy,sell,portfolio,portfolioNoEdgeTradeAction.buy/sell+TradeSLSBBean.buy/sell/createOrder/completeOrder/cancelOrder/queueOrder/updateQuotePriceVolumeserviceinservice.goorder.jsp,portfolio.jsptrading_order.html,trading_portfolio.htmlDTBroker3MDB+jms/TradeBrokerQueueorderConsumer+orderQueue(queue.go,sqs.go)Each trade is one
app.Store.InTx:Money is
decimal.Decimalthroughout.portfolio.jspprintsBigDecimal.toString(), so the page keeps the Java scale (9.00 x 10is90.00, an empty total is0).Async mode (off by default)
ORDER_PROCESSING_MODE=asyncleaves the orderopenand queues its id;orderConsumercompletes it in its own transaction.orderQueuehas two implementations:memoryQueue(tests, and async mode withoutORDER_QUEUE_URL) andsqsQueue(aws-sdk-go-v2/service/sqs, queue URL fromORDER_QUEUE_URL, default credential chain). The consumer is started without touching shared files: by the build function ofweb.RegisterRoute("GET /trading/orderQueue", ...)at start-up, and by the first handler call otherwise. That route answers with the mode, queue kind and whether the consumer runs. No test builds an AWS client; the SQS queue is tested against a fake.Verification (observed)
gofmt -l .empty,go vet ./...clean,go test ./...ok on this branch.TRADING_TEST_DATABASE_URL, private schema, skipped when unset): sync buy/sell, cancelled second sell, rollback on bad input, penny stock recovery, async buy/sell through the in-memory queue, rollback when the queue send fails. All pass against the compose database.make parity13/13.make parityprinted PASS for all 13 scenarios, including 05-buy, 06-sell, 07-portfolio, on a local throwaway branch (not pushed) that merged this branch withdevin/1794800000-go-auth,-go-account,-go-market,-go-restand-go-infraas they were on origin at that time.-go-testswas not on origin. This branch alone cannot run those scenarios (they need register, account and quotes).ORDER_PROCESSING_MODE=async, in-memory queue): the buy page showed the orderopen, and/daytrader/trading/orderQueuereported the consumer running. Nothing was sent to AWS.Deliberate differences from legacy
nulls.doBuywith a non-numeric quantity forwards to home once withillegal argument:; the legacy servlet dispatches to home and then again to the order page.updateQuotePriceVolumedoes not publish to the quote topic (PUBLISH_QUOTE_PRICE_CHANGEis off in the scaffold;DTStreamer3MDBis not part of this area).Scaffold requests
templates/layout.htmlwrapsAlert: The following Order(s) have completed.andfor a quote or to trade.over two lines. The parity harness compares text per line, so every page usingpageStart/pageEnddiffers from the recording (this failed 04 to 07 before the workaround).trading_layout.htmlholds copies of the three layout blocks with those texts on one line; fixlayout.htmland delete that file.storehas noFOR UPDATEreads and exports no order column list, so the trading package carries its ownSELECT ... FOR UPDATEstatements for quote, holding and order.context.Background()until the process exits.Apphas no start-up hook; aRegisterRoutebuild function is used as one.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/9173727a95744fa0b6726d9c6531e7bf
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/9173727a95744fa0b6726d9c6531e7bf?variant=devin
Requested by: @sumitshatwara