alt/packages/domain/trading/account.go
toki c0db4b24c1 feat(live-trading): 계좌 동기화와 감사 추적을 추가한다
Live Trading Boundary의 남은 account-sync/audit-trail 작업을 완료해 운영자 headless workflow와 roadmap 완료 후보 상태를 함께 반영한다.
2026-06-08 11:18:41 +09:00

27 lines
993 B
Go

package trading
import "sort"
// SortCashBalances sorts cash balances by currency string for stable output.
// It modifies the slice in-place so snapshot serialisation is deterministic.
func SortCashBalances(balances []CashBalance) {
sort.Slice(balances, func(i, j int) bool {
return string(balances[i].Currency) < string(balances[j].Currency)
})
}
// SortPositionSnapshots sorts position snapshots by instrument ID for stable
// output. It modifies the slice in-place.
func SortPositionSnapshots(positions []PositionSnapshot) {
sort.Slice(positions, func(i, j int) bool {
return string(positions[i].InstrumentID) < string(positions[j].InstrumentID)
})
}
// HasRawAccountNumber returns false unconditionally; it documents the invariant
// that AccountSnapshot must never hold a raw broker account number. The raw
// account identifier is resolved inside the adapter and must not escape the
// BrokerPort boundary.
func HasRawAccountNumber(_ AccountSnapshot) bool {
return false
}