clearstreet

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

README

Clear Street Go API Library

Go Reference

The Clear Street Go library provides convenient access to the Clear Street REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/clear-street/clear-street-go" // imported as clearstreet
)

Or to pin the version:

go get -u 'github.com/clear-street/clear-street-go@v0.5.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/clear-street/clear-street-go"
	"github.com/clear-street/clear-street-go/option"
)

func main() {
	client := clearstreet.NewClient(
		option.WithAPIKey("My API Key"),
		option.WithEnvironmentStaging(), // defaults to option.WithEnvironmentProduction()
	)
	response, err := client.V1.Accounts.GetAccounts(context.TODO(), clearstreet.V1AccountGetAccountsParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response)
}

Request fields

The clearstreet library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `api:"required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, clearstreet.String(string), clearstreet.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := clearstreet.ExampleParams{
	ID:   "id_xxx",                  // required property
	Name: clearstreet.String("..."), // optional property

	Point: clearstreet.Point{
		X: 0,                  // required field will serialize as 0
		Y: clearstreet.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: clearstreet.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[clearstreet.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := clearstreet.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.V1.Accounts.GetAccounts(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *clearstreet.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.V1.Accounts.GetAccounts(context.TODO(), clearstreet.V1AccountGetAccountsParams{})
if err != nil {
	var apierr *clearstreet.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/accounts": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.V1.Accounts.GetAccounts(
	ctx,
	clearstreet.V1AccountGetAccountsParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper clearstreet.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := clearstreet.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.V1.Accounts.GetAccounts(
	context.TODO(),
	clearstreet.V1AccountGetAccountsParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
response, err := client.V1.Accounts.GetAccounts(
	context.TODO(),
	clearstreet.V1AccountGetAccountsParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", response)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: clearstreet.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := clearstreet.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (CLEAR_STREET_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type APIError

type APIError = shared.APIError

A direct mapping of tonic::Status, for use in HTTP responses.

This is an alias to an internal type.

type Account

type Account struct {
	// The unique identifier for the account
	ID int64 `json:"id" api:"required"`
	// The account holder entity identifier
	AccountHolderEntityID int64 `json:"account_holder_entity_id" api:"required"`
	// The full legal name of the account
	FullName string `json:"full_name" api:"required"`
	// The date the account was opened
	OpenDate time.Time `json:"open_date" api:"required" format:"date"`
	// The options level of the account
	OptionsLevel int64 `json:"options_level" api:"required"`
	// The short name of the account
	ShortName string `json:"short_name" api:"required"`
	// The current status of the account
	//
	// Any of "ACTIVE", "INACTIVE", "CLOSED".
	Status AccountStatus `json:"status" api:"required"`
	// The sub-type of account
	//
	// Any of "CASH", "MARGIN", "OTHER".
	Subtype AccountSubtype `json:"subtype" api:"required"`
	// The type of account
	//
	// Any of "CUSTOMER", "OTHER".
	Type AccountType `json:"type" api:"required"`
	// The date the account was closed, if applicable
	CloseDate time.Time `json:"close_date" api:"nullable" format:"date"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		AccountHolderEntityID respjson.Field
		FullName              respjson.Field
		OpenDate              respjson.Field
		OptionsLevel          respjson.Field
		ShortName             respjson.Field
		Status                respjson.Field
		Subtype               respjson.Field
		Type                  respjson.Field
		CloseDate             respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a trading account

func (Account) RawJSON

func (r Account) RawJSON() string

Returns the unmodified JSON received from the API

func (*Account) UnmarshalJSON

func (r *Account) UnmarshalJSON(data []byte) error

type AccountBalances

type AccountBalances struct {
	// The unique identifier for the account
	AccountID int64 `json:"account_id" api:"required"`
	// The total buying power available in the account.
	BuyingPower string `json:"buying_power" api:"required"`
	// Currency identifier for all monetary values.
	Currency string `json:"currency" api:"required"`
	// Realized profit or loss since start of day.
	DailyRealizedPnl string `json:"daily_realized_pnl" api:"required"`
	// Total profit or loss since start of day.
	DailyTotalPnl string `json:"daily_total_pnl" api:"required"`
	// Total unrealized profit or loss across all positions relative to prior close.
	DailyUnrealizedPnl string `json:"daily_unrealized_pnl" api:"required"`
	// The total equity in the account.
	Equity string `json:"equity" api:"required"`
	// The total market value of all long positions.
	LongMarketValue string `json:"long_market_value" api:"required"`
	// The applicable margin model for the account
	//
	// Any of "OTHER", "NONE", "PORTFOLIO_MARGIN", "RISK_BASED_HAIRCUT_BROKER_DEALER",
	// "REG_T", "RISK_BASED_HAIRCUT_MARKET_MAKER", "CIRO", "FUTURES_NLV",
	// "FUTURES_TOT_EQ".
	MarginType MarginType `json:"margin_type" api:"required"`
	// Signed buying-power correction from open orders.
	OpenOrderAdjustment string `json:"open_order_adjustment" api:"required"`
	// The amount of cash that is settled and available for withdrawal or trading.
	SettledCash string `json:"settled_cash" api:"required"`
	// Start-of-day snapshot balances.
	Sod AccountBalancesSod `json:"sod" api:"required"`
	// Trade-date effective cash.
	TradeCash string `json:"trade_cash" api:"required"`
	// Trade-date unsettled cash credits.
	UnsettledCredits string `json:"unsettled_credits" api:"required"`
	// Trade-date unsettled cash debits.
	UnsettledDebits string `json:"unsettled_debits" api:"required"`
	// The amount of cash currently available to withdraw.
	WithdrawableCash string `json:"withdrawable_cash" api:"required"`
	// Margin-account-only details.
	MarginDetails MarginDetails `json:"margin_details" api:"nullable"`
	// Applied multiplier for margin calculations.
	Multiplier string `json:"multiplier" api:"nullable"`
	// The total market value of all short positions.
	ShortMarketValue string `json:"short_market_value" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountID           respjson.Field
		BuyingPower         respjson.Field
		Currency            respjson.Field
		DailyRealizedPnl    respjson.Field
		DailyTotalPnl       respjson.Field
		DailyUnrealizedPnl  respjson.Field
		Equity              respjson.Field
		LongMarketValue     respjson.Field
		MarginType          respjson.Field
		OpenOrderAdjustment respjson.Field
		SettledCash         respjson.Field
		Sod                 respjson.Field
		TradeCash           respjson.Field
		UnsettledCredits    respjson.Field
		UnsettledDebits     respjson.Field
		WithdrawableCash    respjson.Field
		MarginDetails       respjson.Field
		Multiplier          respjson.Field
		ShortMarketValue    respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents the balance details for a trading account

func (AccountBalances) RawJSON

func (r AccountBalances) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccountBalances) UnmarshalJSON

func (r *AccountBalances) UnmarshalJSON(data []byte) error

type AccountBalancesSod

type AccountBalancesSod struct {
	// Start-of-day buying power.
	BuyingPower string `json:"buying_power" api:"required"`
	// Start-of-day equity.
	Equity string `json:"equity" api:"required"`
	// Start-of-day long market value.
	LongMarketValue string `json:"long_market_value" api:"required"`
	// Start-of-day short market value.
	ShortMarketValue string `json:"short_market_value" api:"required"`
	// Timestamp for the start-of-day values.
	Asof time.Time `json:"asof" api:"nullable" format:"date"`
	// Start-of-day day-trade buying power.
	DayTradeBuyingPower string `json:"day_trade_buying_power" api:"nullable"`
	// Start-of-day maintenance margin excess.
	MaintenanceMarginExcess string `json:"maintenance_margin_excess" api:"nullable"`
	// Start-of-day maintenance margin requirement.
	MaintenanceMarginRequirement string `json:"maintenance_margin_requirement" api:"nullable"`
	// Start-of-day trade cash.
	TradeCash string `json:"trade_cash" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BuyingPower                  respjson.Field
		Equity                       respjson.Field
		LongMarketValue              respjson.Field
		ShortMarketValue             respjson.Field
		Asof                         respjson.Field
		DayTradeBuyingPower          respjson.Field
		MaintenanceMarginExcess      respjson.Field
		MaintenanceMarginRequirement respjson.Field
		TradeCash                    respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccountBalancesSod) RawJSON

func (r AccountBalancesSod) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccountBalancesSod) UnmarshalJSON

func (r *AccountBalancesSod) UnmarshalJSON(data []byte) error

type AccountList

type AccountList []Account

type AccountSettings

