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:
+95
-8
@@ -29,8 +29,18 @@ type PositionsRequest struct {
|
||||
Cursor string
|
||||
}
|
||||
|
||||
// Position is one holding from get_equity_positions.
|
||||
type Position struct {
|
||||
Symbol string
|
||||
Qty decimal.Decimal
|
||||
AvgCost decimal.Decimal
|
||||
}
|
||||
|
||||
// PositionsResult is the parsed get_equity_positions payload.
|
||||
type PositionsResult struct{}
|
||||
type PositionsResult struct {
|
||||
Positions []Position
|
||||
NextCursor string
|
||||
}
|
||||
|
||||
// TaxLotsRequest is the argument set for get_equity_tax_lots.
|
||||
type TaxLotsRequest struct {
|
||||
@@ -39,8 +49,21 @@ type TaxLotsRequest struct {
|
||||
Cursor string
|
||||
}
|
||||
|
||||
// TaxLotRow is one open tax lot from get_equity_tax_lots.
|
||||
type TaxLotRow struct {
|
||||
OpenLotID string
|
||||
Quantity decimal.Decimal
|
||||
CostBasis decimal.Decimal
|
||||
AcquiredAt string
|
||||
Term string
|
||||
QuantityAvail decimal.Decimal
|
||||
}
|
||||
|
||||
// TaxLotsResult is the parsed get_equity_tax_lots payload.
|
||||
type TaxLotsResult struct{}
|
||||
type TaxLotsResult struct {
|
||||
Lots []TaxLotRow
|
||||
NextCursor string
|
||||
}
|
||||
|
||||
// QuotesRequest is the argument set for get_equity_quotes.
|
||||
type QuotesRequest struct {
|
||||
@@ -74,7 +97,10 @@ type OrdersRequest struct {
|
||||
}
|
||||
|
||||
// OrdersResult is the parsed get_equity_orders payload.
|
||||
type OrdersResult struct{}
|
||||
type OrdersResult struct {
|
||||
Orders []Order
|
||||
NextCursor string
|
||||
}
|
||||
|
||||
// TradabilityRequest is the argument set for get_equity_tradability.
|
||||
type TradabilityRequest struct {
|
||||
@@ -82,8 +108,17 @@ type TradabilityRequest struct {
|
||||
Symbols []string
|
||||
}
|
||||
|
||||
// SymbolTradability is per-symbol eligibility from get_equity_tradability.
|
||||
type SymbolTradability struct {
|
||||
Symbol string
|
||||
Tradable bool
|
||||
Fractional bool
|
||||
}
|
||||
|
||||
// TradabilityResult is the parsed get_equity_tradability payload.
|
||||
type TradabilityResult struct{}
|
||||
type TradabilityResult struct {
|
||||
Symbols []SymbolTradability
|
||||
}
|
||||
|
||||
// HistoricalsRequest is the argument set for get_equity_historicals.
|
||||
type HistoricalsRequest struct {
|
||||
@@ -115,16 +150,44 @@ type FundamentalsRequest struct {
|
||||
Bounds string
|
||||
}
|
||||
|
||||
// Fundamentals is one symbol's facts from get_equity_fundamentals.
|
||||
type Fundamentals struct {
|
||||
Symbol string
|
||||
AvgVolume decimal.Decimal
|
||||
InstrumentKind string
|
||||
MarketCap decimal.Decimal
|
||||
PE decimal.Decimal
|
||||
High52Week decimal.Decimal
|
||||
Low52Week decimal.Decimal
|
||||
}
|
||||
|
||||
// FundamentalsResult is the parsed get_equity_fundamentals payload.
|
||||
type FundamentalsResult struct{}
|
||||
type FundamentalsResult struct {
|
||||
Fundamentals []Fundamentals
|
||||
}
|
||||
|
||||
// PriceBookRequest is the argument set for get_equity_price_book.
|
||||
type PriceBookRequest struct {
|
||||
Symbols []string
|
||||
}
|
||||
|
||||
// BookLevel is one bid or ask rung.
|
||||
type BookLevel struct {
|
||||
Price decimal.Decimal
|
||||
Quantity decimal.Decimal
|
||||
}
|
||||
|
||||
// PriceBook is a Level-2 snapshot for one symbol.
|
||||
type PriceBook struct {
|
||||
Symbol string
|
||||
Bids []BookLevel
|
||||
Asks []BookLevel
|
||||
}
|
||||
|
||||
// PriceBookResult is the parsed get_equity_price_book payload.
|
||||
type PriceBookResult struct{}
|
||||
type PriceBookResult struct {
|
||||
Books []PriceBook
|
||||
}
|
||||
|
||||
// TechnicalIndicatorsRequest is the argument set for get_equity_technical_indicators.
|
||||
type TechnicalIndicatorsRequest struct {
|
||||
@@ -145,8 +208,20 @@ type TechnicalIndicatorsRequest struct {
|
||||
Method string
|
||||
}
|
||||
|
||||
// IndicatorPoint is one computed indicator bar.
|
||||
type IndicatorPoint struct {
|
||||
Time time.Time
|
||||
Value decimal.Decimal
|
||||
Upper decimal.Decimal
|
||||
Lower decimal.Decimal
|
||||
MACD decimal.Decimal
|
||||
Signal decimal.Decimal
|
||||
}
|
||||
|
||||
// TechnicalIndicatorsResult is the parsed get_equity_technical_indicators payload.
|
||||
type TechnicalIndicatorsResult struct{}
|
||||
type TechnicalIndicatorsResult struct {
|
||||
Points []IndicatorPoint
|
||||
}
|
||||
|
||||
// NewsRequest is the argument set for get_equity_news.
|
||||
type NewsRequest struct {
|
||||
@@ -155,8 +230,20 @@ type NewsRequest struct {
|
||||
Cursor string
|
||||
}
|
||||
|
||||
// NewsArticle is one article from get_equity_news.
|
||||
type NewsArticle struct {
|
||||
Title string
|
||||
URL string
|
||||
PublishedAt string
|
||||
Source string
|
||||
Summary string
|
||||
}
|
||||
|
||||
// NewsResult is the parsed get_equity_news payload.
|
||||
type NewsResult struct{}
|
||||
type NewsResult struct {
|
||||
Articles []NewsArticle
|
||||
NextCursor string
|
||||
}
|
||||
|
||||
// Positions calls get_equity_positions.
|
||||
func (c *Client) Positions(ctx context.Context, req PositionsRequest) (PositionsResult, error) {
|
||||
|
||||
Reference in New Issue
Block a user