Repository navigation
feat: Alpaca paper account portfolio with manual and automated trading - #66
Merged
Merged
Conversation
The Portfolio page now shows the real Alpaca paper account (cash, buying power, equity, positions) and submits paper market orders: manually from a trade form priced at the latest Alpaca trade, or automatically from an opt-in watcher that every five minutes picks the top gainer with a B+ market cap, runs one decision on it, and acts on the signal with the existing suggested sizing. An interactive equity chart records account snapshots with hover and keyboard inspection. The browser-local practice portfolio stays on the decision card; its fills export and reset move to a footer of the Portfolio page.
| try: | ||
| result = paper.overview() | ||
| except ValueError as exc: | ||
| return JSONResponse({'error': str(exc)}, status_code=503) |
| try: | ||
| result = await run_in_threadpool(paper.submit_order, body.symbol, body.side, body.quantity) | ||
| except ValueError as exc: | ||
| return JSONResponse({'error': str(exc)}, status_code=503) |
| try: | ||
| return await run_in_threadpool(paper.last_price, symbol) | ||
| except ValueError as exc: | ||
| return JSONResponse({'error': str(exc)}, status_code=503) |
| try: | ||
| result = paper.movers() | ||
| except ValueError as exc: | ||
| return JSONResponse({'error': str(exc)}, status_code=503) |
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
paper-api.alpaca.marketsusing the existingALPACA_API_KEY/ALPACA_SECRET_KEY; paper trading only, never live ordersNew backend module
fasttrade/paper.py(overview, last price, order submission, movers) routed through the shared pooled HTTP client and circuit breakers; loopback-only endpointsGET /api/paper/account,POST /api/paper/order,GET /api/paper/price,GET /api/paper/movers.Checks
Note:
docs/usage.mdwas updated locally butdocs/is intentionally untracked since 044bf04, so the doc edit stays out of the repo.