type AccountSettings struct {
	// Risk settings for the account
	Risk RiskSettings `json:"risk" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Risk        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccountSettings) RawJSON

func (r AccountSettings) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccountSettings) UnmarshalJSON

func (r *AccountSettings) UnmarshalJSON(data []byte) error

type AccountStatus

type AccountStatus string

Account status

const (
	AccountStatusActive   AccountStatus = "ACTIVE"
	AccountStatusInactive AccountStatus = "INACTIVE"
	AccountStatusClosed   AccountStatus = "CLOSED"
)

type AccountSubtype added in v0.3.0

type AccountSubtype string

Account subtype classification providing more granular categorization

const (
	AccountSubtypeCash   AccountSubtype = "CASH"
	AccountSubtypeMargin AccountSubtype = "MARGIN"
	AccountSubtypeOther  AccountSubtype = "OTHER"
)

type AccountType added in v0.3.0

type AccountType string

Account type classification

const (
	AccountTypeCustomer AccountType = "CUSTOMER"
	AccountTypeOther    AccountType = "OTHER"
)

type ActionButton added in v0.2.0

type ActionButton struct {
	// Stable button identifier within the content part.
	ButtonID string `json:"buttonId" api:"required"`
	// User-visible label.
	Label string `json:"label" api:"required"`
	// Follow-up prompt to submit as the next user message.
	Prompt PromptButtonAction `json:"prompt" api:"nullable"`
	// Structured action in the same message to execute on click.
	StructuredAction StructuredActionButtonAction `json:"structuredAction" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ButtonID         respjson.Field
		Label            respjson.Field
		Prompt           respjson.Field
		StructuredAction respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Button metadata shared by chart and suggested-actions payloads.

func (ActionButton) RawJSON added in v0.2.0

func (r ActionButton) RawJSON() string

Returns the unmodified JSON received from the API

func (*ActionButton) UnmarshalJSON added in v0.2.0

func (r *ActionButton) UnmarshalJSON(data []byte) error

type AddWatchlistItemData

type AddWatchlistItemData struct {
	// ID of the created item
	ItemID string `json:"item_id" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ItemID      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response data for adding a watchlist item

func (AddWatchlistItemData) RawJSON

func (r AddWatchlistItemData) RawJSON() string

Returns the unmodified JSON received from the API

func (*AddWatchlistItemData) UnmarshalJSON

func (r *AddWatchlistItemData) UnmarshalJSON(data []byte) error

type AllEventsEventType

type AllEventsEventType string

Event types supported by the all-events endpoint.

const (
	AllEventsEventTypeEarnings   AllEventsEventType = "EARNINGS"
	AllEventsEventTypeDividend   AllEventsEventType = "DIVIDEND"
	AllEventsEventTypeStockSplit AllEventsEventType = "STOCK_SPLIT"
	AllEventsEventTypeIpo        AllEventsEventType = "IPO"
)

type AnalystDistribution

type AnalystDistribution struct {
	// Number of buy recommendations
	Buy int64 `json:"buy" api:"required"`
	// Number of hold recommendations
	Hold int64 `json:"hold" api:"required"`
	// Number of sell recommendations
	Sell int64 `json:"sell" api:"required"`
	// Number of strong buy recommendations
	StrongBuy int64 `json:"strong_buy" api:"required"`
	// Number of strong sell recommendations
	StrongSell int64 `json:"strong_sell" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buy         respjson.Field
		Hold        respjson.Field
		Sell        respjson.Field
		StrongBuy   respjson.Field
		StrongSell  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Analyst recommendation distribution

func (AnalystDistribution) RawJSON

func (r AnalystDistribution) RawJSON() string

Returns the unmodified JSON received from the API

func (*AnalystDistribution) UnmarshalJSON

func (r *AnalystDistribution) UnmarshalJSON(data []byte) error

type AnalystRating

type AnalystRating string

Analyst rating category

const (
	AnalystRatingStrongBuy  AnalystRating = "STRONG_BUY"
	AnalystRatingBuy        AnalystRating = "BUY"
	AnalystRatingHold       AnalystRating = "HOLD"
	AnalystRatingSell       AnalystRating = "SELL"
	AnalystRatingStrongSell AnalystRating = "STRONG_SELL"
)

type BaseResponse

type BaseResponse = shared.BaseResponse

This is an alias to an internal type.

type CancelOrderRequest added in v0.4.0

type CancelOrderRequest struct {
	// Account ID (from path parameter)
	AccountID int64 `json:"account_id" api:"required"`
	// Order ID to cancel (from path parameter)
	OrderID string `json:"order_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountID   respjson.Field
		OrderID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Request to cancel an existing order

Note: In the API, order cancellation is done via DELETE request without a body. The order_id and account_id come from the URL path parameters.

func (CancelOrderRequest) RawJSON added in v0.4.0

func (r CancelOrderRequest) RawJSON() string

Returns the unmodified JSON received from the API

func (*CancelOrderRequest) UnmarshalJSON added in v0.4.0

func (r *CancelOrderRequest) UnmarshalJSON(data []byte) error

type CancelResponsePayload

type CancelResponsePayload struct {
	Canceled bool `json:"canceled" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Canceled    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CancelResponsePayload) RawJSON

func (r CancelResponsePayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*CancelResponsePayload) UnmarshalJSON

func (r *CancelResponsePayload) UnmarshalJSON(data []byte) error

type ChartPayload added in v0.2.0

type ChartPayload struct {
	// Stable chart identifier scoped to the content part.
	ChartID string `json:"chartId" api:"required"`
	// Buttons associated with this chart.
	ActionButtons []ActionButton `json:"actionButtons"`
	// Explicit series-driven chart definition.
	DataChart DataChart `json:"dataChart" api:"nullable"`
	// Symbol-driven chart definition.
	SymbolChart SymbolChart `json:"symbolChart" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ChartID       respjson.Field
		ActionButtons respjson.Field
		DataChart     respjson.Field
		SymbolChart   respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Typed chart payload rendered inline in assistant content.

func (ChartPayload) RawJSON added in v0.2.0

func (r ChartPayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChartPayload) UnmarshalJSON added in v0.2.0

func (r *ChartPayload) UnmarshalJSON(data []byte) error

type ChartPoint added in v0.2.0

type ChartPoint struct {
	X string  `json:"x" api:"required"`
	Y float64 `json:"y" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		X           respjson.Field
		Y           respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Single chart coordinate.

func (ChartPoint) RawJSON added in v0.2.0

func (r ChartPoint) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChartPoint) UnmarshalJSON added in v0.2.0

func (r *ChartPoint) UnmarshalJSON(data []byte) error

type ChartSeries added in v0.2.0

type ChartSeries struct {
	Name   string       `json:"name" api:"required"`
	Points []ChartPoint `json:"points"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Points      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Named data series within a chart.

func (ChartSeries) RawJSON added in v0.2.0

func (r ChartSeries) RawJSON() string

Returns the unmodified JSON received from the API

func (*ChartSeries) UnmarshalJSON added in v0.2.0

func (r *ChartSeries) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	V1 V1Service
	// contains filtered or unexported fields
}

Client creates a struct with services and top level methods that help with interacting with the clear-street API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (CLEAR_STREET_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type ClockDetail

type ClockDetail struct {
	// Current server time in UTC
	Clock time.Time `json:"clock" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Clock       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Current server time and market clock information

func (ClockDetail) RawJSON

func (r ClockDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*ClockDetail) UnmarshalJSON

func (r *ClockDetail) UnmarshalJSON(data []byte) error

type ContentPartChartPayload

type ContentPartChartPayload struct {
	// Typed chart payload rendered inline in assistant content.
	Payload ChartPayload `json:"payload" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Payload     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Chart payload content part.

func (ContentPartChartPayload) RawJSON

func (r ContentPartChartPayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContentPartChartPayload) UnmarshalJSON

func (r *ContentPartChartPayload) UnmarshalJSON(data []byte) error

type ContentPartCustomPayload

type ContentPartCustomPayload struct {
	Payload any `json:"payload" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Payload     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Escape-hatch custom payload content part.

func (ContentPartCustomPayload) RawJSON

func (r ContentPartCustomPayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContentPartCustomPayload) UnmarshalJSON

func (r *ContentPartCustomPayload) UnmarshalJSON(data []byte) error

type ContentPartStructuredActionPayload

type ContentPartStructuredActionPayload struct {
	// Structured actions that Omni AI can return to clients.
	//
	// These actions provide machine-readable instructions for the client to execute,
	// such as prefilling an order ticket, opening a chart, or navigating to a route.
	Action   StructuredActionUnion `json:"action" api:"required"`
	ActionID string                `json:"action_id" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Action      respjson.Field
		ActionID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Structured action content part.

func (ContentPartStructuredActionPayload) RawJSON

Returns the unmodified JSON received from the API

func (*ContentPartStructuredActionPayload) UnmarshalJSON

func (r *ContentPartStructuredActionPayload) UnmarshalJSON(data []byte) error

type ContentPartSuggestedActionsPayload

type ContentPartSuggestedActionsPayload struct {
	// Suggested follow-up buttons rendered at the end of an assistant message.
	Payload SuggestedActionsPayload `json:"payload" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Payload     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Suggested actions payload content part.

func (ContentPartSuggestedActionsPayload) RawJSON

Returns the unmodified JSON received from the API

func (*ContentPartSuggestedActionsPayload) UnmarshalJSON

func (r *ContentPartSuggestedActionsPayload) UnmarshalJSON(data []byte) error

type ContentPartTextPayload

type ContentPartTextPayload struct {
	Text string `json:"text" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Text content part.

func (ContentPartTextPayload) RawJSON

func (r ContentPartTextPayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContentPartTextPayload) UnmarshalJSON

func (r *ContentPartTextPayload) UnmarshalJSON(data []byte) error

type ContentPartThinkingPayload

type ContentPartThinkingPayload struct {
	Thoughts []string `json:"thoughts" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Thoughts    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Thinking content part shown on dynamic response polling.

func (ContentPartThinkingPayload) RawJSON

func (r ContentPartThinkingPayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContentPartThinkingPayload) UnmarshalJSON

func (r *ContentPartThinkingPayload) UnmarshalJSON(data []byte) error

type ContractType

type ContractType string

The type of options contract

const (
	ContractTypeCall ContractType = "CALL"
	ContractTypePut  ContractType = "PUT"
)

type CreateFeedbackResponse

type CreateFeedbackResponse struct {
	CreatedAt  string `json:"created_at" api:"required"`
	FeedbackID string `json:"feedback_id" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		FeedbackID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CreateFeedbackResponse) RawJSON

func (r CreateFeedbackResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreateFeedbackResponse) UnmarshalJSON

func (r *CreateFeedbackResponse) UnmarshalJSON(data []byte) error

type CreateMessageResponse

type CreateMessageResponse struct {
	ResponseID    string `json:"response_id" api:"required" format:"uuid"`
	ThreadID      string `json:"thread_id" api:"required" format:"uuid"`
	UserMessageID string `json:"user_message_id" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ResponseID    respjson.Field
		ThreadID      respjson.Field
		UserMessageID respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response payload for continuing a thread with a new message.

func (CreateMessageResponse) RawJSON

func (r CreateMessageResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreateMessageResponse) UnmarshalJSON

func (r *CreateMessageResponse) UnmarshalJSON(data []byte) error

type CreateThreadResponse

type CreateThreadResponse struct {
	ResponseID    string `json:"response_id" api:"required" format:"uuid"`
	ThreadID      string `json:"thread_id" api:"required" format:"uuid"`
	UserMessageID string `json:"user_message_id" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ResponseID    respjson.Field
		ThreadID      respjson.Field
		UserMessageID respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response payload for thread creation.

func (CreateThreadResponse) RawJSON

func (r CreateThreadResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreateThreadResponse) UnmarshalJSON

func (r *CreateThreadResponse) UnmarshalJSON(data []byte) error

type DailySummary added in v0.2.0

type DailySummary struct {
	// OEMS instrument identifier. Always populated; echoes the request ID.
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Session high.
	High string `json:"high" api:"nullable"`
	// Session low.
	Low string `json:"low" api:"nullable"`
	// Opening price for the session.
	Open string `json:"open" api:"nullable"`
	// Display symbol for the security. `None` for unresolvable IDs.
	Symbol string `json:"symbol" api:"nullable"`
	// Session date the OHLV represents, US/Eastern.
	TradeDate time.Time `json:"trade_date" api:"nullable" format:"date"`
	// Session cumulative trading volume.
	Volume int64 `json:"volume" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InstrumentID respjson.Field
		High         respjson.Field
		Low          respjson.Field
		Open         respjson.Field
		Symbol       respjson.Field
		TradeDate    respjson.Field
		Volume       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Daily aggregate (OHLV) summary for a single instrument.

Returned by `GET /market-data/daily-summary`. Every field except `instrument_id` is `Option`:

  • Unresolvable `instrument_id` → all other fields `None` (including `symbol`).
  • Resolvable `instrument_id` with no realtime cache entry → `symbol` populated, OHLV/`trade_date` `None`.
  • `trade_date` reflects the session the OHLV represents (today during trading hours, the last trading date during weekends/holidays).

func (DailySummary) RawJSON added in v0.2.0

func (r DailySummary) RawJSON() string

Returns the unmodified JSON received from the API

func (*DailySummary) UnmarshalJSON added in v0.2.0

func (r *DailySummary) UnmarshalJSON(data []byte) error

type DailySummaryList added in v0.2.0

type DailySummaryList []DailySummary

type DataChart added in v0.2.0

type DataChart struct {
	Series []ChartSeries `json:"series"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Series      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Chart represented by explicit data series.

func (DataChart) RawJSON added in v0.2.0

func (r DataChart) RawJSON() string

Returns the unmodified JSON received from the API

func (*DataChart) UnmarshalJSON added in v0.2.0

func (r *DataChart) UnmarshalJSON(data []byte) error

type DayType

type DayType string

Day type for market hours - indicates the type of trading day

const (
	DayTypeTradingDay DayType = "TRADING_DAY"
	DayTypeEarlyClose DayType = "EARLY_CLOSE"
	DayTypeHoliday    DayType = "HOLIDAY"
	DayTypeWeekend    DayType = "WEEKEND"
)

type DeleteEntitlementResponse added in v0.2.0

type DeleteEntitlementResponse struct {
	EntitlementID string `json:"entitlement_id" api:"required"`
	Revoked       bool   `json:"revoked" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EntitlementID respjson.Field
		Revoked       respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (DeleteEntitlementResponse) RawJSON added in v0.2.0

func (r DeleteEntitlementResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*DeleteEntitlementResponse) UnmarshalJSON added in v0.2.0

func (r *DeleteEntitlementResponse) UnmarshalJSON(data []byte) error

type EntitlementAgreementKey added in v0.4.0

type EntitlementAgreementKey string

Stable entitlement agreement family key.

const (
	EntitlementAgreementKeyOmniAccountDataAccess EntitlementAgreementKey = "omni_account_data_access"
)

type EntitlementAgreementResource added in v0.2.0

type EntitlementAgreementResource struct {
	AgreementID string `json:"agreement_id" api:"required"`
	// Stable entitlement agreement family key.
	//
	// Any of "omni_account_data_access".
	AgreementKey     EntitlementAgreementKey `json:"agreement_key" api:"required"`
	DocumentContent  string                  `json:"document_content" api:"required"`
	DocumentSha256   string                  `json:"document_sha256" api:"required"`
	EntitlementCodes []EntitlementCode       `json:"entitlement_codes" api:"required"`
	Title            string                  `json:"title" api:"required"`
	Version          int64                   `json:"version" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AgreementID      respjson.Field
		AgreementKey     respjson.Field
		DocumentContent  respjson.Field
		DocumentSha256   respjson.Field
		EntitlementCodes respjson.Field
		Title            respjson.Field
		Version          respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EntitlementAgreementResource) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*EntitlementAgreementResource) UnmarshalJSON added in v0.2.0

func (r *EntitlementAgreementResource) UnmarshalJSON(data []byte) error

type EntitlementAgreementResourceList added in v0.2.0

type EntitlementAgreementResourceList []EntitlementAgreementResource

type EntitlementCode added in v0.4.0

type EntitlementCode string

Stable entitlement code granted by an agreement.

const (
	EntitlementCodeOmniAccountData EntitlementCode = "omni.account_data"
)

type EntitlementResource added in v0.2.0

type EntitlementResource struct {
	AgreementID string `json:"agreement_id" api:"required"`
	// Stable entitlement code granted by an agreement.
	//
	// Any of "omni.account_data".
	EntitlementCode  EntitlementCode `json:"entitlement_code" api:"required"`
	EntitlementID    string          `json:"entitlement_id" api:"required"`
	GrantedAt        string          `json:"granted_at" api:"required"`
	TradingAccountID int64           `json:"trading_account_id" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AgreementID      respjson.Field
		EntitlementCode  respjson.Field
		EntitlementID    respjson.Field
		GrantedAt        respjson.Field
		TradingAccountID respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (EntitlementResource) RawJSON added in v0.2.0

func (r EntitlementResource) RawJSON() string

Returns the unmodified JSON received from the API

func (*EntitlementResource) UnmarshalJSON added in v0.2.0

func (r *EntitlementResource) UnmarshalJSON(data []byte) error

type EntitlementResourceList added in v0.2.0

type EntitlementResourceList []EntitlementResource

type Error

type Error = apierror.Error

type ErrorStatus

type ErrorStatus struct {
	Code    string `json:"code" api:"required"`
	Message string `json:"message" api:"required"`
	Details any    `json:"details" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code        respjson.Field
		Message     respjson.Field
		Details     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Shared sanitized error payload.

func (ErrorStatus) RawJSON

func (r ErrorStatus) RawJSON() string

Returns the unmodified JSON received from the API

func (*ErrorStatus) UnmarshalJSON

func (r *ErrorStatus) UnmarshalJSON(data []byte) error

type ExerciseStyle

type ExerciseStyle string

The exercise style of an options contract

const (
	ExerciseStyleAmerican ExerciseStyle = "AMERICAN"
	ExerciseStyleEuropean ExerciseStyle = "EUROPEAN"
)

type FiscalPeriodType added in v0.3.0

type FiscalPeriodType string

Fiscal period type for earnings reports

const (
	FiscalPeriodTypeQuarterly FiscalPeriodType = "QUARTERLY"
	FiscalPeriodTypeAnnual    FiscalPeriodType = "ANNUAL"
	FiscalPeriodTypeTtm       FiscalPeriodType = "TTM"
	FiscalPeriodTypeBiannual  FiscalPeriodType = "BIANNUAL"
)

type Instrument

type Instrument struct {
	// Unique OEMS instrument identifier (UUID)
	ID string `json:"id" api:"required" format:"uuid"`
	// The ISO country code of the instrument's issue
	CountryOfIssue string `json:"country_of_issue" api:"required"`
	// The ISO currency code in which the instrument is traded
	Currency string `json:"currency" api:"required"`
	// Indicates if the instrument is classified as Easy-To-Borrow
	EasyToBorrow bool `json:"easy_to_borrow" api:"required"`
	// Indicates if the instrument is liquidation only and cannot be bought
	IsLiquidationOnly bool `json:"is_liquidation_only" api:"required"`
	// Indicates if the instrument is marginable
	IsMarginable bool `json:"is_marginable" api:"required"`
	// Indicates if the instrument is restricted from trading
	IsRestricted bool `json:"is_restricted" api:"required"`
	// Indicates if short selling is prohibited for the instrument
	IsShortProhibited bool `json:"is_short_prohibited" api:"required"`
	// Indicates if the instrument is on the Regulation SHO Threshold Security List
	IsThresholdSecurity bool `json:"is_threshold_security" api:"required"`
	// Indicates if the instrument is tradable
	IsTradable bool `json:"is_tradable" api:"required"`
	// The trading symbol for the instrument
	Symbol string `json:"symbol" api:"required"`
	// The MIC code of the primary listing venue
	Venue string `json:"venue" api:"required"`
	// Average daily share volume from the security definition.
	Adv string `json:"adv" api:"nullable"`
	// The expiration date for options instruments
	Expiry time.Time `json:"expiry" api:"nullable" format:"date"`
	// The type of security (e.g., Common Stock, ETF)
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type" api:"nullable"`
	// The percent of a long position's value you must post as margin
	LongMarginRate string `json:"long_margin_rate" api:"nullable"`
	// The full name of the instrument or its issuer
	Name string `json:"name" api:"nullable"`
	// Notional ADV (`adv × previous_close`). The primary liquidity signal used by
	// `/instruments/search` ranking. Computed at response time so it stays consistent
	// with whatever `adv` and `previous_close` show.
	NotionalAdv string `json:"notional_adv" api:"nullable"`
	// Available options expiration dates for this instrument. Present only when
	// `include_options_expiry_dates=true` in the request.
	OptionsExpiryDates []time.Time `json:"options_expiry_dates" api:"nullable" format:"date"`
	// Last close price from the security definition.
	PreviousClose string `json:"previous_close" api:"nullable"`
	// The percent of a short position's value you must post as margin
	ShortMarginRate string `json:"short_margin_rate" api:"nullable"`
	// The strike price for options instruments
	StrikePrice string `json:"strike_price" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		CountryOfIssue      respjson.Field
		Currency            respjson.Field
		EasyToBorrow        respjson.Field
		IsLiquidationOnly   respjson.Field
		IsMarginable        respjson.Field
		IsRestricted        respjson.Field
		IsShortProhibited   respjson.Field
		IsThresholdSecurity respjson.Field
		IsTradable          respjson.Field
		Symbol              respjson.Field
		Venue               respjson.Field
		Adv                 respjson.Field
		Expiry              respjson.Field
		InstrumentType      respjson.Field
		LongMarginRate      respjson.Field
		Name                respjson.Field
		NotionalAdv         respjson.Field
		OptionsExpiryDates  respjson.Field
		PreviousClose       respjson.Field
		ShortMarginRate     respjson.Field
		StrikePrice         respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a tradable financial instrument.

func (Instrument) RawJSON

func (r Instrument) RawJSON() string

Returns the unmodified JSON received from the API

func (*Instrument) UnmarshalJSON

func (r *Instrument) UnmarshalJSON(data []byte) error

type InstrumentAllEventsData

type InstrumentAllEventsData struct {
	// Events grouped by date in descending order.
	EventDates []InstrumentEventsByDate `json:"event_dates" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EventDates  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

All-events payload grouped by date.

func (InstrumentAllEventsData) RawJSON

func (r InstrumentAllEventsData) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentAllEventsData) UnmarshalJSON

func (r *InstrumentAllEventsData) UnmarshalJSON(data []byte) error

type InstrumentAnalystConsensus

type InstrumentAnalystConsensus struct {
	// The date the consensus snapshot was generated
	Date time.Time `json:"date" api:"required" format:"date"`
	// Count of individual analyst recommendations by category
	Distribution AnalystDistribution `json:"distribution" api:"nullable"`
	// Aggregated analyst price target statistics
	PriceTarget PriceTarget `json:"price_target" api:"nullable"`
	// Consensus analyst rating
	//
	// Any of "STRONG_BUY", "BUY", "HOLD", "SELL", "STRONG_SELL".
	Rating AnalystRating `json:"rating" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Date         respjson.Field
		Distribution respjson.Field
		PriceTarget  respjson.Field
		Rating       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Aggregated analyst consensus metrics

func (InstrumentAnalystConsensus) RawJSON

func (r InstrumentAnalystConsensus) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentAnalystConsensus) UnmarshalJSON

func (r *InstrumentAnalystConsensus) UnmarshalJSON(data []byte) error

type InstrumentBalanceSheetStatement added in v0.3.0

type InstrumentBalanceSheetStatement struct {
	// The date and time when the filing was accepted by the SEC
	AcceptedDate time.Time `json:"accepted_date" api:"required" format:"date-time"`
	// The date the financial statement was filed
	FilingDate time.Time `json:"filing_date" api:"required" format:"date"`
	// The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4")
	Period string `json:"period" api:"required"`
	// The type of fiscal period
	//
	// Any of "QUARTERLY", "ANNUAL", "TTM", "BIANNUAL".
	PeriodType FiscalPeriodType `json:"period_type" api:"required"`
	// The currency in which the statement is reported (ISO 4217)
	ReportedCurrency string `json:"reported_currency" api:"required"`
	// The fiscal year of the statement
	Year int64 `json:"year" api:"required"`
	// Account payables
	AccountPayables string `json:"account_payables" api:"nullable"`
	// Accounts receivables
	AccountsReceivables string `json:"accounts_receivables" api:"nullable"`
	// Accrued expenses
	AccruedExpenses string `json:"accrued_expenses" api:"nullable"`
	// Accumulated other comprehensive income/loss
	AccumulatedOtherComprehensiveIncomeLoss string `json:"accumulated_other_comprehensive_income_loss" api:"nullable"`
	// Additional paid-in capital
	AdditionalPaidInCapital string `json:"additional_paid_in_capital" api:"nullable"`
	// Capital lease obligations (total)
	CapitalLeaseObligations string `json:"capital_lease_obligations" api:"nullable"`
	// Capital lease obligations (current portion)
	CapitalLeaseObligationsCurrent string `json:"capital_lease_obligations_current" api:"nullable"`
	// Cash and cash equivalents
	CashAndCashEquivalents string `json:"cash_and_cash_equivalents" api:"nullable"`
	// Cash and short-term investments combined
	CashAndShortTermInvestments string `json:"cash_and_short_term_investments" api:"nullable"`
	// Common stock
	CommonStock string `json:"common_stock" api:"nullable"`
	// Deferred revenue
	DeferredRevenue string `json:"deferred_revenue" api:"nullable"`
	// Deferred revenue (non-current)
	DeferredRevenueNonCurrent string `json:"deferred_revenue_non_current" api:"nullable"`
	// Deferred tax liabilities (non-current)
	DeferredTaxLiabilitiesNonCurrent string `json:"deferred_tax_liabilities_non_current" api:"nullable"`
	// Goodwill
	Goodwill string `json:"goodwill" api:"nullable"`
	// Goodwill and intangible assets combined
	GoodwillAndIntangibleAssets string `json:"goodwill_and_intangible_assets" api:"nullable"`
	// Intangible assets
	IntangibleAssets string `json:"intangible_assets" api:"nullable"`
	// Inventory
	Inventory string `json:"inventory" api:"nullable"`
	// Long-term debt
	LongTermDebt string `json:"long_term_debt" api:"nullable"`
	// Long-term investments
	LongTermInvestments string `json:"long_term_investments" api:"nullable"`
	// Minority interest
	MinorityInterest string `json:"minority_interest" api:"nullable"`
	// Net debt (total debt minus cash)
	NetDebt string `json:"net_debt" api:"nullable"`
	// Net receivables
	NetReceivables string `json:"net_receivables" api:"nullable"`
	// Other assets
	OtherAssets string `json:"other_assets" api:"nullable"`
	// Other current assets
	OtherCurrentAssets string `json:"other_current_assets" api:"nullable"`
	// Other current liabilities
	OtherCurrentLiabilities string `json:"other_current_liabilities" api:"nullable"`
	// Other liabilities
	OtherLiabilities string `json:"other_liabilities" api:"nullable"`
	// Other non-current assets
	OtherNonCurrentAssets string `json:"other_non_current_assets" api:"nullable"`
	// Other non-current liabilities
	OtherNonCurrentLiabilities string `json:"other_non_current_liabilities" api:"nullable"`
	// Other payables
	OtherPayables string `json:"other_payables" api:"nullable"`
	// Other receivables
	OtherReceivables string `json:"other_receivables" api:"nullable"`
	// Other total stockholders equity
	OtherTotalStockholdersEquity string `json:"other_total_stockholders_equity" api:"nullable"`
	// Preferred stock
	PreferredStock string `json:"preferred_stock" api:"nullable"`
	// Prepaids
	Prepaids string `json:"prepaids" api:"nullable"`
	// Property, plant and equipment net of depreciation
	PropertyPlantAndEquipmentNet string `json:"property_plant_and_equipment_net" api:"nullable"`
	// Retained earnings
	RetainedEarnings string `json:"retained_earnings" api:"nullable"`
	// Short-term debt
	ShortTermDebt string `json:"short_term_debt" api:"nullable"`
	// Short-term investments
	ShortTermInvestments string `json:"short_term_investments" api:"nullable"`
	// Tax assets
	TaxAssets string `json:"tax_assets" api:"nullable"`
	// Tax payables
	TaxPayables string `json:"tax_payables" api:"nullable"`
	// Total assets
	TotalAssets string `json:"total_assets" api:"nullable"`
	// Total current assets
	TotalCurrentAssets string `json:"total_current_assets" api:"nullable"`
	// Total current liabilities
	TotalCurrentLiabilities string `json:"total_current_liabilities" api:"nullable"`
	// Total debt
	TotalDebt string `json:"total_debt" api:"nullable"`
	// Total equity
	TotalEquity string `json:"total_equity" api:"nullable"`
	// Total investments
	TotalInvestments string `json:"total_investments" api:"nullable"`
	// Total liabilities
	TotalLiabilities string `json:"total_liabilities" api:"nullable"`
	// Total liabilities and total equity
	TotalLiabilitiesAndTotalEquity string `json:"total_liabilities_and_total_equity" api:"nullable"`
	// Total non-current assets
	TotalNonCurrentAssets string `json:"total_non_current_assets" api:"nullable"`
	// Total non-current liabilities
	TotalNonCurrentLiabilities string `json:"total_non_current_liabilities" api:"nullable"`
	// Total payables
	TotalPayables string `json:"total_payables" api:"nullable"`
	// Total stockholders equity
	TotalStockholdersEquity string `json:"total_stockholders_equity" api:"nullable"`
	// Treasury stock
	TreasuryStock string `json:"treasury_stock" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AcceptedDate                            respjson.Field
		FilingDate                              respjson.Field
		Period                                  respjson.Field
		PeriodType                              respjson.Field
		ReportedCurrency                        respjson.Field
		Year                                    respjson.Field
		AccountPayables                         respjson.Field
		AccountsReceivables                     respjson.Field
		AccruedExpenses                         respjson.Field
		AccumulatedOtherComprehensiveIncomeLoss respjson.Field
		AdditionalPaidInCapital                 respjson.Field
		CapitalLeaseObligations                 respjson.Field
		CapitalLeaseObligationsCurrent          respjson.Field
		CashAndCashEquivalents                  respjson.Field
		CashAndShortTermInvestments             respjson.Field
		CommonStock                             respjson.Field
		DeferredRevenue                         respjson.Field
		DeferredRevenueNonCurrent               respjson.Field
		DeferredTaxLiabilitiesNonCurrent        respjson.Field
		Goodwill                                respjson.Field
		GoodwillAndIntangibleAssets             respjson.Field
		IntangibleAssets                        respjson.Field
		Inventory                               respjson.Field
		LongTermDebt                            respjson.Field
		LongTermInvestments                     respjson.Field
		MinorityInterest                        respjson.Field
		NetDebt                                 respjson.Field
		NetReceivables                          respjson.Field
		OtherAssets                             respjson.Field
		OtherCurrentAssets                      respjson.Field
		OtherCurrentLiabilities                 respjson.Field
		OtherLiabilities                        respjson.Field
		OtherNonCurrentAssets                   respjson.Field
		OtherNonCurrentLiabilities              respjson.Field
		OtherPayables                           respjson.Field
		OtherReceivables                        respjson.Field
		OtherTotalStockholdersEquity            respjson.Field
		PreferredStock                          respjson.Field
		Prepaids                                respjson.Field
		PropertyPlantAndEquipmentNet            respjson.Field
		RetainedEarnings                        respjson.Field
		ShortTermDebt                           respjson.Field
		ShortTermInvestments                    respjson.Field
		TaxAssets                               respjson.Field
		TaxPayables                             respjson.Field
		TotalAssets                             respjson.Field
		TotalCurrentAssets                      respjson.Field
		TotalCurrentLiabilities                 respjson.Field
		TotalDebt                               respjson.Field
		TotalEquity                             respjson.Field
		TotalInvestments                        respjson.Field
		TotalLiabilities                        respjson.Field
		TotalLiabilitiesAndTotalEquity          respjson.Field
		TotalNonCurrentAssets                   respjson.Field
		TotalNonCurrentLiabilities              respjson.Field
		TotalPayables                           respjson.Field
		TotalStockholdersEquity                 respjson.Field
		TreasuryStock                           respjson.Field
		ExtraFields                             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A quarterly balance sheet statement for an instrument.

func (InstrumentBalanceSheetStatement) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*InstrumentBalanceSheetStatement) UnmarshalJSON added in v0.3.0

func (r *InstrumentBalanceSheetStatement) UnmarshalJSON(data []byte) error

type InstrumentBalanceSheetStatementList added in v0.3.0

type InstrumentBalanceSheetStatementList []InstrumentBalanceSheetStatement

type InstrumentCashFlowStatement added in v0.3.0

type InstrumentCashFlowStatement struct {
	// The date and time when the filing was accepted by the SEC
	AcceptedDate time.Time `json:"accepted_date" api:"required" format:"date-time"`
	// The date the financial statement was filed
	FilingDate time.Time `json:"filing_date" api:"required" format:"date"`
	// The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4")
	Period string `json:"period" api:"required"`
	// The type of fiscal period
	//
	// Any of "QUARTERLY", "ANNUAL", "TTM", "BIANNUAL".
	PeriodType FiscalPeriodType `json:"period_type" api:"required"`
	// The currency in which the statement is reported (ISO 4217)
	ReportedCurrency string `json:"reported_currency" api:"required"`
	// The fiscal year of the statement
	Year int64 `json:"year" api:"required"`
	// Change in accounts payables
	AccountsPayables string `json:"accounts_payables" api:"nullable"`
	// Change in accounts receivables
	AccountsReceivables string `json:"accounts_receivables" api:"nullable"`
	// Net acquisitions
	AcquisitionsNet string `json:"acquisitions_net" api:"nullable"`
	// Capital expenditure
	CapitalExpenditure string `json:"capital_expenditure" api:"nullable"`
	// Cash and cash equivalents at beginning of period
	CashAtBeginningOfPeriod string `json:"cash_at_beginning_of_period" api:"nullable"`
	// Cash and cash equivalents at end of period
	CashAtEndOfPeriod string `json:"cash_at_end_of_period" api:"nullable"`
	// Change in working capital
	ChangeInWorkingCapital string `json:"change_in_working_capital" api:"nullable"`
	// Common dividends paid
	CommonDividendsPaid string `json:"common_dividends_paid" api:"nullable"`
	// Common stock issuance
	CommonStockIssuance string `json:"common_stock_issuance" api:"nullable"`
	// Common stock repurchased (buybacks)
	CommonStockRepurchased string `json:"common_stock_repurchased" api:"nullable"`
	// Deferred income tax expense
	DeferredIncomeTax string `json:"deferred_income_tax" api:"nullable"`
	// Depreciation and amortization expense
	DepreciationAndAmortization string `json:"depreciation_and_amortization" api:"nullable"`
	// Effect of foreign exchange changes on cash
	EffectOfForexChangesOnCash string `json:"effect_of_forex_changes_on_cash" api:"nullable"`
	// Free cash flow (operating cash flow minus capital expenditure)
	FreeCashFlow string `json:"free_cash_flow" api:"nullable"`
	// Income taxes paid
	IncomeTaxesPaid string `json:"income_taxes_paid" api:"nullable"`
	// Interest paid
	InterestPaid string `json:"interest_paid" api:"nullable"`
	// Change in inventory
	Inventory string `json:"inventory" api:"nullable"`
	// Investments in property, plant, and equipment
	InvestmentsInPropertyPlantAndEquipment string `json:"investments_in_property_plant_and_equipment" api:"nullable"`
	// Long-term net debt issuance
	LongTermNetDebtIssuance string `json:"long_term_net_debt_issuance" api:"nullable"`
	// Net cash provided by financing activities
	NetCashProvidedByFinancingActivities string `json:"net_cash_provided_by_financing_activities" api:"nullable"`
	// Net cash provided by investing activities
	NetCashProvidedByInvestingActivities string `json:"net_cash_provided_by_investing_activities" api:"nullable"`
	// Net cash provided by operating activities
	NetCashProvidedByOperatingActivities string `json:"net_cash_provided_by_operating_activities" api:"nullable"`
	// Net change in cash during the period
	NetChangeInCash string `json:"net_change_in_cash" api:"nullable"`
	// Net common stock issuance
	NetCommonStockIssuance string `json:"net_common_stock_issuance" api:"nullable"`
	// Net debt issuance (long-term + short-term)
	NetDebtIssuance string `json:"net_debt_issuance" api:"nullable"`
	// Net dividends paid (common + preferred)
	NetDividendsPaid string `json:"net_dividends_paid" api:"nullable"`
	// Net income for the period
	NetIncome string `json:"net_income" api:"nullable"`
	// Net preferred stock issuance
	NetPreferredStockIssuance string `json:"net_preferred_stock_issuance" api:"nullable"`
	// Net stock issuance (common + preferred)
	NetStockIssuance string `json:"net_stock_issuance" api:"nullable"`
	// Operating cash flow (alternative calculation)
	OperatingCashFlow string `json:"operating_cash_flow" api:"nullable"`
	// Other financing activities
	OtherFinancingActivities string `json:"other_financing_activities" api:"nullable"`
	// Other investing activities
	OtherInvestingActivities string `json:"other_investing_activities" api:"nullable"`
	// Other non-cash items
	OtherNonCashItems string `json:"other_non_cash_items" api:"nullable"`
	// Change in other working capital
	OtherWorkingCapital string `json:"other_working_capital" api:"nullable"`
	// Preferred dividends paid
	PreferredDividendsPaid string `json:"preferred_dividends_paid" api:"nullable"`
	// Purchases of investments
	PurchasesOfInvestments string `json:"purchases_of_investments" api:"nullable"`
	// Sales and maturities of investments
	SalesMaturitiesOfInvestments string `json:"sales_maturities_of_investments" api:"nullable"`
	// Short-term net debt issuance
	ShortTermNetDebtIssuance string `json:"short_term_net_debt_issuance" api:"nullable"`
	// Stock-based compensation expense
	StockBasedCompensation string `json:"stock_based_compensation" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AcceptedDate                           respjson.Field
		FilingDate                             respjson.Field
		Period                                 respjson.Field
		PeriodType                             respjson.Field
		ReportedCurrency                       respjson.Field
		Year                                   respjson.Field
		AccountsPayables                       respjson.Field
		AccountsReceivables                    respjson.Field
		AcquisitionsNet                        respjson.Field
		CapitalExpenditure                     respjson.Field
		CashAtBeginningOfPeriod                respjson.Field
		CashAtEndOfPeriod                      respjson.Field
		ChangeInWorkingCapital                 respjson.Field
		CommonDividendsPaid                    respjson.Field
		CommonStockIssuance                    respjson.Field
		CommonStockRepurchased                 respjson.Field
		DeferredIncomeTax                      respjson.Field
		DepreciationAndAmortization            respjson.Field
		EffectOfForexChangesOnCash             respjson.Field
		FreeCashFlow                           respjson.Field
		IncomeTaxesPaid                        respjson.Field
		InterestPaid                           respjson.Field
		Inventory                              respjson.Field
		InvestmentsInPropertyPlantAndEquipment respjson.Field
		LongTermNetDebtIssuance                respjson.Field
		NetCashProvidedByFinancingActivities   respjson.Field
		NetCashProvidedByInvestingActivities   respjson.Field
		NetCashProvidedByOperatingActivities   respjson.Field
		NetChangeInCash                        respjson.Field
		NetCommonStockIssuance                 respjson.Field
		NetDebtIssuance                        respjson.Field
		NetDividendsPaid                       respjson.Field
		NetIncome                              respjson.Field
		NetPreferredStockIssuance              respjson.Field
		NetStockIssuance                       respjson.Field
		OperatingCashFlow                      respjson.Field
		OtherFinancingActivities               respjson.Field
		OtherInvestingActivities               respjson.Field
		OtherNonCashItems                      respjson.Field
		OtherWorkingCapital                    respjson.Field
		PreferredDividendsPaid                 respjson.Field
		PurchasesOfInvestments                 respjson.Field
		SalesMaturitiesOfInvestments           respjson.Field
		ShortTermNetDebtIssuance               respjson.Field
		StockBasedCompensation                 respjson.Field
		ExtraFields                            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A quarterly cash flow statement for an instrument.

func (InstrumentCashFlowStatement) RawJSON added in v0.3.0

func (r InstrumentCashFlowStatement) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentCashFlowStatement) UnmarshalJSON added in v0.3.0

func (r *InstrumentCashFlowStatement) UnmarshalJSON(data []byte) error

type InstrumentCashFlowStatementList added in v0.3.0

type InstrumentCashFlowStatementList []InstrumentCashFlowStatement

type InstrumentCore

type InstrumentCore struct {
	// Unique OEMS instrument identifier (UUID)
	ID string `json:"id" api:"required" format:"uuid"`
	// The ISO country code of the instrument's issue
	CountryOfIssue string `json:"country_of_issue" api:"required"`
	// The ISO currency code in which the instrument is traded
	Currency string `json:"currency" api:"required"`
	// Indicates if the instrument is classified as Easy-To-Borrow
	EasyToBorrow bool `json:"easy_to_borrow" api:"required"`
	// Indicates if the instrument is liquidation only and cannot be bought
	IsLiquidationOnly bool `json:"is_liquidation_only" api:"required"`
	// Indicates if the instrument is marginable
	IsMarginable bool `json:"is_marginable" api:"required"`
	// Indicates if the instrument is restricted from trading
	IsRestricted bool `json:"is_restricted" api:"required"`
	// Indicates if short selling is prohibited for the instrument
	IsShortProhibited bool `json:"is_short_prohibited" api:"required"`
	// Indicates if the instrument is on the Regulation SHO Threshold Security List
	IsThresholdSecurity bool `json:"is_threshold_security" api:"required"`
	// Indicates if the instrument is tradable
	IsTradable bool `json:"is_tradable" api:"required"`
	// The trading symbol for the instrument
	Symbol string `json:"symbol" api:"required"`
	// The MIC code of the primary listing venue
	Venue string `json:"venue" api:"required"`
	// Average daily share volume from the security definition.
	Adv string `json:"adv" api:"nullable"`
	// The expiration date for options instruments
	Expiry time.Time `json:"expiry" api:"nullable" format:"date"`
	// The type of security (e.g., Common Stock, ETF)
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type" api:"nullable"`
	// The percent of a long position's value you must post as margin
	LongMarginRate string `json:"long_margin_rate" api:"nullable"`
	// The full name of the instrument or its issuer
	Name string `json:"name" api:"nullable"`
	// Notional ADV (`adv × previous_close`). The primary liquidity signal used by
	// `/instruments/search` ranking. Computed at response time so it stays consistent
	// with whatever `adv` and `previous_close` show.
	NotionalAdv string `json:"notional_adv" api:"nullable"`
	// Last close price from the security definition.
	PreviousClose string `json:"previous_close" api:"nullable"`
	// The percent of a short position's value you must post as margin
	ShortMarginRate string `json:"short_margin_rate" api:"nullable"`
	// The strike price for options instruments
	StrikePrice string `json:"strike_price" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                  respjson.Field
		CountryOfIssue      respjson.Field
		Currency            respjson.Field
		EasyToBorrow        respjson.Field
		IsLiquidationOnly   respjson.Field
		IsMarginable        respjson.Field
		IsRestricted        respjson.Field
		IsShortProhibited   respjson.Field
		IsThresholdSecurity respjson.Field
		IsTradable          respjson.Field
		Symbol              respjson.Field
		Venue               respjson.Field
		Adv                 respjson.Field
		Expiry              respjson.Field
		InstrumentType      respjson.Field
		LongMarginRate      respjson.Field
		Name                respjson.Field
		NotionalAdv         respjson.Field
		PreviousClose       respjson.Field
		ShortMarginRate     respjson.Field
		StrikePrice         respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InstrumentCore) RawJSON

func (r InstrumentCore) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentCore) UnmarshalJSON

func (r *InstrumentCore) UnmarshalJSON(data []byte) error

type InstrumentCoreList

type InstrumentCoreList []InstrumentCore

type InstrumentDividendEvent

type InstrumentDividendEvent struct {
	// The adjusted dividend amount accounting for any splits.
	AdjustedDividendAmount string `json:"adjusted_dividend_amount" api:"required"`
	// The day the stock starts trading without the right to receive that dividend.
	ExDate time.Time `json:"ex_date" api:"required" format:"date"`
	// The declaration date of the dividend
	DeclarationDate time.Time `json:"declaration_date" api:"nullable" format:"date"`
	// The dividend amount per share.
	DividendAmount string `json:"dividend_amount" api:"nullable"`
	// The dividend yield as a percentage of the stock price.
	DividendYield string `json:"dividend_yield" api:"nullable"`
	// The frequency of the dividend payments (e.g., "Quarterly", "Annual").
	Frequency string `json:"frequency" api:"nullable"`
	// The payment date is the date on which a declared stock dividend is scheduled to
	// be paid.
	PaymentDate time.Time `json:"payment_date" api:"nullable" format:"date"`
	// The record date, set by a company's board of directors, is when a company
	// compiles a list of shareholders of the stock for which it has declared a
	// dividend.
	RecordDate time.Time `json:"record_date" api:"nullable" format:"date"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdjustedDividendAmount respjson.Field
		ExDate                 respjson.Field
		DeclarationDate        respjson.Field
		DividendAmount         respjson.Field
		DividendYield          respjson.Field
		Frequency              respjson.Field
		PaymentDate            respjson.Field
		RecordDate             respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a dividend event for an instrument

func (InstrumentDividendEvent) RawJSON

func (r InstrumentDividendEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentDividendEvent) UnmarshalJSON

func (r *InstrumentDividendEvent) UnmarshalJSON(data []byte) error

type InstrumentEarnings

type InstrumentEarnings struct {
	// The date when the earnings report was published
	Date time.Time `json:"date" api:"required" format:"date"`
	// The actual earnings per share (EPS) for the period
	EpsActual string `json:"eps_actual" api:"nullable"`
	// The estimated earnings per share (EPS) for the period
	EpsEstimate string `json:"eps_estimate" api:"nullable"`
	// The percentage difference between actual and estimated EPS
	EpsSurprisePercent string `json:"eps_surprise_percent" api:"nullable"`
	// The actual total revenue for the period
	RevenueActual string `json:"revenue_actual" api:"nullable"`
	// The estimated total revenue for the period
	RevenueEstimate string `json:"revenue_estimate" api:"nullable"`
	// The percentage difference between actual and estimated revenue
	RevenueSurprisePercent string `json:"revenue_surprise_percent" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Date                   respjson.Field
		EpsActual              respjson.Field
		EpsEstimate            respjson.Field
		EpsSurprisePercent     respjson.Field
		RevenueActual          respjson.Field
		RevenueEstimate        respjson.Field
		RevenueSurprisePercent respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents instrument earnings data

func (InstrumentEarnings) RawJSON

func (r InstrumentEarnings) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentEarnings) UnmarshalJSON

func (r *InstrumentEarnings) UnmarshalJSON(data []byte) error

type InstrumentEventEnvelope

type InstrumentEventEnvelope struct {
	// Symbol associated with the event.
	Symbol string `json:"symbol" api:"required"`
	// Event type discriminator.
	//
	// Any of "EARNINGS", "DIVIDEND", "STOCK_SPLIT", "IPO".
	Type AllEventsEventType `json:"type" api:"required"`
	// Dividend payload when type is DIVIDEND.
	DividendEventData InstrumentDividendEvent `json:"dividend_event_data" api:"nullable"`
	// Earnings payload when type is EARNINGS.
	EarningsEventData InstrumentEarnings `json:"earnings_event_data" api:"nullable"`
	// OEMS instrument identifier, when the instrument is found in the instrument
	// cache.
	InstrumentID string `json:"instrument_id" api:"nullable" format:"uuid"`
	// IPO payload when type is IPO.
	IpoEventData InstrumentEventIpoItem `json:"ipo_event_data" api:"nullable"`
	// Instrument name associated with the event, when available.
	Name string `json:"name" api:"nullable"`
	// Stock split payload when type is STOCK_SPLIT.
	StockSplitEventData InstrumentSplitEvent `json:"stock_split_event_data" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Symbol              respjson.Field
		Type                respjson.Field
		DividendEventData   respjson.Field
		EarningsEventData   respjson.Field
		InstrumentID        respjson.Field
		IpoEventData        respjson.Field
		Name                respjson.Field
		StockSplitEventData respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Unified envelope for the all-events response.

func (InstrumentEventEnvelope) RawJSON

func (r InstrumentEventEnvelope) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentEventEnvelope) UnmarshalJSON

func (r *InstrumentEventEnvelope) UnmarshalJSON(data []byte) error

type InstrumentEventIpoItem

type InstrumentEventIpoItem struct {
	// IPO action.
	Actions string `json:"actions" api:"nullable"`
	// IPO announced timestamp.
	AnnouncedAt time.Time `json:"announced_at" api:"nullable" format:"date-time"`
	// IPO company name.
	Company string `json:"company" api:"nullable"`
	// IPO exchange.
	Exchange string `json:"exchange" api:"nullable"`
	// IPO market cap.
	MarketCap string `json:"market_cap" api:"nullable"`
	// IPO price range.
	PriceRange string `json:"price_range" api:"nullable"`
	// IPO shares offered.
	Shares string `json:"shares" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Actions     respjson.Field
		AnnouncedAt respjson.Field
		Company     respjson.Field
		Exchange    respjson.Field
		MarketCap   respjson.Field
		PriceRange  respjson.Field
		Shares      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

IPO event in the all-events date grouping response.

func (InstrumentEventIpoItem) RawJSON

func (r InstrumentEventIpoItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentEventIpoItem) UnmarshalJSON

func (r *InstrumentEventIpoItem) UnmarshalJSON(data []byte) error

type InstrumentEventsByDate

type InstrumentEventsByDate struct {
	// Event date.
	Date time.Time `json:"date" api:"required" format:"date"`
	// Flat event envelopes for this date.
	Events []InstrumentEventEnvelope `json:"events" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Date        respjson.Field
		Events      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Instrument events for a single date.

func (InstrumentEventsByDate) RawJSON

func (r InstrumentEventsByDate) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentEventsByDate) UnmarshalJSON

func (r *InstrumentEventsByDate) UnmarshalJSON(data []byte) error

type InstrumentEventsData

type InstrumentEventsData struct {
	// Dividend distribution events
	Dividends []InstrumentDividendEvent `json:"dividends" api:"required"`
	// Earnings announcement events
	Earnings []InstrumentEarnings `json:"earnings" api:"required"`
	// OEMS instrument UUID from the request
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Stock split events
	Splits []InstrumentSplitEvent `json:"splits" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Dividends    respjson.Field
		Earnings     respjson.Field
		InstrumentID respjson.Field
		Splits       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Grouped instrument events by type

func (InstrumentEventsData) RawJSON

func (r InstrumentEventsData) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentEventsData) UnmarshalJSON

func (r *InstrumentEventsData) UnmarshalJSON(data []byte) error

type InstrumentFundamentals added in v0.2.0

type InstrumentFundamentals struct {
	// The average daily trading volume over the past 30 days
	AverageVolume int64 `json:"average_volume" api:"nullable"`
	// The beta value, measuring the instrument's volatility relative to the overall
	// market
	Beta string `json:"beta" api:"nullable"`
	// A detailed description of the instrument or company
	Description string `json:"description" api:"nullable"`
	// The trailing twelve months (TTM) dividend yield
	DividendYield string `json:"dividend_yield" api:"nullable"`
	// The trailing twelve months (TTM) earnings per share
	EarningsPerShare string `json:"earnings_per_share" api:"nullable"`
	// The highest price over the last 52 weeks
	FiftyTwoWeekHigh string `json:"fifty_two_week_high" api:"nullable"`
	// The lowest price over the last 52 weeks
	FiftyTwoWeekLow string `json:"fifty_two_week_low" api:"nullable"`
	// The specific industry of the instrument's issuer
	Industry string `json:"industry" api:"nullable"`
	// The date the instrument was first listed
	ListDate time.Time `json:"list_date" api:"nullable" format:"date"`
	// URL to a representative logo image for the instrument or issuer
	LogoURL string `json:"logo_url" api:"nullable"`
	// The total market capitalization
	MarketCap string `json:"market_cap" api:"nullable"`
	// The closing price from the previous trading day
	PreviousClose string `json:"previous_close" api:"nullable"`
	// The price-to-earnings (P/E) ratio for the trailing twelve months (TTM)
	PriceToEarnings string `json:"price_to_earnings" api:"nullable"`
	// The business sector of the instrument's issuer
	Sector string `json:"sector" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AverageVolume    respjson.Field
		Beta             respjson.Field
		Description      respjson.Field
		DividendYield    respjson.Field
		EarningsPerShare respjson.Field
		FiftyTwoWeekHigh respjson.Field
		FiftyTwoWeekLow  respjson.Field
		Industry         respjson.Field
		ListDate         respjson.Field
		LogoURL          respjson.Field
		MarketCap        respjson.Field
		PreviousClose    respjson.Field
		PriceToEarnings  respjson.Field
		Sector           respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Supplemental fundamentals and company profile data for an instrument.

func (InstrumentFundamentals) RawJSON added in v0.2.0

func (r InstrumentFundamentals) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentFundamentals) UnmarshalJSON added in v0.2.0

func (r *InstrumentFundamentals) UnmarshalJSON(data []byte) error

type InstrumentIDOrSymbol added in v0.4.0

type InstrumentIDOrSymbol = string

type InstrumentIncomeStatement added in v0.3.0

type InstrumentIncomeStatement struct {
	// The date and time when the filing was accepted by the SEC
	AcceptedDate time.Time `json:"accepted_date" api:"required" format:"date-time"`
	// The date the financial statement was filed
	FilingDate time.Time `json:"filing_date" api:"required" format:"date"`
	// The fiscal period identifier (e.g., "Q1", "Q2", "Q3", "Q4")
	Period string `json:"period" api:"required"`
	// The type of fiscal period
	//
	// Any of "QUARTERLY", "ANNUAL", "TTM", "BIANNUAL".
	PeriodType FiscalPeriodType `json:"period_type" api:"required"`
	// The currency in which the statement is reported (ISO 4217)
	ReportedCurrency string `json:"reported_currency" api:"required"`
	// The fiscal year of the statement
	Year int64 `json:"year" api:"required"`
	// Bottom line net income after all adjustments
	BottomLineNetIncome string `json:"bottom_line_net_income" api:"nullable"`
	// Total costs and expenses
	CostAndExpenses string `json:"cost_and_expenses" api:"nullable"`
	// Direct costs attributable to producing goods sold
	CostOfRevenue string `json:"cost_of_revenue" api:"nullable"`
	// Depreciation and amortization expenses
	DepreciationAndAmortization string `json:"depreciation_and_amortization" api:"nullable"`
	// Earnings before interest and taxes
	Ebit string `json:"ebit" api:"nullable"`
	// Earnings before interest, taxes, depreciation, and amortization
	Ebitda string `json:"ebitda" api:"nullable"`
	// Basic earnings per share
	Eps string `json:"eps" api:"nullable"`
	// Diluted earnings per share
	EpsDiluted string `json:"eps_diluted" api:"nullable"`
	// General administrative overhead expenses
	GeneralAndAdministrativeExpenses string `json:"general_and_administrative_expenses" api:"nullable"`
	// Revenue minus cost of revenue
	GrossProfit string `json:"gross_profit" api:"nullable"`
	// Income before income tax expense
	IncomeBeforeTax string `json:"income_before_tax" api:"nullable"`
	// Income tax expense for the period
	IncomeTaxExpense string `json:"income_tax_expense" api:"nullable"`
	// Interest paid on debt
	InterestExpense string `json:"interest_expense" api:"nullable"`
	// Interest earned on investments and cash
	InterestIncome string `json:"interest_income" api:"nullable"`
	// Total net income for the period
	NetIncome string `json:"net_income" api:"nullable"`
	// Deductions from net income
	NetIncomeDeductions string `json:"net_income_deductions" api:"nullable"`
	// Net income from continuing operations
	NetIncomeFromContinuingOperations string `json:"net_income_from_continuing_operations" api:"nullable"`
	// Net income from discontinued operations
	NetIncomeFromDiscontinuedOperations string `json:"net_income_from_discontinued_operations" api:"nullable"`
	// Net interest income (interest income minus interest expense)
	NetInterestIncome string `json:"net_interest_income" api:"nullable"`
	// Non-operating income excluding interest
	NonOperatingIncomeExcludingInterest string `json:"non_operating_income_excluding_interest" api:"nullable"`
	// Total operating expenses
	OperatingExpenses string `json:"operating_expenses" api:"nullable"`
	// Income from core business operations
	OperatingIncome string `json:"operating_income" api:"nullable"`
	// Other adjustments to net income
	OtherAdjustmentsToNetIncome string `json:"other_adjustments_to_net_income" api:"nullable"`
	// Other miscellaneous expenses
	OtherExpenses string `json:"other_expenses" api:"nullable"`
	// Expenditure on research and development activities
	ResearchAndDevelopmentExpenses string `json:"research_and_development_expenses" api:"nullable"`
	// Total revenue from sales of goods and services
	Revenue string `json:"revenue" api:"nullable"`
	// Expenditure on marketing and sales activities
	SellingAndMarketingExpenses string `json:"selling_and_marketing_expenses" api:"nullable"`
	// Combined selling, general, and administrative expenses
	SellingGeneralAndAdministrativeExpenses string `json:"selling_general_and_administrative_expenses" api:"nullable"`
	// Net of other income and expenses
	TotalOtherIncomeExpensesNet string `json:"total_other_income_expenses_net" api:"nullable"`
	// Weighted average shares outstanding (basic)
	WeightedAverageShsOut string `json:"weighted_average_shs_out" api:"nullable"`
	// Weighted average shares outstanding (diluted)
	WeightedAverageShsOutDil string `json:"weighted_average_shs_out_dil" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AcceptedDate                            respjson.Field
		FilingDate                              respjson.Field
		Period                                  respjson.Field
		PeriodType                              respjson.Field
		ReportedCurrency                        respjson.Field
		Year                                    respjson.Field
		BottomLineNetIncome                     respjson.Field
		CostAndExpenses                         respjson.Field
		CostOfRevenue                           respjson.Field
		DepreciationAndAmortization             respjson.Field
		Ebit                                    respjson.Field
		Ebitda                                  respjson.Field
		Eps                                     respjson.Field
		EpsDiluted                              respjson.Field
		GeneralAndAdministrativeExpenses        respjson.Field
		GrossProfit                             respjson.Field
		IncomeBeforeTax                         respjson.Field
		IncomeTaxExpense                        respjson.Field
		InterestExpense                         respjson.Field
		InterestIncome                          respjson.Field
		NetIncome                               respjson.Field
		NetIncomeDeductions                     respjson.Field
		NetIncomeFromContinuingOperations       respjson.Field
		NetIncomeFromDiscontinuedOperations     respjson.Field
		NetInterestIncome                       respjson.Field
		NonOperatingIncomeExcludingInterest     respjson.Field
		OperatingExpenses                       respjson.Field
		OperatingIncome                         respjson.Field
		OtherAdjustmentsToNetIncome             respjson.Field
		OtherExpenses                           respjson.Field
		ResearchAndDevelopmentExpenses          respjson.Field
		Revenue                                 respjson.Field
		SellingAndMarketingExpenses             respjson.Field
		SellingGeneralAndAdministrativeExpenses respjson.Field
		TotalOtherIncomeExpensesNet             respjson.Field
		WeightedAverageShsOut                   respjson.Field
		WeightedAverageShsOutDil                respjson.Field
		ExtraFields                             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A quarterly income statement for an instrument.

func (InstrumentIncomeStatement) RawJSON added in v0.3.0

func (r InstrumentIncomeStatement) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentIncomeStatement) UnmarshalJSON added in v0.3.0

func (r *InstrumentIncomeStatement) UnmarshalJSON(data []byte) error

type InstrumentIncomeStatementList added in v0.3.0

type InstrumentIncomeStatementList []InstrumentIncomeStatement

type InstrumentSplitEvent

type InstrumentSplitEvent struct {
	// The date of the stock split
	Date time.Time `json:"date" api:"required" format:"date"`
	// The denominator of the split ratio
	Denominator string `json:"denominator" api:"required"`
	// The numerator of the split ratio
	Numerator string `json:"numerator" api:"required"`
	// The type of stock split (e.g., "stock-split", "stock-dividend", "bonus-issue")
	SplitType string `json:"split_type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Date        respjson.Field
		Denominator respjson.Field
		Numerator   respjson.Field
		SplitType   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a stock split event for an instrument

func (InstrumentSplitEvent) RawJSON

func (r InstrumentSplitEvent) RawJSON() string

Returns the unmodified JSON received from the API

func (*InstrumentSplitEvent) UnmarshalJSON

func (r *InstrumentSplitEvent) UnmarshalJSON(data []byte) error

type ListingType

type ListingType string

The listing type of an options contract

const (
	ListingTypeStandard ListingType = "STANDARD"
	ListingTypeFlex     ListingType = "FLEX"
	ListingTypeOtc      ListingType = "OTC"
)

type MarginDetails

type MarginDetails struct {
	// The number of day trades executed over the 5 most recent trading days.
	DayTradeCount int64 `json:"day_trade_count" api:"required"`
	// Initial margin excess for trade-date balances.
	InitialMarginExcess string `json:"initial_margin_excess" api:"required"`
	// Initial margin requirement for trade-date balances.
	InitialMarginRequirement string `json:"initial_margin_requirement" api:"required"`
	// Maintenance margin excess for trade-date balances.
	MaintenanceMarginExcess string `json:"maintenance_margin_excess" api:"required"`
	// Maintenance margin requirement for trade-date balances.
	MaintenanceMarginRequirement string `json:"maintenance_margin_requirement" api:"required"`
	// `true` if the account is currently flagged as a PDT, otherwise `false`.
	PatternDayTrader bool `json:"pattern_day_trader" api:"required"`
	// The amount of day-trade buying power used during the current trading day.
	DayTradeBuyingPowerUsage string `json:"day_trade_buying_power_usage" api:"nullable"`
	// Optional top margin contributors, returned only when explicitly requested.
	TopContributors []MarginTopContributor `json:"top_contributors"`
	// Current usage totals.
	Usage MarginDetailsUsage `json:"usage" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DayTradeCount                respjson.Field
		InitialMarginExcess          respjson.Field
		InitialMarginRequirement     respjson.Field
		MaintenanceMarginExcess      respjson.Field
		MaintenanceMarginRequirement respjson.Field
		PatternDayTrader             respjson.Field
		DayTradeBuyingPowerUsage     respjson.Field
		TopContributors              respjson.Field
		Usage                        respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MarginDetails) RawJSON

func (r MarginDetails) RawJSON() string

Returns the unmodified JSON received from the API

func (*MarginDetails) UnmarshalJSON

func (r *MarginDetails) UnmarshalJSON(data []byte) error

type MarginDetailsUsage

type MarginDetailsUsage struct {
	// The total margin available in the current model.
	Total string `json:"total" api:"required"`
	// The amount of margin that is currently being utilized.
	Used string `json:"used" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Total       respjson.Field
		Used        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MarginDetailsUsage) RawJSON

func (r MarginDetailsUsage) RawJSON() string

Returns the unmodified JSON received from the API

func (*MarginDetailsUsage) UnmarshalJSON

func (r *MarginDetailsUsage) UnmarshalJSON(data []byte) error

type MarginTopContributor

type MarginTopContributor struct {
	// Day-trade buying power consumed by fills against this underlying on the current
	// trade date. Populated only for pattern day trader accounts.
	DayTradeBuyingPowerUsage string `json:"day_trade_buying_power_usage" api:"required"`
	// Initial margin requirement attributable to this underlying.
	InitialMarginRequirement string `json:"initial_margin_requirement" api:"required"`
	// Maintenance margin requirement attributable to this underlying.
	MaintenanceMarginRequirement string `json:"maintenance_margin_requirement" api:"required"`
	// Net market value attributable to this underlying.
	MarketValue string `json:"market_value" api:"required"`
	// UUID of the underlying security contributing to margin requirement.
	UnderlyingInstrumentID string `json:"underlying_instrument_id" api:"required" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DayTradeBuyingPowerUsage     respjson.Field
		InitialMarginRequirement     respjson.Field
		MaintenanceMarginRequirement respjson.Field
		MarketValue                  respjson.Field
		UnderlyingInstrumentID       respjson.Field
		ExtraFields                  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MarginTopContributor) RawJSON

func (r MarginTopContributor) RawJSON() string

Returns the unmodified JSON received from the API

func (*MarginTopContributor) UnmarshalJSON

func (r *MarginTopContributor) UnmarshalJSON(data []byte) error

type MarginType

type MarginType string

An account's margin type

const (
	MarginTypeOther                        MarginType = "OTHER"
	MarginTypeNone                         MarginType = "NONE"
	MarginTypePortfolioMargin              MarginType = "PORTFOLIO_MARGIN"
	MarginTypeRiskBasedHaircutBrokerDealer MarginType = "RISK_BASED_HAIRCUT_BROKER_DEALER"
	MarginTypeRegT                         MarginType = "REG_T"
	MarginTypeRiskBasedHaircutMarketMaker  MarginType = "RISK_BASED_HAIRCUT_MARKET_MAKER"
	MarginTypeCiro                         MarginType = "CIRO"
	MarginTypeFuturesNlv                   MarginType = "FUTURES_NLV"
	MarginTypeFuturesTotEq                 MarginType = "FUTURES_TOT_EQ"
)

type MarketDataSnapshot

type MarketDataSnapshot struct {
	// OEMS instrument identifier.
	InstrumentID string `json:"instrument_id" api:"required"`
	// Display symbol for the security.
	Symbol string `json:"symbol" api:"required"`
	// Cumulative traded volume reported on the most recent trade, in shares for
	// equities or contracts for options. Absent when no trade is available.
	CumulativeVolume int64 `json:"cumulative_volume" api:"nullable"`
	// Most recent quote if available.
	LastQuote SnapshotQuote `json:"last_quote" api:"nullable"`
	// Most recent last-sale trade if available.
	LastTrade SnapshotLastTrade `json:"last_trade" api:"nullable"`
	// Security name if available.
	Name string `json:"name" api:"nullable"`
	// Session metrics computed from previous close and last trade, if available.
	Session SnapshotSession `json:"session" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InstrumentID     respjson.Field
		Symbol           respjson.Field
		CumulativeVolume respjson.Field
		LastQuote        respjson.Field
		LastTrade        respjson.Field
		Name             respjson.Field
		Session          respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Market data snapshot for a single security.

func (MarketDataSnapshot) RawJSON

func (r MarketDataSnapshot) RawJSON() string

Returns the unmodified JSON received from the API

func (*MarketDataSnapshot) UnmarshalJSON

func (r *MarketDataSnapshot) UnmarshalJSON(data []byte) error

type MarketDataSnapshotList

type MarketDataSnapshotList []MarketDataSnapshot

type MarketHoursDetail

type MarketHoursDetail struct {
	// Current time in market timezone with offset
	CurrentTime time.Time `json:"current_time" api:"required" format:"date-time"`
	// The date for which market hours are provided
	Date time.Time `json:"date" api:"required" format:"date"`
	// Market type identifier
	//
	// Any of "us_equities", "us_options".
	Market MarketType `json:"market" api:"required"`
	// Human-readable market name
	MarketName string `json:"market_name" api:"required"`
	// Next trading day's session schedules (without time_until fields)
	NextSessions TradingSessions `json:"next_sessions" api:"required"`
	// Market status information
	Status MarketStatus `json:"status" api:"required"`
	// IANA timezone identifier for the market
	Timezone string `json:"timezone" api:"required"`
	// Trading session schedules for the requested date with time_until fields
	TodaySessions TradingSessions `json:"today_sessions" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CurrentTime   respjson.Field
		Date          respjson.Field
		Market        respjson.Field
		MarketName    respjson.Field
		NextSessions  respjson.Field
		Status        respjson.Field
		Timezone      respjson.Field
		TodaySessions respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Comprehensive market hours information for a specific market and date

func (MarketHoursDetail) RawJSON

func (r MarketHoursDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*MarketHoursDetail) UnmarshalJSON

func (r *MarketHoursDetail) UnmarshalJSON(data []byte) error

type MarketHoursDetailList

type MarketHoursDetailList []MarketHoursDetail

type MarketSessionType

type MarketSessionType string

Session type for market hours

const (
	MarketSessionTypePreMarket  MarketSessionType = "pre_market"
	MarketSessionTypeRegular    MarketSessionType = "regular"
	MarketSessionTypeAfterHours MarketSessionType = "after_hours"
)

type MarketStatus

type MarketStatus struct {
	// The type of trading day
	//
	// Any of "TRADING_DAY", "EARLY_CLOSE", "HOLIDAY", "WEEKEND".
	DayType DayType `json:"day_type" api:"required"`
	// Whether the market is currently open (real-time)
	IsOpen bool `json:"is_open" api:"required"`
	// Current session type if market is open, null if closed
	//
	// Any of "pre_market", "regular", "after_hours".
	CurrentSession MarketSessionType `json:"current_session" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DayType        respjson.Field
		IsOpen         respjson.Field
		CurrentSession respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Market status information

func (MarketStatus) RawJSON

func (r MarketStatus) RawJSON() string

Returns the unmodified JSON received from the API

func (*MarketStatus) UnmarshalJSON

func (r *MarketStatus) UnmarshalJSON(data []byte) error

type MarketType

type MarketType string

Market type for market hours calendar endpoint

const (
	MarketTypeUsEquities MarketType = "us_equities"
	MarketTypeUsOptions  MarketType = "us_options"
)

type Message

type Message struct {
	ID string `json:"id" api:"required" format:"uuid"`
	// Finalized immutable message content container. Never includes thinking parts.
	Content   MessageContent `json:"content" api:"required"`
	CreatedAt string         `json:"created_at" api:"required"`
	// Immutable terminal outcome for a finalized assistant message.
	//
	// Any of "completed", "errored", "canceled".
	Outcome MessageOutcome `json:"outcome" api:"required"`
	// Finalized message role in the public contract.
	//
	// Any of "USER", "ASSISTANT".
	Role     MessageRole `json:"role" api:"required"`
	Seq      int64       `json:"seq" api:"required"`
	ThreadID string      `json:"thread_id" api:"required" format:"uuid"`
	// Shared sanitized error payload.
	Error ErrorStatus `json:"error" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Content     respjson.Field
		CreatedAt   respjson.Field
		Outcome     respjson.Field
		Role        respjson.Field
		Seq         respjson.Field
		ThreadID    respjson.Field
		Error       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Final immutable message.

func (Message) RawJSON

func (r Message) RawJSON() string

Returns the unmodified JSON received from the API

func (*Message) UnmarshalJSON

func (r *Message) UnmarshalJSON(data []byte) error

type MessageContent

type MessageContent struct {
	Parts []MessageContentPartUnion `json:"parts" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Parts       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Finalized immutable message content container. Never includes thinking parts.

func (MessageContent) RawJSON

func (r MessageContent) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContent) UnmarshalJSON

func (r *MessageContent) UnmarshalJSON(data []byte) error

type MessageContentPartObject

type MessageContentPartObject struct {
	// Any of "text".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartTextPayload
}

Text content part.

func (MessageContentPartObject) RawJSON

func (r MessageContentPartObject) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentPartObject) UnmarshalJSON

func (r *MessageContentPartObject) UnmarshalJSON(data []byte) error

type MessageContentPartObject2

type MessageContentPartObject2 struct {
	// Any of "structured_action".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartStructuredActionPayload
}

Structured action content part.

func (MessageContentPartObject2) RawJSON

func (r MessageContentPartObject2) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentPartObject2) UnmarshalJSON

func (r *MessageContentPartObject2) UnmarshalJSON(data []byte) error

type MessageContentPartObject3

type MessageContentPartObject3 struct {
	// Any of "chart".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartChartPayload
}

Chart payload content part.

func (MessageContentPartObject3) RawJSON

func (r MessageContentPartObject3) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentPartObject3) UnmarshalJSON

func (r *MessageContentPartObject3) UnmarshalJSON(data []byte) error

type MessageContentPartObject4

type MessageContentPartObject4 struct {
	// Any of "suggested_actions".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartSuggestedActionsPayload
}

Suggested actions payload content part.

func (MessageContentPartObject4) RawJSON

func (r MessageContentPartObject4) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentPartObject4) UnmarshalJSON

func (r *MessageContentPartObject4) UnmarshalJSON(data []byte) error

type MessageContentPartObject5

type MessageContentPartObject5 struct {
	// Any of "custom".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartCustomPayload
}

Escape-hatch custom payload content part.

func (MessageContentPartObject5) RawJSON

func (r MessageContentPartObject5) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentPartObject5) UnmarshalJSON

func (r *MessageContentPartObject5) UnmarshalJSON(data []byte) error

type MessageContentPartUnion

type MessageContentPartUnion struct {
	// This field is from variant [MessageContentPartObject].
	Text string `json:"text"`
	Type string `json:"type"`
	// This field is from variant [MessageContentPartObject2].
	Action StructuredActionUnion `json:"action"`
	// This field is from variant [MessageContentPartObject2].
	ActionID string `json:"action_id"`
	// This field is a union of [ChartPayload], [SuggestedActionsPayload], [any]
	Payload MessageContentPartUnionPayload `json:"payload"`
	JSON    struct {
		Text     respjson.Field
		Type     respjson.Field
		Action   respjson.Field
		ActionID respjson.Field
		Payload  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

MessageContentPartUnion contains all possible properties and values from MessageContentPartObject, MessageContentPartObject2, MessageContentPartObject3, MessageContentPartObject4, MessageContentPartObject5.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (MessageContentPartUnion) AsMessageContentPartObject

func (u MessageContentPartUnion) AsMessageContentPartObject() (v MessageContentPartObject)

func (MessageContentPartUnion) AsMessageContentPartObject2

func (u MessageContentPartUnion) AsMessageContentPartObject2() (v MessageContentPartObject2)

func (MessageContentPartUnion) AsMessageContentPartObject3

func (u MessageContentPartUnion) AsMessageContentPartObject3() (v MessageContentPartObject3)

func (MessageContentPartUnion) AsMessageContentPartObject4

func (u MessageContentPartUnion) AsMessageContentPartObject4() (v MessageContentPartObject4)

func (MessageContentPartUnion) AsMessageContentPartObject5

func (u MessageContentPartUnion) AsMessageContentPartObject5() (v MessageContentPartObject5)

func (MessageContentPartUnion) RawJSON

func (u MessageContentPartUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentPartUnion) UnmarshalJSON

func (r *MessageContentPartUnion) UnmarshalJSON(data []byte) error

type MessageContentPartUnionPayload added in v0.2.0

type MessageContentPartUnionPayload struct {
	// This field will be present if the value is a [any] instead of an object.
	OfContentPartCustomPayloadPayload any `json:",inline"`
	// This field is from variant [ChartPayload].
	ChartID       string         `json:"chartId"`
	ActionButtons []ActionButton `json:"actionButtons"`
	// This field is from variant [ChartPayload].
	DataChart DataChart `json:"dataChart"`
	// This field is from variant [ChartPayload].
	SymbolChart SymbolChart `json:"symbolChart"`
	JSON        struct {
		OfContentPartCustomPayloadPayload respjson.Field
		ChartID                           respjson.Field
		ActionButtons                     respjson.Field
		DataChart                         respjson.Field
		SymbolChart                       respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

MessageContentPartUnionPayload is an implicit subunion of MessageContentPartUnion. MessageContentPartUnionPayload provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the MessageContentPartUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfContentPartCustomPayloadPayload]

func (*MessageContentPartUnionPayload) UnmarshalJSON added in v0.2.0

func (r *MessageContentPartUnionPayload) UnmarshalJSON(data []byte) error

type MessageList

type MessageList []Message

type MessageOutcome

type MessageOutcome string

Immutable terminal outcome for a finalized assistant message.

const (
	MessageOutcomeCompleted MessageOutcome = "completed"
	MessageOutcomeErrored   MessageOutcome = "errored"
	MessageOutcomeCanceled  MessageOutcome = "canceled"
)

type MessageRole

type MessageRole string

Finalized message role in the public contract.

const (
	MessageRoleUser      MessageRole = "USER"
	MessageRoleAssistant MessageRole = "ASSISTANT"
)

type NewOrderRequest added in v0.4.0

type NewOrderRequest struct {
	// Type of security
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type" api:"required"`
	// Type of order
	//
	// Any of "MARKET", "LIMIT", "STOP", "STOP_LIMIT", "TRAILING_STOP",
	// "TRAILING_STOP_LIMIT".
	OrderType RequestOrderType `json:"order_type" api:"required"`
	// Quantity to trade. For COMMON_STOCK: shares (may be fractional if supported).
	// For OPTION (single-leg): contracts (must be an integer)
	Quantity string `json:"quantity" api:"required"`
	// Side of the order
	//
	// Any of "BUY", "SELL", "SELL_SHORT", "OTHER".
	Side Side `json:"side" api:"required"`
	// Time in force
	//
	// Any of "DAY", "GOOD_TILL_CANCEL", "IMMEDIATE_OR_CANCEL", "FILL_OR_KILL",
	// "GOOD_TILL_DATE", "AT_THE_OPENING", "AT_THE_CLOSE", "GOOD_TILL_CROSSING",
	// "GOOD_THROUGH_CROSSING", "AT_CROSSING".
	TimeInForce RequestTimeInForce `json:"time_in_force" api:"required"`
	// Optional client-provided unique ID (idempotency). Required to be unique per
	// account.
	ID string `json:"id" api:"nullable"`
	// The timestamp when the order should expire (UTC). Required when time_in_force is
	// GOOD_TILL_DATE.
	ExpiresAt time.Time `json:"expires_at" api:"nullable" format:"date-time"`
	// Allow trading outside regular trading hours. Some brokers disallow options
	// outside RTH.
	ExtendedHours bool `json:"extended_hours" api:"nullable"`
	// OEMS instrument UUID
	InstrumentID InstrumentIDOrSymbol `json:"instrument_id" api:"nullable" format:"uuid"`
	// Limit offset for trailing stop-limit orders (signed)
	LimitOffset string `json:"limit_offset" api:"nullable"`
	// Limit price (required for LIMIT and STOP_LIMIT orders)
	LimitPrice string `json:"limit_price" api:"nullable"`
	// Required when instrument_type is OPTION. Specifies whether the order opens or
	// closes a position.
	//
	// Any of "OPEN", "CLOSE".
	PositionEffect PositionEffect `json:"position_effect"`
	// Stop price (required for STOP and STOP_LIMIT orders)
	StopPrice string `json:"stop_price" api:"nullable"`
	// Trading symbol. For equities, use the ticker symbol (e.g., "AAPL"). For options,
	// use the OSI symbol (e.g., "AAPL 250117C00190000"). Either `symbol` or
	// `instrument_id` must be provided.
	Symbol string `json:"symbol" api:"nullable"`
	// Trailing offset amount (required for trailing orders)
	TrailingOffset string `json:"trailing_offset" api:"nullable"`
	// Trailing offset type (PRICE or PERCENT_BPS)
	//
	// Any of "PRICE", "BPS".
	TrailingOffsetType TrailingOffsetType `json:"trailing_offset_type" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InstrumentType     respjson.Field
		OrderType          respjson.Field
		Quantity           respjson.Field
		Side               respjson.Field
		TimeInForce        respjson.Field
		ID                 respjson.Field
		ExpiresAt          respjson.Field
		ExtendedHours      respjson.Field
		InstrumentID       respjson.Field
		LimitOffset        respjson.Field
		LimitPrice         respjson.Field
		PositionEffect     respjson.Field
		StopPrice          respjson.Field
		Symbol             respjson.Field
		TrailingOffset     respjson.Field
		TrailingOffsetType respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Request to submit a new order (PlaceOrderRequest from spec)

func (NewOrderRequest) RawJSON added in v0.4.0

func (r NewOrderRequest) RawJSON() string

Returns the unmodified JSON received from the API

func (NewOrderRequest) ToParam added in v0.4.0

ToParam converts this NewOrderRequest to a NewOrderRequestParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with NewOrderRequestParam.Overrides()

func (*NewOrderRequest) UnmarshalJSON added in v0.4.0

func (r *NewOrderRequest) UnmarshalJSON(data []byte) error

type NewOrderRequestParam added in v0.4.0

type NewOrderRequestParam struct {
	// Type of security
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type,omitzero" api:"required"`
	// Type of order
	//
	// Any of "MARKET", "LIMIT", "STOP", "STOP_LIMIT", "TRAILING_STOP",
	// "TRAILING_STOP_LIMIT".
	OrderType RequestOrderType `json:"order_type,omitzero" api:"required"`
	// Quantity to trade. For COMMON_STOCK: shares (may be fractional if supported).
	// For OPTION (single-leg): contracts (must be an integer)
	Quantity string `json:"quantity" api:"required"`
	// Side of the order
	//
	// Any of "BUY", "SELL", "SELL_SHORT", "OTHER".
	Side Side `json:"side,omitzero" api:"required"`
	// Time in force
	//
	// Any of "DAY", "GOOD_TILL_CANCEL", "IMMEDIATE_OR_CANCEL", "FILL_OR_KILL",
	// "GOOD_TILL_DATE", "AT_THE_OPENING", "AT_THE_CLOSE", "GOOD_TILL_CROSSING",
	// "GOOD_THROUGH_CROSSING", "AT_CROSSING".
	TimeInForce RequestTimeInForce `json:"time_in_force,omitzero" api:"required"`
	// Optional client-provided unique ID (idempotency). Required to be unique per
	// account.
	ID param.Opt[string] `json:"id,omitzero"`
	// The timestamp when the order should expire (UTC). Required when time_in_force is
	// GOOD_TILL_DATE.
	ExpiresAt param.Opt[time.Time] `json:"expires_at,omitzero" format:"date-time"`
	// Allow trading outside regular trading hours. Some brokers disallow options
	// outside RTH.
	ExtendedHours param.Opt[bool] `json:"extended_hours,omitzero"`
	// Limit offset for trailing stop-limit orders (signed)
	LimitOffset param.Opt[string] `json:"limit_offset,omitzero"`
	// Limit price (required for LIMIT and STOP_LIMIT orders)
	LimitPrice param.Opt[string] `json:"limit_price,omitzero"`
	// Stop price (required for STOP and STOP_LIMIT orders)
	StopPrice param.Opt[string] `json:"stop_price,omitzero"`
	// Trading symbol. For equities, use the ticker symbol (e.g., "AAPL"). For options,
	// use the OSI symbol (e.g., "AAPL 250117C00190000"). Either `symbol` or
	// `instrument_id` must be provided.
	Symbol param.Opt[string] `json:"symbol,omitzero"`
	// Trailing offset amount (required for trailing orders)
	TrailingOffset param.Opt[string] `json:"trailing_offset,omitzero"`
	// OEMS instrument UUID
	InstrumentID param.Opt[InstrumentIDOrSymbol] `json:"instrument_id,omitzero" format:"uuid"`
	// Required when instrument_type is OPTION. Specifies whether the order opens or
	// closes a position.
	//
	// Any of "OPEN", "CLOSE".
	PositionEffect PositionEffect `json:"position_effect,omitzero"`
	// Trailing offset type (PRICE or PERCENT_BPS)
	//
	// Any of "PRICE", "BPS".
	TrailingOffsetType TrailingOffsetType `json:"trailing_offset_type,omitzero"`
	// contains filtered or unexported fields
}

Request to submit a new order (PlaceOrderRequest from spec)

The properties InstrumentType, OrderType, Quantity, Side, TimeInForce are required.

func (NewOrderRequestParam) MarshalJSON added in v0.4.0

func (r NewOrderRequestParam) MarshalJSON() (data []byte, err error)

func (*NewOrderRequestParam) UnmarshalJSON added in v0.4.0

func (r *NewOrderRequestParam) UnmarshalJSON(data []byte) error

type NewsInstrument

type NewsInstrument struct {
	// OEMS instrument UUID.
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Instrument name/description, if available from instrument cache enrichment.
	Name string `json:"name" api:"nullable"`
	// Trading symbol, if available from instrument cache enrichment.
	Symbol string `json:"symbol" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		InstrumentID respjson.Field
		Name         respjson.Field
		Symbol       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Instrument associated with a news item.

func (NewsInstrument) RawJSON

func (r NewsInstrument) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsInstrument) UnmarshalJSON

func (r *NewsInstrument) UnmarshalJSON(data []byte) error

type NewsItem

type NewsItem struct {
	// Instruments associated with this news item.
	Instruments []NewsInstrument `json:"instruments" api:"required"`
	// Classification of the item.
	//
	// Any of "NEWS", "PRESS_RELEASE".
	NewsType NewsType `json:"news_type" api:"required"`
	// The published date/time of the article in UTC.
	PublishedAt time.Time `json:"published_at" api:"required" format:"date-time"`
	// The publisher or newswire source.
	Publisher string `json:"publisher" api:"required"`
	// The headline/title of the article.
	Title string `json:"title" api:"required"`
	// Canonical URL to the full article.
	URL string `json:"url" api:"required"`
	// URL of an associated image if provided by the source.
	ImageURL string `json:"image_url" api:"nullable"`
	// The primary domain/site of the publisher.
	Site string `json:"site" api:"nullable"`
	// The full or excerpted article body.
	Text string `json:"text" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Instruments respjson.Field
		NewsType    respjson.Field
		PublishedAt respjson.Field
		Publisher   respjson.Field
		Title       respjson.Field
		URL         respjson.Field
		ImageURL    respjson.Field
		Site        respjson.Field
		Text        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single news item and its associated instruments.

func (NewsItem) RawJSON

func (r NewsItem) RawJSON() string

Returns the unmodified JSON received from the API

func (*NewsItem) UnmarshalJSON

func (r *NewsItem) UnmarshalJSON(data []byte) error

type NewsItemList

type NewsItemList []NewsItem

type NewsType

type NewsType string

News item classification.

const (
	NewsTypeNews         NewsType = "NEWS"
	NewsTypePressRelease NewsType = "PRESS_RELEASE"
)

type OpenChartAction

type OpenChartAction struct {
	// Trading symbol to chart
	Symbol string `json:"symbol" api:"required"`
	// Additional chart configuration (indicators, overlays, etc.)
	Extras any `json:"extras"`
	// Chart timeframe (e.g., "1D", "1W", "1M", "3M", "1Y", "5Y")
	Timeframe string `json:"timeframe" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Symbol      respjson.Field
		Extras      respjson.Field
		Timeframe   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Action to open a chart for a symbol.

func (OpenChartAction) RawJSON

func (r OpenChartAction) RawJSON() string

Returns the unmodified JSON received from the API

func (*OpenChartAction) UnmarshalJSON

func (r *OpenChartAction) UnmarshalJSON(data []byte) error

type OpenEntitlementConsentAction added in v0.2.0

type OpenEntitlementConsentAction struct {
	// Stable entitlement agreement family key.
	//
	// Any of "omni_account_data_access".
	AgreementKey              EntitlementAgreementKey `json:"agreement_key" api:"required"`
	Reason                    string                  `json:"reason" api:"required"`
	RequestedEntitlementCodes []EntitlementCode       `json:"requested_entitlement_codes" api:"required"`
	TradingAccountIDs         []int64                 `json:"trading_account_ids" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AgreementKey              respjson.Field
		Reason                    respjson.Field
		RequestedEntitlementCodes respjson.Field
		TradingAccountIDs         respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Action to open entitlement consent flow for one or more accounts.

func (OpenEntitlementConsentAction) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*OpenEntitlementConsentAction) UnmarshalJSON added in v0.2.0

func (r *OpenEntitlementConsentAction) UnmarshalJSON(data []byte) error

type OpenScreenerAction

type OpenScreenerAction struct {
	// Filter criteria for the screener
	Filters []ScreenerFilter `json:"filters" api:"required"`
	// Optional field/column selection for screener results.
	FieldFilter []string `json:"field_filter" api:"nullable"`
	// Optional page size.
	PageSize int64 `json:"page_size" api:"nullable"`
	// Optional sort field for screener rows.
	SortBy string `json:"sort_by" api:"nullable"`
	// Optional sort direction (`ASC` or `DESC`).
	SortDirection string `json:"sort_direction" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Filters       respjson.Field
		FieldFilter   respjson.Field
		PageSize      respjson.Field
		SortBy        respjson.Field
		SortDirection respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Action to open a stock screener with filters.

func (OpenScreenerAction) RawJSON

func (r OpenScreenerAction) RawJSON() string

Returns the unmodified JSON received from the API

func (*OpenScreenerAction) UnmarshalJSON

func (r *OpenScreenerAction) UnmarshalJSON(data []byte) error

type OptionsContract

type OptionsContract struct {
	// OEMS instrument identifier
	ID string `json:"id" api:"required" format:"uuid"`
	// Whether this is a CALL or PUT
	//
	// Any of "CALL", "PUT".
	ContractType ContractType `json:"contract_type" api:"required"`
	// ISO currency code
	Currency string `json:"currency" api:"required"`
	// MIC code of the primary listing venue
	Exchange string `json:"exchange" api:"required"`
	// Exercise style
	//
	// Any of "AMERICAN", "EUROPEAN".
	ExerciseStyle ExerciseStyle `json:"exercise_style" api:"required"`
	// Expiration date
	Expiry time.Time `json:"expiry" api:"required" format:"date"`
	// Whether the contract is liquidation-only
	IsLiquidationOnly bool `json:"is_liquidation_only" api:"required"`
	// Whether the contract is marginable
	IsMarginable bool `json:"is_marginable" api:"required"`
	// Whether the contract is restricted from trading
	IsRestricted bool `json:"is_restricted" api:"required"`
	// Listing type
	//
	// Any of "STANDARD", "FLEX", "OTC".
	ListingType ListingType `json:"listing_type" api:"required"`
	// Contract multiplier (100 for standard options)
	Multiplier string `json:"multiplier" api:"required"`
	// Strike price
	StrikePrice string `json:"strike_price" api:"required"`
	// OSI symbol (e.g. "AAPL 251219C00150000")
	Symbol string `json:"symbol" api:"required"`
	// Open interest (number of outstanding contracts), if available
	OpenInterest int64 `json:"open_interest" api:"nullable"`
	// OEMS instrument ID of the underlying instrument, if resolvable
	UnderlyingInstrumentID string `json:"underlying_instrument_id" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		ContractType           respjson.Field
		Currency               respjson.Field
		Exchange               respjson.Field
		ExerciseStyle          respjson.Field
		Expiry                 respjson.Field
		IsLiquidationOnly      respjson.Field
		IsMarginable           respjson.Field
		IsRestricted           respjson.Field
		ListingType            respjson.Field
		Multiplier             respjson.Field
		StrikePrice            respjson.Field
		Symbol                 respjson.Field
		OpenInterest           respjson.Field
		UnderlyingInstrumentID respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An options contract with options-specific metadata

func (OptionsContract) RawJSON

func (r OptionsContract) RawJSON() string

Returns the unmodified JSON received from the API

func (*OptionsContract) UnmarshalJSON

func (r *OptionsContract) UnmarshalJSON(data []byte) error

type OptionsContractList

type OptionsContractList []OptionsContract

type Order

type Order struct {
	// Engine-assigned unique identifier for this order (UUID).
	ID string `json:"id" api:"required"`
	// Account placing the order
	AccountID int64 `json:"account_id" api:"required"`
	// Client-provided identifier echoed back (FIX tag 11).
	ClientOrderID string `json:"client_order_id" api:"required"`
	// Timestamp when order was created (UTC)
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Cumulative filled quantity
	FilledQuantity string `json:"filled_quantity" api:"required"`
	// OEMS instrument UUID for the traded instrument.
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Type of security
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type" api:"required"`
	// Remaining unfilled quantity
	LeavesQuantity string `json:"leaves_quantity" api:"required"`
	// Type of order (MARKET, LIMIT, etc.)
	//
	// Any of "MARKET", "LIMIT", "STOP", "STOP_LIMIT", "TRAILING_STOP",
	// "TRAILING_STOP_LIMIT", "OTHER".
	OrderType OrderType `json:"order_type" api:"required"`
	// Total order quantity
	Quantity string `json:"quantity" api:"required"`
	// Side of the order (BUY, SELL, SELL_SHORT)
	//
	// Any of "BUY", "SELL", "SELL_SHORT", "OTHER".
	Side Side `json:"side" api:"required"`
	// Current status of the order
	//
	// Any of "PENDING_NEW", "NEW", "PARTIALLY_FILLED", "FILLED", "CANCELED",
	// "REJECTED", "EXPIRED", "PENDING_CANCEL", "PENDING_REPLACE", "REPLACED",
	// "DONE_FOR_DAY", "STOPPED", "SUSPENDED", "CALCULATED", "OTHER".
	Status OrderStatus `json:"status" api:"required"`
	// Trading symbol
	Symbol string `json:"symbol" api:"required"`
	// Time in force instruction
	//
	// Any of "DAY", "GOOD_TILL_CANCEL", "IMMEDIATE_OR_CANCEL", "FILL_OR_KILL",
	// "GOOD_TILL_DATE", "AT_THE_OPENING", "AT_THE_CLOSE", "GOOD_TILL_CROSSING",
	// "GOOD_THROUGH_CROSSING", "AT_CROSSING", "OTHER".
	TimeInForce TimeInForce `json:"time_in_force" api:"required"`
	// Timestamp of the most recent update (UTC)
	UpdatedAt time.Time `json:"updated_at" api:"required" format:"date-time"`
	// MIC code of the venue where the order is routed
	Venue string `json:"venue" api:"required"`
	// Average fill price across all executions
	AverageFillPrice string `json:"average_fill_price" api:"nullable"`
	// Contains execution, rejection or cancellation details, if any
	Details []string `json:"details"`
	// Timestamp when the order will expire (UTC). Present when time_in_force is
	// GOOD_TILL_DATE.
	ExpiresAt time.Time `json:"expires_at" api:"nullable" format:"date-time"`
	// Whether the order is eligible for extended-hours trading.
	ExtendedHours bool `json:"extended_hours" api:"nullable"`
	// Limit offset for trailing stop-limit orders (signed)
	LimitOffset string `json:"limit_offset" api:"nullable"`
	// Limit price (for LIMIT and STOP_LIMIT orders)
	LimitPrice string `json:"limit_price" api:"nullable"`
	// Parent order queue state, present when the order is awaiting release or
	// released.
	//
	// Any of "AWAITING_RELEASE", "RELEASED".
	QueueState QueueState `json:"queue_state" api:"nullable"`
	// Scheduled release time for orders awaiting release.
	ReleasesAt time.Time `json:"releases_at" api:"nullable" format:"date-time"`
	// Stop price (for STOP and STOP_LIMIT orders)
	StopPrice string `json:"stop_price" api:"nullable"`
	// Current trailing limit price computed by the trailing strategy
	TrailingLimitPx string `json:"trailing_limit_px" api:"nullable"`
	// Trailing offset amount for trailing orders
	TrailingOffset string `json:"trailing_offset" api:"nullable"`
	// Trailing offset type for trailing orders
	//
	// Any of "PRICE", "BPS".
	TrailingOffsetType TrailingOffsetType `json:"trailing_offset_type" api:"nullable"`
	// Current trailing stop price computed by the trailing strategy
	TrailingStopPx string `json:"trailing_stop_px" api:"nullable"`
	// Trailing watermark price for trailing orders
	TrailingWatermarkPx string `json:"trailing_watermark_px" api:"nullable"`
	// Trailing watermark timestamp for trailing orders
	TrailingWatermarkTs time.Time `json:"trailing_watermark_ts" api:"nullable" format:"date-time"`
	// OEMS instrument ID of the option's underlying instrument. Populated only for
	// OPTIONS orders; `null` for non-options and for options whose underlier cannot be
	// resolved from the instrument cache.
	UnderlyingInstrumentID string `json:"underlying_instrument_id" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		AccountID              respjson.Field
		ClientOrderID          respjson.Field
		CreatedAt              respjson.Field
		FilledQuantity         respjson.Field
		InstrumentID           respjson.Field
		InstrumentType         respjson.Field
		LeavesQuantity         respjson.Field
		OrderType              respjson.Field
		Quantity               respjson.Field
		Side                   respjson.Field
		Status                 respjson.Field
		Symbol                 respjson.Field
		TimeInForce            respjson.Field
		UpdatedAt              respjson.Field
		Venue                  respjson.Field
		AverageFillPrice       respjson.Field
		Details                respjson.Field
		ExpiresAt              respjson.Field
		ExtendedHours          respjson.Field
		LimitOffset            respjson.Field
		LimitPrice             respjson.Field
		QueueState             respjson.Field
		ReleasesAt             respjson.Field
		StopPrice              respjson.Field
		TrailingLimitPx        respjson.Field
		TrailingOffset         respjson.Field
		TrailingOffsetType     respjson.Field
		TrailingStopPx         respjson.Field
		TrailingWatermarkPx    respjson.Field
		TrailingWatermarkTs    respjson.Field
		UnderlyingInstrumentID respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A trading order with its current state and execution details.

This is the unified API representation of an order across its lifecycle, combining data from execution reports, order status queries, and parent/child tracking.

func (Order) RawJSON

func (r Order) RawJSON() string

Returns the unmodified JSON received from the API

func (*Order) UnmarshalJSON

func (r *Order) UnmarshalJSON(data []byte) error

type OrderList

type OrderList []Order

type OrderStatus

type OrderStatus string

Order status

const (
	OrderStatusPendingNew      OrderStatus = "PENDING_NEW"
	OrderStatusNew             OrderStatus = "NEW"
	OrderStatusPartiallyFilled OrderStatus = "PARTIALLY_FILLED"
	OrderStatusFilled          OrderStatus = "FILLED"
	OrderStatusCanceled        OrderStatus = "CANCELED"
	OrderStatusRejected        OrderStatus = "REJECTED"
	OrderStatusExpired         OrderStatus = "EXPIRED"
	OrderStatusPendingCancel   OrderStatus = "PENDING_CANCEL"
	OrderStatusPendingReplace  OrderStatus = "PENDING_REPLACE"
	OrderStatusReplaced        OrderStatus = "REPLACED"
	OrderStatusDoneForDay      OrderStatus = "DONE_FOR_DAY"
	OrderStatusStopped         OrderStatus = "STOPPED"
	OrderStatusSuspended       OrderStatus = "SUSPENDED"
	OrderStatusCalculated      OrderStatus = "CALCULATED"
	OrderStatusOther           OrderStatus = "OTHER"
)

type OrderType

type OrderType string

Order type

const (
	OrderTypeMarket            OrderType = "MARKET"
	OrderTypeLimit             OrderType = "LIMIT"
	OrderTypeStop              OrderType = "STOP"
	OrderTypeStopLimit         OrderType = "STOP_LIMIT"
	OrderTypeTrailingStop      OrderType = "TRAILING_STOP"
	OrderTypeTrailingStopLimit OrderType = "TRAILING_STOP_LIMIT"
	OrderTypeOther             OrderType = "OTHER"
)

type PortfolioHistoryResponse

type PortfolioHistoryResponse struct {
	Segments []PortfolioHistorySegment `json:"segments" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Segments    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PortfolioHistoryResponse) RawJSON

func (r PortfolioHistoryResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PortfolioHistoryResponse) UnmarshalJSON

func (r *PortfolioHistoryResponse) UnmarshalJSON(data []byte) error

type PortfolioHistorySegment

type PortfolioHistorySegment struct {
	// The date for this segment
	Date time.Time `json:"date" api:"required" format:"date"`
	// The equity at the end of the trading day.
	EodEquity string `json:"eod_equity" api:"required"`
	// Sum of the profit and loss realized from position closing trading activity.
	RealizedPnl string `json:"realized_pnl" api:"required"`
	// The equity at the start of the trading day.
	SodEquity string `json:"sod_equity" api:"required"`
	// Sum of the profit and loss from market changes.
	UnrealizedPnl string `json:"unrealized_pnl" api:"required"`
	// Amount bought MTM
	BoughtNotional string `json:"bought_notional" api:"nullable"`
	// Sum of the profit and loss from intraday trading activities for the trading day.
	DayPnl string `json:"day_pnl" api:"nullable"`
	// P&L after netting all realized and unrealized P&L, adjustments, dividends,
	// change in accruals, income and expenses
	NetPnl string `json:"net_pnl" api:"nullable"`
	// P&L attributable to start-of-day (carried) positions from market movement during
	// this trading day.
	PositionPnl string `json:"position_pnl" api:"nullable"`
	// Amount sold MTM
	SoldNotional string `json:"sold_notional" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Date           respjson.Field
		EodEquity      respjson.Field
		RealizedPnl    respjson.Field
		SodEquity      respjson.Field
		UnrealizedPnl  respjson.Field
		BoughtNotional respjson.Field
		DayPnl         respjson.Field
		NetPnl         respjson.Field
		PositionPnl    respjson.Field
		SoldNotional   respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PortfolioHistorySegment) RawJSON

func (r PortfolioHistorySegment) RawJSON() string

Returns the unmodified JSON received from the API

func (*PortfolioHistorySegment) UnmarshalJSON

func (r *PortfolioHistorySegment) UnmarshalJSON(data []byte) error

type Position

type Position struct {
	// The account this position belongs to
	AccountID int64 `json:"account_id" api:"required"`
	// The quantity of a position that is free to be operated on.
	AvailableQuantity string `json:"available_quantity" api:"required"`
	// OEMS instrument UUID
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Type of security
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type" api:"required"`
	// The current market value of the position
	MarketValue string `json:"market_value" api:"required"`
	// The type of position
	//
	// Any of "LONG", "SHORT", "LONG_CALL", "SHORT_CALL", "LONG_PUT", "SHORT_PUT".
	PositionType PositionType `json:"position_type" api:"required"`
	// The number of shares or contracts. Can be positive (long) or negative (short)
	Quantity string `json:"quantity" api:"required"`
	// The trading symbol for the instrument
	Symbol string `json:"symbol" api:"required"`
	// The average price paid per share or contract for this position
	AvgPrice string `json:"avg_price" api:"nullable"`
	// The closing price used to value the position for the last trading day
	ClosingPrice string `json:"closing_price" api:"nullable"`
	// The market date associated with `closing_price`
	ClosingPriceDate time.Time `json:"closing_price_date" api:"nullable" format:"date"`
	// The total cost basis for this position
	CostBasis string `json:"cost_basis" api:"nullable"`
	// The unrealized profit or loss for this position relative to the previous close
	DailyUnrealizedPnl string `json:"daily_unrealized_pnl" api:"nullable"`
	// The unrealized profit/loss for the position for the current day, expressed as a
	// percentage of the baseline value (range: 0-100).
	DailyUnrealizedPnlPct string `json:"daily_unrealized_pnl_pct" api:"nullable"`
	// The current market price of the instrument
	InstrumentPrice string `json:"instrument_price" api:"nullable"`
	// OEMS instrument identifier of the underlying instrument, if resolvable
	UnderlyingInstrumentID string `json:"underlying_instrument_id" api:"nullable" format:"uuid"`
	// The total unrealized profit or loss for this position based on current market
	// value
	UnrealizedPnl string `json:"unrealized_pnl" api:"nullable"`
	// The unrealized profit/loss for the position, expressed as a percentage of the
	// position's cost basis (range: 0-100).
	UnrealizedPnlPct string `json:"unrealized_pnl_pct" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccountID              respjson.Field
		AvailableQuantity      respjson.Field
		InstrumentID           respjson.Field
		InstrumentType         respjson.Field
		MarketValue            respjson.Field
		PositionType           respjson.Field
		Quantity               respjson.Field
		Symbol                 respjson.Field
		AvgPrice               respjson.Field
		ClosingPrice           respjson.Field
		ClosingPriceDate       respjson.Field
		CostBasis              respjson.Field
		DailyUnrealizedPnl     respjson.Field
		DailyUnrealizedPnlPct  respjson.Field
		InstrumentPrice        respjson.Field
		UnderlyingInstrumentID respjson.Field
		UnrealizedPnl          respjson.Field
		UnrealizedPnlPct       respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a holding of a particular instrument in an account

func (Position) RawJSON

func (r Position) RawJSON() string

Returns the unmodified JSON received from the API

func (*Position) UnmarshalJSON

func (r *Position) UnmarshalJSON(data []byte) error

type PositionEffect added in v0.4.0

type PositionEffect string

Position effect for options orders

const (
	PositionEffectOpen  PositionEffect = "OPEN"
	PositionEffectClose PositionEffect = "CLOSE"
)

type PositionInstruction added in v0.4.0

type PositionInstruction struct {
	// Stable server-assigned id for the instruction (the engine instruction UUID).
	// Used as the `{instruction_id}` path parameter on DELETE.
	ID string `json:"id" api:"required" format:"uuid"`
	// Account the instruction belongs to.
	AccountID int64 `json:"account_id" api:"required"`
	// Caller-supplied instruction id (echoed from the submit request, or the
	// server-generated fallback when the caller omitted one).
	InstructionID string `json:"instruction_id" api:"required"`
	// The instruction type as understood by this API.
	//
	// Any of "EXERCISE", "DO_NOT_EXERCISE", "CONTRARY_EXERCISE".
	InstructionType PositionInstructionType `json:"instruction_type" api:"required"`
	// OEMS instrument identifier the instruction is for.
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Quantity of contracts.
	Quantity string `json:"quantity" api:"required"`
	// Current lifecycle status.
	//
	// Any of "SENT", "ACCEPTED", "REJECTED", "ENGINE_REJECTED", "CANCEL_REQUESTED",
	// "CANCELLED", "CANCEL_FAILED", "UNKNOWN".
	Status PositionInstructionStatus `json:"status" api:"required"`
	// Trading symbol resolved from the instrument cache (OSI for options, since
	// exercises are options-only). Empty if the instrument cannot be resolved (e.g.
	// expired option). Display-only.
	Symbol string `json:"symbol" api:"required"`
	// Quantity accepted by OCC. Populated after `ACCEPTED`.
	AcceptedQuantity string `json:"accepted_quantity" api:"nullable"`
	// Row creation timestamp surfaced from `oems-csc`.
	CreatedAt time.Time `json:"created_at" api:"nullable" format:"date-time"`
	// Inline error detail when a batch entry was rejected (omitted on success).
	Error string `json:"error" api:"nullable"`
	// Reason text populated on terminal reject / cancel-failed statuses.
	RejectionReason string `json:"rejection_reason" api:"nullable"`
	// Last update timestamp surfaced from `oems-csc`.
	UpdatedAt time.Time `json:"updated_at" api:"nullable" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		AccountID        respjson.Field
		InstructionID    respjson.Field
		InstructionType  respjson.Field
		InstrumentID     respjson.Field
		Quantity         respjson.Field
		Status           respjson.Field
		Symbol           respjson.Field
		AcceptedQuantity respjson.Field
		CreatedAt        respjson.Field
		Error            respjson.Field
		RejectionReason  respjson.Field
		UpdatedAt        respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

The API representation of a single CSC instruction, combining the caller's request with the `oems-csc` lifecycle state.

func (PositionInstruction) RawJSON added in v0.4.0

func (r PositionInstruction) RawJSON() string

Returns the unmodified JSON received from the API

func (*PositionInstruction) UnmarshalJSON added in v0.4.0

func (r *PositionInstruction) UnmarshalJSON(data []byte) error

type PositionInstructionList added in v0.4.0

type PositionInstructionList []PositionInstruction

type PositionInstructionStatus added in v0.4.0

type PositionInstructionStatus string

Public Active API lifecycle status for a position instruction.

Maps 1:1 to the `oems-csc` wire enum while keeping the REST schema stable: api-gw owns serialization, OpenAPI generation, and the `Unknown` fallback for missing or unrecognized gRPC values.

const (
	PositionInstructionStatusSent            PositionInstructionStatus = "SENT"
	PositionInstructionStatusAccepted        PositionInstructionStatus = "ACCEPTED"
	PositionInstructionStatusRejected        PositionInstructionStatus = "REJECTED"
	PositionInstructionStatusEngineRejected  PositionInstructionStatus = "ENGINE_REJECTED"
	PositionInstructionStatusCancelRequested PositionInstructionStatus = "CANCEL_REQUESTED"
	PositionInstructionStatusCancelled       PositionInstructionStatus = "CANCELLED"
	PositionInstructionStatusCancelFailed    PositionInstructionStatus = "CANCEL_FAILED"
	PositionInstructionStatusUnknown         PositionInstructionStatus = "UNKNOWN"
)

type PositionInstructionType added in v0.4.0

type PositionInstructionType string

The instruction type a caller wants `oems-csc` to take against an options position.

Maps onto FIX `PosTransType` (tag 709) + `PosMaintAction` (tag 712) + `ContraryInstructionIndicator` (tag 719) per `oems-csc`'s `classify_action`.

const (
	PositionInstructionTypeExercise         PositionInstructionType = "EXERCISE"
	PositionInstructionTypeDoNotExercise    PositionInstructionType = "DO_NOT_EXERCISE"
	PositionInstructionTypeContraryExercise PositionInstructionType = "CONTRARY_EXERCISE"
)

type PositionList

type PositionList []Position

type PositionType

type PositionType string

Position type classification

const (
	PositionTypeLong      PositionType = "LONG"
	PositionTypeShort     PositionType = "SHORT"
	PositionTypeLongCall  PositionType = "LONG_CALL"
	PositionTypeShortCall PositionType = "SHORT_CALL"
	PositionTypeLongPut   PositionType = "LONG_PUT"
	PositionTypeShortPut  PositionType = "SHORT_PUT"
)

type PrefillCancelOrderAction added in v0.4.0

type PrefillCancelOrderAction struct {
	// Orders to cancel using the same identifiers required by the cancel-order API.
	Orders []CancelOrderRequest `json:"orders" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Orders      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Cancel-order prefill action.

func (PrefillCancelOrderAction) RawJSON added in v0.4.0

func (r PrefillCancelOrderAction) RawJSON() string

Returns the unmodified JSON received from the API

func (*PrefillCancelOrderAction) UnmarshalJSON added in v0.4.0

func (r *PrefillCancelOrderAction) UnmarshalJSON(data []byte) error

type PrefillNewOrderAction added in v0.4.0

type PrefillNewOrderAction struct {
	// Orders to prefill using the same shape accepted by the orders API.
	Orders []NewOrderRequest `json:"orders" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Orders      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

New-order prefill action.

func (PrefillNewOrderAction) RawJSON added in v0.4.0

func (r PrefillNewOrderAction) RawJSON() string

Returns the unmodified JSON received from the API

func (*PrefillNewOrderAction) UnmarshalJSON added in v0.4.0

func (r *PrefillNewOrderAction) UnmarshalJSON(data []byte) error

type PrefillOrderActionPrefillCancelOrderAction added in v0.4.0

type PrefillOrderActionPrefillCancelOrderAction struct {
	// Any of "CANCEL".
	ActionType string `json:"action_type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ActionType  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	PrefillCancelOrderAction
}

Cancel one or more existing orders.

func (PrefillOrderActionPrefillCancelOrderAction) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*PrefillOrderActionPrefillCancelOrderAction) UnmarshalJSON added in v0.4.0

func (r *PrefillOrderActionPrefillCancelOrderAction) UnmarshalJSON(data []byte) error

type PrefillOrderActionPrefillNewOrderAction added in v0.4.0

type PrefillOrderActionPrefillNewOrderAction struct {
	// Any of "NEW".
	ActionType string `json:"action_type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ActionType  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	PrefillNewOrderAction
}

Create one or more new orders.

func (PrefillOrderActionPrefillNewOrderAction) RawJSON added in v0.4.0

Returns the unmodified JSON received from the API

func (*PrefillOrderActionPrefillNewOrderAction) UnmarshalJSON added in v0.4.0

func (r *PrefillOrderActionPrefillNewOrderAction) UnmarshalJSON(data []byte) error

type PrefillOrderActionUnion added in v0.4.0

type PrefillOrderActionUnion struct {
	// This field is a union of [[]NewOrderRequest], [[]CancelOrderRequest]
	Orders     PrefillOrderActionUnionOrders `json:"orders"`
	ActionType string                        `json:"action_type"`
	JSON       struct {
		Orders     respjson.Field
		ActionType respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PrefillOrderActionUnion contains all possible properties and values from PrefillOrderActionPrefillNewOrderAction, PrefillOrderActionPrefillCancelOrderAction.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (PrefillOrderActionUnion) AsPrefillCancelOrderAction added in v0.4.0

func (u PrefillOrderActionUnion) AsPrefillCancelOrderAction() (v PrefillOrderActionPrefillCancelOrderAction)

func (PrefillOrderActionUnion) AsPrefillNewOrderAction added in v0.4.0

func (u PrefillOrderActionUnion) AsPrefillNewOrderAction() (v PrefillOrderActionPrefillNewOrderAction)

func (PrefillOrderActionUnion) RawJSON added in v0.4.0

func (u PrefillOrderActionUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*PrefillOrderActionUnion) UnmarshalJSON added in v0.4.0

func (r *PrefillOrderActionUnion) UnmarshalJSON(data []byte) error

type PrefillOrderActionUnionOrders added in v0.4.0

type PrefillOrderActionUnionOrders struct {
	// This field will be present if the value is a [[]NewOrderRequest] instead of an
	// object.
	OfNewOrderRequestArray []NewOrderRequest `json:",inline"`
	// This field will be present if the value is a [[]CancelOrderRequest] instead of
	// an object.
	OfCancelOrderRequestArray []CancelOrderRequest `json:",inline"`
	JSON                      struct {
		OfNewOrderRequestArray    respjson.Field
		OfCancelOrderRequestArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

PrefillOrderActionUnionOrders is an implicit subunion of PrefillOrderActionUnion. PrefillOrderActionUnionOrders provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the PrefillOrderActionUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfNewOrderRequestArray OfCancelOrderRequestArray]

func (*PrefillOrderActionUnionOrders) UnmarshalJSON added in v0.4.0

func (r *PrefillOrderActionUnionOrders) UnmarshalJSON(data []byte) error

type PriceTarget

type PriceTarget struct {
	// Average analyst price target
	Average string `json:"average" api:"required"`
	// ISO 4217 currency code of the price targets
	Currency string `json:"currency" api:"required"`
	// Highest analyst price target
	High string `json:"high" api:"required"`
	// Lowest analyst price target
	Low string `json:"low" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Average     respjson.Field
		Currency    respjson.Field
		High        respjson.Field
		Low         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Analyst price target statistics

func (PriceTarget) RawJSON

func (r PriceTarget) RawJSON() string

Returns the unmodified JSON received from the API

func (*PriceTarget) UnmarshalJSON

func (r *PriceTarget) UnmarshalJSON(data []byte) error

type PromptButtonAction added in v0.2.0

type PromptButtonAction struct {
	// Prompt text to submit as the next user turn.
	Prompt string `json:"prompt" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Prompt      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Prompt-style button behavior.

func (PromptButtonAction) RawJSON added in v0.2.0

func (r PromptButtonAction) RawJSON() string

Returns the unmodified JSON received from the API

func (*PromptButtonAction) UnmarshalJSON added in v0.2.0

func (r *PromptButtonAction) UnmarshalJSON(data []byte) error

type QueueState added in v0.3.0

type QueueState string

Parent order queue or hold state.

const (
	QueueStateAwaitingRelease QueueState = "AWAITING_RELEASE"
	QueueStateReleased        QueueState = "RELEASED"
)

type RequestOrderType added in v0.4.0

type RequestOrderType string

Strict order-type enum for order submission/replacement requests.

const (
	RequestOrderTypeMarket            RequestOrderType = "MARKET"
	RequestOrderTypeLimit             RequestOrderType = "LIMIT"
	RequestOrderTypeStop              RequestOrderType = "STOP"
	RequestOrderTypeStopLimit         RequestOrderType = "STOP_LIMIT"
	RequestOrderTypeTrailingStop      RequestOrderType = "TRAILING_STOP"
	RequestOrderTypeTrailingStopLimit RequestOrderType = "TRAILING_STOP_LIMIT"
)

type RequestTimeInForce added in v0.4.0

type RequestTimeInForce string

Strict time-in-force enum for order submission/replacement requests.

const (
	RequestTimeInForceDay                 RequestTimeInForce = "DAY"
	RequestTimeInForceGoodTillCancel      RequestTimeInForce = "GOOD_TILL_CANCEL"
	RequestTimeInForceImmediateOrCancel   RequestTimeInForce = "IMMEDIATE_OR_CANCEL"
	RequestTimeInForceFillOrKill          RequestTimeInForce = "FILL_OR_KILL"
	RequestTimeInForceGoodTillDate        RequestTimeInForce = "GOOD_TILL_DATE"
	RequestTimeInForceAtTheOpening        RequestTimeInForce = "AT_THE_OPENING"
	RequestTimeInForceAtTheClose          RequestTimeInForce = "AT_THE_CLOSE"
	RequestTimeInForceGoodTillCrossing    RequestTimeInForce = "GOOD_TILL_CROSSING"
	RequestTimeInForceGoodThroughCrossing RequestTimeInForce = "GOOD_THROUGH_CROSSING"
	RequestTimeInForceAtCrossing          RequestTimeInForce = "AT_CROSSING"
)

type Response

type Response struct {
	ID string `json:"id" api:"required" format:"uuid"`
	// Dynamic lifecycle status for a pollable response.
	//
	// Any of "queued", "running", "succeeded", "failed", "canceled".
	Status        ResponseStatus `json:"status" api:"required"`
	ThreadID      string         `json:"thread_id" api:"required" format:"uuid"`
	UserMessageID string         `json:"user_message_id" api:"required" format:"uuid"`
	// Dynamic response content container. May include thinking parts.
	Content ResponseContent `json:"content" api:"nullable"`
	// Shared sanitized error payload.
	Error           ErrorStatus `json:"error" api:"nullable"`
	OutputMessageID string      `json:"output_message_id" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		Status          respjson.Field
		ThreadID        respjson.Field
		UserMessageID   respjson.Field
		Content         respjson.Field
		Error           respjson.Field
		OutputMessageID respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Dynamic pollable response.

func (Response) RawJSON

func (r Response) RawJSON() string

Returns the unmodified JSON received from the API

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

type ResponseContent

type ResponseContent struct {
	Parts []ResponseContentPartUnion `json:"parts" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Parts       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Dynamic response content container. May include thinking parts.

func (ResponseContent) RawJSON

func (r ResponseContent) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContent) UnmarshalJSON

func (r *ResponseContent) UnmarshalJSON(data []byte) error

type ResponseContentPartObject

type ResponseContentPartObject struct {
	// Any of "text".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartTextPayload
}

Text content part.

func (ResponseContentPartObject) RawJSON

func (r ResponseContentPartObject) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartObject) UnmarshalJSON

func (r *ResponseContentPartObject) UnmarshalJSON(data []byte) error

type ResponseContentPartObject2

type ResponseContentPartObject2 struct {
	// Any of "thinking".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartThinkingPayload
}

Thinking content part shown on dynamic response polling.

func (ResponseContentPartObject2) RawJSON

func (r ResponseContentPartObject2) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartObject2) UnmarshalJSON

func (r *ResponseContentPartObject2) UnmarshalJSON(data []byte) error

type ResponseContentPartObject3

type ResponseContentPartObject3 struct {
	// Any of "structured_action".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartStructuredActionPayload
}

Structured action content part.

func (ResponseContentPartObject3) RawJSON

func (r ResponseContentPartObject3) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartObject3) UnmarshalJSON

func (r *ResponseContentPartObject3) UnmarshalJSON(data []byte) error

type ResponseContentPartObject4

type ResponseContentPartObject4 struct {
	// Any of "chart".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartChartPayload
}

Chart payload content part.

func (ResponseContentPartObject4) RawJSON

func (r ResponseContentPartObject4) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartObject4) UnmarshalJSON

func (r *ResponseContentPartObject4) UnmarshalJSON(data []byte) error

type ResponseContentPartObject5

type ResponseContentPartObject5 struct {
	// Any of "suggested_actions".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartSuggestedActionsPayload
}

Suggested actions payload content part.

func (ResponseContentPartObject5) RawJSON

func (r ResponseContentPartObject5) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartObject5) UnmarshalJSON

func (r *ResponseContentPartObject5) UnmarshalJSON(data []byte) error

type ResponseContentPartObject6

type ResponseContentPartObject6 struct {
	// Any of "custom".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	ContentPartCustomPayload
}

Escape-hatch custom payload content part.

func (ResponseContentPartObject6) RawJSON

func (r ResponseContentPartObject6) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartObject6) UnmarshalJSON

func (r *ResponseContentPartObject6) UnmarshalJSON(data []byte) error

type ResponseContentPartUnion

type ResponseContentPartUnion struct {
	// This field is from variant [ResponseContentPartObject].
	Text string `json:"text"`
	Type string `json:"type"`
	// This field is from variant [ResponseContentPartObject2].
	Thoughts []string `json:"thoughts"`
	// This field is from variant [ResponseContentPartObject3].
	Action StructuredActionUnion `json:"action"`
	// This field is from variant [ResponseContentPartObject3].
	ActionID string `json:"action_id"`
	// This field is a union of [ChartPayload], [SuggestedActionsPayload], [any]
	Payload ResponseContentPartUnionPayload `json:"payload"`
	JSON    struct {
		Text     respjson.Field
		Type     respjson.Field
		Thoughts respjson.Field
		Action   respjson.Field
		ActionID respjson.Field
		Payload  respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseContentPartUnion contains all possible properties and values from ResponseContentPartObject, ResponseContentPartObject2, ResponseContentPartObject3, ResponseContentPartObject4, ResponseContentPartObject5, ResponseContentPartObject6.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (ResponseContentPartUnion) AsResponseContentPartObject

func (u ResponseContentPartUnion) AsResponseContentPartObject() (v ResponseContentPartObject)

func (ResponseContentPartUnion) AsResponseContentPartObject2

func (u ResponseContentPartUnion) AsResponseContentPartObject2() (v ResponseContentPartObject2)

func (ResponseContentPartUnion) AsResponseContentPartObject3

func (u ResponseContentPartUnion) AsResponseContentPartObject3() (v ResponseContentPartObject3)

func (ResponseContentPartUnion) AsResponseContentPartObject4

func (u ResponseContentPartUnion) AsResponseContentPartObject4() (v ResponseContentPartObject4)

func (ResponseContentPartUnion) AsResponseContentPartObject5

func (u ResponseContentPartUnion) AsResponseContentPartObject5() (v ResponseContentPartObject5)

func (ResponseContentPartUnion) AsResponseContentPartObject6

func (u ResponseContentPartUnion) AsResponseContentPartObject6() (v ResponseContentPartObject6)

func (ResponseContentPartUnion) RawJSON

func (u ResponseContentPartUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*ResponseContentPartUnion) UnmarshalJSON

func (r *ResponseContentPartUnion) UnmarshalJSON(data []byte) error

type ResponseContentPartUnionPayload added in v0.2.0

type ResponseContentPartUnionPayload struct {
	// This field will be present if the value is a [any] instead of an object.
	OfContentPartCustomPayloadPayload any `json:",inline"`
	// This field is from variant [ChartPayload].
	ChartID       string         `json:"chartId"`
	ActionButtons []ActionButton `json:"actionButtons"`
	// This field is from variant [ChartPayload].
	DataChart DataChart `json:"dataChart"`
	// This field is from variant [ChartPayload].
	SymbolChart SymbolChart `json:"symbolChart"`
	JSON        struct {
		OfContentPartCustomPayloadPayload respjson.Field
		ChartID                           respjson.Field
		ActionButtons                     respjson.Field
		DataChart                         respjson.Field
		SymbolChart                       respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

ResponseContentPartUnionPayload is an implicit subunion of ResponseContentPartUnion. ResponseContentPartUnionPayload provides convenient access to the sub-properties of the union.

For type safety it is recommended to directly use a variant of the ResponseContentPartUnion.

If the underlying value is not a json object, one of the following properties will be valid: OfContentPartCustomPayloadPayload]

func (*ResponseContentPartUnionPayload) UnmarshalJSON added in v0.2.0

func (r *ResponseContentPartUnionPayload) UnmarshalJSON(data []byte) error

type ResponseMetadata

type ResponseMetadata = shared.ResponseMetadata

Metadata for the response. This will always contain a request ID which can be used to identify the request to Clear Street for tracing, and optionally may include pagination data.

This is an alias to an internal type.

type ResponseStatus

type ResponseStatus string

Dynamic lifecycle status for a pollable response.

const (
	ResponseStatusQueued    ResponseStatus = "queued"
	ResponseStatusRunning   ResponseStatus = "running"
	ResponseStatusSucceeded ResponseStatus = "succeeded"
	ResponseStatusFailed    ResponseStatus = "failed"
	ResponseStatusCanceled  ResponseStatus = "canceled"
)

type RiskSettings

type RiskSettings struct {
	// The maximum notional value available to the account
	MaxNotional string `json:"max_notional" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		MaxNotional respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Risk settings for an account

func (RiskSettings) RawJSON

func (r RiskSettings) RawJSON() string

Returns the unmodified JSON received from the API

func (RiskSettings) ToParam

func (r RiskSettings) ToParam() RiskSettingsParam

ToParam converts this RiskSettings to a RiskSettingsParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with RiskSettingsParam.Overrides()

func (*RiskSettings) UnmarshalJSON

func (r *RiskSettings) UnmarshalJSON(data []byte) error

type RiskSettingsParam

type RiskSettingsParam struct {
	// The maximum notional value available to the account
	MaxNotional param.Opt[string] `json:"max_notional,omitzero"`
	// contains filtered or unexported fields
}

Risk settings for an account

func (RiskSettingsParam) MarshalJSON

func (r RiskSettingsParam) MarshalJSON() (data []byte, err error)

func (*RiskSettingsParam) UnmarshalJSON

func (r *RiskSettingsParam) UnmarshalJSON(data []byte) error

type ScreenerFilter

type ScreenerFilter struct {
	// Field to filter on (e.g., "market_cap", "sector", "price")
	Field string `json:"field" api:"required"`
	// Comparison operator (e.g., "eq", "gte", "lte", "in")
	Operator string `json:"operator" api:"required"`
	// Filter value
	Value any `json:"value" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Field       respjson.Field
		Operator    respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single filter criterion for the screener.

func (ScreenerFilter) RawJSON

func (r ScreenerFilter) RawJSON() string

Returns the unmodified JSON received from the API

func (*ScreenerFilter) UnmarshalJSON

func (r *ScreenerFilter) UnmarshalJSON(data []byte) error

type SecurityType

type SecurityType string

Security type

const (
	SecurityTypeCommonStock    SecurityType = "COMMON_STOCK"
	SecurityTypePreferredStock SecurityType = "PREFERRED_STOCK"
	SecurityTypeOption         SecurityType = "OPTION"
	SecurityTypeCash           SecurityType = "CASH"
	SecurityTypeOther          SecurityType = "OTHER"
)

type SessionSchedule

type SessionSchedule struct {
	// Session close timestamp with timezone offset
	Close time.Time `json:"close" api:"required" format:"date-time"`
	// Session open timestamp with timezone offset
	Open time.Time `json:"open" api:"required" format:"date-time"`
	// ISO 8601 duration until session closes. Null if session is not currently open.
	TimeUntilClose string `json:"time_until_close" api:"nullable" format:"duration"`
	// ISO 8601 duration until session opens. Null if session has already started or
	// closed.
	TimeUntilOpen string `json:"time_until_open" api:"nullable" format:"duration"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Close          respjson.Field
		Open           respjson.Field
		TimeUntilClose respjson.Field
		TimeUntilOpen  respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Session schedule with open and close timestamps

func (SessionSchedule) RawJSON

func (r SessionSchedule) RawJSON() string

Returns the unmodified JSON received from the API

func (*SessionSchedule) UnmarshalJSON

func (r *SessionSchedule) UnmarshalJSON(data []byte) error

type Side

type Side string

Side of an order

const (
	SideBuy       Side = "BUY"
	SideSell      Side = "SELL"
	SideSellShort Side = "SELL_SHORT"
	SideOther     Side = "OTHER"
)

type SnapshotLastTrade

type SnapshotLastTrade struct {
	// Most recent last-sale eligible trade price.
	Price string `json:"price" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Price       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Last-trade fields for a market data snapshot.

func (SnapshotLastTrade) RawJSON

func (r SnapshotLastTrade) RawJSON() string

Returns the unmodified JSON received from the API

func (*SnapshotLastTrade) UnmarshalJSON

func (r *SnapshotLastTrade) UnmarshalJSON(data []byte) error

type SnapshotQuote

type SnapshotQuote struct {
	// Current best ask.
	Ask string `json:"ask" api:"required"`
	// Current best bid.
	Bid string `json:"bid" api:"required"`
	// Midpoint of bid and ask.
	Midpoint string `json:"midpoint" api:"required"`
	// Size at the best ask, in shares.
	AskSize int64 `json:"ask_size" api:"nullable"`
	// Size at the best bid, in shares.
	BidSize int64 `json:"bid_size" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Ask         respjson.Field
		Bid         respjson.Field
		Midpoint    respjson.Field
		AskSize     respjson.Field
		BidSize     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

L1 quote fields for a market data snapshot.

func (SnapshotQuote) RawJSON

func (r SnapshotQuote) RawJSON() string

Returns the unmodified JSON received from the API

func (*SnapshotQuote) UnmarshalJSON

func (r *SnapshotQuote) UnmarshalJSON(data []byte) error

type SnapshotSession

type SnapshotSession struct {
	// Absolute change from previous close to last trade.
	Change string `json:"change" api:"required"`
	// Percent change from previous close to last trade.
	ChangePercent string `json:"change_percent" api:"required"`
	// Previous session close price.
	PreviousClose string `json:"previous_close" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Change        respjson.Field
		ChangePercent respjson.Field
		PreviousClose respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Session-level pricing metrics for a market data snapshot.

func (SnapshotSession) RawJSON

func (r SnapshotSession) RawJSON() string

Returns the unmodified JSON received from the API

func (*SnapshotSession) UnmarshalJSON

func (r *SnapshotSession) UnmarshalJSON(data []byte) error

type StructuredActionButtonAction added in v0.2.0

type StructuredActionButtonAction struct {
	// UUID of a `structured_action` content part in the same message.
	ActionID string `json:"actionId" api:"nullable" format:"uuid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ActionID    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Structured-action button behavior.

func (StructuredActionButtonAction) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*StructuredActionButtonAction) UnmarshalJSON added in v0.2.0

func (r *StructuredActionButtonAction) UnmarshalJSON(data []byte) error

type StructuredActionOpenChart

type StructuredActionOpenChart struct {
	// Open a chart for a symbol
	OpenChart OpenChartAction `json:"open_chart" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		OpenChart   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Open a chart for a symbol

func (StructuredActionOpenChart) RawJSON

func (r StructuredActionOpenChart) RawJSON() string

Returns the unmodified JSON received from the API

func (*StructuredActionOpenChart) UnmarshalJSON

func (r *StructuredActionOpenChart) UnmarshalJSON(data []byte) error

type StructuredActionOpenEntitlementConsent added in v0.2.0

type StructuredActionOpenEntitlementConsent struct {
	// Open entitlement consent flow
	OpenEntitlementConsent OpenEntitlementConsentAction `json:"open_entitlement_consent" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		OpenEntitlementConsent respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Open entitlement consent flow

func (StructuredActionOpenEntitlementConsent) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*StructuredActionOpenEntitlementConsent) UnmarshalJSON added in v0.2.0

func (r *StructuredActionOpenEntitlementConsent) UnmarshalJSON(data []byte) error

type StructuredActionOpenScreener

type StructuredActionOpenScreener struct {
	// Open a stock screener with filters
	OpenScreener OpenScreenerAction `json:"open_screener" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		OpenScreener respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Open a stock screener with filters

func (StructuredActionOpenScreener) RawJSON

Returns the unmodified JSON received from the API

func (*StructuredActionOpenScreener) UnmarshalJSON

func (r *StructuredActionOpenScreener) UnmarshalJSON(data []byte) error

type StructuredActionPrefillOrder

type StructuredActionPrefillOrder struct {
	// Prefill an order ticket for user confirmation
	PrefillOrder PrefillOrderActionUnion `json:"prefill_order" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PrefillOrder respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Prefill an order ticket for user confirmation

func (StructuredActionPrefillOrder) RawJSON

Returns the unmodified JSON received from the API

func (*StructuredActionPrefillOrder) UnmarshalJSON

func (r *StructuredActionPrefillOrder) UnmarshalJSON(data []byte) error

type StructuredActionUnion

type StructuredActionUnion struct {
	// This field is from variant [StructuredActionPrefillOrder].
	PrefillOrder PrefillOrderActionUnion `json:"prefill_order"`
	// This field is from variant [StructuredActionOpenChart].
	OpenChart OpenChartAction `json:"open_chart"`
	// This field is from variant [StructuredActionOpenScreener].
	OpenScreener OpenScreenerAction `json:"open_screener"`
	// This field is from variant [StructuredActionOpenEntitlementConsent].
	OpenEntitlementConsent OpenEntitlementConsentAction `json:"open_entitlement_consent"`
	JSON                   struct {
		PrefillOrder           respjson.Field
		OpenChart              respjson.Field
		OpenScreener           respjson.Field
		OpenEntitlementConsent respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

StructuredActionUnion contains all possible properties and values from StructuredActionPrefillOrder, StructuredActionOpenChart, StructuredActionOpenScreener, StructuredActionOpenEntitlementConsent.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (StructuredActionUnion) AsOpenChart

func (StructuredActionUnion) AsOpenEntitlementConsent added in v0.2.0

func (u StructuredActionUnion) AsOpenEntitlementConsent() (v StructuredActionOpenEntitlementConsent)

func (StructuredActionUnion) AsOpenScreener

func (u StructuredActionUnion) AsOpenScreener() (v StructuredActionOpenScreener)

func (StructuredActionUnion) AsPrefillOrder

func (u StructuredActionUnion) AsPrefillOrder() (v StructuredActionPrefillOrder)

func (StructuredActionUnion) RawJSON

func (u StructuredActionUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (*StructuredActionUnion) UnmarshalJSON

func (r *StructuredActionUnion) UnmarshalJSON(data []byte) error

type SuggestedActionsPayload added in v0.2.0

type SuggestedActionsPayload struct {
	// Ordered message-level buttons.
	ActionButtons []ActionButton `json:"actionButtons"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ActionButtons respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Suggested follow-up buttons rendered at the end of an assistant message.

func (SuggestedActionsPayload) RawJSON added in v0.2.0

func (r SuggestedActionsPayload) RawJSON() string

Returns the unmodified JSON received from the API

func (*SuggestedActionsPayload) UnmarshalJSON added in v0.2.0

func (r *SuggestedActionsPayload) UnmarshalJSON(data []byte) error

type SymbolChart added in v0.2.0

type SymbolChart struct {
	Symbol    string `json:"symbol" api:"required"`
	Timeframe string `json:"timeframe" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Symbol      respjson.Field
		Timeframe   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Chart for a single symbol and timeframe.

func (SymbolChart) RawJSON added in v0.2.0

func (r SymbolChart) RawJSON() string

Returns the unmodified JSON received from the API

func (*SymbolChart) UnmarshalJSON added in v0.2.0

func (r *SymbolChart) UnmarshalJSON(data []byte) error

type Thread

type Thread struct {
	ID        string `json:"id" api:"required" format:"uuid"`
	CreatedAt string `json:"created_at" api:"required"`
	Title     string `json:"title" api:"required"`
	UpdatedAt string `json:"updated_at" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Title       respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Thread metadata returned by list/get thread endpoints.

func (Thread) RawJSON

func (r Thread) RawJSON() string

Returns the unmodified JSON received from the API

func (*Thread) UnmarshalJSON

func (r *Thread) UnmarshalJSON(data []byte) error

type ThreadList

type ThreadList []Thread

type TimeInForce

type TimeInForce string

Time in force

const (
	TimeInForceDay                 TimeInForce = "DAY"
	TimeInForceGoodTillCancel      TimeInForce = "GOOD_TILL_CANCEL"
	TimeInForceImmediateOrCancel   TimeInForce = "IMMEDIATE_OR_CANCEL"
	TimeInForceFillOrKill          TimeInForce = "FILL_OR_KILL"
	TimeInForceGoodTillDate        TimeInForce = "GOOD_TILL_DATE"
	TimeInForceAtTheOpening        TimeInForce = "AT_THE_OPENING"
	TimeInForceAtTheClose          TimeInForce = "AT_THE_CLOSE"
	TimeInForceGoodTillCrossing    TimeInForce = "GOOD_TILL_CROSSING"
	TimeInForceGoodThroughCrossing TimeInForce = "GOOD_THROUGH_CROSSING"
	TimeInForceAtCrossing          TimeInForce = "AT_CROSSING"
	TimeInForceOther               TimeInForce = "OTHER"
)

type TradingSessions

type TradingSessions struct {
	// After-hours session schedule, null if not available
	AfterHours SessionSchedule `json:"after_hours" api:"nullable"`
	// Pre-market session schedule, null if not available
	PreMarket SessionSchedule `json:"pre_market" api:"nullable"`
	// Regular trading session schedule, null if holiday/weekend
	Regular SessionSchedule `json:"regular" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AfterHours  respjson.Field
		PreMarket   respjson.Field
		Regular     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Trading sessions for a market day with full timestamps

func (TradingSessions) RawJSON

func (r TradingSessions) RawJSON() string

Returns the unmodified JSON received from the API

func (*TradingSessions) UnmarshalJSON

func (r *TradingSessions) UnmarshalJSON(data []byte) error

type TrailingOffsetType

type TrailingOffsetType string

Trailing offset type for trailing stop orders.

const (
	TrailingOffsetTypePrice TrailingOffsetType = "PRICE"
	TrailingOffsetTypeBps   TrailingOffsetType = "BPS"
)

type V1APIVersionGetVersionResponse added in v0.5.0

type V1APIVersionGetVersionResponse struct {
	// API version information
	Data Version `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1APIVersionGetVersionResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1APIVersionGetVersionResponse) UnmarshalJSON added in v0.5.0

func (r *V1APIVersionGetVersionResponse) UnmarshalJSON(data []byte) error

type V1APIVersionService added in v0.5.0

type V1APIVersionService struct {
	// contains filtered or unexported fields
}

Endpoints for API service metadata.

V1APIVersionService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1APIVersionService method instead.

func NewV1APIVersionService added in v0.5.0

func NewV1APIVersionService(opts ...option.RequestOption) (r V1APIVersionService)

NewV1APIVersionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1APIVersionService) GetVersion added in v0.5.0

Returns the current version string for this API endpoint.

type V1AccountGetAccountBalancesParams added in v0.5.0

type V1AccountGetAccountBalancesParams struct {
	// Limit the number of top margin contributors returned by the engine.
	TopMarginContributorsLimit param.Opt[int64] `query:"top_margin_contributors_limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1AccountGetAccountBalancesParams) URLQuery added in v0.5.0

func (r V1AccountGetAccountBalancesParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1AccountGetAccountBalancesParams's query parameters as `url.Values`.

type V1AccountGetAccountBalancesResponse added in v0.5.0

type V1AccountGetAccountBalancesResponse struct {
	// Represents the balance details for a trading account
	Data AccountBalances `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1AccountGetAccountBalancesResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1AccountGetAccountBalancesResponse) UnmarshalJSON added in v0.5.0

func (r *V1AccountGetAccountBalancesResponse) UnmarshalJSON(data []byte) error

type V1AccountGetAccountByIDResponse added in v0.3.0

type V1AccountGetAccountByIDResponse struct {
	// Represents a trading account
	Data Account `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1AccountGetAccountByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1AccountGetAccountByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1AccountGetAccountByIDResponse) UnmarshalJSON(data []byte) error

type V1AccountGetAccountsParams added in v0.3.0

type V1AccountGetAccountsParams struct {
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// contains filtered or unexported fields
}

func (V1AccountGetAccountsParams) URLQuery added in v0.3.0

func (r V1AccountGetAccountsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1AccountGetAccountsParams's query parameters as `url.Values`.

type V1AccountGetAccountsResponse added in v0.3.0

type V1AccountGetAccountsResponse struct {
	Data AccountList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1AccountGetAccountsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1AccountGetAccountsResponse) UnmarshalJSON added in v0.3.0

func (r *V1AccountGetAccountsResponse) UnmarshalJSON(data []byte) error

type V1AccountGetPortfolioHistoryParams added in v0.5.0

type V1AccountGetPortfolioHistoryParams struct {
	StartDate time.Time `query:"start_date" api:"required" format:"date" json:"-"`
	// Defaults to today in America/New_York when omitted.
	EndDate param.Opt[time.Time] `query:"end_date,omitzero" format:"date" json:"-"`
	// contains filtered or unexported fields
}

func (V1AccountGetPortfolioHistoryParams) URLQuery added in v0.5.0

func (r V1AccountGetPortfolioHistoryParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1AccountGetPortfolioHistoryParams's query parameters as `url.Values`.

type V1AccountGetPortfolioHistoryResponse added in v0.5.0

type V1AccountGetPortfolioHistoryResponse struct {
	Data PortfolioHistoryResponse `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1AccountGetPortfolioHistoryResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1AccountGetPortfolioHistoryResponse) UnmarshalJSON added in v0.5.0

func (r *V1AccountGetPortfolioHistoryResponse) UnmarshalJSON(data []byte) error

type V1AccountPatchAccountByIDParams added in v0.3.0

type V1AccountPatchAccountByIDParams struct {
	// Risk settings for the account
	Risk RiskSettingsParam `json:"risk,omitzero"`
	// contains filtered or unexported fields
}

func (V1AccountPatchAccountByIDParams) MarshalJSON added in v0.3.0

func (r V1AccountPatchAccountByIDParams) MarshalJSON() (data []byte, err error)

func (*V1AccountPatchAccountByIDParams) UnmarshalJSON added in v0.3.0

func (r *V1AccountPatchAccountByIDParams) UnmarshalJSON(data []byte) error

type V1AccountPatchAccountByIDResponse added in v0.3.0

type V1AccountPatchAccountByIDResponse struct {
	Data AccountSettings `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1AccountPatchAccountByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1AccountPatchAccountByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1AccountPatchAccountByIDResponse) UnmarshalJSON(data []byte) error

type V1AccountService added in v0.3.0

type V1AccountService struct {
	// contains filtered or unexported fields
}

Manage trading accounts, balances, and portfolio history.

V1AccountService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1AccountService method instead.

func NewV1AccountService added in v0.3.0

func NewV1AccountService(opts ...option.RequestOption) (r V1AccountService)

NewV1AccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1AccountService) GetAccountBalances added in v0.5.0

Fetch account balance information

func (*V1AccountService) GetAccountByID added in v0.3.0

func (r *V1AccountService) GetAccountByID(ctx context.Context, accountID int64, opts ...option.RequestOption) (res *V1AccountGetAccountByIDResponse, err error)

Fetch account details by ID

func (*V1AccountService) GetAccounts added in v0.3.0

List accounts the authenticated user has permission to access

func (*V1AccountService) GetPortfolioHistory added in v0.5.0

Retrieves daily portfolio history for the specified account.

func (*V1AccountService) PatchAccountByID added in v0.3.0

Update account risk settings

type V1CalendarGetClockResponse added in v0.5.0

type V1CalendarGetClockResponse struct {
	// Current server time and market clock information
	Data ClockDetail `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1CalendarGetClockResponse) RawJSON added in v0.5.0

func (r V1CalendarGetClockResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1CalendarGetClockResponse) UnmarshalJSON added in v0.5.0

func (r *V1CalendarGetClockResponse) UnmarshalJSON(data []byte) error

type V1CalendarGetMarketHoursCalendarParams added in v0.5.0

type V1CalendarGetMarketHoursCalendarParams struct {
	// The date to query market hours for (YYYY-MM-DD). Defaults to today.
	Date string `query:"date" api:"required" json:"-"`
	// Market type to query (us_equities, us_options). If omitted, returns all markets.
	//
	// Any of "us_equities", "us_options".
	Market MarketType `query:"market,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1CalendarGetMarketHoursCalendarParams) URLQuery added in v0.5.0

URLQuery serializes V1CalendarGetMarketHoursCalendarParams's query parameters as `url.Values`.

type V1CalendarGetMarketHoursCalendarResponse added in v0.5.0

type V1CalendarGetMarketHoursCalendarResponse struct {
	Data MarketHoursDetailList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1CalendarGetMarketHoursCalendarResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1CalendarGetMarketHoursCalendarResponse) UnmarshalJSON added in v0.5.0

func (r *V1CalendarGetMarketHoursCalendarResponse) UnmarshalJSON(data []byte) error

type V1CalendarService added in v0.3.0

type V1CalendarService struct {
	// contains filtered or unexported fields
}

Access clocks and financial calendars for market sessions and events.

V1CalendarService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1CalendarService method instead.

func NewV1CalendarService added in v0.3.0

func NewV1CalendarService(opts ...option.RequestOption) (r V1CalendarService)

NewV1CalendarService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1CalendarService) GetClock added in v0.5.0

Returns the current server time in UTC.

func (*V1CalendarService) GetMarketHoursCalendar added in v0.5.0

Retrieves comprehensive trading hours including pre-market, regular, and after-hours sessions. Returns market status, session times, and next session schedules.

type V1InstrumentDataGetAllInstrumentEventsParams added in v0.5.0

type V1InstrumentDataGetAllInstrumentEventsParams struct {
	// The start date for the query range, inclusive (YYYY-MM-DD).
	FromDate param.Opt[string] `query:"from_date,omitzero" json:"-"`
	// The end date for the query range, inclusive (YYYY-MM-DD).
	ToDate param.Opt[string] `query:"to_date,omitzero" json:"-"`
	// Filter by event type(s). Comma-delimited list. Example:
	// `event_types=EARNINGS,IPO`.
	EventTypes []AllEventsEventType `query:"event_types,omitzero" json:"-"`
	// Filter by OEMS instrument ID(s). Comma-delimited list of UUIDs. Example:
	// `instrument_ids=550e8400-e29b-41d4-a716-446655440000`.
	InstrumentIDs []string `query:"instrument_ids,omitzero" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataGetAllInstrumentEventsParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataGetAllInstrumentEventsParams's query parameters as `url.Values`.

type V1InstrumentDataGetAllInstrumentEventsResponse added in v0.5.0

type V1InstrumentDataGetAllInstrumentEventsResponse struct {
	// All-events payload grouped by date.
	Data InstrumentAllEventsData `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetAllInstrumentEventsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetAllInstrumentEventsResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataGetInstrumentAnalystConsensusParams added in v0.5.0

type V1InstrumentDataGetInstrumentAnalystConsensusParams struct {
	// The start date for the query range, inclusive (YYYY-MM-DD)
	From param.Opt[time.Time] `query:"from,omitzero" format:"date" json:"-"`
	// The end date for the query range, inclusive (YYYY-MM-DD)
	To param.Opt[time.Time] `query:"to,omitzero" format:"date" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataGetInstrumentAnalystConsensusParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataGetInstrumentAnalystConsensusParams's query parameters as `url.Values`.

type V1InstrumentDataGetInstrumentAnalystConsensusResponse added in v0.5.0

type V1InstrumentDataGetInstrumentAnalystConsensusResponse struct {
	// Aggregated analyst consensus metrics
	Data InstrumentAnalystConsensus `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetInstrumentAnalystConsensusResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetInstrumentAnalystConsensusResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataGetInstrumentBalanceSheetStatementsParams added in v0.5.0

type V1InstrumentDataGetInstrumentBalanceSheetStatementsParams struct {
	// The start date for the query range, inclusive (YYYY-MM-DD).
	FromDate param.Opt[string] `query:"from_date,omitzero" json:"-"`
	PageSize param.Opt[int64]  `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// The end date for the query range, inclusive (YYYY-MM-DD).
	ToDate param.Opt[string] `query:"to_date,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataGetInstrumentBalanceSheetStatementsParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataGetInstrumentBalanceSheetStatementsParams's query parameters as `url.Values`.

type V1InstrumentDataGetInstrumentBalanceSheetStatementsResponse added in v0.5.0

type V1InstrumentDataGetInstrumentBalanceSheetStatementsResponse struct {
	Data InstrumentBalanceSheetStatementList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetInstrumentBalanceSheetStatementsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetInstrumentBalanceSheetStatementsResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataGetInstrumentCashFlowStatementsParams added in v0.5.0

type V1InstrumentDataGetInstrumentCashFlowStatementsParams struct {
	// The start date for the query range, inclusive (YYYY-MM-DD).
	FromDate param.Opt[string] `query:"from_date,omitzero" json:"-"`
	PageSize param.Opt[int64]  `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// The end date for the query range, inclusive (YYYY-MM-DD).
	ToDate param.Opt[string] `query:"to_date,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataGetInstrumentCashFlowStatementsParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataGetInstrumentCashFlowStatementsParams's query parameters as `url.Values`.

type V1InstrumentDataGetInstrumentCashFlowStatementsResponse added in v0.5.0

type V1InstrumentDataGetInstrumentCashFlowStatementsResponse struct {
	Data InstrumentCashFlowStatementList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetInstrumentCashFlowStatementsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetInstrumentCashFlowStatementsResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataGetInstrumentEventsParams added in v0.5.0

type V1InstrumentDataGetInstrumentEventsParams struct {
	// The start date for the query range, inclusive (YYYY-MM-DD).
	FromDate param.Opt[string] `query:"from_date,omitzero" json:"-"`
	// The end date for the query range, inclusive (YYYY-MM-DD).
	ToDate param.Opt[string] `query:"to_date,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataGetInstrumentEventsParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataGetInstrumentEventsParams's query parameters as `url.Values`.

type V1InstrumentDataGetInstrumentEventsResponse added in v0.5.0

type V1InstrumentDataGetInstrumentEventsResponse struct {
	// Grouped instrument events by type
	Data InstrumentEventsData `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetInstrumentEventsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetInstrumentEventsResponse) UnmarshalJSON added in v0.5.0

func (r *V1InstrumentDataGetInstrumentEventsResponse) UnmarshalJSON(data []byte) error

type V1InstrumentDataGetInstrumentFundamentalsResponse added in v0.5.0

type V1InstrumentDataGetInstrumentFundamentalsResponse struct {
	// Supplemental fundamentals and company profile data for an instrument.
	Data InstrumentFundamentals `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetInstrumentFundamentalsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetInstrumentFundamentalsResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataGetInstrumentIncomeStatementsParams added in v0.5.0

type V1InstrumentDataGetInstrumentIncomeStatementsParams struct {
	// The start date for the query range, inclusive (YYYY-MM-DD).
	FromDate param.Opt[string] `query:"from_date,omitzero" json:"-"`
	PageSize param.Opt[int64]  `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// The end date for the query range, inclusive (YYYY-MM-DD).
	ToDate param.Opt[string] `query:"to_date,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataGetInstrumentIncomeStatementsParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataGetInstrumentIncomeStatementsParams's query parameters as `url.Values`.

type V1InstrumentDataGetInstrumentIncomeStatementsResponse added in v0.5.0

type V1InstrumentDataGetInstrumentIncomeStatementsResponse struct {
	Data InstrumentIncomeStatementList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataGetInstrumentIncomeStatementsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataGetInstrumentIncomeStatementsResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataMarketDataGetDailySummariesParams added in v0.5.0

type V1InstrumentDataMarketDataGetDailySummariesParams struct {
	// Comma-separated OEMS instrument UUIDs (required, 1..=100)
	InstrumentIDs string `query:"instrument_ids" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataMarketDataGetDailySummariesParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataMarketDataGetDailySummariesParams's query parameters as `url.Values`.

type V1InstrumentDataMarketDataGetDailySummariesResponse added in v0.5.0

type V1InstrumentDataMarketDataGetDailySummariesResponse struct {
	Data DailySummaryList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataMarketDataGetDailySummariesResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataMarketDataGetDailySummariesResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataMarketDataGetSnapshotsParams added in v0.5.0

type V1InstrumentDataMarketDataGetSnapshotsParams struct {
	// Comma-separated OEMS instrument UUIDs.
	InstrumentIDs []string `query:"instrument_ids,omitzero" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataMarketDataGetSnapshotsParams) URLQuery added in v0.5.0

URLQuery serializes V1InstrumentDataMarketDataGetSnapshotsParams's query parameters as `url.Values`.

type V1InstrumentDataMarketDataGetSnapshotsResponse added in v0.5.0

type V1InstrumentDataMarketDataGetSnapshotsResponse struct {
	Data MarketDataSnapshotList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataMarketDataGetSnapshotsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataMarketDataGetSnapshotsResponse) UnmarshalJSON added in v0.5.0

type V1InstrumentDataMarketDataService added in v0.5.0

type V1InstrumentDataMarketDataService struct {
	// contains filtered or unexported fields
}

Retrieve instrument analytics, market data, news, and related reference data.

V1InstrumentDataMarketDataService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1InstrumentDataMarketDataService method instead.

func NewV1InstrumentDataMarketDataService added in v0.5.0

func NewV1InstrumentDataMarketDataService(opts ...option.RequestOption) (r V1InstrumentDataMarketDataService)

NewV1InstrumentDataMarketDataService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1InstrumentDataMarketDataService) GetDailySummaries added in v0.5.0

Returns the most recent OHLV and current price for the requested OEMS instruments. Backed by the in-memory Polygon snapshot cache.

Response contract: every request returns one row per **unique** `instrument_id`, in first-seen request order. Unresolvable IDs come back with `symbol = null` and every market-data field `null`; resolvable IDs with no cache entry come back with `symbol` populated but market-data fields `null`.

**Note (temporary):** ID resolution currently goes through the supplemental screener (OEMS instrument_id → FMP fmp_symbol → metadata_id → realtime cache). Removed when the market-data service serves daily aggregates directly, or when Polygon symbology is loaded into the instrument cache.

func (*V1InstrumentDataMarketDataService) GetSnapshots added in v0.5.0

Get market data snapshots for one or more securities.

type V1InstrumentDataNewsGetNewsParams added in v0.5.0

type V1InstrumentDataNewsGetNewsParams struct {
	// Comma-separated list of publishers to exclude (mutually exclusive with
	// include_publishers).
	ExcludePublishers param.Opt[string] `query:"exclude_publishers,omitzero" json:"-"`
	// Inclusive start timestamp. Accepts `YYYY-MM-DD` or RFC3339 datetime.
	From param.Opt[string] `query:"from,omitzero" json:"-"`
	// Comma-separated list of publishers to include (mutually exclusive with
	// exclude_publishers).
	IncludePublishers param.Opt[string] `query:"include_publishers,omitzero" json:"-"`
	PageSize          param.Opt[int64]  `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// Free-text query matched against title/text and associated security IDs.
	SearchQuery param.Opt[string] `query:"search_query,omitzero" json:"-"`
	// Inclusive end timestamp. Accepts `YYYY-MM-DD` or RFC3339 datetime.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// Comma-delimited OEMS instrument UUIDs to filter by.
	InstrumentIDs []string `query:"instrument_ids,omitzero" json:"-"`
	// Filter by news type.
	//
	// Any of "NEWS", "PRESS_RELEASE".
	NewsType V1InstrumentDataNewsGetNewsParamsNewsType `query:"news_type,omitzero" json:"-"`
	// Comma-separated sector values to filter by.
	//
	// Any of "BASIC_MATERIALS", "COMMUNICATION_SERVICES", "CONSUMER_CYCLICAL",
	// "CONSUMER_DEFENSIVE", "ENERGY", "FINANCIAL_SERVICES", "HEALTHCARE",
	// "INDUSTRIALS", "REAL_ESTATE", "TECHNOLOGY", "UTILITIES".
	Sectors []string `query:"sectors,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentDataNewsGetNewsParams) URLQuery added in v0.5.0

func (r V1InstrumentDataNewsGetNewsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1InstrumentDataNewsGetNewsParams's query parameters as `url.Values`.

type V1InstrumentDataNewsGetNewsParamsNewsType added in v0.5.0

type V1InstrumentDataNewsGetNewsParamsNewsType string

Filter by news type.

const (
	V1InstrumentDataNewsGetNewsParamsNewsTypeNews         V1InstrumentDataNewsGetNewsParamsNewsType = "NEWS"
	V1InstrumentDataNewsGetNewsParamsNewsTypePressRelease V1InstrumentDataNewsGetNewsParamsNewsType = "PRESS_RELEASE"
)

type V1InstrumentDataNewsGetNewsResponse added in v0.5.0

type V1InstrumentDataNewsGetNewsResponse struct {
	Data NewsItemList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentDataNewsGetNewsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentDataNewsGetNewsResponse) UnmarshalJSON added in v0.5.0

func (r *V1InstrumentDataNewsGetNewsResponse) UnmarshalJSON(data []byte) error

type V1InstrumentDataNewsService added in v0.5.0

type V1InstrumentDataNewsService struct {
	// contains filtered or unexported fields
}

Retrieve instrument analytics, market data, news, and related reference data.

V1InstrumentDataNewsService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1InstrumentDataNewsService method instead.

func NewV1InstrumentDataNewsService added in v0.5.0

func NewV1InstrumentDataNewsService(opts ...option.RequestOption) (r V1InstrumentDataNewsService)

NewV1InstrumentDataNewsService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1InstrumentDataNewsService) GetNews added in v0.5.0

Retrieves news items with optional filtering by security IDs, time range, publisher, type, and text query.

type V1InstrumentDataService added in v0.5.0

type V1InstrumentDataService struct {

	// Retrieve instrument analytics, market data, news, and related reference data.
	MarketData V1InstrumentDataMarketDataService
	// Retrieve instrument analytics, market data, news, and related reference data.
	News V1InstrumentDataNewsService
	// contains filtered or unexported fields
}

Retrieve instrument analytics, market data, news, and related reference data.

V1InstrumentDataService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1InstrumentDataService method instead.

func NewV1InstrumentDataService added in v0.5.0

func NewV1InstrumentDataService(opts ...option.RequestOption) (r V1InstrumentDataService)

NewV1InstrumentDataService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1InstrumentDataService) GetAllInstrumentEvents added in v0.5.0

List instrument events across all securities.

Retrieves all instrument events grouped by date.

func (*V1InstrumentDataService) GetInstrumentAnalystConsensus added in v0.5.0

Retrieves analyst ratings and price targets for an instrument.

func (*V1InstrumentDataService) GetInstrumentBalanceSheetStatements added in v0.5.0

Get balance sheet statements for an instrument.

Retrieves quarterly balance sheet statements for a specific instrument, sorted by fiscal period (most recent first).

Date range defaults:

- `from_date`: None (no lower bound) - `to_date`: None (no upper bound)

func (*V1InstrumentDataService) GetInstrumentCashFlowStatements added in v0.5.0

Get cash flow statements for an instrument.

Retrieves historical cash flow statements for the specified instrument. Cash flow statements show cash inflows and outflows from operating, investing, and financing activities.

func (*V1InstrumentDataService) GetInstrumentEvents added in v0.5.0

Retrieves corporate events (dividends, splits, etc.) for an instrument, grouped by event type.

Date range defaults:

- `from_date`: today - 365 days - `to_date`: today + 60 days

func (*V1InstrumentDataService) GetInstrumentFundamentals added in v0.5.0

Retrieves supplemental fundamentals and company profile data for an instrument.

func (*V1InstrumentDataService) GetInstrumentIncomeStatements added in v0.5.0

Retrieves quarterly income statements for a specific instrument, sorted by fiscal period (most recent first).

Date range defaults:

- `from_date`: None (no lower bound) - `to_date`: None (no upper bound)

type V1InstrumentGetInstrumentByIDParams added in v0.3.0

type V1InstrumentGetInstrumentByIDParams struct {
	// When true, include unique options expiry dates for this instrument
	IncludeOptionsExpiryDates param.Opt[bool] `query:"include_options_expiry_dates,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentGetInstrumentByIDParams) URLQuery added in v0.3.0

func (r V1InstrumentGetInstrumentByIDParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1InstrumentGetInstrumentByIDParams's query parameters as `url.Values`.

type V1InstrumentGetInstrumentByIDResponse added in v0.3.0

type V1InstrumentGetInstrumentByIDResponse struct {
	// Represents a tradable financial instrument.
	Data Instrument `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentGetInstrumentByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1InstrumentGetInstrumentByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1InstrumentGetInstrumentByIDResponse) UnmarshalJSON(data []byte) error

type V1InstrumentGetInstrumentsParams added in v0.3.0

type V1InstrumentGetInstrumentsParams struct {
	// Filter by easy to borrow status
	EasyToBorrow param.Opt[bool] `query:"easy_to_borrow,omitzero" json:"-"`
	// Filter by liquidation only status
	IsLiquidationOnly param.Opt[bool] `query:"is_liquidation_only,omitzero" json:"-"`
	// Filter by marginable status
	IsMarginable param.Opt[bool] `query:"is_marginable,omitzero" json:"-"`
	// Filter by restricted status
	IsRestricted param.Opt[bool] `query:"is_restricted,omitzero" json:"-"`
	// Filter by short prohibited status
	IsShortProhibited param.Opt[bool] `query:"is_short_prohibited,omitzero" json:"-"`
	// Filter by threshold security status
	IsThresholdSecurity param.Opt[bool]  `query:"is_threshold_security,omitzero" json:"-"`
	PageSize            param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// Comma-separated OEMS instrument UUIDs
	InstrumentIDs []string `query:"instrument_ids,omitzero" format:"uuid" json:"-"`
	// Filter by instrument type. OPTION is not supported on this endpoint; use GET
	// /instruments/options/contracts to list option contracts. If omitted, returns all
	// supported instrument types except options.
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType V1InstrumentGetInstrumentsParamsInstrumentType `query:"instrument_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentGetInstrumentsParams) URLQuery added in v0.3.0

func (r V1InstrumentGetInstrumentsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1InstrumentGetInstrumentsParams's query parameters as `url.Values`.

type V1InstrumentGetInstrumentsParamsInstrumentType added in v0.3.0

type V1InstrumentGetInstrumentsParamsInstrumentType string

Filter by instrument type. OPTION is not supported on this endpoint; use GET /instruments/options/contracts to list option contracts. If omitted, returns all supported instrument types except options.

const (
	V1InstrumentGetInstrumentsParamsInstrumentTypeCommonStock    V1InstrumentGetInstrumentsParamsInstrumentType = "COMMON_STOCK"
	V1InstrumentGetInstrumentsParamsInstrumentTypePreferredStock V1InstrumentGetInstrumentsParamsInstrumentType = "PREFERRED_STOCK"
	V1InstrumentGetInstrumentsParamsInstrumentTypeOption         V1InstrumentGetInstrumentsParamsInstrumentType = "OPTION"
	V1InstrumentGetInstrumentsParamsInstrumentTypeCash           V1InstrumentGetInstrumentsParamsInstrumentType = "CASH"
	V1InstrumentGetInstrumentsParamsInstrumentTypeOther          V1InstrumentGetInstrumentsParamsInstrumentType = "OTHER"
)

type V1InstrumentGetInstrumentsResponse added in v0.3.0

type V1InstrumentGetInstrumentsResponse struct {
	Data InstrumentCoreList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentGetInstrumentsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1InstrumentGetInstrumentsResponse) UnmarshalJSON added in v0.3.0

func (r *V1InstrumentGetInstrumentsResponse) UnmarshalJSON(data []byte) error

type V1InstrumentGetOptionContractsParams added in v0.5.0

type V1InstrumentGetOptionContractsParams struct {
	// Filter to contracts expiring on this date (YYYY-MM-DD)
	Expiry   param.Opt[time.Time] `query:"expiry,omitzero" format:"date" json:"-"`
	PageSize param.Opt[int64]     `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// Underlier symbol (e.g., AAPL, SPX)
	Underlier param.Opt[string] `query:"underlier,omitzero" json:"-"`
	// OEMS instrument UUID or symbol of the underlying equity/index
	UnderlyingInstrumentID param.Opt[InstrumentIDOrSymbol] `query:"underlying_instrument_id,omitzero" format:"uuid" json:"-"`
	// Filter by contract type: CALL or PUT
	//
	// Any of "CALL", "PUT".
	ContractType ContractType `query:"contract_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentGetOptionContractsParams) URLQuery added in v0.5.0

func (r V1InstrumentGetOptionContractsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1InstrumentGetOptionContractsParams's query parameters as `url.Values`.

type V1InstrumentGetOptionContractsResponse added in v0.5.0

type V1InstrumentGetOptionContractsResponse struct {
	Data OptionsContractList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentGetOptionContractsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1InstrumentGetOptionContractsResponse) UnmarshalJSON added in v0.5.0

func (r *V1InstrumentGetOptionContractsResponse) UnmarshalJSON(data []byte) error

type V1InstrumentSearchInstrumentsParams added in v0.3.0

type V1InstrumentSearchInstrumentsParams struct {
	// Search term applied case-insensitively to ticker symbols, alternate identifiers
	// (CUSIP, ISIN, OPRA root, CMS), and company names for non-option instruments.
	// Option searches match symbols and alternate identifiers.
	Q string `query:"q" api:"required" json:"-"`
	// Comma-separated asset classes (EQUITY|OPTION|WARRANT|BOND|FX|OTHER). Defaults to
	// EQUITY.
	AssetClass param.Opt[string] `query:"asset_class,omitzero" json:"-"`
	// Optional listing-country filter (e.g., US).
	Country param.Opt[string] `query:"country,omitzero" json:"-"`
	// Optional ISO currency filter (e.g., USD).
	Currency param.Opt[string] `query:"currency,omitzero" json:"-"`
	// Include inactive instruments. Default false.
	IncludeInactive param.Opt[bool] `query:"include_inactive,omitzero" json:"-"`
	// Include restricted instruments. Default true (penalized in ranking).
	IncludeRestricted param.Opt[bool]  `query:"include_restricted,omitzero" json:"-"`
	PageSize          param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// contains filtered or unexported fields
}

func (V1InstrumentSearchInstrumentsParams) URLQuery added in v0.3.0

func (r V1InstrumentSearchInstrumentsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1InstrumentSearchInstrumentsParams's query parameters as `url.Values`.

type V1InstrumentSearchInstrumentsResponse added in v0.3.0

type V1InstrumentSearchInstrumentsResponse struct {
	Data InstrumentCoreList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1InstrumentSearchInstrumentsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1InstrumentSearchInstrumentsResponse) UnmarshalJSON added in v0.3.0

func (r *V1InstrumentSearchInstrumentsResponse) UnmarshalJSON(data []byte) error

type V1InstrumentService added in v0.3.0

type V1InstrumentService struct {
	// contains filtered or unexported fields
}

Retrieve core details and discovery endpoints for tradable instruments.

V1InstrumentService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1InstrumentService method instead.

func NewV1InstrumentService added in v0.3.0

func NewV1InstrumentService(opts ...option.RequestOption) (r V1InstrumentService)

NewV1InstrumentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1InstrumentService) GetInstrumentByID added in v0.3.0

Retrieves detailed information for a specific instrument.

func (*V1InstrumentService) GetInstruments added in v0.3.0

Retrieves a list of tradeable instruments.

func (*V1InstrumentService) GetOptionContracts added in v0.5.0

List options contracts.

Returns options contracts for a given underlier with options-specific metadata. Exactly one underlier identifier must be provided.

func (*V1InstrumentService) SearchInstruments added in v0.3.0

Search instruments by symbol, alternate identifier, or company name.

The `q` parameter is case-insensitive and supports ticker symbols, alternate identifiers such as CUSIP, ISIN, OPRA root, and CMS identifiers, and company names for non-option instruments. Results are ranked by match quality plus instrument quality signals including log-scaled ADV, listing status, marginability, easy-to-borrow status, and OTC, restricted, and liquidation-only penalties. Defaults to the `EQUITY` asset class (common stocks, preferred shares, ADRs, ETFs, and exchange-traded mutual funds). Pass `asset_class=OPTION` to search option contracts by symbol or alternate identifier.

type V1OmniAIEntitlementDeleteEntitlementResponse added in v0.3.0

type V1OmniAIEntitlementDeleteEntitlementResponse struct {
	Data DeleteEntitlementResponse `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIEntitlementDeleteEntitlementResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIEntitlementDeleteEntitlementResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIEntitlementDeleteEntitlementResponse) UnmarshalJSON(data []byte) error

type V1OmniAIEntitlementGetEntitlementAgreementsResponse added in v0.5.0

type V1OmniAIEntitlementGetEntitlementAgreementsResponse struct {
	Data EntitlementAgreementResourceList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIEntitlementGetEntitlementAgreementsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1OmniAIEntitlementGetEntitlementAgreementsResponse) UnmarshalJSON added in v0.5.0

type V1OmniAIEntitlementGetEntitlementsParams added in v0.3.0

type V1OmniAIEntitlementGetEntitlementsParams struct {
	TradingAccountID param.Opt[int64] `query:"trading_account_id,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIEntitlementGetEntitlementsParams) URLQuery added in v0.3.0

URLQuery serializes V1OmniAIEntitlementGetEntitlementsParams's query parameters as `url.Values`.

type V1OmniAIEntitlementGetEntitlementsResponse added in v0.3.0

type V1OmniAIEntitlementGetEntitlementsResponse struct {
	Data EntitlementResourceList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIEntitlementGetEntitlementsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIEntitlementGetEntitlementsResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIEntitlementGetEntitlementsResponse) UnmarshalJSON(data []byte) error

type V1OmniAIEntitlementNewEntitlementsParams added in v0.3.0

type V1OmniAIEntitlementNewEntitlementsParams struct {
	AgreementID               string            `json:"agreement_id" api:"required"`
	RequestedEntitlementCodes []EntitlementCode `json:"requested_entitlement_codes,omitzero" api:"required"`
	TradingAccountIDs         []int64           `json:"trading_account_ids,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (V1OmniAIEntitlementNewEntitlementsParams) MarshalJSON added in v0.3.0

func (r V1OmniAIEntitlementNewEntitlementsParams) MarshalJSON() (data []byte, err error)

func (*V1OmniAIEntitlementNewEntitlementsParams) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIEntitlementNewEntitlementsParams) UnmarshalJSON(data []byte) error

type V1OmniAIEntitlementNewEntitlementsResponse added in v0.3.0

type V1OmniAIEntitlementNewEntitlementsResponse struct {
	Data EntitlementResourceList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIEntitlementNewEntitlementsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIEntitlementNewEntitlementsResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIEntitlementNewEntitlementsResponse) UnmarshalJSON(data []byte) error

type V1OmniAIEntitlementService added in v0.3.0

type V1OmniAIEntitlementService struct {
	// contains filtered or unexported fields
}

Thread-centric AI assistant for conversational trading. Create threads to start conversations, poll response objects for in-progress output, and read finalized messages from thread history. Thread/message/response endpoints require an explicit account_id. Entitlement endpoints are caller-scoped and use trading_account_ids.

V1OmniAIEntitlementService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1OmniAIEntitlementService method instead.

func NewV1OmniAIEntitlementService added in v0.3.0

func NewV1OmniAIEntitlementService(opts ...option.RequestOption) (r V1OmniAIEntitlementService)

NewV1OmniAIEntitlementService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1OmniAIEntitlementService) DeleteEntitlement added in v0.3.0

func (r *V1OmniAIEntitlementService) DeleteEntitlement(ctx context.Context, entitlementID string, opts ...option.RequestOption) (res *V1OmniAIEntitlementDeleteEntitlementResponse, err error)

Revoke one entitlement grant by id.

func (*V1OmniAIEntitlementService) GetEntitlementAgreements added in v0.5.0

List current signable entitlement agreements for consent UX.

func (*V1OmniAIEntitlementService) GetEntitlements added in v0.3.0

List caller's active entitlement grants.

func (*V1OmniAIEntitlementService) NewEntitlements added in v0.3.0

Record consent and upsert one-or-more active grants.

type V1OmniAIMessageGetMessageByIDParams added in v0.3.0

type V1OmniAIMessageGetMessageByIDParams struct {
	// Account ID for the request
	AccountID int64 `query:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIMessageGetMessageByIDParams) URLQuery added in v0.3.0

func (r V1OmniAIMessageGetMessageByIDParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIMessageGetMessageByIDParams's query parameters as `url.Values`.

type V1OmniAIMessageGetMessageByIDResponse added in v0.3.0

type V1OmniAIMessageGetMessageByIDResponse struct {
	// Final immutable message.
	Data Message `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIMessageGetMessageByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIMessageGetMessageByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIMessageGetMessageByIDResponse) UnmarshalJSON(data []byte) error

type V1OmniAIMessageService added in v0.3.0

type V1OmniAIMessageService struct {
	// contains filtered or unexported fields
}

Thread-centric AI assistant for conversational trading. Create threads to start conversations, poll response objects for in-progress output, and read finalized messages from thread history. Thread/message/response endpoints require an explicit account_id. Entitlement endpoints are caller-scoped and use trading_account_ids.

V1OmniAIMessageService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1OmniAIMessageService method instead.

func NewV1OmniAIMessageService added in v0.3.0

func NewV1OmniAIMessageService(opts ...option.RequestOption) (r V1OmniAIMessageService)

NewV1OmniAIMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1OmniAIMessageService) GetMessageByID added in v0.3.0

Get a finalized message by ID.

Returns a single finalized message. Returns **404** if the message belongs to an in-progress assistant turn (use the response endpoint for live output). Once the turn completes, the message becomes available here.

func (*V1OmniAIMessageService) SubmitFeedback added in v0.3.0

Submit feedback on a finalized assistant message.

Attaches a score and optional comment to a finalized assistant message. Feedback is only valid for messages with role `ASSISTANT` that have reached a terminal outcome.

type V1OmniAIMessageSubmitFeedbackParams added in v0.3.0

type V1OmniAIMessageSubmitFeedbackParams struct {
	// Account ID for the request
	AccountID int64 `json:"account_id" api:"required"`
	// Feedback score (-1, 0, +1 or 1-5)
	Score int64 `json:"score" api:"required"`
	// Optional feedback comment
	Comment param.Opt[string] `json:"comment,omitzero"`
	// Optional metadata
	Metadata any `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (V1OmniAIMessageSubmitFeedbackParams) MarshalJSON added in v0.3.0

func (r V1OmniAIMessageSubmitFeedbackParams) MarshalJSON() (data []byte, err error)

func (*V1OmniAIMessageSubmitFeedbackParams) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIMessageSubmitFeedbackParams) UnmarshalJSON(data []byte) error

type V1OmniAIMessageSubmitFeedbackResponse added in v0.3.0

type V1OmniAIMessageSubmitFeedbackResponse struct {
	Data CreateFeedbackResponse `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIMessageSubmitFeedbackResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIMessageSubmitFeedbackResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIMessageSubmitFeedbackResponse) UnmarshalJSON(data []byte) error

type V1OmniAIResponseCancelResponseParams added in v0.3.0

type V1OmniAIResponseCancelResponseParams struct {
	// Account ID for the request
	AccountID int64 `query:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIResponseCancelResponseParams) URLQuery added in v0.3.0

func (r V1OmniAIResponseCancelResponseParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIResponseCancelResponseParams's query parameters as `url.Values`.

type V1OmniAIResponseCancelResponseResponse added in v0.3.0

type V1OmniAIResponseCancelResponseResponse struct {
	Data CancelResponsePayload `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIResponseCancelResponseResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIResponseCancelResponseResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIResponseCancelResponseResponse) UnmarshalJSON(data []byte) error

type V1OmniAIResponseGetResponseByIDParams added in v0.3.0

type V1OmniAIResponseGetResponseByIDParams struct {
	// Account ID for the request
	AccountID int64 `query:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIResponseGetResponseByIDParams) URLQuery added in v0.3.0

func (r V1OmniAIResponseGetResponseByIDParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIResponseGetResponseByIDParams's query parameters as `url.Values`.

type V1OmniAIResponseGetResponseByIDResponse added in v0.3.0

type V1OmniAIResponseGetResponseByIDResponse struct {
	// Dynamic pollable response.
	Data Response `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIResponseGetResponseByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIResponseGetResponseByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIResponseGetResponseByIDResponse) UnmarshalJSON(data []byte) error

type V1OmniAIResponseService added in v0.3.0

type V1OmniAIResponseService struct {
	// contains filtered or unexported fields
}

Thread-centric AI assistant for conversational trading. Create threads to start conversations, poll response objects for in-progress output, and read finalized messages from thread history. Thread/message/response endpoints require an explicit account_id. Entitlement endpoints are caller-scoped and use trading_account_ids.

V1OmniAIResponseService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1OmniAIResponseService method instead.

func NewV1OmniAIResponseService added in v0.3.0

func NewV1OmniAIResponseService(opts ...option.RequestOption) (r V1OmniAIResponseService)

NewV1OmniAIResponseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1OmniAIResponseService) CancelResponse added in v0.3.0

Cancel a response.

Requests cancellation of a queued or running response. If the response has already reached a terminal status, this is an idempotent success. A canceled turn still produces a final assistant message with outcome `canceled` in the thread history.

func (*V1OmniAIResponseService) GetResponseByID added in v0.3.0

Poll a response for assistant output.

Returns the current snapshot of an in-progress or completed response. While the status is `queued` or `running`, the content may be partial and may include `thinking` parts. Poll this endpoint periodically until the status reaches a terminal value (`succeeded`, `failed`, or `canceled`).

Once terminal, the finalized assistant message is available in thread history via `GET /omni-ai/threads/{thread_id}/messages`.

type V1OmniAIService added in v0.3.0

type V1OmniAIService struct {

	// Thread-centric AI assistant for conversational trading. Create threads to start
	// conversations, poll response objects for in-progress output, and read finalized
	// messages from thread history. Thread/message/response endpoints require an
	// explicit account_id. Entitlement endpoints are caller-scoped and use
	// trading_account_ids.
	Entitlements V1OmniAIEntitlementService
	// Thread-centric AI assistant for conversational trading. Create threads to start
	// conversations, poll response objects for in-progress output, and read finalized
	// messages from thread history. Thread/message/response endpoints require an
	// explicit account_id. Entitlement endpoints are caller-scoped and use
	// trading_account_ids.
	Messages V1OmniAIMessageService
	// Thread-centric AI assistant for conversational trading. Create threads to start
	// conversations, poll response objects for in-progress output, and read finalized
	// messages from thread history. Thread/message/response endpoints require an
	// explicit account_id. Entitlement endpoints are caller-scoped and use
	// trading_account_ids.
	Responses V1OmniAIResponseService
	// Thread-centric AI assistant for conversational trading. Create threads to start
	// conversations, poll response objects for in-progress output, and read finalized
	// messages from thread history. Thread/message/response endpoints require an
	// explicit account_id. Entitlement endpoints are caller-scoped and use
	// trading_account_ids.
	Threads V1OmniAIThreadService
	// contains filtered or unexported fields
}

V1OmniAIService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1OmniAIService method instead.

func NewV1OmniAIService added in v0.3.0

func NewV1OmniAIService(opts ...option.RequestOption) (r V1OmniAIService)

NewV1OmniAIService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type V1OmniAIThreadGetMessagesParams added in v0.5.0

type V1OmniAIThreadGetMessagesParams struct {
	// Account ID for the request
	AccountID int64            `query:"account_id" api:"required" json:"-"`
	PageSize  param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIThreadGetMessagesParams) URLQuery added in v0.5.0

func (r V1OmniAIThreadGetMessagesParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIThreadGetMessagesParams's query parameters as `url.Values`.

type V1OmniAIThreadGetMessagesResponse added in v0.5.0

type V1OmniAIThreadGetMessagesResponse struct {
	Data MessageList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIThreadGetMessagesResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1OmniAIThreadGetMessagesResponse) UnmarshalJSON added in v0.5.0

func (r *V1OmniAIThreadGetMessagesResponse) UnmarshalJSON(data []byte) error

type V1OmniAIThreadGetThreadByIDParams added in v0.3.0

type V1OmniAIThreadGetThreadByIDParams struct {
	// Account ID for the request
	AccountID int64 `query:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIThreadGetThreadByIDParams) URLQuery added in v0.3.0

func (r V1OmniAIThreadGetThreadByIDParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIThreadGetThreadByIDParams's query parameters as `url.Values`.

type V1OmniAIThreadGetThreadByIDResponse added in v0.3.0

type V1OmniAIThreadGetThreadByIDResponse struct {
	// Thread metadata returned by list/get thread endpoints.
	Data Thread `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIThreadGetThreadByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIThreadGetThreadByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIThreadGetThreadByIDResponse) UnmarshalJSON(data []byte) error

type V1OmniAIThreadGetThreadResponseParams added in v0.3.0

type V1OmniAIThreadGetThreadResponseParams struct {
	// Account ID for the request
	AccountID int64 `query:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIThreadGetThreadResponseParams) URLQuery added in v0.3.0

func (r V1OmniAIThreadGetThreadResponseParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIThreadGetThreadResponseParams's query parameters as `url.Values`.

type V1OmniAIThreadGetThreadResponseResponse added in v0.3.0

type V1OmniAIThreadGetThreadResponseResponse struct {
	// Dynamic pollable response.
	Data Response `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIThreadGetThreadResponseResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIThreadGetThreadResponseResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIThreadGetThreadResponseResponse) UnmarshalJSON(data []byte) error

type V1OmniAIThreadGetThreadsParams added in v0.3.0

type V1OmniAIThreadGetThreadsParams struct {
	// Account ID for the request
	AccountID int64            `query:"account_id" api:"required" json:"-"`
	PageSize  param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// contains filtered or unexported fields
}

func (V1OmniAIThreadGetThreadsParams) URLQuery added in v0.3.0

func (r V1OmniAIThreadGetThreadsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OmniAIThreadGetThreadsParams's query parameters as `url.Values`.

type V1OmniAIThreadGetThreadsResponse added in v0.3.0

type V1OmniAIThreadGetThreadsResponse struct {
	Data ThreadList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIThreadGetThreadsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIThreadGetThreadsResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIThreadGetThreadsResponse) UnmarshalJSON(data []byte) error

type V1OmniAIThreadNewMessageParams added in v0.5.0

type V1OmniAIThreadNewMessageParams struct {
	AccountID int64  `json:"account_id" api:"required"`
	Text      string `json:"text" api:"required"`
	// Any of "PREFILL_ORDER", "OPEN_CHART", "OPEN_SCREENER",
	// "OPEN_ENTITLEMENT_CONSENT".
	Capabilities []string `json:"capabilities,omitzero"`
	// contains filtered or unexported fields
}

func (V1OmniAIThreadNewMessageParams) MarshalJSON added in v0.5.0

func (r V1OmniAIThreadNewMessageParams) MarshalJSON() (data []byte, err error)

func (*V1OmniAIThreadNewMessageParams) UnmarshalJSON added in v0.5.0

func (r *V1OmniAIThreadNewMessageParams) UnmarshalJSON(data []byte) error

type V1OmniAIThreadNewMessageResponse added in v0.5.0

type V1OmniAIThreadNewMessageResponse struct {
	// Response payload for continuing a thread with a new message.
	Data CreateMessageResponse `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIThreadNewMessageResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1OmniAIThreadNewMessageResponse) UnmarshalJSON added in v0.5.0

func (r *V1OmniAIThreadNewMessageResponse) UnmarshalJSON(data []byte) error

type V1OmniAIThreadNewThreadParams added in v0.3.0

type V1OmniAIThreadNewThreadParams struct {
	AccountID int64 `json:"account_id" api:"required"`
	// Thread creation mode.
	//
	// Any of "instant", "deep_insights".
	Type   V1OmniAIThreadNewThreadParamsType `json:"type,omitzero" api:"required"`
	Text   param.Opt[string]                 `json:"text,omitzero"`
	Thesis param.Opt[string]                 `json:"thesis,omitzero"`
	// Deep-insights target payload.
	Target V1OmniAIThreadNewThreadParamsTarget `json:"target,omitzero"`
	// Any of "PREFILL_ORDER", "OPEN_CHART", "OPEN_SCREENER",
	// "OPEN_ENTITLEMENT_CONSENT".
	Capabilities []string `json:"capabilities,omitzero"`
	// contains filtered or unexported fields
}

func (V1OmniAIThreadNewThreadParams) MarshalJSON added in v0.3.0

func (r V1OmniAIThreadNewThreadParams) MarshalJSON() (data []byte, err error)

func (*V1OmniAIThreadNewThreadParams) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIThreadNewThreadParams) UnmarshalJSON(data []byte) error

type V1OmniAIThreadNewThreadParamsTarget added in v0.3.0

type V1OmniAIThreadNewThreadParamsTarget struct {
	Ticker string `json:"ticker" api:"required"`
	// Deep-insights target type. Launch supports ticker-only.
	//
	// Any of "ticker".
	Type string `json:"type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

Deep-insights target payload.

The properties Ticker, Type are required.

func (V1OmniAIThreadNewThreadParamsTarget) MarshalJSON added in v0.3.0

func (r V1OmniAIThreadNewThreadParamsTarget) MarshalJSON() (data []byte, err error)

func (*V1OmniAIThreadNewThreadParamsTarget) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIThreadNewThreadParamsTarget) UnmarshalJSON(data []byte) error

type V1OmniAIThreadNewThreadParamsType added in v0.3.0

type V1OmniAIThreadNewThreadParamsType string

Thread creation mode.

const (
	V1OmniAIThreadNewThreadParamsTypeInstant      V1OmniAIThreadNewThreadParamsType = "instant"
	V1OmniAIThreadNewThreadParamsTypeDeepInsights V1OmniAIThreadNewThreadParamsType = "deep_insights"
)

type V1OmniAIThreadNewThreadResponse added in v0.3.0

type V1OmniAIThreadNewThreadResponse struct {
	// Response payload for thread creation.
	Data CreateThreadResponse `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OmniAIThreadNewThreadResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1OmniAIThreadNewThreadResponse) UnmarshalJSON added in v0.3.0

func (r *V1OmniAIThreadNewThreadResponse) UnmarshalJSON(data []byte) error

type V1OmniAIThreadService added in v0.3.0

type V1OmniAIThreadService struct {
	// contains filtered or unexported fields
}

Thread-centric AI assistant for conversational trading. Create threads to start conversations, poll response objects for in-progress output, and read finalized messages from thread history. Thread/message/response endpoints require an explicit account_id. Entitlement endpoints are caller-scoped and use trading_account_ids.

V1OmniAIThreadService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1OmniAIThreadService method instead.

func NewV1OmniAIThreadService added in v0.3.0

func NewV1OmniAIThreadService(opts ...option.RequestOption) (r V1OmniAIThreadService)

NewV1OmniAIThreadService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1OmniAIThreadService) GetMessages added in v0.5.0

List finalized messages in a thread.

Returns **finalized** messages in chronological order. Messages from in-progress assistant turns are excluded — use `GET /omni-ai/threads/{thread_id}/response` or `GET /omni-ai/responses/{response_id}` for live output.

If the last finalized message has role `USER`, an active response likely exists and should be polled separately.

func (*V1OmniAIThreadService) GetThreadByID added in v0.3.0

Get a specific thread.

Returns metadata (title, timestamps) for a single thread. Does not include messages — use `GET /omni-ai/threads/{thread_id}/messages` for conversation history.

func (*V1OmniAIThreadService) GetThreadResponse added in v0.3.0

Get the active response for a thread.

Convenience endpoint to look up the currently active response for a thread without knowing the `response_id`. Useful when reloading a thread whose last finalized message is a `USER` message — this indicates an assistant turn is likely in progress.

Returns **404** if no active response exists (the thread is idle).

func (*V1OmniAIThreadService) GetThreads added in v0.3.0

List conversation threads.

Returns thread metadata ordered by most recently created first. Use `page_size` and `page_token` for pagination. Thread objects contain only metadata (title, timestamps) — use the messages endpoint for conversation history.

func (*V1OmniAIThreadService) NewMessage added in v0.5.0

Continue an existing conversation thread.

Appends a new user message to the thread and starts an assistant response. Only one response may be active per thread at a time — if the previous turn is still in progress, this endpoint returns **409 Conflict**. Wait for the active response to reach a terminal status before submitting the next turn.

Poll the returned `response_id` via `GET /omni-ai/responses/{response_id}` for assistant output.

func (*V1OmniAIThreadService) NewThread added in v0.3.0

Create a new conversation thread.

Atomically creates a new thread and submits the first user turn. The response contains a `response_id` that should be polled via `GET /omni-ai/responses/{response_id}` for assistant output.

Two creation modes are supported:

  • **instant** — provide `text` with a natural-language prompt.
  • **deep_insights** — provide a `target` ticker and optional `thesis` for long-form research.

type V1OrderCancelAllOpenOrdersParams added in v0.5.0

type V1OrderCancelAllOpenOrdersParams struct {
	// Comma-separated OEMS instrument UUIDs
	InstrumentIDs []string `query:"instrument_ids,omitzero" format:"uuid" json:"-"`
	// Filter by instrument type (e.g., COMMON_STOCK, OPTION)
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType V1OrderCancelAllOpenOrdersParamsInstrumentType `query:"instrument_type,omitzero" json:"-"`
	// Filter by order side (BUY or SELL)
	//
	// Any of "BUY", "SELL", "SELL_SHORT", "OTHER".
	Side V1OrderCancelAllOpenOrdersParamsSide `query:"side,omitzero" json:"-"`
	// Filter by order type (e.g., MARKET, LIMIT)
	//
	// Any of "MARKET", "LIMIT", "STOP", "STOP_LIMIT", "TRAILING_STOP",
	// "TRAILING_STOP_LIMIT", "OTHER".
	Type V1OrderCancelAllOpenOrdersParamsType `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1OrderCancelAllOpenOrdersParams) URLQuery added in v0.5.0

func (r V1OrderCancelAllOpenOrdersParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OrderCancelAllOpenOrdersParams's query parameters as `url.Values`.

type V1OrderCancelAllOpenOrdersParamsInstrumentType added in v0.5.0

type V1OrderCancelAllOpenOrdersParamsInstrumentType string

Filter by instrument type (e.g., COMMON_STOCK, OPTION)

const (
	V1OrderCancelAllOpenOrdersParamsInstrumentTypeCommonStock    V1OrderCancelAllOpenOrdersParamsInstrumentType = "COMMON_STOCK"
	V1OrderCancelAllOpenOrdersParamsInstrumentTypePreferredStock V1OrderCancelAllOpenOrdersParamsInstrumentType = "PREFERRED_STOCK"
	V1OrderCancelAllOpenOrdersParamsInstrumentTypeOption         V1OrderCancelAllOpenOrdersParamsInstrumentType = "OPTION"
	V1OrderCancelAllOpenOrdersParamsInstrumentTypeCash           V1OrderCancelAllOpenOrdersParamsInstrumentType = "CASH"
	V1OrderCancelAllOpenOrdersParamsInstrumentTypeOther          V1OrderCancelAllOpenOrdersParamsInstrumentType = "OTHER"
)

type V1OrderCancelAllOpenOrdersParamsSide added in v0.5.0

type V1OrderCancelAllOpenOrdersParamsSide string

Filter by order side (BUY or SELL)

const (
	V1OrderCancelAllOpenOrdersParamsSideBuy       V1OrderCancelAllOpenOrdersParamsSide = "BUY"
	V1OrderCancelAllOpenOrdersParamsSideSell      V1OrderCancelAllOpenOrdersParamsSide = "SELL"
	V1OrderCancelAllOpenOrdersParamsSideSellShort V1OrderCancelAllOpenOrdersParamsSide = "SELL_SHORT"
	V1OrderCancelAllOpenOrdersParamsSideOther     V1OrderCancelAllOpenOrdersParamsSide = "OTHER"
)

type V1OrderCancelAllOpenOrdersParamsType added in v0.5.0

type V1OrderCancelAllOpenOrdersParamsType string

Filter by order type (e.g., MARKET, LIMIT)

const (
	V1OrderCancelAllOpenOrdersParamsTypeMarket            V1OrderCancelAllOpenOrdersParamsType = "MARKET"
	V1OrderCancelAllOpenOrdersParamsTypeLimit             V1OrderCancelAllOpenOrdersParamsType = "LIMIT"
	V1OrderCancelAllOpenOrdersParamsTypeStop              V1OrderCancelAllOpenOrdersParamsType = "STOP"
	V1OrderCancelAllOpenOrdersParamsTypeStopLimit         V1OrderCancelAllOpenOrdersParamsType = "STOP_LIMIT"
	V1OrderCancelAllOpenOrdersParamsTypeTrailingStop      V1OrderCancelAllOpenOrdersParamsType = "TRAILING_STOP"
	V1OrderCancelAllOpenOrdersParamsTypeTrailingStopLimit V1OrderCancelAllOpenOrdersParamsType = "TRAILING_STOP_LIMIT"
	V1OrderCancelAllOpenOrdersParamsTypeOther             V1OrderCancelAllOpenOrdersParamsType = "OTHER"
)

type V1OrderCancelAllOpenOrdersResponse added in v0.5.0

type V1OrderCancelAllOpenOrdersResponse struct {
	Data OrderList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OrderCancelAllOpenOrdersResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1OrderCancelAllOpenOrdersResponse) UnmarshalJSON added in v0.5.0

func (r *V1OrderCancelAllOpenOrdersResponse) UnmarshalJSON(data []byte) error

type V1OrderCancelOpenOrderParams added in v0.5.0

type V1OrderCancelOpenOrderParams struct {
	AccountID int64 `path:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type V1OrderCancelOpenOrderResponse added in v0.5.0

type V1OrderCancelOpenOrderResponse struct {
	// A trading order with its current state and execution details.
	//
	// This is the unified API representation of an order across its lifecycle,
	// combining data from execution reports, order status queries, and parent/child
	// tracking.
	Data Order `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OrderCancelOpenOrderResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1OrderCancelOpenOrderResponse) UnmarshalJSON added in v0.5.0

func (r *V1OrderCancelOpenOrderResponse) UnmarshalJSON(data []byte) error

type V1OrderGetOrderByIDParams added in v0.5.0

type V1OrderGetOrderByIDParams struct {
	AccountID int64 `path:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type V1OrderGetOrderByIDResponse added in v0.5.0

type V1OrderGetOrderByIDResponse struct {
	// A trading order with its current state and execution details.
	//
	// This is the unified API representation of an order across its lifecycle,
	// combining data from execution reports, order status queries, and parent/child
	// tracking.
	Data Order `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OrderGetOrderByIDResponse) RawJSON added in v0.5.0

func (r V1OrderGetOrderByIDResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1OrderGetOrderByIDResponse) UnmarshalJSON added in v0.5.0

func (r *V1OrderGetOrderByIDResponse) UnmarshalJSON(data []byte) error

type V1OrderGetOrdersParams added in v0.5.0

type V1OrderGetOrdersParams struct {
	// The start date and time for the query range, inclusive (ISO 8601 format)
	From     param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	PageSize param.Opt[int64]     `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// Filter by symbol
	Symbol param.Opt[string] `query:"symbol,omitzero" json:"-"`
	// The end date and time for the query range, inclusive (ISO 8601 format)
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Comma-separated OEMS instrument UUIDs. Matches options orders whose resolved
	// underlier is any of the given IDs.
	UnderlyingInstrumentIDs param.Opt[string] `query:"underlying_instrument_ids,omitzero" json:"-"`
	// Comma-separated OEMS instrument UUIDs
	InstrumentIDs []string `query:"instrument_ids,omitzero" format:"uuid" json:"-"`
	// Instrument type filter (e.g., COMMON_STOCK, OPTION)
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType V1OrderGetOrdersParamsInstrumentType `query:"instrument_type,omitzero" json:"-"`
	// Comma-separated order statuses to filter by
	//
	// Any of "PENDING_NEW", "NEW", "PARTIALLY_FILLED", "FILLED", "CANCELED",
	// "REJECTED", "EXPIRED", "PENDING_CANCEL", "PENDING_REPLACE", "REPLACED",
	// "DONE_FOR_DAY", "STOPPED", "SUSPENDED", "CALCULATED", "OTHER".
	Status []string `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1OrderGetOrdersParams) URLQuery added in v0.5.0

func (r V1OrderGetOrdersParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1OrderGetOrdersParams's query parameters as `url.Values`.

type V1OrderGetOrdersParamsInstrumentType added in v0.5.0

type V1OrderGetOrdersParamsInstrumentType string

Instrument type filter (e.g., COMMON_STOCK, OPTION)

const (
	V1OrderGetOrdersParamsInstrumentTypeCommonStock    V1OrderGetOrdersParamsInstrumentType = "COMMON_STOCK"
	V1OrderGetOrdersParamsInstrumentTypePreferredStock V1OrderGetOrdersParamsInstrumentType = "PREFERRED_STOCK"
	V1OrderGetOrdersParamsInstrumentTypeOption         V1OrderGetOrdersParamsInstrumentType = "OPTION"
	V1OrderGetOrdersParamsInstrumentTypeCash           V1OrderGetOrdersParamsInstrumentType = "CASH"
	V1OrderGetOrdersParamsInstrumentTypeOther          V1OrderGetOrdersParamsInstrumentType = "OTHER"
)

type V1OrderGetOrdersResponse added in v0.5.0

type V1OrderGetOrdersResponse struct {
	Data OrderList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OrderGetOrdersResponse) RawJSON added in v0.5.0

func (r V1OrderGetOrdersResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1OrderGetOrdersResponse) UnmarshalJSON added in v0.5.0

func (r *V1OrderGetOrdersResponse) UnmarshalJSON(data []byte) error

type V1OrderReplaceOrderParams added in v0.5.0

type V1OrderReplaceOrderParams struct {
	AccountID int64 `path:"account_id" api:"required" json:"-"`
	// New limit price for the order
	LimitPrice param.Opt[string] `json:"limit_price,omitzero"`
	// New quantity for the order
	Quantity param.Opt[string] `json:"quantity,omitzero"`
	// New stop price for the order
	StopPrice param.Opt[string] `json:"stop_price,omitzero"`
	// New time in force for the order
	//
	// Any of "DAY", "GOOD_TILL_CANCEL", "IMMEDIATE_OR_CANCEL", "FILL_OR_KILL",
	// "GOOD_TILL_DATE", "AT_THE_OPENING", "AT_THE_CLOSE", "GOOD_TILL_CROSSING",
	// "GOOD_THROUGH_CROSSING", "AT_CROSSING".
	TimeInForce RequestTimeInForce `json:"time_in_force,omitzero"`
	// contains filtered or unexported fields
}

func (V1OrderReplaceOrderParams) MarshalJSON added in v0.5.0

func (r V1OrderReplaceOrderParams) MarshalJSON() (data []byte, err error)

func (*V1OrderReplaceOrderParams) UnmarshalJSON added in v0.5.0

func (r *V1OrderReplaceOrderParams) UnmarshalJSON(data []byte) error

type V1OrderReplaceOrderResponse added in v0.5.0

type V1OrderReplaceOrderResponse struct {
	// A trading order with its current state and execution details.
	//
	// This is the unified API representation of an order across its lifecycle,
	// combining data from execution reports, order status queries, and parent/child
	// tracking.
	Data Order `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OrderReplaceOrderResponse) RawJSON added in v0.5.0

func (r V1OrderReplaceOrderResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1OrderReplaceOrderResponse) UnmarshalJSON added in v0.5.0

func (r *V1OrderReplaceOrderResponse) UnmarshalJSON(data []byte) error

type V1OrderService added in v0.5.0

type V1OrderService struct {
	// contains filtered or unexported fields
}

Place, monitor, and manage trading orders.

V1OrderService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1OrderService method instead.

func NewV1OrderService added in v0.5.0

func NewV1OrderService(opts ...option.RequestOption) (r V1OrderService)

NewV1OrderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1OrderService) CancelAllOpenOrders added in v0.5.0

func (r *V1OrderService) CancelAllOpenOrders(ctx context.Context, accountID int64, body V1OrderCancelAllOpenOrdersParams, opts ...option.RequestOption) (res *V1OrderCancelAllOpenOrdersResponse, err error)

Cancel all orders for an account

func (*V1OrderService) CancelOpenOrder added in v0.5.0

Cancel a specific order

func (*V1OrderService) GetOrderByID added in v0.5.0

func (r *V1OrderService) GetOrderByID(ctx context.Context, orderID string, query V1OrderGetOrderByIDParams, opts ...option.RequestOption) (res *V1OrderGetOrderByIDResponse, err error)

Get Order By ID

func (*V1OrderService) GetOrders added in v0.5.0

func (r *V1OrderService) GetOrders(ctx context.Context, accountID int64, query V1OrderGetOrdersParams, opts ...option.RequestOption) (res *V1OrderGetOrdersResponse, err error)

List orders for an account with optional filtering

func (*V1OrderService) ReplaceOrder added in v0.5.0

func (r *V1OrderService) ReplaceOrder(ctx context.Context, orderID string, params V1OrderReplaceOrderParams, opts ...option.RequestOption) (res *V1OrderReplaceOrderResponse, err error)

Replace an order with new parameters

func (*V1OrderService) SubmitOrders added in v0.5.0

func (r *V1OrderService) SubmitOrders(ctx context.Context, accountID int64, body V1OrderSubmitOrdersParams, opts ...option.RequestOption) (res *V1OrderSubmitOrdersResponse, err error)

Submit new orders

type V1OrderSubmitOrdersParams added in v0.5.0

type V1OrderSubmitOrdersParams struct {
	Orders []V1OrderSubmitOrdersParamsOrderUnion
	// contains filtered or unexported fields
}

func (V1OrderSubmitOrdersParams) MarshalJSON added in v0.5.0

func (r V1OrderSubmitOrdersParams) MarshalJSON() (data []byte, err error)

func (*V1OrderSubmitOrdersParams) UnmarshalJSON added in v0.5.0

func (r *V1OrderSubmitOrdersParams) UnmarshalJSON(data []byte) error

type V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest added in v0.5.0

type V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest struct {
	// Legs that compose the strategy.
	Legs []V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg `json:"legs,omitzero" api:"required"`
	// Type of order (currently MARKET or LIMIT for multileg strategy submission)
	//
	// Any of "MARKET", "LIMIT", "STOP", "STOP_LIMIT", "TRAILING_STOP",
	// "TRAILING_STOP_LIMIT".
	OrderType RequestOrderType `json:"order_type,omitzero" api:"required"`
	// Time in force
	//
	// Any of "DAY", "GOOD_TILL_CANCEL", "IMMEDIATE_OR_CANCEL", "FILL_OR_KILL",
	// "GOOD_TILL_DATE", "AT_THE_OPENING", "AT_THE_CLOSE", "GOOD_TILL_CROSSING",
	// "GOOD_THROUGH_CROSSING", "AT_CROSSING".
	TimeInForce RequestTimeInForce `json:"time_in_force,omitzero" api:"required"`
	// Optional client-provided unique ID (idempotency). Required to be unique per
	// account.
	ID param.Opt[string] `json:"id,omitzero"`
	// Strategy price, required for LIMIT orders.
	LimitPrice param.Opt[string] `json:"limit_price,omitzero"`
	// Optional strategy-level quantity. Multiplies leg quantities. Defaults to 1.
	Quantity param.Opt[string] `json:"quantity,omitzero"`
	// contains filtered or unexported fields
}

Multileg strategy order request

The properties Legs, OrderType, TimeInForce are required.

func (V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest) MarshalJSON added in v0.5.0

func (*V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest) UnmarshalJSON added in v0.5.0

type V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg added in v0.5.0

type V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg struct {
	// Security type for the leg.
	//
	// Any of "COMMON_STOCK", "PREFERRED_STOCK", "OPTION", "CASH", "OTHER".
	InstrumentType SecurityType `json:"instrument_type,omitzero" api:"required"`
	// Ratio for the leg.
	Ratio string `json:"ratio" api:"required"`
	// Trading symbol (e.g. "AAPL" or OSI symbol for options)
	Security string `json:"security" api:"required"`
	// Leg side.
	//
	// Any of "BUY", "SELL", "SELL_SHORT", "OTHER".
	Side Side `json:"side,omitzero" api:"required"`
	// Optional leg reference identifier.
	ID param.Opt[string] `json:"id,omitzero"`
	// Optional leg position effect.
	//
	// Any of "OPEN", "CLOSE".
	PositionEffect PositionEffect `json:"position_effect,omitzero"`
	// contains filtered or unexported fields
}

A single leg in a multileg strategy request.

The properties InstrumentType, Ratio, Security, Side are required.

func (V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg) MarshalJSON added in v0.5.0

func (*V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequestLeg) UnmarshalJSON added in v0.5.0

type V1OrderSubmitOrdersParamsOrderUnion added in v0.5.0

type V1OrderSubmitOrdersParamsOrderUnion struct {
	OfV1OrderSubmitOrderssOrderNewOrderMultilegRequest *V1OrderSubmitOrdersParamsOrderNewOrderMultilegRequest `json:",omitzero,inline"`
	OfNewOrderRequest                                  *NewOrderRequestParam                                  `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (V1OrderSubmitOrdersParamsOrderUnion) MarshalJSON added in v0.5.0

func (u V1OrderSubmitOrdersParamsOrderUnion) MarshalJSON() ([]byte, error)

func (*V1OrderSubmitOrdersParamsOrderUnion) UnmarshalJSON added in v0.5.0

func (u *V1OrderSubmitOrdersParamsOrderUnion) UnmarshalJSON(data []byte) error

type V1OrderSubmitOrdersResponse added in v0.5.0

type V1OrderSubmitOrdersResponse struct {
	Data OrderList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1OrderSubmitOrdersResponse) RawJSON added in v0.5.0

func (r V1OrderSubmitOrdersResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*V1OrderSubmitOrdersResponse) UnmarshalJSON added in v0.5.0

func (r *V1OrderSubmitOrdersResponse) UnmarshalJSON(data []byte) error

type V1PositionCancelPositionInstructionParams added in v0.5.0

type V1PositionCancelPositionInstructionParams struct {
	AccountID int64 `path:"account_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type V1PositionCancelPositionInstructionResponse added in v0.5.0

type V1PositionCancelPositionInstructionResponse struct {
	// The API representation of a single CSC instruction, combining the caller's
	// request with the `oems-csc` lifecycle state.
	Data PositionInstruction `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1PositionCancelPositionInstructionResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1PositionCancelPositionInstructionResponse) UnmarshalJSON added in v0.5.0

func (r *V1PositionCancelPositionInstructionResponse) UnmarshalJSON(data []byte) error

type V1PositionClosePositionParams added in v0.5.0

type V1PositionClosePositionParams struct {
	AccountID    int64           `path:"account_id" api:"required" json:"-"`
	CancelOrders param.Opt[bool] `json:"cancel_orders,omitzero"`
	// contains filtered or unexported fields
}

func (V1PositionClosePositionParams) MarshalJSON added in v0.5.0

func (r V1PositionClosePositionParams) MarshalJSON() (data []byte, err error)

func (*V1PositionClosePositionParams) UnmarshalJSON added in v0.5.0

func (r *V1PositionClosePositionParams) UnmarshalJSON(data []byte) error

type V1PositionClosePositionResponse added in v0.5.0

type V1PositionClosePositionResponse struct {
	Data OrderList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1PositionClosePositionResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1PositionClosePositionResponse) UnmarshalJSON added in v0.5.0

func (r *V1PositionClosePositionResponse) UnmarshalJSON(data []byte) error

type V1PositionClosePositionsParams added in v0.5.0

type V1PositionClosePositionsParams struct {
	CancelOrders param.Opt[bool] `json:"cancel_orders,omitzero"`
	// contains filtered or unexported fields
}

func (V1PositionClosePositionsParams) MarshalJSON added in v0.5.0

func (r V1PositionClosePositionsParams) MarshalJSON() (data []byte, err error)

func (*V1PositionClosePositionsParams) UnmarshalJSON added in v0.5.0

func (r *V1PositionClosePositionsParams) UnmarshalJSON(data []byte) error

type V1PositionClosePositionsResponse added in v0.5.0

type V1PositionClosePositionsResponse struct {
	Data OrderList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1PositionClosePositionsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1PositionClosePositionsResponse) UnmarshalJSON added in v0.5.0

func (r *V1PositionClosePositionsResponse) UnmarshalJSON(data []byte) error

type V1PositionGetPositionInstructionsParams added in v0.5.0

type V1PositionGetPositionInstructionsParams struct {
	// Filter by OEMS instrument id or symbol (CMS / OSI).
	InstrumentID param.Opt[InstrumentIDOrSymbol] `query:"instrument_id,omitzero" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

func (V1PositionGetPositionInstructionsParams) URLQuery added in v0.5.0

URLQuery serializes V1PositionGetPositionInstructionsParams's query parameters as `url.Values`.

type V1PositionGetPositionInstructionsResponse added in v0.5.0

type V1PositionGetPositionInstructionsResponse struct {
	Data PositionInstructionList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1PositionGetPositionInstructionsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1PositionGetPositionInstructionsResponse) UnmarshalJSON added in v0.5.0

func (r *V1PositionGetPositionInstructionsResponse) UnmarshalJSON(data []byte) error

type V1PositionGetPositionsParams added in v0.5.0

type V1PositionGetPositionsParams struct {
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// Comma-separated OEMS instrument UUIDs
	InstrumentIDs []string `query:"instrument_ids,omitzero" format:"uuid" json:"-"`
	// Field to sort by
	//
	// Any of "SYMBOL", "INSTRUMENT_TYPE", "QUANTITY", "MARKET_VALUE", "POSITION_TYPE",
	// "UNREALIZED_PNL", "DAILY_UNREALIZED_PNL".
	SortBy V1PositionGetPositionsParamsSortBy `query:"sort_by,omitzero" json:"-"`
	// Sort direction
	//
	// Any of "ASC", "DESC".
	SortDirection V1PositionGetPositionsParamsSortDirection `query:"sort_direction,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (V1PositionGetPositionsParams) URLQuery added in v0.5.0

func (r V1PositionGetPositionsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1PositionGetPositionsParams's query parameters as `url.Values`.

type V1PositionGetPositionsParamsSortBy added in v0.5.0

type V1PositionGetPositionsParamsSortBy string

Field to sort by

const (
	V1PositionGetPositionsParamsSortBySymbol             V1PositionGetPositionsParamsSortBy = "SYMBOL"
	V1PositionGetPositionsParamsSortByInstrumentType     V1PositionGetPositionsParamsSortBy = "INSTRUMENT_TYPE"
	V1PositionGetPositionsParamsSortByQuantity           V1PositionGetPositionsParamsSortBy = "QUANTITY"
	V1PositionGetPositionsParamsSortByMarketValue        V1PositionGetPositionsParamsSortBy = "MARKET_VALUE"
	V1PositionGetPositionsParamsSortByPositionType       V1PositionGetPositionsParamsSortBy = "POSITION_TYPE"
	V1PositionGetPositionsParamsSortByUnrealizedPnl      V1PositionGetPositionsParamsSortBy = "UNREALIZED_PNL"
	V1PositionGetPositionsParamsSortByDailyUnrealizedPnl V1PositionGetPositionsParamsSortBy = "DAILY_UNREALIZED_PNL"
)

type V1PositionGetPositionsParamsSortDirection added in v0.5.0

type V1PositionGetPositionsParamsSortDirection string

Sort direction

const (
	V1PositionGetPositionsParamsSortDirectionAsc  V1PositionGetPositionsParamsSortDirection = "ASC"
	V1PositionGetPositionsParamsSortDirectionDesc V1PositionGetPositionsParamsSortDirection = "DESC"
)

type V1PositionGetPositionsResponse added in v0.5.0

type V1PositionGetPositionsResponse struct {
	Data PositionList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1PositionGetPositionsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1PositionGetPositionsResponse) UnmarshalJSON added in v0.5.0

func (r *V1PositionGetPositionsResponse) UnmarshalJSON(data []byte) error

type V1PositionService added in v0.5.0

type V1PositionService struct {
	// contains filtered or unexported fields
}

View positions and manage position instructions.

V1PositionService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1PositionService method instead.

func NewV1PositionService added in v0.5.0

func NewV1PositionService(opts ...option.RequestOption) (r V1PositionService)

NewV1PositionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1PositionService) CancelPositionInstruction added in v0.5.0

Cancel an outstanding exercise / DNE / CEA instruction by its server- assigned `id`. Returns the updated instruction with status `CANCEL_REQUESTED`; the terminal `CANCELLED` / `CANCEL_FAILED` state arrives asynchronously via subsequent GETs.

func (*V1PositionService) ClosePosition added in v0.5.0

Delete a position within an account for an instrument.

Retrieves orders generated to close the position.

func (*V1PositionService) ClosePositions added in v0.5.0

Delete all positions within an account.

Closes all positions for the specified trading account.

func (*V1PositionService) GetPositionInstructions added in v0.5.0

Returns the current lifecycle state of exercise / DNE / CEA instructions for the account. Optionally filter by a specific instrument.

func (*V1PositionService) GetPositions added in v0.5.0

Retrieves all positions for the specified trading account.

func (*V1PositionService) SubmitPositionInstructions added in v0.5.0

Submit one or more option lifecycle instructions against the account. Each row is routed to `oems-csc` independently; per-row rejections are surfaced on the corresponding response entry without failing the batch.

type V1PositionSubmitPositionInstructionsParams added in v0.5.0

type V1PositionSubmitPositionInstructionsParams struct {
	Instructions []V1PositionSubmitPositionInstructionsParamsInstruction
	// contains filtered or unexported fields
}

func (V1PositionSubmitPositionInstructionsParams) MarshalJSON added in v0.5.0

func (r V1PositionSubmitPositionInstructionsParams) MarshalJSON() (data []byte, err error)

func (*V1PositionSubmitPositionInstructionsParams) UnmarshalJSON added in v0.5.0

func (r *V1PositionSubmitPositionInstructionsParams) UnmarshalJSON(data []byte) error

type V1PositionSubmitPositionInstructionsParamsInstruction added in v0.5.0

type V1PositionSubmitPositionInstructionsParamsInstruction struct {
	// Instruction type.
	//
	// Any of "EXERCISE", "DO_NOT_EXERCISE", "CONTRARY_EXERCISE".
	InstructionType PositionInstructionType `json:"instruction_type,omitzero" api:"required"`
	// OEMS instrument identifier. api-gw resolves this to `security_id` +
	// `security_id_source` via the instrument cache before dispatching to `oems-csc`.
	// Unknown ids return 404.
	InstrumentID string `json:"instrument_id" api:"required" format:"uuid"`
	// Quantity of contracts to exercise / DNE / CEA.
	Quantity string `json:"quantity" api:"required"`
	// Caller-supplied instruction id. Echoed back on the response and used as the FIX
	// `pos_req_id` (tag 710) for idempotency. If omitted the server generates a UUID.
	InstructionID param.Opt[string] `json:"instruction_id,omitzero"`
	// contains filtered or unexported fields
}

One exercise / DNE / CEA instruction requested by a client.

Cancel is not an instruction type — use `DELETE /accounts/{account_id}/positions/instructions/{instruction_id}`.

The properties InstructionType, InstrumentID, Quantity are required.

func (V1PositionSubmitPositionInstructionsParamsInstruction) MarshalJSON added in v0.5.0

func (*V1PositionSubmitPositionInstructionsParamsInstruction) UnmarshalJSON added in v0.5.0

type V1PositionSubmitPositionInstructionsResponse added in v0.5.0

type V1PositionSubmitPositionInstructionsResponse struct {
	Data PositionInstructionList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1PositionSubmitPositionInstructionsResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1PositionSubmitPositionInstructionsResponse) UnmarshalJSON added in v0.5.0

func (r *V1PositionSubmitPositionInstructionsResponse) UnmarshalJSON(data []byte) error

type V1Service added in v0.3.0

type V1Service struct {

	// Manage trading accounts, balances, and portfolio history.
	Accounts V1AccountService
	// Endpoints for API service metadata.
	APIVersion V1APIVersionService
	// Access clocks and financial calendars for market sessions and events.
	Calendar V1CalendarService
	// Retrieve instrument analytics, market data, news, and related reference data.
	InstrumentData V1InstrumentDataService
	// Retrieve core details and discovery endpoints for tradable instruments.
	Instruments V1InstrumentService
	OmniAI      V1OmniAIService
	// Place, monitor, and manage trading orders.
	Orders V1OrderService
	// View positions and manage position instructions.
	Positions V1PositionService
	// Create and manage watchlists.
	Watchlist V1WatchlistService
	// Active Websocket.
	Websocket V1WebsocketService
	// contains filtered or unexported fields
}

V1Service contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1Service method instead.

func NewV1Service added in v0.3.0

func NewV1Service(opts ...option.RequestOption) (r V1Service)

NewV1Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type V1WatchlistAddWatchlistItemParams added in v0.5.0

type V1WatchlistAddWatchlistItemParams struct {
	// OEMS instrument UUID
	InstrumentID InstrumentIDOrSymbol `json:"instrument_id" api:"required" format:"uuid"`
	// contains filtered or unexported fields
}

func (V1WatchlistAddWatchlistItemParams) MarshalJSON added in v0.5.0

func (r V1WatchlistAddWatchlistItemParams) MarshalJSON() (data []byte, err error)

func (*V1WatchlistAddWatchlistItemParams) UnmarshalJSON added in v0.5.0

func (r *V1WatchlistAddWatchlistItemParams) UnmarshalJSON(data []byte) error

type V1WatchlistAddWatchlistItemResponse added in v0.5.0

type V1WatchlistAddWatchlistItemResponse struct {
	// Response data for adding a watchlist item
	Data AddWatchlistItemData `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1WatchlistAddWatchlistItemResponse) RawJSON added in v0.5.0

Returns the unmodified JSON received from the API

func (*V1WatchlistAddWatchlistItemResponse) UnmarshalJSON added in v0.5.0

func (r *V1WatchlistAddWatchlistItemResponse) UnmarshalJSON(data []byte) error

type V1WatchlistDeleteWatchlistItemParams added in v0.5.0

type V1WatchlistDeleteWatchlistItemParams struct {
	WatchlistID string `path:"watchlist_id" api:"required" format:"uuid" json:"-"`
	// contains filtered or unexported fields
}

type V1WatchlistDeleteWatchlistItemResponse added in v0.5.0

type V1WatchlistDeleteWatchlistItemResponse = any

type V1WatchlistDeleteWatchlistResponse added in v0.3.0

type V1WatchlistDeleteWatchlistResponse = any

type V1WatchlistGetWatchlistByIDResponse added in v0.3.0

type V1WatchlistGetWatchlistByIDResponse struct {
	// Detailed watchlist with all items
	Data WatchlistDetail `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1WatchlistGetWatchlistByIDResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1WatchlistGetWatchlistByIDResponse) UnmarshalJSON added in v0.3.0

func (r *V1WatchlistGetWatchlistByIDResponse) UnmarshalJSON(data []byte) error

type V1WatchlistGetWatchlistsParams added in v0.3.0

type V1WatchlistGetWatchlistsParams struct {
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// Token for retrieving the next page of results. Contains encoded pagination state
	// (limit + offset). When provided, page_size is ignored.
	PageToken param.Opt[string] `query:"page_token,omitzero" format:"byte" json:"-"`
	// contains filtered or unexported fields
}

func (V1WatchlistGetWatchlistsParams) URLQuery added in v0.3.0

func (r V1WatchlistGetWatchlistsParams) URLQuery() (v url.Values, err error)

URLQuery serializes V1WatchlistGetWatchlistsParams's query parameters as `url.Values`.

type V1WatchlistGetWatchlistsResponse added in v0.3.0

type V1WatchlistGetWatchlistsResponse struct {
	Data WatchlistEntryList `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1WatchlistGetWatchlistsResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1WatchlistGetWatchlistsResponse) UnmarshalJSON added in v0.3.0

func (r *V1WatchlistGetWatchlistsResponse) UnmarshalJSON(data []byte) error

type V1WatchlistNewWatchlistParams added in v0.3.0

type V1WatchlistNewWatchlistParams struct {
	// The desired watchlist name.
	Name string `json:"name" api:"required"`
	// contains filtered or unexported fields
}

func (V1WatchlistNewWatchlistParams) MarshalJSON added in v0.3.0

func (r V1WatchlistNewWatchlistParams) MarshalJSON() (data []byte, err error)

func (*V1WatchlistNewWatchlistParams) UnmarshalJSON added in v0.3.0

func (r *V1WatchlistNewWatchlistParams) UnmarshalJSON(data []byte) error

type V1WatchlistNewWatchlistResponse added in v0.3.0

type V1WatchlistNewWatchlistResponse struct {
	// Represents a user watchlist.
	Data WatchlistEntry `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	shared.BaseResponse
}

func (V1WatchlistNewWatchlistResponse) RawJSON added in v0.3.0

Returns the unmodified JSON received from the API

func (*V1WatchlistNewWatchlistResponse) UnmarshalJSON added in v0.3.0

func (r *V1WatchlistNewWatchlistResponse) UnmarshalJSON(data []byte) error

type V1WatchlistService added in v0.3.0

type V1WatchlistService struct {
	// contains filtered or unexported fields
}

Create and manage watchlists.

V1WatchlistService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1WatchlistService method instead.

func NewV1WatchlistService added in v0.3.0

func NewV1WatchlistService(opts ...option.RequestOption) (r V1WatchlistService)

NewV1WatchlistService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1WatchlistService) AddWatchlistItem added in v0.5.0

Add an instrument to a watchlist

func (*V1WatchlistService) DeleteWatchlist added in v0.3.0

func (r *V1WatchlistService) DeleteWatchlist(ctx context.Context, watchlistID string, opts ...option.RequestOption) (res *V1WatchlistDeleteWatchlistResponse, err error)

Delete a watchlist and all its items

func (*V1WatchlistService) DeleteWatchlistItem added in v0.5.0

Delete an instrument from a watchlist

func (*V1WatchlistService) GetWatchlistByID added in v0.3.0

func (r *V1WatchlistService) GetWatchlistByID(ctx context.Context, watchlistID string, opts ...option.RequestOption) (res *V1WatchlistGetWatchlistByIDResponse, err error)

Get a watchlist by ID with all its items

func (*V1WatchlistService) GetWatchlists added in v0.3.0

List watchlists for the authenticated user

func (*V1WatchlistService) NewWatchlist added in v0.3.0

Create Watchlist

type V1WebsocketService added in v0.5.0

type V1WebsocketService struct {
	// contains filtered or unexported fields
}

Active Websocket.

V1WebsocketService contains methods and other services that help with interacting with the clear-street API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewV1WebsocketService method instead.

func NewV1WebsocketService added in v0.5.0

func NewV1WebsocketService(opts ...option.RequestOption) (r V1WebsocketService)

NewV1WebsocketService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*V1WebsocketService) WebsocketHandler added in v0.5.0

func (r *V1WebsocketService) WebsocketHandler(ctx context.Context, opts ...option.RequestOption) (err error)

Upgrade the HTTP connection to a WebSocket and echo incoming messages.

type Version

type Version struct {
	// API version string
	Version string `json:"version" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Version     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

API version information

func (Version) RawJSON

func (r Version) RawJSON() string

Returns the unmodified JSON received from the API

func (*Version) UnmarshalJSON

func (r *Version) UnmarshalJSON(data []byte) error

type WatchlistDetail

type WatchlistDetail struct {
	// Watchlist ID
	ID string `json:"id" api:"required" format:"uuid"`
	// Creation timestamp
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// Items in the watchlist
	Items []WatchlistItemEntry `json:"items" api:"required"`
	// Watchlist name
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Items       respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Detailed watchlist with all items

func (WatchlistDetail) RawJSON

func (r WatchlistDetail) RawJSON() string

Returns the unmodified JSON received from the API

func (*WatchlistDetail) UnmarshalJSON

func (r *WatchlistDetail) UnmarshalJSON(data []byte) error

type WatchlistEntry

type WatchlistEntry struct {
	// The unique identifier for the watchlist.
	ID string `json:"id" api:"required" format:"uuid"`
	// The timestamp when the watchlist was created.
	CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
	// The user-provided watchlist name.
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Represents a user watchlist.

func (WatchlistEntry) RawJSON

func (r WatchlistEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*WatchlistEntry) UnmarshalJSON

func (r *WatchlistEntry) UnmarshalJSON(data []byte) error

type WatchlistEntryList

type WatchlistEntryList []WatchlistEntry

type WatchlistItemEntry

type WatchlistItemEntry struct {
	// Item ID
	ID string `json:"id" api:"required" format:"uuid"`
	// When the item was added
	AddedAt time.Time `json:"added_at" api:"required" format:"date-time"`
	// Price when the item was added
	AddedPrice string `json:"added_price" api:"nullable"`
	// Instrument details
	Instrument Instrument `json:"instrument" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AddedAt     respjson.Field
		AddedPrice  respjson.Field
		Instrument  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A single item in a watchlist

func (WatchlistItemEntry) RawJSON

func (r WatchlistItemEntry) RawJSON() string

Returns the unmodified JSON received from the API

func (*WatchlistItemEntry) UnmarshalJSON

func (r *WatchlistItemEntry) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL