fix: parse MCP result payloads and drop place idempotency_key

Typed result structs replace empty envelopes. Equity place sends
ref_id only so live additionalProperties:false schemas accept the call.
This commit is contained in:
2026-09-01 14:18:39 -05:00
parent f52a19181d
commit a6bf8632ce
22 changed files with 2225 additions and 74 deletions
+46 -5
View File
@@ -60,8 +60,20 @@ type RealizedPnLRequest struct {
Timezone string
}
// PnLBucket is one span bucket from get_realized_pnl.
type PnLBucket struct {
Label string
Amount decimal.Decimal
Percent decimal.Decimal
Trades int
}
// RealizedPnLResult is the parsed get_realized_pnl payload.
type RealizedPnLResult struct{}
type RealizedPnLResult struct {
Total decimal.Decimal
Percent decimal.Decimal
Buckets []PnLBucket
}
// PnLTradeHistoryRequest is the argument set for get_pnl_trade_history.
type PnLTradeHistoryRequest struct {
@@ -71,8 +83,20 @@ type PnLTradeHistoryRequest struct {
Cursor string
}
// PnLTrade is one realizing trade from get_pnl_trade_history.
type PnLTrade struct {
Symbol string
Side string
Quantity decimal.Decimal
Price decimal.Decimal
PnL decimal.Decimal
}
// PnLTradeHistoryResult is the parsed get_pnl_trade_history payload.
type PnLTradeHistoryResult struct{}
type PnLTradeHistoryResult struct {
Trades []PnLTrade
NextCursor string
}
// AccountNumberRequest is a single account_number argument.
type AccountNumberRequest struct {
@@ -80,10 +104,17 @@ type AccountNumberRequest struct {
}
// UpgradeInfoResult is the parsed upgrade-info payload.
type UpgradeInfoResult struct{}
type UpgradeInfoResult struct {
URL string
WebURL string
MobileURL string
}
// OnboardingInfoResult is the parsed crypto onboarding payload.
type OnboardingInfoResult struct{}
type OnboardingInfoResult struct {
URL string
WebURL string
}
// SearchRequest is the argument set for search.
type SearchRequest struct {
@@ -92,8 +123,18 @@ type SearchRequest struct {
Limit int
}
// SearchHit is one instrument/pair/index from search.
type SearchHit struct {
Symbol string
Name string
ID string
InstrumentID string
}
// SearchResult is the parsed search payload.
type SearchResult struct{}
type SearchResult struct {
Results []SearchHit
}
// Accounts calls get_accounts and returns every account (no IRA/margin filter).
func (c *Client) Accounts(ctx context.Context, req AccountsRequest) (AccountsResult, error) {