mirror of
https://github.com/luxfi/broker.git
synced 2026-09-24 00:25:18 +00:00
Same issue as snapshots — Alpaca sandbox returns 404 for
/v1beta3/crypto/us/{sym}/bars but works with
/v1beta3/crypto/us/bars?symbols={sym}. Also handle the wrapped
response format {"bars":{"BTC/USD":[...]}} vs stock {"bars":[...]}.
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
package compliance
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
// reportsHandler holds reports HTTP handler state.
|
|
type reportsHandler struct{}
|
|
|
|
// reportType describes an available report.
|
|
type reportType struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
LastGenerated string `json:"lastGenerated"`
|
|
}
|
|
|
|
func (h *reportsHandler) handleListReports(w http.ResponseWriter, r *http.Request) {
|
|
now := time.Now().UTC().Format(time.RFC3339)
|
|
reports := []reportType{
|
|
{
|
|
ID: "monthly-statement",
|
|
Name: "Monthly Statement",
|
|
Description: "Comprehensive monthly account statement with all activity",
|
|
LastGenerated: now,
|
|
},
|
|
{
|
|
ID: "form-8949",
|
|
Name: "Form 8949",
|
|
Description: "IRS Form 8949 for reporting capital gains and losses",
|
|
LastGenerated: now,
|
|
},
|
|
{
|
|
ID: "form-1099b",
|
|
Name: "1099-B",
|
|
Description: "Broker proceeds from securities and barter exchange transactions",
|
|
LastGenerated: now,
|
|
},
|
|
{
|
|
ID: "transaction-history",
|
|
Name: "Transaction History",
|
|
Description: "Complete transaction history export for audit and compliance",
|
|
LastGenerated: now,
|
|
},
|
|
}
|
|
writeJSON(w, http.StatusOK, reports)
|
|
}
|