api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api is the contract (spec/openapi.yaml) as Go types: every schema of the engine's HTTP API, models only, generated by oapi-codegen with the same settings as the engine's own package, so an enum value has the same name on both sides (api.SignerAnswerKindShare, api.VenueBinance). The contract's Decimal is a string here too; nothing is parsed into a float.

Regenerate with `make gen` after the contract changes.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLogEntry added in v0.4.0

type AccessLogEntry struct {
	AgentId   string    `json:"agentId"`
	AgentName string    `json:"agentName"`
	At        time.Time `json:"at"`

	// ConnectedAccountId Absent for `accounts`, the agent's list of what it was given.
	ConnectedAccountId *string `json:"connectedAccountId,omitempty"`

	// From The start of the range asked for, or the moment for a snapshot.
	From *time.Time `json:"from,omitempty"`
	Id   string     `json:"id"`

	// KeyId The agent key the read was signed with.
	KeyId *string       `json:"keyId,omitempty"`
	Read  AccessLogRead `json:"read"`
	To    *time.Time    `json:"to,omitempty"`
}

AccessLogEntry One read of connected-account data by an agent.

type AccessLogPage added in v0.4.0

type AccessLogPage struct {
	Items      []AccessLogEntry `json:"items"`
	NextCursor *string          `json:"nextCursor,omitempty"`
}

AccessLogPage defines model for AccessLogPage.

type AccessLogRead added in v0.4.0

type AccessLogRead string

AccessLogRead defines model for AccessLogRead.

const (
	AccessLogReadAccounts     AccessLogRead = "accounts"
	AccessLogReadBalances     AccessLogRead = "balances"
	AccessLogReadEquity       AccessLogRead = "equity"
	AccessLogReadPositions    AccessLogRead = "positions"
	AccessLogReadTransactions AccessLogRead = "transactions"
)

Defines values for AccessLogRead.

func (AccessLogRead) Valid added in v0.4.0

func (e AccessLogRead) Valid() bool

Valid indicates whether the value is a known member of the AccessLogRead enum.

type Account

type Account struct {
	// ConfigRevision Bumped on every configuration change. Decisions record the revision they were evaluated under.
	ConfigRevision int       `json:"configRevision"`
	CreatedAt      time.Time `json:"createdAt"`

	// Entitlements What the account's tier includes (plan doc, Pricing). Billing writes it
	// for hosted accounts and a self-hosted engine reads it from its signed
	// licence; the API only reads it. Safety is never gated: every rule, the
	// stop, the pause, cancels, exits and approvals are in every tier.
	Entitlements Entitlements `json:"entitlements"`
	Id           string       `json:"id"`

	// KillSwitch True while all trading is stopped (killAccount): every proposal
	// from every agent is refused, reduce-only included. Nothing is
	// closed or cancelled; positions and resting orders stay at the venue.
	KillSwitch bool   `json:"killSwitch"`
	Name       string `json:"name"`

	// Paused True while all trading is paused (pauseAccount): only reduce-only
	// orders pass, so agents can close their own positions. A stop
	// outranks a pause.
	Paused bool `json:"paused"`
}

Account defines model for Account.

type AccountDataEntitlements added in v0.4.0

type AccountDataEntitlements struct {
	// History True, a reading of each connected account's positions, balances and
	// value is kept per stretch of `resolutionSeconds`, and they are
	// served over time and at a past moment. False, only the latest
	// reading is kept, and those reads are refused with `limit_reached`.
	History bool `json:"history"`

	// IncludedStorageMb The stored data the plan includes; beyond it is charged for. Absent means not metered.
	IncludedStorageMb *int `json:"includedStorageMb,omitempty"`

	// ResolutionSeconds How often each connected account is read, and the stretch one stored reading stands for. Absent means 60.
	ResolutionSeconds *int `json:"resolutionSeconds,omitempty"`

	// RetentionDays How long snapshots and transactions are kept and served.
	RetentionDays int `json:"retentionDays"`
}

AccountDataEntitlements What the plan includes of connected-account data. The values come from the plan file, not from code. The data is collected by polling, whether or not the engine that judges orders is up: on the hosted service a collector stays up for an account whose engine was stopped for being quiet, until the account is released.

type AccountPosition added in v0.4.0

type AccountPosition struct {
	// EntryPrice A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	EntryPrice Decimal `json:"entryPrice"`

	// Leverage A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Leverage *Decimal `json:"leverage,omitempty"`

	// MarkPrice A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MarkPrice *Decimal `json:"markPrice,omitempty"`

	// Market What kind of market a symbol is on. A venue may use one symbol for
	// several (Binance's BTCUSDT is a spot pair and a perpetual), so a
	// symbol identifies a market only together with this.
	Market MarketKind `json:"market"`

	// NotionalUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	NotionalUsd *Decimal            `json:"notionalUsd,omitempty"`
	Side        AccountPositionSide `json:"side"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size   Decimal `json:"size"`
	Symbol string  `json:"symbol"`

	// UnrealizedUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	UnrealizedUsd *Decimal `json:"unrealizedUsd,omitempty"`
}

AccountPosition The venue's own net position in one market, whoever placed the orders behind it. Derivatives only: an asset held outright is a balance.

type AccountPositionSide added in v0.4.0

type AccountPositionSide string

AccountPositionSide defines model for AccountPosition.Side.

const (
	AccountPositionSideLong  AccountPositionSide = "long"
	AccountPositionSideShort AccountPositionSide = "short"
)

Defines values for AccountPositionSide.

func (AccountPositionSide) Valid added in v0.4.0

func (e AccountPositionSide) Valid() bool

Valid indicates whether the value is a known member of the AccountPositionSide enum.

type AccountPositionSnapshot added in v0.4.0

type AccountPositionSnapshot struct {
	AsOf               time.Time         `json:"asOf"`
	ConnectedAccountId string            `json:"connectedAccountId"`
	Positions          []AccountPosition `json:"positions"`

	// Source observed: read from the venue at that moment. rebuilt: worked out
	// afterwards, for a moment nobody was reading the account (before it
	// was connected), by replaying its transactions and, for values in USD,
	// the venue's historical prices. No engine rebuilds yet: every reading
	// served today is observed.
	Source SnapshotSource `json:"source"`
}

AccountPositionSnapshot defines model for AccountPositionSnapshot.

type AccountTransaction added in v0.4.0

type AccountTransaction struct {
	// Amount What the account gained (positive) or lost (negative), in `asset`. Transfers, funding, fees, rebates.
	Amount *Decimal `json:"amount,omitempty"`

	// AmountUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	AmountUsd *Decimal `json:"amountUsd,omitempty"`

	// Asset What `amount` is in.
	Asset              *string   `json:"asset,omitempty"`
	At                 time.Time `json:"at"`
	ConnectedAccountId string    `json:"connectedAccountId"`

	// CounterpartConnectedAccountId On a transfer, the connected account on the other side, when the
	// engine can tell: always for a move within one connection, and
	// for a move to or from a sub-account whose connection is here
	// too. Absent on a deposit or a withdrawal.
	CounterpartConnectedAccountId *string `json:"counterpartConnectedAccountId,omitempty"`

	// FeeUsd A trade's fee.
	FeeUsd *Decimal `json:"feeUsd,omitempty"`
	Id     string   `json:"id"`

	// Kind transfer_in and transfer_out cross the account's edge: deposits,
	// withdrawals, and moves to or from another account. A move between
	// two accounts of one connection (Binance Futures to Spot) is a
	// transfer_out on the one and a transfer_in on the other, each naming
	// the other side (`counterpartConnectedAccountId`); it moves each
	// account's value by the amount and the connection's by nothing.
	Kind AccountTransactionKind `json:"kind"`

	// Market With `symbol`.
	Market *MarketKind `json:"market,omitempty"`

	// Origin Trades and liquidations. Absent on the rest.
	Origin *TransactionOrigin `json:"origin,omitempty"`

	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price *Decimal `json:"price,omitempty"`
	Side  *Side    `json:"side,omitempty"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size *Decimal `json:"size,omitempty"`

	// Symbol Trades, funding and liquidations.
	Symbol *string `json:"symbol,omitempty"`

	// VenueId The venue's own id for it; each is recorded once.
	VenueId *string `json:"venueId,omitempty"`
}

AccountTransaction One thing that happened on a connected account, as the venue reports it. A trade Mishmar placed is here as the venue saw it and, as a fill, in its agent's book.

type AccountTransactionKind added in v0.4.0

type AccountTransactionKind string

AccountTransactionKind transfer_in and transfer_out cross the account's edge: deposits, withdrawals, and moves to or from another account. A move between two accounts of one connection (Binance Futures to Spot) is a transfer_out on the one and a transfer_in on the other, each naming the other side (`counterpartConnectedAccountId`); it moves each account's value by the amount and the connection's by nothing.

const (
	AccountTransactionKindFee         AccountTransactionKind = "fee"
	AccountTransactionKindFunding     AccountTransactionKind = "funding"
	AccountTransactionKindLiquidation AccountTransactionKind = "liquidation"
	AccountTransactionKindOther       AccountTransactionKind = "other"
	AccountTransactionKindRebate      AccountTransactionKind = "rebate"
	AccountTransactionKindTrade       AccountTransactionKind = "trade"
	AccountTransactionKindTransferIn  AccountTransactionKind = "transfer_in"
	AccountTransactionKindTransferOut AccountTransactionKind = "transfer_out"
)

Defines values for AccountTransactionKind.

func (AccountTransactionKind) Valid added in v0.4.0

func (e AccountTransactionKind) Valid() bool

Valid indicates whether the value is a known member of the AccountTransactionKind enum.

type AccountTransactionPage added in v0.4.0

type AccountTransactionPage struct {
	Items      []AccountTransaction `json:"items"`
	NextCursor *string              `json:"nextCursor,omitempty"`
}

AccountTransactionPage defines model for AccountTransactionPage.

type AccountValue added in v0.5.0

type AccountValue struct {
	ConnectedAccountId string `json:"connectedAccountId"`

	// EquityUsd Its balances at their prices plus its positions' unrealised PnL.
	EquityUsd Decimal `json:"equityUsd"`

	// UnpricedAssets Assets the account held that the engine had no price for at that
	// moment, so `equityUsd` leaves them out. Absent when every asset
	// was priced.
	UnpricedAssets *[]string `json:"unpricedAssets,omitempty"`
}

AccountValue One account's value at a moment, within its connection's.

type Agent

type Agent struct {
	// CapitalUsd The capital allocated to the agent: what its own leverage (its
	// gross exposure ÷ this) and drawdown are measured against. It is
	// a number the person sets, not money moved anywhere, and not a cap
	// on exposure; a gross_exposure rule is. Above 0: 0 or less is 422
	// `validation`, at create and at update, and so is capital on a
	// read agent, which places no orders. Absent when none is set,
	// and then no leverage or drawdown rule may be scoped to the agent
	// (createRule). Before contract 0.21.0 capital was a portfolio's.
	CapitalUsd *Decimal `json:"capitalUsd,omitempty"`

	// ConnectedAccountIds The connected accounts the agent was given: it may read each one
	// whole. A trade agent trades on those where it holds an unrevoked
	// venue key (`venueKeys`); getting a key on an account gives the
	// account. Before contract 0.20.0 this list was derived from the
	// keys alone.
	ConnectedAccountIds []string   `json:"connectedAccountIds"`
	CreatedAt           time.Time  `json:"createdAt"`
	Description         *string    `json:"description,omitempty"`
	Id                  string     `json:"id"`
	Keys                []AgentKey `json:"keys"`
	LastDecisionAt      *time.Time `json:"lastDecisionAt,omitempty"`
	Name                string     `json:"name"`

	// Permission read: the agent has a Mishmar API key and reads the connected accounts
	// it is given; it has no signer and can hold no trading key
	// (createVenueKey answers 409 `conflict`), and its proposals are refused
	// (403 `forbidden`). trade: it may also hold trading keys and propose
	// orders on the accounts it holds one on.
	Permission AgentPermission `json:"permission"`

	// Signer Whether the agent's signer is reaching the engine. Absent when the engine does not track it (no signer channel).
	Signer    *SignerPresence `json:"signer,omitempty"`
	Status    AgentStatus     `json:"status"`
	UpdatedAt time.Time       `json:"updatedAt"`

	// VenueKeys The agent's trading keys, one per connected account it may trade on. Always empty for a read agent.
	VenueKeys []VenueKey `json:"venueKeys"`
}

Agent defines model for Agent.

type AgentCreate

type AgentCreate struct {
	// CapitalUsd The capital allocated to the agent (Agent.capitalUsd). Absent for none.
	CapitalUsd *Decimal `json:"capitalUsd,omitempty"`

	// ConnectedAccountIds Connected accounts to give the agent from the start. Default none.
	ConnectedAccountIds *[]string `json:"connectedAccountIds,omitempty"`
	Description         *string   `json:"description,omitempty"`
	Name                string    `json:"name"`

	// Permission Required, with no default, so that whoever adds an agent says what it may do.
	Permission AgentPermission `json:"permission"`
}

AgentCreate defines model for AgentCreate.

type AgentGetAccountBalancesParams added in v0.4.0

type AgentGetAccountBalancesParams struct {
	// At The moment to answer for. Absent means now.
	At *time.Time `form:"at,omitempty" json:"at,omitempty"`
}

AgentGetAccountBalancesParams defines parameters for AgentGetAccountBalances.

type AgentGetAccountEquityParams added in v0.4.0

type AgentGetAccountEquityParams struct {
	From *time.Time `form:"from,omitempty" json:"from,omitempty"`
	To   *time.Time `form:"to,omitempty" json:"to,omitempty"`

	// Resolution How far apart the points are. Absent, the engine picks one that
	// gives a few hundred points over the range. Never finer than the
	// plan allows (`Entitlements.accountData.resolutionSeconds`).
	Resolution *EquityResolution `form:"resolution,omitempty" json:"resolution,omitempty"`
}

AgentGetAccountEquityParams defines parameters for AgentGetAccountEquity.

type AgentGetAccountPositionsParams added in v0.4.0

type AgentGetAccountPositionsParams struct {
	// At The moment to answer for. Absent means now.
	At *time.Time `form:"at,omitempty" json:"at,omitempty"`
}

AgentGetAccountPositionsParams defines parameters for AgentGetAccountPositions.

type AgentGetPnlParams

type AgentGetPnlParams struct {
	From *openapi_types.Date `form:"from,omitempty" json:"from,omitempty"`
	To   *openapi_types.Date `form:"to,omitempty" json:"to,omitempty"`
}

AgentGetPnlParams defines parameters for AgentGetPnl.

type AgentGetVenueRulesParams

type AgentGetVenueRulesParams struct {
	// Symbol Only this symbol.
	Symbol *string `form:"symbol,omitempty" json:"symbol,omitempty"`
}

AgentGetVenueRulesParams defines parameters for AgentGetVenueRules.

type AgentId

type AgentId = string

AgentId defines model for agentId.

type AgentIdentity added in v0.3.0

type AgentIdentity struct {
	AccountId string `json:"accountId"`
	AgentId   string `json:"agentId"`
	AgentName string `json:"agentName"`

	// CapitalUsd The capital allocated to the agent (Agent.capitalUsd): what its
	// own leverage and drawdown rules are measured against. Absent
	// when none is set.
	CapitalUsd *Decimal `json:"capitalUsd,omitempty"`

	// KeyExpiresAt When the key that asked stops working
	KeyExpiresAt *time.Time `json:"keyExpiresAt,omitempty"`
	KeyId        string     `json:"keyId"`

	// KeyScope The scope of the key that asked. A signer starts its channel only
	// with a `trade` key of a trade agent. An engine before 0.21.0
	// sends none: read the agent's `permission` then.
	KeyScope *AgentKeyScope `json:"keyScope,omitempty"`

	// Permission What the agent may do. A signer or MCP server started with the
	// key reads it first: for a read agent it starts no signer channel
	// and no key sync, so every call it makes is a read of
	// connected-account data, which a hosted account's collector
	// answers while the engine sleeps. An engine from before this field
	// sends none; a client treats that as trade.
	Permission AgentPermission `json:"permission"`
}

AgentIdentity Who an agent key belongs to, as `GET /agent/me` answers the key.

type AgentKey

type AgentKey struct {
	CreatedAt time.Time `json:"createdAt"`

	// ExpiresAt After it the key is refused (401, "Key expired"). Absent when it does not expire.
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`

	// Fingerprint The first 80 bits of SHA-256 of the raw 32-byte public key in
	// Crockford base32, four groups of four. What a person compares
	// between the console and the machine; its first two groups are
	// the code a trade sign-in shows in both places
	// (`spec/vectors/agent-key-fingerprint.json`).
	Fingerprint *string `json:"fingerprint,omitempty"`

	// Id key_<account suffix>_<12 random characters>; the account id is readable off it (acc_<suffix>), so a hosted router can map a proposal to its account's cell from the key id alone.
	Id string `json:"id"`

	// Label A name for the key; a registered key's is its machine's own name for itself. Shown, never trusted.
	Label      *string    `json:"label,omitempty"`
	LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`

	// Origin issued: the engine made the pair and showed its secret once
	// (issueAgentKey). registered: the agent's machine made it and sent only
	// the public half (registerAgentKey).
	Origin AgentKeyOrigin `json:"origin"`

	// Prefix First characters of the key, enough to recognise it. Never the secret.
	Prefix string `json:"prefix"`

	// PublicKey The agent's Ed25519 public key, base64. The engine verifies proposal signatures with it.
	PublicKey *string    `json:"publicKey,omitempty"`
	RevokedAt *time.Time `json:"revokedAt,omitempty"`

	// Scope What a request signed with the key may do, within what the agent may.
	// read: every GET under /agent; proposing (POST /proposals) and the
	// signer channel (/agent/signer/*) are 403 `key_scope`. trade:
	// everything the agent may; on a read agent it reads only. A key from
	// before 0.21.0 has its agent's permission at the upgrade. A connected
	// app's hosted key is `read` and stays so when the same agent gets a
	// trading machine: the hosted side can never propose an order.
	Scope AgentKeyScope `json:"scope"`
}

AgentKey defines model for AgentKey.

type AgentKeyIssue added in v0.5.0

type AgentKeyIssue struct {
	Label *string `json:"label,omitempty"`

	// Scope What a request signed with the key may do, within what the agent may.
	// read: every GET under /agent; proposing (POST /proposals) and the
	// signer channel (/agent/signer/*) are 403 `key_scope`. trade:
	// everything the agent may; on a read agent it reads only. A key from
	// before 0.21.0 has its agent's permission at the upgrade. A connected
	// app's hosted key is `read` and stays so when the same agent gets a
	// trading machine: the hosted side can never propose an order.
	Scope *AgentKeyScope `json:"scope,omitempty"`
}

AgentKeyIssue defines model for AgentKeyIssue.

type AgentKeyIssued

type AgentKeyIssued struct {
	CreatedAt time.Time `json:"createdAt"`

	// ExpiresAt After it the key is refused (401, "Key expired"). Absent when it does not expire.
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`

	// Fingerprint The first 80 bits of SHA-256 of the raw 32-byte public key in
	// Crockford base32, four groups of four. What a person compares
	// between the console and the machine; its first two groups are
	// the code a trade sign-in shows in both places
	// (`spec/vectors/agent-key-fingerprint.json`).
	Fingerprint *string `json:"fingerprint,omitempty"`

	// Id key_<account suffix>_<12 random characters>; the account id is readable off it (acc_<suffix>), so a hosted router can map a proposal to its account's cell from the key id alone.
	Id string `json:"id"`

	// Label A name for the key; a registered key's is its machine's own name for itself. Shown, never trusted.
	Label      *string    `json:"label,omitempty"`
	LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`

	// Origin issued: the engine made the pair and showed its secret once
	// (issueAgentKey). registered: the agent's machine made it and sent only
	// the public half (registerAgentKey).
	Origin AgentKeyOrigin `json:"origin"`

	// Prefix First characters of the key, enough to recognise it. Never the secret.
	Prefix string `json:"prefix"`

	// PublicKey The agent's Ed25519 public key, base64. The engine verifies proposal signatures with it.
	PublicKey *string    `json:"publicKey,omitempty"`
	RevokedAt *time.Time `json:"revokedAt,omitempty"`

	// Scope What a request signed with the key may do, within what the agent may.
	// read: every GET under /agent; proposing (POST /proposals) and the
	// signer channel (/agent/signer/*) are 403 `key_scope`. trade:
	// everything the agent may; on a read agent it reads only. A key from
	// before 0.21.0 has its agent's permission at the upgrade. A connected
	// app's hosted key is `read` and stays so when the same agent gets a
	// trading machine: the hosted side can never propose an order.
	Scope AgentKeyScope `json:"scope"`

	// Secret The agent's API key, shown once:
	// `msk_<environment>_<account suffix>_<key random part>_<seed>`.
	// The seed is the agent's Ed25519 private key, base64url; before
	// it, what names the engine and the key: the environment
	// (`testnet`, `prod`, … for hosted Mishmar, which the CLI and the
	// SDKs map to the API host; anything else means `MISHMAR_ENGINE`
	// names the engine) and the key id's two parts
	// (`key_<account suffix>_<random part>`). An agent needs nothing
	// else: `mishmar signer run` with the key in `MISHMAR_API_KEY`
	// writes its config, learns its agent from `GET /agent/me` and
	// generates the trading keys added for it. The engine keeps only
	// the public key, so a leaked engine database cannot sign as the
	// agent. A key issued before 0.19.0 is `msk_<6 characters>_<seed>`
	// and keeps working, with the engine URL and key id given by hand.
	Secret string `json:"secret"`
}

AgentKeyIssued defines model for AgentKeyIssued.

type AgentKeyOrigin added in v0.5.0

type AgentKeyOrigin string

AgentKeyOrigin issued: the engine made the pair and showed its secret once (issueAgentKey). registered: the agent's machine made it and sent only the public half (registerAgentKey).

const (
	AgentKeyOriginIssued     AgentKeyOrigin = "issued"
	AgentKeyOriginRegistered AgentKeyOrigin = "registered"
)

Defines values for AgentKeyOrigin.

func (AgentKeyOrigin) Valid added in v0.5.0

func (e AgentKeyOrigin) Valid() bool

Valid indicates whether the value is a known member of the AgentKeyOrigin enum.

type AgentKeyRegister added in v0.5.0

type AgentKeyRegister struct {
	// ExpiresAt Required for scope trade; in the future, at most 366 days ahead.
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`
	Label     *string    `json:"label,omitempty"`

	// PublicKey The Ed25519 public key, 32 bytes, base64 (standard, padded), as
	// AgentKey.publicKey. It must encode a point of the curve, and not
	// one of small order (422 `validation`).
	PublicKey string `json:"publicKey"`

	// Scope What a request signed with the key may do, within what the agent may.
	// read: every GET under /agent; proposing (POST /proposals) and the
	// signer channel (/agent/signer/*) are 403 `key_scope`. trade:
	// everything the agent may; on a read agent it reads only. A key from
	// before 0.21.0 has its agent's permission at the upgrade. A connected
	// app's hosted key is `read` and stays so when the same agent gets a
	// trading machine: the hosted side can never propose an order.
	Scope AgentKeyScope `json:"scope"`
}

AgentKeyRegister defines model for AgentKeyRegister.

type AgentKeyRegistered added in v0.5.0

type AgentKeyRegistered struct {
	Key AgentKey `json:"key"`

	// RevokedKeyIds The trading machine's key this one replaced, if any.
	RevokedKeyIds []string `json:"revokedKeyIds"`

	// RevokedVenueKeyIds The trading keys whose shares the replaced key's signer held.
	RevokedVenueKeyIds []string `json:"revokedVenueKeyIds"`
}

AgentKeyRegistered defines model for AgentKeyRegistered.

type AgentKeyScope added in v0.5.0

type AgentKeyScope string

AgentKeyScope What a request signed with the key may do, within what the agent may. read: every GET under /agent; proposing (POST /proposals) and the signer channel (/agent/signer/*) are 403 `key_scope`. trade: everything the agent may; on a read agent it reads only. A key from before 0.21.0 has its agent's permission at the upgrade. A connected app's hosted key is `read` and stays so when the same agent gets a trading machine: the hosted side can never propose an order.

const (
	AgentKeyScopeRead  AgentKeyScope = "read"
	AgentKeyScopeTrade AgentKeyScope = "trade"
)

Defines values for AgentKeyScope.

func (AgentKeyScope) Valid added in v0.5.0

func (e AgentKeyScope) Valid() bool

Valid indicates whether the value is a known member of the AgentKeyScope enum.

type AgentListAccountTransactionsParams added in v0.4.0

type AgentListAccountTransactionsParams struct {
	From   *time.Time              `form:"from,omitempty" json:"from,omitempty"`
	To     *time.Time              `form:"to,omitempty" json:"to,omitempty"`
	Kind   *AccountTransactionKind `form:"kind,omitempty" json:"kind,omitempty"`
	Limit  *int                    `form:"limit,omitempty" json:"limit,omitempty"`
	Cursor *string                 `form:"cursor,omitempty" json:"cursor,omitempty"`
}

AgentListAccountTransactionsParams defines parameters for AgentListAccountTransactions.

type AgentListApprovalsParams

type AgentListApprovalsParams struct {
	Status *ApprovalStatus `form:"status,omitempty" json:"status,omitempty"`
}

AgentListApprovalsParams defines parameters for AgentListApprovals.

type AgentListDecisionsParams

type AgentListDecisionsParams struct {
	ConnectedAccountId *string    `form:"connectedAccountId,omitempty" json:"connectedAccountId,omitempty"`
	Verdict            *Verdict   `form:"verdict,omitempty" json:"verdict,omitempty"`
	From               *time.Time `form:"from,omitempty" json:"from,omitempty"`
	To                 *time.Time `form:"to,omitempty" json:"to,omitempty"`
	Cursor             *string    `form:"cursor,omitempty" json:"cursor,omitempty"`
	Limit              *int       `form:"limit,omitempty" json:"limit,omitempty"`
}

AgentListDecisionsParams defines parameters for AgentListDecisions.

type AgentPermission added in v0.4.0

type AgentPermission string

AgentPermission read: the agent has a Mishmar API key and reads the connected accounts it is given; it has no signer and can hold no trading key (createVenueKey answers 409 `conflict`), and its proposals are refused (403 `forbidden`). trade: it may also hold trading keys and propose orders on the accounts it holds one on.

const (
	AgentPermissionRead  AgentPermission = "read"
	AgentPermissionTrade AgentPermission = "trade"
)

Defines values for AgentPermission.

func (AgentPermission) Valid added in v0.4.0

func (e AgentPermission) Valid() bool

Valid indicates whether the value is a known member of the AgentPermission enum.

type AgentStatus

type AgentStatus string

AgentStatus defines model for AgentStatus.

const (
	AgentStatusActive AgentStatus = "active"
	AgentStatusKilled AgentStatus = "killed"
	AgentStatusPaused AgentStatus = "paused"
)

Defines values for AgentStatus.

func (AgentStatus) Valid

func (e AgentStatus) Valid() bool

Valid indicates whether the value is a known member of the AgentStatus enum.

type AgentUnauthorized

type AgentUnauthorized = Error

AgentUnauthorized defines model for AgentUnauthorized.

type AgentUpdate

type AgentUpdate struct {
	// CapitalUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	CapitalUsd  *Decimal `json:"capitalUsd,omitempty"`
	Description *string  `json:"description,omitempty"`
	Name        *string  `json:"name,omitempty"`

	// Permission read to trade lets the agent get trading keys from then on; each
	// still needs its own setup at the venue. It makes the agent count
	// against `Entitlements.maxAgents`, and is refused with
	// `limit_reached` when the plan holds no more trade agents; the
	// agent goes on reading. trade to read is refused
	// with 409 `conflict` while the agent holds an unrevoked trading key.
	Permission *AgentPermission `json:"permission,omitempty"`

	// RemoveCapital True takes the allocated capital away; capitalUsd must then be absent.
	// Refused while a leverage or drawdown rule of the agent's is
	// measured against it (updateAgent).
	RemoveCapital *bool `json:"removeCapital,omitempty"`
}

AgentUpdate defines model for AgentUpdate.

type Approval

type Approval struct {
	Comment    *string    `json:"comment,omitempty"`
	DecidedAt  *time.Time `json:"decidedAt,omitempty"`
	DecidedBy  *string    `json:"decidedBy,omitempty"`
	Decision   Decision   `json:"decision"`
	DecisionId string     `json:"decisionId"`
	ExpiresAt  time.Time  `json:"expiresAt"`
	Id         string     `json:"id"`

	// Now The parked proposal evaluated again against the account as it is at the
	// time of the read: present on a pending approval read one at a time
	// (GET /approvals/{approvalId}), absent on decided and expired approvals and
	// on the list. The decision's own `evaluations` are what was true when the
	// proposal was parked.
	Now         *ApprovalEvaluation `json:"now,omitempty"`
	RequestedAt time.Time           `json:"requestedAt"`
	Status      ApprovalStatus      `json:"status"`
}

Approval defines model for Approval.

type ApprovalDecide

type ApprovalDecide struct {
	Comment *string `json:"comment,omitempty"`

	// Revision The `revision` of the `now` evaluation the approver saw (Approval.now). The
	// engine evaluates once more as it approves: a different revision is refused
	// with 409 `evaluation_changed` and the current `now` in `details.now`, so the
	// approver confirms what is true now. Absent, only a `block` now refuses.
	Revision *string `json:"revision,omitempty"`
}

ApprovalDecide defines model for ApprovalDecide.

type ApprovalEvaluation added in v0.3.0

type ApprovalEvaluation struct {
	EvaluatedAt time.Time        `json:"evaluatedAt"`
	Evaluations []RuleEvaluation `json:"evaluations"`

	// Reason One line for a person, as on a decision; absent when allowed cleanly.
	Reason *string `json:"reason,omitempty"`

	// Revision A hash of the outcome: the verdict, the reason and each rule's id, pass or
	// fail, outcome and waiver. The observed values move with the market and are
	// not in it, so a drift that flips no rule keeps the revision. Send it with the
	// approve (ApprovalDecide.revision); a different revision at that moment is
	// 409 `evaluation_changed`.
	Revision string `json:"revision"`

	// State The whole Mishmar account's state when the rules ran, before the
	// proposal: every agent on every connected account. What a rule at a
	// narrower scope measured is on its evaluation.
	State StateSnapshot `json:"state"`

	// Valuation What the order was valued at for this evaluation (the current mark; a market order's book is not read again).
	Valuation *DecisionValuation `json:"valuation,omitempty"`

	// Verdict allow or require_approval: the approver may co-sign. block: a rule, status or restriction refuses it now, and approve answers 409 until that changes.
	Verdict Verdict `json:"verdict"`
}

ApprovalEvaluation The rules re-run for a pending approval: the verdict the proposal would get if it were submitted now, each rule's observed value and threshold against the current book (with the orders in flight and resting), marks, PnL, statuses and restrictions, the account-level numbers before the proposal, and a `revision` of the outcome.

type ApprovalId

type ApprovalId = string

ApprovalId defines model for approvalId.

type ApprovalOutcome

type ApprovalOutcome struct {
	Comment     *string        `json:"comment,omitempty"`
	DecidedAt   *time.Time     `json:"decidedAt,omitempty"`
	DecidedBy   *string        `json:"decidedBy,omitempty"`
	ExpiresAt   time.Time      `json:"expiresAt"`
	Id          string         `json:"id"`
	RequestedAt time.Time      `json:"requestedAt"`
	Status      ApprovalStatus `json:"status"`
}

ApprovalOutcome defines model for ApprovalOutcome.

type ApprovalStatus

type ApprovalStatus string

ApprovalStatus defines model for ApprovalStatus.

const (
	ApprovalStatusApproved ApprovalStatus = "approved"
	ApprovalStatusExpired  ApprovalStatus = "expired"
	ApprovalStatusPending  ApprovalStatus = "pending"
	ApprovalStatusRejected ApprovalStatus = "rejected"
)

Defines values for ApprovalStatus.

func (ApprovalStatus) Valid

func (e ApprovalStatus) Valid() bool

Valid indicates whether the value is a known member of the ApprovalStatus enum.

type ApproveApprovalJSONRequestBody

type ApproveApprovalJSONRequestBody = ApprovalDecide

ApproveApprovalJSONRequestBody defines body for ApproveApproval for application/json ContentType.

type Balance added in v0.4.0

type Balance struct {
	// Amount A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Amount Decimal `json:"amount"`

	// Asset The asset as the venue names it, e.g. USDC, BTC.
	Asset string `json:"asset"`

	// PriceUsd The price `usdValue` was worked out at. Absent with it.
	PriceUsd *Decimal `json:"priceUsd,omitempty"`

	// UsdValue Absent when the engine has no price for the asset; the
	// snapshot's `unpricedAssets` then names it.
	UsdValue *Decimal `json:"usdValue,omitempty"`
}

Balance One asset the account holds. Before contract 0.21.0 it carried `wallet`, a label; the pool is now the account itself.

type BalanceSnapshot added in v0.4.0

type BalanceSnapshot struct {
	AsOf               time.Time `json:"asOf"`
	Balances           []Balance `json:"balances"`
	ConnectedAccountId string    `json:"connectedAccountId"`

	// EquityUsd The account's value at `asOf`: balances at their prices plus
	// unrealised PnL. An asset with no price is left out and named in
	// `unpricedAssets`.
	EquityUsd *Decimal `json:"equityUsd,omitempty"`

	// Source observed: read from the venue at that moment. rebuilt: worked out
	// afterwards, for a moment nobody was reading the account (before it
	// was connected), by replaying its transactions and, for values in USD,
	// the venue's historical prices. No engine rebuilds yet: every reading
	// served today is observed.
	Source SnapshotSource `json:"source"`

	// UnpricedAssets Assets held at `asOf` with no price. Absent when every asset was priced.
	UnpricedAssets *[]string `json:"unpricedAssets,omitempty"`
}

BalanceSnapshot defines model for BalanceSnapshot.

type CommitmentBatch

type CommitmentBatch struct {
	// BatchSize The account's entitlement (Entitlements.commitmentBatch).
	BatchSize int `json:"batchSize"`

	// EngineInstance The engine instance that issued the batch; it changes each time
	// the engine starts. The engine keeps the secret half of each
	// commitment in memory only (written down, a restored backup could
	// sign two messages with one nonce and give the engine's key share
	// away), so after a restart the batch is unknown to it and a
	// proposal using one is refused with 409. The signer poll names the
	// current instance, so a signer drops a stale batch before it
	// proposes with it.
	EngineInstance string             `json:"engineInstance"`
	Items          []EngineCommitment `json:"items"`

	// Outstanding Unused commitments the signer holds for this key, these included.
	Outstanding int `json:"outstanding"`

	// Scheme The protocol a sign request runs, decided by the venue key's scheme (VenueKeyScheme), never chosen by anyone.
	Scheme     SigningScheme `json:"scheme"`
	VenueKeyId string        `json:"venueKeyId"`
}

CommitmentBatch defines model for CommitmentBatch.

type CommitmentRequest

type CommitmentRequest struct {
	// Count How many the signer wants. Default and cap, the entitlement less what it already holds unused.
	Count      *int   `json:"count,omitempty"`
	VenueKeyId string `json:"venueKeyId"`
}

CommitmentRequest defines model for CommitmentRequest.

type ConnectedAccount added in v0.4.0

type ConnectedAccount struct {
	// Connection What an account says about its connection, so that the account alone
	// is enough to tell which one it is and, for a signer, how to reach
	// the venue. Nothing secret.
	Connection VenueConnectionRef `json:"connection"`
	CreatedAt  time.Time          `json:"createdAt"`
	EquityAsOf *time.Time         `json:"equityAsOf,omitempty"`

	// EquityUsd The account's value at `equityAsOf`: its balances at their prices
	// plus its positions' unrealised PnL. Absent until the first
	// reading.
	EquityUsd *Decimal `json:"equityUsd,omitempty"`
	Id        string   `json:"id"`

	// Maintenance An open maintenance window (openMaintenance). Absent when none is open.
	Maintenance *MaintenanceWindow `json:"maintenance,omitempty"`

	// Mode What a fill Mishmar did not place means on a connected account agents
	// trade on (`traded`); on one Mishmar only reads it means nothing and
	// such fills are simply recorded. Several agents
	// may share a connected account in either mode, and transfers, funding, liquidations
	// and the venue's other entries are handled the same way in both.
	// agents_only (the default): Mishmar is the only thing trading on the
	// connected account, so such a fill restricts new risk on the connected account, exits still
	// passing, until the owner assigns it (resolveDiscrepancy) or it falls in
	// a maintenance window. shared: such a fill is booked to the unassigned book
	// and trading continues; account and connected account rules see it, agent rules do not.
	Mode ConnectedAccountMode `json:"mode"`

	// Name What the venue calls it: "Spot", "USDⓈ-M Futures", "Perps". On a
	// connection with a single account, "Main". Not editable; a person
	// names the connection. A line of text for the account is the
	// venue, the connection's name, this name and
	// `connection.venueAccount.label`.
	Name string `json:"name"`

	// Restrictions What blocks new risk on the connected account right now, set by the engine
	// rather than by a person (pause and stop are `status`). Exits pass
	// under every restriction. Absent when there is none.
	Restrictions *[]ConnectedAccountRestriction `json:"restrictions,omitempty"`

	// Status pending until the account's connection is verified. pause and stop
	// are per account.
	Status ConnectedAccountStatus `json:"status"`

	// Tradable Whether agents can trade on the account through Mishmar (with a
	// trading key, or through a custodian's callback). False on an
	// account the engine reads but cannot trade yet (Binance Spot,
	// Hyperliquid Spot, a Hyperliquid sub-account's): createVenueKey
	// there is 409 `conflict`. Absent means true.
	Tradable *bool `json:"tradable,omitempty"`

	// Traded Whether any agent holds an unrevoked trading key on the account.
	// False, Mishmar can only read it: every trade there is recorded as
	// it is, `mode` restricts nothing and no discrepancy is opened.
	Traded bool `json:"traded"`

	// Type spot: assets held outright (a broker's cash account). derivatives:
	// the collateral behind perpetuals and futures, with their positions
	// (Hyperliquid's perps, Binance's USDⓈ-M futures). margin: assets
	// bought with borrowing (cross or isolated margin, a broker's margin
	// account). funding: holds deposits, withdrawals and payments and
	// trades nothing. unified: one pool behind every kind of market (a
	// unified trading account). other: anything else the venue keeps
	// apart.
	Type ConnectedAccountType `json:"type"`

	// UnpricedAssets Assets the account held at `equityAsOf` that the engine had no
	// price for, so `equityUsd` leaves them out. Absent when every
	// asset was priced.
	UnpricedAssets *[]string `json:"unpricedAssets,omitempty"`

	// UntradableReason With `tradable` false, one line for a person saying why, without
	// the account's name: "Mishmar does not trade spot on Binance
	// yet", "Mishmar does not trade a Hyperliquid sub-account yet".
	// Absent when the account can be traded.
	UntradableReason  *string   `json:"untradableReason,omitempty"`
	UpdatedAt         time.Time `json:"updatedAt"`
	Venue             Venue     `json:"venue"`
	VenueConnectionId string    `json:"venueConnectionId"`

	// VenueRef The engine's stable word for the pool at this venue, readable:
	// `spot`, `usdm-futures`, `perps`, `main`. Unique within the
	// connection.
	VenueRef string `json:"venueRef"`
}

ConnectedAccount One pool of money at a venue, with its own balances, positions, margin and value. The test: moving money between two of them takes a transfer. A Binance login has a Spot account and a USDⓈ-M Futures account; a Hyperliquid address has Perps and Spot; a brokerage account number is one. Every balance, position, transaction and equity reading belongs to exactly one, rules are scoped to one, and an agent is given one to read or to trade on.

Accounts are not connected one by one: they come with their venue connection (VenueConnection), which holds the read access. The engine keeps each account's balances, positions, equity and transactions over time. Before contract 0.21.0 a ConnectedAccount was the whole login; an account connected before it keeps its id as the pool its value measured (USDⓈ-M Futures on Binance, Perps on Hyperliquid) and the login's other pools are new accounts. Before contract 0.20.0 this was TradingAccount.

type ConnectedAccountId added in v0.4.0

type ConnectedAccountId = string

ConnectedAccountId defines model for connectedAccountId.

type ConnectedAccountMode added in v0.4.0

type ConnectedAccountMode string

ConnectedAccountMode What a fill Mishmar did not place means on a connected account agents trade on (`traded`); on one Mishmar only reads it means nothing and such fills are simply recorded. Several agents may share a connected account in either mode, and transfers, funding, liquidations and the venue's other entries are handled the same way in both. agents_only (the default): Mishmar is the only thing trading on the connected account, so such a fill restricts new risk on the connected account, exits still passing, until the owner assigns it (resolveDiscrepancy) or it falls in a maintenance window. shared: such a fill is booked to the unassigned book and trading continues; account and connected account rules see it, agent rules do not.

const (
	ConnectedAccountModeAgentsOnly ConnectedAccountMode = "agents_only"
	ConnectedAccountModeShared     ConnectedAccountMode = "shared"
)

Defines values for ConnectedAccountMode.

func (ConnectedAccountMode) Valid added in v0.4.0

func (e ConnectedAccountMode) Valid() bool

Valid indicates whether the value is a known member of the ConnectedAccountMode enum.

type ConnectedAccountRestriction added in v0.4.0

type ConnectedAccountRestriction struct {
	// Asset The asset
	Asset *string `json:"asset,omitempty"`

	// Cause foreign_fill: an agents-only connected account saw a fill Mishmar did not place.
	// unexplained_position: the venue's position in the asset disagrees
	// with the books and nothing explains it. ambiguous_transfer: an
	// asset several agents hold was transferred out beyond what the unassigned
	// book holds. stream_gap: the venue's stream missed more than its
	// history can fill. state_unavailable: the venue's state cannot be read.
	// venue_unreachable: the engine has no live stream of the connected account's
	// fills and orders from the venue: the venue refused the subscription, or the
	// stream has been down past its grace. It lifts by itself once the stream is
	// back and the engine has caught up.
	Cause ConnectedAccountRestrictionCause `json:"cause"`

	// Detail More than the cause says, when there is more: for venue_unreachable,
	// why the stream is down, in the venue's words where it gave any.
	Detail *string `json:"detail,omitempty"`

	// DiscrepancyId The discrepancy that lifts it once resolved
	DiscrepancyId *string `json:"discrepancyId,omitempty"`

	// Scope The whole connected account, or one asset on it (every market that trades that asset).
	Scope ConnectedAccountRestrictionScope `json:"scope"`
	Since time.Time                        `json:"since"`
}

ConnectedAccountRestriction defines model for ConnectedAccountRestriction.

type ConnectedAccountRestrictionCause added in v0.4.0

type ConnectedAccountRestrictionCause string

ConnectedAccountRestrictionCause foreign_fill: an agents-only connected account saw a fill Mishmar did not place. unexplained_position: the venue's position in the asset disagrees with the books and nothing explains it. ambiguous_transfer: an asset several agents hold was transferred out beyond what the unassigned book holds. stream_gap: the venue's stream missed more than its history can fill. state_unavailable: the venue's state cannot be read. venue_unreachable: the engine has no live stream of the connected account's fills and orders from the venue: the venue refused the subscription, or the stream has been down past its grace. It lifts by itself once the stream is back and the engine has caught up.

const (
	ConnectedAccountRestrictionCauseAmbiguousTransfer   ConnectedAccountRestrictionCause = "ambiguous_transfer"
	ConnectedAccountRestrictionCauseForeignFill         ConnectedAccountRestrictionCause = "foreign_fill"
	ConnectedAccountRestrictionCauseStateUnavailable    ConnectedAccountRestrictionCause = "state_unavailable"
	ConnectedAccountRestrictionCauseStreamGap           ConnectedAccountRestrictionCause = "stream_gap"
	ConnectedAccountRestrictionCauseUnexplainedPosition ConnectedAccountRestrictionCause = "unexplained_position"
	ConnectedAccountRestrictionCauseVenueUnreachable    ConnectedAccountRestrictionCause = "venue_unreachable"
)

Defines values for ConnectedAccountRestrictionCause.

func (ConnectedAccountRestrictionCause) Valid added in v0.4.0

Valid indicates whether the value is a known member of the ConnectedAccountRestrictionCause enum.

type ConnectedAccountRestrictionScope added in v0.4.0

type ConnectedAccountRestrictionScope string

ConnectedAccountRestrictionScope The whole connected account, or one asset on it (every market that trades that asset).

const (
	ConnectedAccountRestrictionScopeAsset            ConnectedAccountRestrictionScope = "asset"
	ConnectedAccountRestrictionScopeConnectedAccount ConnectedAccountRestrictionScope = "connected_account"
)

Defines values for ConnectedAccountRestrictionScope.

func (ConnectedAccountRestrictionScope) Valid added in v0.4.0

Valid indicates whether the value is a known member of the ConnectedAccountRestrictionScope enum.

type ConnectedAccountStatus added in v0.4.0

type ConnectedAccountStatus string

ConnectedAccountStatus pending until the account's connection is verified. pause and stop are per account.

const (
	ConnectedAccountStatusActive  ConnectedAccountStatus = "active"
	ConnectedAccountStatusKilled  ConnectedAccountStatus = "killed"
	ConnectedAccountStatusPaused  ConnectedAccountStatus = "paused"
	ConnectedAccountStatusPending ConnectedAccountStatus = "pending"
)

Defines values for ConnectedAccountStatus.

func (ConnectedAccountStatus) Valid added in v0.4.0

func (e ConnectedAccountStatus) Valid() bool

Valid indicates whether the value is a known member of the ConnectedAccountStatus enum.

type ConnectedAccountType added in v0.5.0

type ConnectedAccountType string

ConnectedAccountType spot: assets held outright (a broker's cash account). derivatives: the collateral behind perpetuals and futures, with their positions (Hyperliquid's perps, Binance's USDⓈ-M futures). margin: assets bought with borrowing (cross or isolated margin, a broker's margin account). funding: holds deposits, withdrawals and payments and trades nothing. unified: one pool behind every kind of market (a unified trading account). other: anything else the venue keeps apart.

const (
	ConnectedAccountTypeDerivatives ConnectedAccountType = "derivatives"
	ConnectedAccountTypeFunding     ConnectedAccountType = "funding"
	ConnectedAccountTypeMargin      ConnectedAccountType = "margin"
	ConnectedAccountTypeOther       ConnectedAccountType = "other"
	ConnectedAccountTypeSpot        ConnectedAccountType = "spot"
	ConnectedAccountTypeUnified     ConnectedAccountType = "unified"
)

Defines values for ConnectedAccountType.

func (ConnectedAccountType) Valid added in v0.5.0

func (e ConnectedAccountType) Valid() bool

Valid indicates whether the value is a known member of the ConnectedAccountType enum.

type ConnectedAccountUpdate added in v0.4.0

type ConnectedAccountUpdate struct {
	// Mode What a fill Mishmar did not place means on a connected account agents
	// trade on (`traded`); on one Mishmar only reads it means nothing and
	// such fills are simply recorded. Several agents
	// may share a connected account in either mode, and transfers, funding, liquidations
	// and the venue's other entries are handled the same way in both.
	// agents_only (the default): Mishmar is the only thing trading on the
	// connected account, so such a fill restricts new risk on the connected account, exits still
	// passing, until the owner assigns it (resolveDiscrepancy) or it falls in
	// a maintenance window. shared: such a fill is booked to the unassigned book
	// and trading continues; account and connected account rules see it, agent rules do not.
	Mode *ConnectedAccountMode `json:"mode,omitempty"`
}

ConnectedAccountUpdate defines model for ConnectedAccountUpdate.

type CosignerCallbackSetup

type CosignerCallbackSetup struct {
	// ApiUserId The Fireblocks API user that maps to this connection.
	ApiUserId         *string `json:"apiUserId,omitempty"`
	CallbackPublicKey string  `json:"callbackPublicKey"`

	// CallbackUrl Register this as the co-signer callback.
	CallbackUrl string                    `json:"callbackUrl"`
	Kind        CosignerCallbackSetupKind `json:"kind"`
}

CosignerCallbackSetup defines model for CosignerCallbackSetup.

type CosignerCallbackSetupKind

type CosignerCallbackSetupKind string

CosignerCallbackSetupKind defines model for CosignerCallbackSetup.Kind.

const (
	CosignerCallbackSetupKindCosignerCallback CosignerCallbackSetupKind = "cosigner_callback"
)

Defines values for CosignerCallbackSetupKind.

func (CosignerCallbackSetupKind) Valid

func (e CosignerCallbackSetupKind) Valid() bool

Valid indicates whether the value is a known member of the CosignerCallbackSetupKind enum.

type CreateAgentJSONRequestBody

type CreateAgentJSONRequestBody = AgentCreate

CreateAgentJSONRequestBody defines body for CreateAgent for application/json ContentType.

type CreateRuleJSONRequestBody

type CreateRuleJSONRequestBody = RuleCreate

CreateRuleJSONRequestBody defines body for CreateRule for application/json ContentType.

type CreateVenueConnectionJSONRequestBody added in v0.5.0

type CreateVenueConnectionJSONRequestBody = VenueConnectionCreate

CreateVenueConnectionJSONRequestBody defines body for CreateVenueConnection for application/json ContentType.

type CreateVenueKeyJSONRequestBody

type CreateVenueKeyJSONRequestBody = VenueKeyCreate

CreateVenueKeyJSONRequestBody defines body for CreateVenueKey for application/json ContentType.

type CreateWalletApprovalJSONRequestBody

type CreateWalletApprovalJSONRequestBody = WalletApprovalRequest

CreateWalletApprovalJSONRequestBody defines body for CreateWalletApproval for application/json ContentType.

type DataUsage added in v0.4.0

type DataUsage struct {
	AsOf time.Time `json:"asOf"`

	// IncludedBytes From `Entitlements.accountData.includedStorageMb`. Absent when not metered.
	IncludedBytes *int64 `json:"includedBytes,omitempty"`

	// StorageBytes What the account's connected-account data takes in the engine's database.
	StorageBytes int64 `json:"storageBytes"`
}

DataUsage defines model for DataUsage.

type Decimal

type Decimal = string

Decimal A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and quantities are never JSON numbers. A string survives every language's float formatting unchanged, so the bytes an agent signs are the bytes the engine verifies, and sums of cents stay exact.

type Decision

type Decision struct {
	AgentId        string `json:"agentId"`
	AgentName      string `json:"agentName"`
	AgentSignature string `json:"agentSignature"`

	// Approval The approval's outcome, when the decision was parked for a person.
	Approval   *ApprovalOutcome `json:"approval,omitempty"`
	ApprovalId *string          `json:"approvalId,omitempty"`

	// Cancellation How the order left the venue's book without filling completely, once the
	// engine knows (the `cancelled` ledger event). Absent while it rests, after it
	// filled completely, and on orders that never rested. Not covered by
	// engineSignature: it arrives later, as a chained event.
	Cancellation       *OrderCancellation `json:"cancellation,omitempty"`
	ConfigRevision     int                `json:"configRevision"`
	ConnectedAccountId string             `json:"connectedAccountId"`
	CreatedAt          time.Time          `json:"createdAt"`

	// EngineSignature The engine key's Ed25519 signature, base64, over the canonical JSON
	// (keys sorted) of the decision record as written: id, createdAt,
	// agentId, agentName, connectedAccountId, verdict, proposal, exit
	// (when set), evaluations, state, configRevision, agentSignature and
	// submission (when set); versions 1 and 2 also carry portfolioId
	// (see signingVersion). Nothing else on a decision is covered.
	// Present on every decision. `spec/vectors/decision-signing.json`
	// pins the bytes for each version.
	EngineSignature *string          `json:"engineSignature,omitempty"`
	Evaluations     []RuleEvaluation `json:"evaluations"`

	// Exit True when the engine judged the order an exit (see submitProposal):
	// every rule without appliesToExits was waived. Absent otherwise.
	Exit      *bool   `json:"exit,omitempty"`
	Id        string  `json:"id"`
	LatencyMs float64 `json:"latencyMs"`

	// PortfolioId Only on a decision with `signingVersion` 1 or 2: the portfolio the
	// agent was in, which the engine's signature on those records
	// covers, kept so a verifier can rebuild their bytes. Nothing else
	// reads it; there are no portfolios since contract 0.21.0.
	PortfolioId *string `json:"portfolioId,omitempty"`

	// Proposal The proposal as the engine priced it. For a cancel, the order fields
	// (side, size, price, orderType, reduceOnly) describe the order being
	// cancelled as its own decision recorded it, and notionalUsd is "0": a
	// cancel adds no exposure.
	Proposal Proposal `json:"proposal"`

	// Reason One line for a person, e.g. the rule that blocked it or the kill switch that was engaged.
	Reason *string `json:"reason,omitempty"`

	// Signing Where the order stands with the agent's signer. Absent on connected accounts that
	// need no signer (the paper simulator, co-signer callbacks).
	Signing *SigningStatus `json:"signing,omitempty"`

	// SigningVersion Which shape the agent's and the engine's signatures on this
	// decision cover. 3: this contract's: the record the engine signs
	// has no `portfolioId`; what the agent signs is as in 2. 2:
	// contract 0.20.0's, the account's id under `connectedAccountId`,
	// the engine's record carrying `portfolioId`. 1: a decision from
	// before contract 0.20.0, whose signed bytes carry the account's id
	// under `tradingAccountId`; the record is served under today's
	// names, and a verifier rebuilds the bytes with the old name.
	// Absent means 1.
	SigningVersion *DecisionSigningVersion `json:"signingVersion,omitempty"`

	// State The whole Mishmar account's state when the rules ran, before the
	// proposal: every agent on every connected account. What a rule at a
	// narrower scope measured is on its evaluation.
	State StateSnapshot `json:"state"`

	// Submission What the agent submitted that the priced proposal does not keep, so the
	// agent's signature can be verified again from the ledger alone: the key,
	// the nonce, the submission time, the price as sent (absent for a market
	// order, whose stored price is the mark the engine used) and the
	// one-shot venue message when there was one. A cancel's target is on the
	// proposal (`targetClientOrderId`).
	Submission *DecisionSubmission `json:"submission,omitempty"`

	// Valuation What the rules valued the order at and where that price came from. Present
	// on orders; absent on cancels and on decisions from before it was recorded.
	// Not covered by engineSignature.
	Valuation *DecisionValuation `json:"valuation,omitempty"`
	VenueAck  *VenueAck          `json:"venueAck,omitempty"`
	Verdict   Verdict            `json:"verdict"`
}

Decision defines model for Decision.

type DecisionPage

type DecisionPage struct {
	Items      []Decision `json:"items"`
	NextCursor *string    `json:"nextCursor,omitempty"`
}

DecisionPage defines model for DecisionPage.

type DecisionSigningVersion added in v0.4.0

type DecisionSigningVersion int

DecisionSigningVersion Which shape the agent's and the engine's signatures on this decision cover. 3: this contract's: the record the engine signs has no `portfolioId`; what the agent signs is as in 2. 2: contract 0.20.0's, the account's id under `connectedAccountId`, the engine's record carrying `portfolioId`. 1: a decision from before contract 0.20.0, whose signed bytes carry the account's id under `tradingAccountId`; the record is served under today's names, and a verifier rebuilds the bytes with the old name. Absent means 1.

const (
	DecisionSigningVersionN1 DecisionSigningVersion = 1
	DecisionSigningVersionN2 DecisionSigningVersion = 2
	DecisionSigningVersionN3 DecisionSigningVersion = 3
)

Defines values for DecisionSigningVersion.

func (DecisionSigningVersion) Valid added in v0.4.0

func (e DecisionSigningVersion) Valid() bool

Valid indicates whether the value is a known member of the DecisionSigningVersion enum.

type DecisionSubmission

type DecisionSubmission struct {
	KeyId string `json:"keyId"`
	Nonce string `json:"nonce"`

	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price      *Decimal  `json:"price,omitempty"`
	ProposedAt time.Time `json:"proposedAt"`

	// VenueMessage The one-shot path. The agent's signer builds the venue request and
	// signs its half before the proposal leaves the agent's machine, so an
	// allowed order needs no round trip to the signer: the engine decodes
	// `message`, checks it against the proposal and the connected account's venue rules,
	// runs the rules, and only then adds its own half and forwards. It is
	// inside the signed proposal, so nobody can pair a proposal with a
	// message the agent did not mean. The engine spends the commitment named
	// here whatever the outcome: it signs with it when the order is allowed
	// and discards it on a block, a park or a refusal. A parked order is
	// signed again through the signer channel once a person decides, since
	// this message would be stale by then. Without this field the engine
	// asks the signer through the channel.
	VenueMessage *ProposalVenueMessage `json:"venueMessage,omitempty"`
}

DecisionSubmission What the agent submitted that the priced proposal does not keep, so the agent's signature can be verified again from the ledger alone: the key, the nonce, the submission time, the price as sent (absent for a market order, whose stored price is the mark the engine used) and the one-shot venue message when there was one. A cancel's target is on the proposal (`targetClientOrderId`).

type DecisionValuation added in v0.3.0

type DecisionValuation struct {
	// BookAsOf When the venue's book snapshot was taken. Only when a book was walked.
	BookAsOf *time.Time `json:"bookAsOf,omitempty"`

	// BookLevels How many price levels of the book the walk consumed. Only when a book was walked.
	BookLevels *int `json:"bookLevels,omitempty"`

	// BookPrice The worst price the walk through the book reached, before it is compared with the order's price and the mark (a market sell walks below the mark, and the rules still value it at the mark). The IOC bound the order is sent with (on Hyperliquid its IOC limit, on Binance a LIMIT IOC) is tightened to it. Present whenever a book was walked.
	BookPrice *Decimal `json:"bookPrice,omitempty"`

	// BookShort True when the book held less than 105% of the order's size: the last level's price was used and the real fill could be worse. Only when a book was walked.
	BookShort *bool `json:"bookShort,omitempty"`

	// Detail Why the book was not used when a market order was valued without one: the venue's error, a stale book, or an adapter that cannot read books. One line.
	Detail *string `json:"detail,omitempty"`

	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price Decimal `json:"price"`

	// Source limit: the order's own price was the highest. mark: the symbol's mark.
	// mark_slippage: the mark moved by the venue's market-order slippage (a market
	// buy where no book was read). book: the worst price of the walk through the
	// venue's order book. one_shot: the price in the agent's one-shot venue message.
	Source DecisionValuationSource `json:"source"`
}

DecisionValuation The price the rules valued the order at (the `order_size` metric and the projected book), which is the highest of the order's own price, the symbol's mark and what the engine knows it could fill at beyond both. For a market order that is not reduce-only the engine fetches the venue's order book and walks 105% of the order's size through it on the order's side: the worst price reached is the valuation, and on Hyperliquid the bound the order is sent with when it is tighter than the slippage bound. Exits (reduce-only) keep the mark. See docs/rules.md in the engine, "Pricing the proposal".

type DecisionValuationSource added in v0.3.0

type DecisionValuationSource string

DecisionValuationSource limit: the order's own price was the highest. mark: the symbol's mark. mark_slippage: the mark moved by the venue's market-order slippage (a market buy where no book was read). book: the worst price of the walk through the venue's order book. one_shot: the price in the agent's one-shot venue message.

const (
	DecisionValuationSourceBook         DecisionValuationSource = "book"
	DecisionValuationSourceLimit        DecisionValuationSource = "limit"
	DecisionValuationSourceMark         DecisionValuationSource = "mark"
	DecisionValuationSourceMarkSlippage DecisionValuationSource = "mark_slippage"
	DecisionValuationSourceOneShot      DecisionValuationSource = "one_shot"
)

Defines values for DecisionValuationSource.

func (DecisionValuationSource) Valid added in v0.3.0

func (e DecisionValuationSource) Valid() bool

Valid indicates whether the value is a known member of the DecisionValuationSource enum.

type Discrepancy

type Discrepancy struct {
	// Asset The asset concerned
	Asset *string `json:"asset,omitempty"`

	// BooksQuantity What the books add up to, the unassigned book included.
	BooksQuantity      *Decimal  `json:"booksQuantity,omitempty"`
	ConnectedAccountId string    `json:"connectedAccountId"`
	DetectedAt         time.Time `json:"detectedAt"`

	// Difference venueQuantity minus booksQuantity.
	Difference *Decimal `json:"difference,omitempty"`

	// DuringMaintenance The fill fell in a maintenance window, so it restricts nothing.
	DuringMaintenance *bool            `json:"duringMaintenance,omitempty"`
	Fill              *DiscrepancyFill `json:"fill,omitempty"`
	Id                string           `json:"id"`

	// Kind foreign_fill: a fill the venue reported that Mishmar did not place;
	// restricts an agents-only connected account, and on a shared connected account is already in the
	// unassigned book and listed only for re-attribution. unexplained_position: a
	// venue position that disagrees with the books with nothing to explain
	// it; that asset on the connected account is degraded, and every agent holding it has
	// the difference added to its agent rules in whichever direction is
	// worse. unexplained_balance: a cash or collateral change with nothing to
	// explain it; nothing is degraded, a drop counts as a loss and a rise is
	// not counted until resolved. ambiguous_transfer: an asset several agents
	// hold was transferred out beyond what the unassigned book holds; that asset
	// is degraded until the owner names the agent it came from. stream_gap:
	// the venue's stream missed more than its history can fill; the whole
	// connected account is degraded until the engine has re-read the venue.
	Kind       DiscrepancyKind `json:"kind"`
	Resolution *struct {
		AgentId *string `json:"agentId,omitempty"`

		// AssignTo unassigned: book it to the connected account's unassigned book. agent: book it to `agentId`'s
		// book, an agent on the connected account (for an ambiguous transfer, the agent it
		// came from). capital: it was a transfer in or out, recorded at the mark,
		// moving equity and the drawdown baseline together.
		AssignTo  DiscrepancyAssignTo `json:"assignTo"`
		Comment   *string             `json:"comment,omitempty"`
		DecidedAt time.Time           `json:"decidedAt"`
		DecidedBy string              `json:"decidedBy"`
	} `json:"resolution,omitempty"`

	// Restricts What it blocks for new risk while open. Exits always pass.
	Restricts DiscrepancyRestricts `json:"restricts"`
	Status    DiscrepancyStatus    `json:"status"`

	// Suggestion The engine's guess, e.g. a fill that exactly offsets one agent's position.
	Suggestion *struct {
		AgentId *string `json:"agentId,omitempty"`

		// AssignTo unassigned: book it to the connected account's unassigned book. agent: book it to `agentId`'s
		// book, an agent on the connected account (for an ambiguous transfer, the agent it
		// came from). capital: it was a transfer in or out, recorded at the mark,
		// moving equity and the drawdown baseline together.
		AssignTo DiscrepancyAssignTo `json:"assignTo"`
		Reason   string              `json:"reason"`
	} `json:"suggestion,omitempty"`

	// VenueQuantity The venue's position (signed, long positive) or balance when detected.
	VenueQuantity *Decimal `json:"venueQuantity,omitempty"`
}

Discrepancy defines model for Discrepancy.

type DiscrepancyAssignTo

type DiscrepancyAssignTo string

DiscrepancyAssignTo unassigned: book it to the connected account's unassigned book. agent: book it to `agentId`'s book, an agent on the connected account (for an ambiguous transfer, the agent it came from). capital: it was a transfer in or out, recorded at the mark, moving equity and the drawdown baseline together.

const (
	DiscrepancyAssignToAgent      DiscrepancyAssignTo = "agent"
	DiscrepancyAssignToCapital    DiscrepancyAssignTo = "capital"
	DiscrepancyAssignToUnassigned DiscrepancyAssignTo = "unassigned"
)

Defines values for DiscrepancyAssignTo.

func (DiscrepancyAssignTo) Valid

func (e DiscrepancyAssignTo) Valid() bool

Valid indicates whether the value is a known member of the DiscrepancyAssignTo enum.

type DiscrepancyFill

type DiscrepancyFill struct {
	At time.Time `json:"at"`

	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price Decimal `json:"price"`
	Side  Side    `json:"side"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size        Decimal `json:"size"`
	Symbol      string  `json:"symbol"`
	VenueFillId string  `json:"venueFillId"`
}

DiscrepancyFill defines model for DiscrepancyFill.

type DiscrepancyId

type DiscrepancyId = string

DiscrepancyId defines model for discrepancyId.

type DiscrepancyKind

type DiscrepancyKind string

DiscrepancyKind foreign_fill: a fill the venue reported that Mishmar did not place; restricts an agents-only connected account, and on a shared connected account is already in the unassigned book and listed only for re-attribution. unexplained_position: a venue position that disagrees with the books with nothing to explain it; that asset on the connected account is degraded, and every agent holding it has the difference added to its agent rules in whichever direction is worse. unexplained_balance: a cash or collateral change with nothing to explain it; nothing is degraded, a drop counts as a loss and a rise is not counted until resolved. ambiguous_transfer: an asset several agents hold was transferred out beyond what the unassigned book holds; that asset is degraded until the owner names the agent it came from. stream_gap: the venue's stream missed more than its history can fill; the whole connected account is degraded until the engine has re-read the venue.

const (
	DiscrepancyKindAmbiguousTransfer   DiscrepancyKind = "ambiguous_transfer"
	DiscrepancyKindForeignFill         DiscrepancyKind = "foreign_fill"
	DiscrepancyKindStreamGap           DiscrepancyKind = "stream_gap"
	DiscrepancyKindUnexplainedBalance  DiscrepancyKind = "unexplained_balance"
	DiscrepancyKindUnexplainedPosition DiscrepancyKind = "unexplained_position"
)

Defines values for DiscrepancyKind.

func (DiscrepancyKind) Valid

func (e DiscrepancyKind) Valid() bool

Valid indicates whether the value is a known member of the DiscrepancyKind enum.

type DiscrepancyResolve

type DiscrepancyResolve struct {
	// AgentId Required when assignTo is agent, refused otherwise.
	AgentId *string `json:"agentId,omitempty"`

	// AssignTo unassigned: book it to the connected account's unassigned book. agent: book it to `agentId`'s
	// book, an agent on the connected account (for an ambiguous transfer, the agent it
	// came from). capital: it was a transfer in or out, recorded at the mark,
	// moving equity and the drawdown baseline together.
	AssignTo DiscrepancyAssignTo `json:"assignTo"`
	Comment  *string             `json:"comment,omitempty"`
}

DiscrepancyResolve defines model for DiscrepancyResolve.

type DiscrepancyRestricts

type DiscrepancyRestricts string

DiscrepancyRestricts What it blocks for new risk while open. Exits always pass.

const (
	DiscrepancyRestrictsAsset            DiscrepancyRestricts = "asset"
	DiscrepancyRestrictsConnectedAccount DiscrepancyRestricts = "connected_account"
	DiscrepancyRestrictsNone             DiscrepancyRestricts = "none"
)

Defines values for DiscrepancyRestricts.

func (DiscrepancyRestricts) Valid

func (e DiscrepancyRestricts) Valid() bool

Valid indicates whether the value is a known member of the DiscrepancyRestricts enum.

type DiscrepancyStatus

type DiscrepancyStatus string

DiscrepancyStatus defines model for DiscrepancyStatus.

const (
	DiscrepancyStatusOpen     DiscrepancyStatus = "open"
	DiscrepancyStatusResolved DiscrepancyStatus = "resolved"
)

Defines values for DiscrepancyStatus.

func (DiscrepancyStatus) Valid

func (e DiscrepancyStatus) Valid() bool

Valid indicates whether the value is a known member of the DiscrepancyStatus enum.

type EngineCommitment

type EngineCommitment struct {
	// Commitment Base64. FROST only, the engine's nonce commitment; a two-party ECDSA slot carries nothing, since the signer's own presignature holds its side.
	Commitment *string   `json:"commitment,omitempty"`
	ExpiresAt  time.Time `json:"expiresAt"`
	Id         string    `json:"id"`
}

EngineCommitment One single-use engine nonce: a FROST commitment the signer computes against, or a presigned two-party ECDSA slot.

type EngineMode

type EngineMode string

EngineMode paper: venues are simulated or test networks; fixtures may be imported. live: real venues and real money; the engine refuses fixtures and refuses to start if any connected account's venue lacks a live adapter.

const (
	EngineModeLive  EngineMode = "live"
	EngineModePaper EngineMode = "paper"
)

Defines values for EngineMode.

func (EngineMode) Valid

func (e EngineMode) Valid() bool

Valid indicates whether the value is a known member of the EngineMode enum.

type Entitlements

type Entitlements struct {
	// AccountData What the plan includes of connected-account data. The values come from
	// the plan file, not from code. The data is collected by polling, whether
	// or not the engine that judges orders is up: on the hosted service a
	// collector stays up for an account whose engine was stopped for being
	// quiet, until the account is released.
	AccountData *AccountDataEntitlements `json:"accountData,omitempty"`

	// CommitmentBatch The most unused engine commitments (or presignatures) an agent's
	// signer may hold per venue key: how many orders in a burst take the
	// one-shot path before the rest fall back to the signer channel.
	CommitmentBatch int `json:"commitmentBatch"`

	// DedicatedCell The account runs on a cell of its own.
	DedicatedCell bool `json:"dedicatedCell"`

	// FailoverCell A standby cell in another availability zone takes over when the account's cell fails (the uptime guarantee).
	FailoverCell bool `json:"failoverCell"`

	// MaxAgents The most trade agents the account may have, stopped ones included.
	// Read agents are not counted. Absent means no limit. An account
	// already over it keeps what it has; adding a trade agent
	// (createAgent), and turning a read agent into a trade agent
	// (updateAgent), are refused with `limit_reached` until a trade
	// agent is deleted or made a read agent. Before contract 0.23.0
	// this counted every agent.
	MaxAgents *int `json:"maxAgents,omitempty"`

	// MaxVenueConnections The most venue connections the account may have, on every venue
	// together. Absent means no limit. createVenueConnection is refused
	// with `limit_reached` past it, as createAgent is. A connection
	// counts once whatever the number of accounts under it; a
	// sub-account's connection counts like any other; one Mishmar only
	// reads counts like one agents trade on. Before contract 0.21.0
	// this was `maxConnectedAccounts`.
	MaxVenueConnections *int `json:"maxVenueConnections,omitempty"`

	// SelfHosted Licensed to run the engine on the customer's own infrastructure.
	SelfHosted bool `json:"selfHosted"`

	// SignerTransports The transports the signer channel may use. long_poll is in every tier.
	SignerTransports []SignerTransport `json:"signerTransports"`

	// Tier The account's plan: free, plus, pro, or team (by agreement; billing
	// never puts an account on it by itself). Before contract 0.23.0 there
	// was no plus, and team was `enterprise`.
	Tier Tier `json:"tier"`

	// VenueBudgets The account's share of each venue's request budget. A venue limits
	// requests per address, and accounts may share an address, so each
	// takes no more than its share. The engine counts every request it
	// makes to the venue for the account: reads, polling, orders and
	// cancels. When the share is spent, polling waits, and a new order
	// is refused with `rate_limited` until the share refills; exits and
	// cancels always go. A venue not listed has no share of its own.
	VenueBudgets *[]VenueBudget `json:"venueBudgets,omitempty"`
}

Entitlements What the account's tier includes (plan doc, Pricing). Billing writes it for hosted accounts and a self-hosted engine reads it from its signed licence; the API only reads it. Safety is never gated: every rule, the stop, the pause, cancels, exits and approvals are in every tier.

type EquityPoint added in v0.4.0

type EquityPoint struct {
	At time.Time `json:"at"`

	// EquityUsd The account's value at that moment.
	EquityUsd Decimal `json:"equityUsd"`

	// Source observed: read from the venue at that moment. rebuilt: worked out
	// afterwards, for a moment nobody was reading the account (before it
	// was connected), by replaying its transactions and, for values in USD,
	// the venue's historical prices. No engine rebuilds yet: every reading
	// served today is observed.
	Source SnapshotSource `json:"source"`
}

EquityPoint defines model for EquityPoint.

type EquityResolution added in v0.4.0

type EquityResolution string

EquityResolution defines model for EquityResolution.

const (
	EquityResolutionDay    EquityResolution = "day"
	EquityResolutionHour   EquityResolution = "hour"
	EquityResolutionMinute EquityResolution = "minute"
)

Defines values for EquityResolution.

func (EquityResolution) Valid added in v0.4.0

func (e EquityResolution) Valid() bool

Valid indicates whether the value is a known member of the EquityResolution enum.

type EquitySeries added in v0.4.0

type EquitySeries struct {
	ConnectedAccountId string `json:"connectedAccountId"`

	// Points Oldest first.
	Points     []EquityPoint    `json:"points"`
	Resolution EquityResolution `json:"resolution"`
}

EquitySeries defines model for EquitySeries.

type Error

type Error struct {
	// Code Stable machine code: `not_found`, `conflict`, `validation`, `unauthorized`,
	// `forbidden`, `unavailable`, `rate_limited`, `too_large`, `approval_expired`,
	// `venue_rejected`, `limit_reached`, `signer_unreachable`, `evaluation_changed`,
	// `internal`, `not_implemented` (501: in the contract, not yet in this engine).
	// `signer_too_old` (426): signerPoll, or a proposal with a one-shot
	// message (`venueMessage`), from a signer older than the engine works
	// with or naming no version (`Mishmar-Signer-Version`). Nothing was
	// done. Upgrade the signer to the version the message names.
	// `key_scope` (403): the request was signed with an agent key of scope
	// `read`; proposing and the signer channel take a `trade` key. Nothing
	// was done. A key past its `expiresAt` is 401, "Key expired".
	// `already_connected` (409) answers connecting or verifying a venue login
	// that is connected already; `details.venueConnectionId` is the existing one.
	// `evaluation_changed` (409) answers an approve whose `revision` is not the
	// current evaluation's: the rules now say something else than what the approver
	// saw. `details.now` is the current ApprovalEvaluation; show it and approve again
	// with its `revision`. Nothing was decided.
	// `signer_unreachable` (409) means the request needs the agent's signer and none
	// answered (verifyVenueKey's co-signed read). Nothing was recorded: start the
	// signer and send the same request again.
	// `limit_reached` (403) means the account's plan holds no more of what
	// the request would add (`Entitlements.maxAgents`, `maxVenueConnections`).
	// Sending it again changes nothing: delete one, or move to a larger plan.
	// It also answers a read agent past the 50 an account may have on any
	// plan; there a larger plan changes nothing. `details.limit` is the limit.
	// `unavailable` (503) means the request did nothing: the engine cannot read its
	// state, it is starting or waiting for its account, or it is stopping. Send the
	// same request again after the seconds in the `Retry-After` header (one, while
	// an engine starts or stops).
	// `rate_limited` (429) also means the request did nothing: this caller has sent
	// too many requests. Wait the seconds in the `Retry-After` header, then send the
	// same request again. `too_large` (413) means the body was over the limit the
	// engine accepts; sending it again changes nothing.
	Code    string                  `json:"code"`
	Details *map[string]interface{} `json:"details,omitempty"`
	Message string                  `json:"message"`
}

Error defines model for Error.

type ExchangeReadKey added in v0.3.0

type ExchangeReadKey struct {
	ReadApiKey    string `json:"readApiKey"`
	ReadApiSecret string `json:"readApiSecret"`

	// Subaccount Replaces the connection's subaccount name when given.
	Subaccount *string `json:"subaccount,omitempty"`
}

ExchangeReadKey An exchange connection's read-only key, for `setReadKey`. Both write-only.

type ExchangeSetup

type ExchangeSetup struct {
	// EngineEgressIp Allowlist this at the venue on every key of the account. Present only when the engine runs in live mode and knows its egress address.
	EngineEgressIp *string `json:"engineEgressIp,omitempty"`

	// Environment Demo trading (what a paper engine creates) or the live venue.
	Environment        ExchangeSetupEnvironment `json:"environment"`
	Kind               ExchangeSetupKind        `json:"kind"`
	ReadKeyFingerprint *string                  `json:"readKeyFingerprint,omitempty"`

	// ReadKeyRegistered Whether the engine holds the connection's read-only key, for margin,
	// positions and fills. The trading keys belong to the agents (VenueKey);
	// a connection without a read key verifies and streams nothing.
	ReadKeyRegistered bool    `json:"readKeyRegistered"`
	Subaccount        *string `json:"subaccount,omitempty"`
}

ExchangeSetup defines model for ExchangeSetup.

type ExchangeSetupEnvironment

type ExchangeSetupEnvironment string

ExchangeSetupEnvironment Demo trading (what a paper engine creates) or the live venue.

const (
	ExchangeSetupEnvironmentDemo ExchangeSetupEnvironment = "demo"
	ExchangeSetupEnvironmentLive ExchangeSetupEnvironment = "live"
)

Defines values for ExchangeSetupEnvironment.

func (ExchangeSetupEnvironment) Valid

func (e ExchangeSetupEnvironment) Valid() bool

Valid indicates whether the value is a known member of the ExchangeSetupEnvironment enum.

type ExchangeSetupKind

type ExchangeSetupKind string

ExchangeSetupKind defines model for ExchangeSetup.Kind.

const (
	ExchangeSetupKindExchange ExchangeSetupKind = "exchange"
)

Defines values for ExchangeSetupKind.

func (ExchangeSetupKind) Valid

func (e ExchangeSetupKind) Valid() bool

Valid indicates whether the value is a known member of the ExchangeSetupKind enum.

type GetConnectedAccountBalancesParams added in v0.4.0

type GetConnectedAccountBalancesParams struct {
	// At The moment to answer for. Absent means now.
	At *time.Time `form:"at,omitempty" json:"at,omitempty"`
}

GetConnectedAccountBalancesParams defines parameters for GetConnectedAccountBalances.

type GetConnectedAccountEquityParams added in v0.4.0

type GetConnectedAccountEquityParams struct {
	From *time.Time `form:"from,omitempty" json:"from,omitempty"`
	To   *time.Time `form:"to,omitempty" json:"to,omitempty"`

	// Resolution How far apart the points are. Absent, the engine picks one that
	// gives a few hundred points over the range. Never finer than the
	// plan allows (`Entitlements.accountData.resolutionSeconds`).
	Resolution *EquityResolution `form:"resolution,omitempty" json:"resolution,omitempty"`
}

GetConnectedAccountEquityParams defines parameters for GetConnectedAccountEquity.

type GetConnectedAccountPositionsParams added in v0.4.0

type GetConnectedAccountPositionsParams struct {
	// At The moment to answer for. Absent means now.
	At *time.Time `form:"at,omitempty" json:"at,omitempty"`
}

GetConnectedAccountPositionsParams defines parameters for GetConnectedAccountPositions.

type GetPnlParams

type GetPnlParams struct {
	ScopeKind ScopeKind           `form:"scopeKind" json:"scopeKind"`
	ScopeId   string              `form:"scopeId" json:"scopeId"`
	From      *openapi_types.Date `form:"from,omitempty" json:"from,omitempty"`
	To        *openapi_types.Date `form:"to,omitempty" json:"to,omitempty"`
}

GetPnlParams defines parameters for GetPnl.

type GetVenueConnectionEquityParams added in v0.5.0

type GetVenueConnectionEquityParams struct {
	From       *time.Time        `form:"from,omitempty" json:"from,omitempty"`
	To         *time.Time        `form:"to,omitempty" json:"to,omitempty"`
	Resolution *EquityResolution `form:"resolution,omitempty" json:"resolution,omitempty"`
}

GetVenueConnectionEquityParams defines parameters for GetVenueConnectionEquity.

type HyperliquidSetup

type HyperliquidSetup struct {
	Kind HyperliquidSetupKind `json:"kind"`

	// MasterAddress The customer's Hyperliquid master account. Reads need no key: the info
	// API is public by address. Each agent's API wallet (its VenueKey) is
	// approved by this account. Absent until known: an account added
	// without one learns it from the first of its agents' API wallets the
	// master approves at Hyperliquid.
	MasterAddress *string                 `json:"masterAddress,omitempty"`
	Network       HyperliquidSetupNetwork `json:"network"`

	// SubaccountAddress On a sub-account (`venueAccount.role` subaccount), its own
	// address: what the engine reads. `masterAddress` is then the
	// master that owns it, whose API wallets trade on it.
	SubaccountAddress *string `json:"subaccountAddress,omitempty"`
}

HyperliquidSetup defines model for HyperliquidSetup.

type HyperliquidSetupKind

type HyperliquidSetupKind string

HyperliquidSetupKind defines model for HyperliquidSetup.Kind.

const (
	HyperliquidSetupKindHyperliquid HyperliquidSetupKind = "hyperliquid"
)

Defines values for HyperliquidSetupKind.

func (HyperliquidSetupKind) Valid

func (e HyperliquidSetupKind) Valid() bool

Valid indicates whether the value is a known member of the HyperliquidSetupKind enum.

type HyperliquidSetupNetwork

type HyperliquidSetupNetwork string

HyperliquidSetupNetwork defines model for HyperliquidSetup.Network.

const (
	HyperliquidSetupNetworkMainnet HyperliquidSetupNetwork = "mainnet"
	HyperliquidSetupNetworkTestnet HyperliquidSetupNetwork = "testnet"
)

Defines values for HyperliquidSetupNetwork.

func (HyperliquidSetupNetwork) Valid

func (e HyperliquidSetupNetwork) Valid() bool

Valid indicates whether the value is a known member of the HyperliquidSetupNetwork enum.

type IssueAgentKeyJSONRequestBody added in v0.5.0

type IssueAgentKeyJSONRequestBody = AgentKeyIssue

IssueAgentKeyJSONRequestBody defines body for IssueAgentKey for application/json ContentType.

type KeygenRound

type KeygenRound struct {
	// Message Round 2. Base64, the signer's protocol message answering the engine's first.
	Message *string          `json:"message,omitempty"`
	Round   KeygenRoundRound `json:"round"`

	// SessionId Round 2. The session round 1 opened.
	SessionId  *string `json:"sessionId,omitempty"`
	VenueKeyId string  `json:"venueKeyId"`
}

KeygenRound One round of two-party key generation from the agent's signer (signerKeygen).

type KeygenRoundResult

type KeygenRoundResult struct {
	// Address Round 2. The joint key's EVM address, now recorded as VenueKey.publicKey.
	Address *string `json:"address,omitempty"`

	// Message Base64, the engine's protocol message for the round.
	Message string `json:"message"`

	// PublicKey Round 2. The joint public key, compressed SEC1 as base64, which the signer checks against its own.
	PublicKey *string `json:"publicKey,omitempty"`
	Round     int     `json:"round"`
	SessionId string  `json:"sessionId"`
}

KeygenRoundResult Key generation agrees its own session id inside the protocol; only presigning takes the joint one.

type KeygenRoundRound

type KeygenRoundRound int

KeygenRoundRound defines model for KeygenRound.Round.

const (
	KeygenRoundRoundN1 KeygenRoundRound = 1
	KeygenRoundRoundN2 KeygenRoundRound = 2
)

Defines values for KeygenRoundRound.

func (KeygenRoundRound) Valid

func (e KeygenRoundRound) Valid() bool

Valid indicates whether the value is a known member of the KeygenRoundRound enum.

type LedgerEvent

type LedgerEvent struct {
	At         time.Time              `json:"at"`
	DecisionId *string                `json:"decisionId,omitempty"`
	Hash       string                 `json:"hash"`
	Kind       LedgerEventKind        `json:"kind"`
	Payload    map[string]interface{} `json:"payload"`
	PrevHash   string                 `json:"prevHash"`
	Seq        int64                  `json:"seq"`
}

LedgerEvent One append-only entry of the audit ledger. `hash` is SHA-256 over the previous event's hash, a newline and the canonical JSON of `payload` (keys sorted, no whitespace, nulls dropped), hex; the first event's prevHash is empty. The kinds: decision (the record as written), forwarded (reason, venue ack, fills the venue returned; a cancel's own answer too), fills (fills a venue stream reported), parked, approval (the outcome), expired (approvals nobody decided in time), cancelled (an order Mishmar placed left the venue's book without filling completely, written once against the decision that placed it; the payload is that decision's OrderCancellation plus `decisionId` and `clientOrderId`), capital (a transfer in or out, valued at the mark), venue_event (funding, a liquidation or auto-deleveraging, a settlement, a rebate, interest and the venue's other non-trade entries, with how they were booked), discrepancy (one opened), resolved (one resolved, and how), reassigned (a position moved between books), maintenance (a window opened or closed).

type LedgerEventKind

type LedgerEventKind string

LedgerEventKind defines model for LedgerEvent.Kind.

const (
	LedgerEventKindApproval    LedgerEventKind = "approval"
	LedgerEventKindCancelled   LedgerEventKind = "cancelled"
	LedgerEventKindCapital     LedgerEventKind = "capital"
	LedgerEventKindDecision    LedgerEventKind = "decision"
	LedgerEventKindDiscrepancy LedgerEventKind = "discrepancy"
	LedgerEventKindExpired     LedgerEventKind = "expired"
	LedgerEventKindFills       LedgerEventKind = "fills"
	LedgerEventKindForwarded   LedgerEventKind = "forwarded"
	LedgerEventKindMaintenance LedgerEventKind = "maintenance"
	LedgerEventKindParked      LedgerEventKind = "parked"
	LedgerEventKindReassigned  LedgerEventKind = "reassigned"
	LedgerEventKindResolved    LedgerEventKind = "resolved"
	LedgerEventKindVenueEvent  LedgerEventKind = "venue_event"
)

Defines values for LedgerEventKind.

func (LedgerEventKind) Valid

func (e LedgerEventKind) Valid() bool

Valid indicates whether the value is a known member of the LedgerEventKind enum.

type LedgerEventPage

type LedgerEventPage struct {
	Items []LedgerEvent `json:"items"`

	// NextAfter Pass as `after` for the next page; absent on the last page.
	NextAfter *int64 `json:"nextAfter,omitempty"`
}

LedgerEventPage defines model for LedgerEventPage.

type LedgerHead

type LedgerHead struct {
	// EnginePublicKey The engine key's Ed25519 public key, base64. Verifies every engineSignature.
	EnginePublicKey string `json:"enginePublicKey"`
	Events          int64  `json:"events"`

	// Hash The latest event's hash
	Hash string `json:"hash"`

	// Seq The latest event's sequence number; 0 when the chain is empty.
	Seq int64 `json:"seq"`
}

LedgerHead defines model for LedgerHead.

type ListAccessLogParams added in v0.4.0

type ListAccessLogParams struct {
	AgentId            *string `form:"agentId,omitempty" json:"agentId,omitempty"`
	ConnectedAccountId *string `form:"connectedAccountId,omitempty" json:"connectedAccountId,omitempty"`
	Limit              *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Cursor             *string `form:"cursor,omitempty" json:"cursor,omitempty"`
}

ListAccessLogParams defines parameters for ListAccessLog.

type ListAgentsParams

type ListAgentsParams struct {
	// ConnectedAccountId Only agents given this connected account.
	ConnectedAccountId *string      `form:"connectedAccountId,omitempty" json:"connectedAccountId,omitempty"`
	Status             *AgentStatus `form:"status,omitempty" json:"status,omitempty"`
}

ListAgentsParams defines parameters for ListAgents.

type ListApprovalsParams

type ListApprovalsParams struct {
	Status *ApprovalStatus `form:"status,omitempty" json:"status,omitempty"`
}

ListApprovalsParams defines parameters for ListApprovals.

type ListConnectedAccountTransactionsParams added in v0.4.0

type ListConnectedAccountTransactionsParams struct {
	From   *time.Time              `form:"from,omitempty" json:"from,omitempty"`
	To     *time.Time              `form:"to,omitempty" json:"to,omitempty"`
	Kind   *AccountTransactionKind `form:"kind,omitempty" json:"kind,omitempty"`
	Limit  *int                    `form:"limit,omitempty" json:"limit,omitempty"`
	Cursor *string                 `form:"cursor,omitempty" json:"cursor,omitempty"`
}

ListConnectedAccountTransactionsParams defines parameters for ListConnectedAccountTransactions.

type ListConnectedAccountsParams added in v0.5.0

type ListConnectedAccountsParams struct {
	// VenueConnectionId Only this connection's accounts.
	VenueConnectionId *string `form:"venueConnectionId,omitempty" json:"venueConnectionId,omitempty"`
}

ListConnectedAccountsParams defines parameters for ListConnectedAccounts.

type ListDecisionsParams

type ListDecisionsParams struct {
	AgentId            *string  `form:"agentId,omitempty" json:"agentId,omitempty"`
	ConnectedAccountId *string  `form:"connectedAccountId,omitempty" json:"connectedAccountId,omitempty"`
	Verdict            *Verdict `form:"verdict,omitempty" json:"verdict,omitempty"`

	// Signing Only orders a person approved that wait for the agent's signer
	// (`signing.status` waiting). The hosted control plane reads it
	// before letting a quiet account's engine stop.
	Signing *ListDecisionsParamsSigning `form:"signing,omitempty" json:"signing,omitempty"`
	From    *time.Time                  `form:"from,omitempty" json:"from,omitempty"`
	To      *time.Time                  `form:"to,omitempty" json:"to,omitempty"`
	Cursor  *string                     `form:"cursor,omitempty" json:"cursor,omitempty"`
	Limit   *int                        `form:"limit,omitempty" json:"limit,omitempty"`
}

ListDecisionsParams defines parameters for ListDecisions.

type ListDecisionsParamsSigning added in v0.5.0

type ListDecisionsParamsSigning string

ListDecisionsParamsSigning defines parameters for ListDecisions.

const (
	ListDecisionsParamsSigningWaiting ListDecisionsParamsSigning = "waiting"
)

Defines values for ListDecisionsParamsSigning.

func (ListDecisionsParamsSigning) Valid added in v0.5.0

func (e ListDecisionsParamsSigning) Valid() bool

Valid indicates whether the value is a known member of the ListDecisionsParamsSigning enum.

type ListDiscrepanciesParams

type ListDiscrepanciesParams struct {
	ConnectedAccountId *string            `form:"connectedAccountId,omitempty" json:"connectedAccountId,omitempty"`
	Status             *DiscrepancyStatus `form:"status,omitempty" json:"status,omitempty"`
}

ListDiscrepanciesParams defines parameters for ListDiscrepancies.

type ListLedgerEventsParams

type ListLedgerEventsParams struct {
	// After Return events with a sequence number above this. Default 0.
	After *int64 `form:"after,omitempty" json:"after,omitempty"`

	// Limit Page size, default 200.
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}

ListLedgerEventsParams defines parameters for ListLedgerEvents.

type ListPositionsParams

type ListPositionsParams struct {
	ScopeKind *ScopeKind `form:"scopeKind,omitempty" json:"scopeKind,omitempty"`
	ScopeId   *string    `form:"scopeId,omitempty" json:"scopeId,omitempty"`
}

ListPositionsParams defines parameters for ListPositions.

type ListRulesParams

type ListRulesParams struct {
	ScopeKind *ScopeKind `form:"scopeKind,omitempty" json:"scopeKind,omitempty"`
	ScopeId   *string    `form:"scopeId,omitempty" json:"scopeId,omitempty"`
	Enabled   *bool      `form:"enabled,omitempty" json:"enabled,omitempty"`
}

ListRulesParams defines parameters for ListRules.

type MaintenanceOpen

type MaintenanceOpen struct {
	Comment *string `json:"comment,omitempty"`
}

MaintenanceOpen defines model for MaintenanceOpen.

type MaintenanceWindow

type MaintenanceWindow struct {
	Comment  *string   `json:"comment,omitempty"`
	OpenedAt time.Time `json:"openedAt"`

	// OpenedBy The operator who opened it.
	OpenedBy string `json:"openedBy"`
}

MaintenanceWindow An open maintenance window (openMaintenance). Absent when none is open.

type MarkInput

type MarkInput struct {
	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price  Decimal `json:"price"`
	Symbol string  `json:"symbol"`
	Venue  Venue   `json:"venue"`
}

MarkInput defines model for MarkInput.

type MarketKind added in v0.5.0

type MarketKind string

MarketKind What kind of market a symbol is on. A venue may use one symbol for several (Binance's BTCUSDT is a spot pair and a perpetual), so a symbol identifies a market only together with this.

const (
	MarketKindEquity MarketKind = "equity"
	MarketKindFuture MarketKind = "future"
	MarketKindOption MarketKind = "option"
	MarketKindPerp   MarketKind = "perp"
	MarketKindSpot   MarketKind = "spot"
)

Defines values for MarketKind.

func (MarketKind) Valid added in v0.5.0

func (e MarketKind) Valid() bool

Valid indicates whether the value is a known member of the MarketKind enum.

type OpenMaintenanceJSONRequestBody

type OpenMaintenanceJSONRequestBody = MaintenanceOpen

OpenMaintenanceJSONRequestBody defines body for OpenMaintenance for application/json ContentType.

type Operator

type Operator struct {
	// Mode paper: venues are simulated or test networks; fixtures may be imported.
	// live: real venues and real money; the engine refuses fixtures and refuses
	// to start if any connected account's venue lacks a live adapter.
	Mode EngineMode `json:"mode"`

	// Name The person behind the bearer token. Recorded on approvals as decidedBy.
	Name string `json:"name"`
}

Operator defines model for Operator.

type OrderCancellation added in v0.2.0

type OrderCancellation struct {
	// At When the venue took it off the book, or when the engine learned it did.
	At time.Time `json:"at"`

	// By agent: a cancel the agent proposed through Mishmar (`cancelDecisionId`).
	// venue: the venue pulled it itself (expiry, margin, reduce-only, self-trade,
	// delisting, liquidation, …; `venueStatus` says which). outside: cancelled at
	// the venue but not through Mishmar, by the owner in the venue's app or another
	// key. unknown: it left the venue's list of open orders with no status the
	// engine could read and no fill to explain it.
	By OrderCancellationBy `json:"by"`

	// CancelDecisionId Present when by is agent. The decision of the cancel.
	CancelDecisionId *string `json:"cancelDecisionId,omitempty"`

	// FilledSize How much of the order filled before it left the book; "0" when none did.
	FilledSize Decimal `json:"filledSize"`

	// VenueStatus The venue's own word for it when it gave one, e.g. Hyperliquid's `marginCanceled` or Binance's `EXPIRED`.
	VenueStatus *string `json:"venueStatus,omitempty"`
}

OrderCancellation The end of a resting order that did not fill completely. Each order has at most one.

type OrderCancellationBy added in v0.2.0

type OrderCancellationBy string

OrderCancellationBy agent: a cancel the agent proposed through Mishmar (`cancelDecisionId`). venue: the venue pulled it itself (expiry, margin, reduce-only, self-trade, delisting, liquidation, …; `venueStatus` says which). outside: cancelled at the venue but not through Mishmar, by the owner in the venue's app or another key. unknown: it left the venue's list of open orders with no status the engine could read and no fill to explain it.

const (
	OrderCancellationByAgent   OrderCancellationBy = "agent"
	OrderCancellationByOutside OrderCancellationBy = "outside"
	OrderCancellationByUnknown OrderCancellationBy = "unknown"
	OrderCancellationByVenue   OrderCancellationBy = "venue"
)

Defines values for OrderCancellationBy.

func (OrderCancellationBy) Valid added in v0.2.0

func (e OrderCancellationBy) Valid() bool

Valid indicates whether the value is a known member of the OrderCancellationBy enum.

type PnlDay

type PnlDay struct {
	Date openapi_types.Date `json:"date"`

	// FeesUsd Trading fees paid, negative; a rebate is positive.
	FeesUsd Decimal `json:"feesUsd"`

	// FundingUsd Funding received, negative when paid.
	FundingUsd Decimal `json:"fundingUsd"`

	// NetUsd The PnL, realized + unrealized + fees + funding. daily_loss and an agent's drawdown read it.
	NetUsd Decimal `json:"netUsd"`

	// RealizedNetUsd The realized PnL, realized + fees + funding, without the open positions' moves. daily_realized_loss reads it.
	RealizedNetUsd Decimal `json:"realizedNetUsd"`

	// RealizedUsd Closed trading PnL, before fees and funding.
	RealizedUsd Decimal `json:"realizedUsd"`

	// UnrealizedUsd The change in the open positions' value at their marks; today's moves with the marks.
	UnrealizedUsd Decimal `json:"unrealizedUsd"`
}

PnlDay defines model for PnlDay.

type PnlSeries

type PnlSeries struct {
	Days  []PnlDay           `json:"days"`
	From  openapi_types.Date `json:"from"`
	Name  string             `json:"name"`
	Scope Scope              `json:"scope"`
	To    openapi_types.Date `json:"to"`

	// Totals PnL over a day or a range of days, for one scope. The engine books it
	// as positions move: a fill that closes part of a position realises
	// its PnL at the position's average entry, its fee goes to the book
	// whose order it was, and a funding payment is shared among the books
	// by each one's own position (the unassigned book takes what the books
	// do not explain). A day runs from the moment the engine opens it,
	// just after midnight UTC, to the next.
	Totals PnlTotals `json:"totals"`
}

PnlSeries defines model for PnlSeries.

type PnlSummary

type PnlSummary struct {
	AsOf time.Time       `json:"asOf"`
	Rows []PnlSummaryRow `json:"rows"`
}

PnlSummary defines model for PnlSummary.

type PnlSummaryRow

type PnlSummaryRow struct {
	// DayNetUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	DayNetUsd Decimal `json:"dayNetUsd"`

	// GrossExposureUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	GrossExposureUsd Decimal `json:"grossExposureUsd"`

	// MtdNetUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MtdNetUsd Decimal `json:"mtdNetUsd"`
	Name      string  `json:"name"`

	// RealizedUsd Month to date.
	RealizedUsd Decimal `json:"realizedUsd"`
	Scope       Scope   `json:"scope"`

	// UnrealizedUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	UnrealizedUsd Decimal `json:"unrealizedUsd"`
}

PnlSummaryRow defines model for PnlSummaryRow.

type PnlTotals

type PnlTotals struct {
	// FeesUsd Trading fees paid, negative; a rebate is positive.
	FeesUsd Decimal `json:"feesUsd"`

	// FundingUsd Funding received, negative when paid.
	FundingUsd Decimal `json:"fundingUsd"`

	// NetUsd The PnL, realized + unrealized + fees + funding. daily_loss and an agent's drawdown read it.
	NetUsd Decimal `json:"netUsd"`

	// RealizedNetUsd The realized PnL, realized + fees + funding, without the open positions' moves. daily_realized_loss reads it.
	RealizedNetUsd Decimal `json:"realizedNetUsd"`

	// RealizedUsd Closed trading PnL, before fees and funding.
	RealizedUsd Decimal `json:"realizedUsd"`

	// UnrealizedUsd The change in the open positions' value at their marks; today's moves with the marks.
	UnrealizedUsd Decimal `json:"unrealizedUsd"`
}

PnlTotals PnL over a day or a range of days, for one scope. The engine books it as positions move: a fill that closes part of a position realises its PnL at the position's average entry, its fee goes to the book whose order it was, and a funding payment is shared among the books by each one's own position (the unassigned book takes what the books do not explain). A day runs from the moment the engine opens it, just after midnight UTC, to the next.

type Position

type Position struct {
	AgentId *string `json:"agentId,omitempty"`

	// Book unassigned: a holding no agent owns, such as a manual trade on a shared
	// connected account, an asset deposited in kind, or what a retired agent held;
	// agentId is then absent. Account, venue connection and connected account rules
	// see the unassigned book; agent rules do not. Absent means agent.
	Book               *PositionBook `json:"book,omitempty"`
	ConnectedAccountId *string       `json:"connectedAccountId,omitempty"`

	// EntryPrice A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	EntryPrice Decimal `json:"entryPrice"`
	Id         string  `json:"id"`

	// Leverage A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Leverage *Decimal `json:"leverage,omitempty"`

	// MarkPrice A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MarkPrice Decimal `json:"markPrice"`

	// NotionalUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	NotionalUsd Decimal      `json:"notionalUsd"`
	Side        PositionSide `json:"side"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size   Decimal `json:"size"`
	Symbol string  `json:"symbol"`

	// UnrealizedUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	UnrealizedUsd Decimal `json:"unrealizedUsd"`
	Venue         Venue   `json:"venue"`
}

Position defines model for Position.

type PositionBook

type PositionBook string

PositionBook unassigned: a holding no agent owns, such as a manual trade on a shared connected account, an asset deposited in kind, or what a retired agent held; agentId is then absent. Account, venue connection and connected account rules see the unassigned book; agent rules do not. Absent means agent.

const (
	PositionBookAgent      PositionBook = "agent"
	PositionBookUnassigned PositionBook = "unassigned"
)

Defines values for PositionBook.

func (PositionBook) Valid

func (e PositionBook) Valid() bool

Valid indicates whether the value is a known member of the PositionBook enum.

type PositionInput

type PositionInput struct {
	AgentId            string `json:"agentId"`
	ConnectedAccountId string `json:"connectedAccountId"`

	// EntryPrice A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	EntryPrice Decimal `json:"entryPrice"`

	// MarkPrice A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MarkPrice Decimal           `json:"markPrice"`
	Side      PositionInputSide `json:"side"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size   Decimal `json:"size"`
	Symbol string  `json:"symbol"`
	Venue  Venue   `json:"venue"`
}

PositionInput defines model for PositionInput.

type PositionInputSide

type PositionInputSide string

PositionInputSide defines model for PositionInput.Side.

const (
	PositionInputSideLong  PositionInputSide = "long"
	PositionInputSideShort PositionInputSide = "short"
)

Defines values for PositionInputSide.

func (PositionInputSide) Valid

func (e PositionInputSide) Valid() bool

Valid indicates whether the value is a known member of the PositionInputSide enum.

type PositionReassign

type PositionReassign struct {
	Comment *string `json:"comment,omitempty"`

	// FromAgentId The agent giving the holding. Absent means the unassigned book.
	FromAgentId *string `json:"fromAgentId,omitempty"`

	// Size How much to move, positive, in the direction the giving book holds.
	Size   Decimal `json:"size"`
	Symbol string  `json:"symbol"`

	// ToAgentId The agent receiving it. Absent means the unassigned book; the two must differ.
	ToAgentId *string `json:"toAgentId,omitempty"`
}

PositionReassign defines model for PositionReassign.

type PositionSide

type PositionSide string

PositionSide defines model for Position.Side.

const (
	PositionSideLong  PositionSide = "long"
	PositionSideShort PositionSide = "short"
)

Defines values for PositionSide.

func (PositionSide) Valid

func (e PositionSide) Valid() bool

Valid indicates whether the value is a known member of the PositionSide enum.

type PresignRound

type PresignRound struct {
	// Count Round 1. How many nonces the signer wants. Default and cap, the entitlement less what it already holds unused.
	Count *int `json:"count,omitempty"`

	// Message Round 2. Base64, the signer's protocol message answering the engine's first.
	Message *string           `json:"message,omitempty"`
	Round   PresignRoundRound `json:"round"`

	// SessionId Round 2. The session round 1 opened.
	SessionId *string `json:"sessionId,omitempty"`

	// SignerSid Round 1. Base64 of 16 random bytes, the signer's half of the
	// session id. The engine adds 16 of its own, and both sides run the
	// protocol under SHA-256 of the signer's half then the engine's.
	SignerSid  *string `json:"signerSid,omitempty"`
	VenueKeyId string  `json:"venueKeyId"`
}

PresignRound One round of presigning from the agent's signer (signerPresign).

type PresignRoundResult

type PresignRoundResult struct {
	// BatchSize Round 2. The account's entitlement (Entitlements.commitmentBatch).
	BatchSize *int `json:"batchSize,omitempty"`

	// Count Round 1. How many nonces the session makes, after the entitlement's cap.
	Count *int `json:"count,omitempty"`

	// EngineInstance As CommitmentBatch.engineInstance; it changes when the engine or the signer behind it restarts, and the slots are gone with it.
	EngineInstance string `json:"engineInstance"`

	// EngineSid Round 1. Base64 of the engine's 16 bytes of the session id.
	EngineSid *string `json:"engineSid,omitempty"`

	// Message Base64, the engine's protocol message for the round.
	Message string `json:"message"`

	// Outstanding Round 2. Unused slots the signer holds for this key, these included.
	Outstanding *int   `json:"outstanding,omitempty"`
	Round       int    `json:"round"`
	SessionId   string `json:"sessionId"`

	// Slots Round 2. One per nonce, in the order of the signer's own presignature.
	Slots *[]EngineCommitment `json:"slots,omitempty"`
}

PresignRoundResult defines model for PresignRoundResult.

type PresignRoundRound

type PresignRoundRound int

PresignRoundRound defines model for PresignRound.Round.

const (
	PresignRoundRoundN1 PresignRoundRound = 1
	PresignRoundRoundN2 PresignRoundRound = 2
)

Defines values for PresignRoundRound.

func (PresignRoundRound) Valid

func (e PresignRoundRound) Valid() bool

Valid indicates whether the value is a known member of the PresignRoundRound enum.

type Proposal

type Proposal struct {
	// ClientOrderId Assigned by the engine. Names the agent so fills attribute per agent on a shared account.
	ClientOrderId string `json:"clientOrderId"`

	// ExpiresAt The deadline the agent set (ProposalSubmit.expiresAt). Nothing is forwarded past it.
	ExpiresAt time.Time `json:"expiresAt"`

	// Kind cancel pulls a resting order the agent placed through Mishmar, named by
	// `targetClientOrderId`; it carries no order fields.
	Kind ProposalKind `json:"kind"`

	// Leverage A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Leverage *Decimal `json:"leverage,omitempty"`

	// NotionalUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	NotionalUsd Decimal           `json:"notionalUsd"`
	OrderType   ProposalOrderType `json:"orderType"`

	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price      *Decimal `json:"price,omitempty"`
	ReduceOnly bool     `json:"reduceOnly"`
	Side       Side     `json:"side"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size   Decimal `json:"size"`
	Symbol string  `json:"symbol"`

	// TargetClientOrderId Cancels only. The clientOrderId of the order being cancelled.
	TargetClientOrderId *string `json:"targetClientOrderId,omitempty"`

	// TargetDecisionId Cancels only. The decision that placed the order being cancelled.
	TargetDecisionId *string `json:"targetDecisionId,omitempty"`
	Venue            Venue   `json:"venue"`
}

Proposal The proposal as the engine priced it. For a cancel, the order fields (side, size, price, orderType, reduceOnly) describe the order being cancelled as its own decision recorded it, and notionalUsd is "0": a cancel adds no exposure.

type ProposalKind

type ProposalKind string

ProposalKind cancel pulls a resting order the agent placed through Mishmar, named by `targetClientOrderId`; it carries no order fields.

const (
	ProposalKindCancel        ProposalKind = "cancel"
	ProposalKindOrder         ProposalKind = "order"
	ProposalKindSignedMessage ProposalKind = "signed_message"
	ProposalKindTransaction   ProposalKind = "transaction"
)

Defines values for ProposalKind.

func (ProposalKind) Valid

func (e ProposalKind) Valid() bool

Valid indicates whether the value is a known member of the ProposalKind enum.

type ProposalOrderType

type ProposalOrderType string

ProposalOrderType defines model for Proposal.OrderType.

const (
	ProposalOrderTypeLimit  ProposalOrderType = "limit"
	ProposalOrderTypeMarket ProposalOrderType = "market"
)

Defines values for ProposalOrderType.

func (ProposalOrderType) Valid

func (e ProposalOrderType) Valid() bool

Valid indicates whether the value is a known member of the ProposalOrderType enum.

type ProposalSubmit

type ProposalSubmit struct {
	// ConnectedAccountId The connected account to trade on. Part of the signed bytes under
	// this name since contract 0.20.0 (before, `tradingAccountId`): a
	// client built for an earlier contract is refused with 422.
	ConnectedAccountId string `json:"connectedAccountId"`

	// ExpiresAt The latest moment the order may reach the venue. Must be after
	// proposedAt and at most 24 hours later. A decision parked for a
	// person expires then (sooner when the engine's approval window is
	// shorter), an approval after it is refused, and nothing is forwarded
	// past it. A proposal that is already past it is refused (422).
	ExpiresAt time.Time `json:"expiresAt"`

	// KeyId The id returned when the key was issued.
	KeyId string `json:"keyId"`

	// Kind cancel pulls a resting order the agent placed through Mishmar, named by
	// `targetClientOrderId`; it carries no order fields.
	Kind ProposalKind `json:"kind"`

	// Leverage A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Leverage *Decimal `json:"leverage,omitempty"`

	// Nonce Unique per proposal. A replayed nonce is rejected.
	Nonce     string                  `json:"nonce"`
	OrderType ProposalSubmitOrderType `json:"orderType,omitempty"`

	// Price Required for limit orders. Ignored for market orders, which are priced at mark.
	Price *Decimal `json:"price,omitempty"`

	// ProposedAt Rejected when more than 60 seconds old.
	ProposedAt time.Time `json:"proposedAt"`

	// ReduceOnly The agent's claim that the order only reduces its position. With it
	// the signer sets the venue's own reduce-only flag, and the engine
	// judges whether the order is an exit (see submitProposal).
	ReduceOnly *bool `json:"reduceOnly,omitempty"`
	Side       Side  `json:"side,omitempty"`

	// Signature Base64 Ed25519 signature over the canonical JSON of every other
	// field in this object: keys sorted at every level (venueMessage
	// included), no whitespace, numbers as the shortest round-trip
	// decimal, absent optional fields omitted. Pinned in
	// spec/vectors/proposal-signing.json.
	Signature string `json:"signature"`

	// Size A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Size Decimal `json:"size,omitempty"`

	// Symbol For a cancel, the symbol of the order being cancelled; the venues need it.
	Symbol string `json:"symbol"`

	// TargetClientOrderId Cancels only, and required for them: the clientOrderId the engine
	// assigned on the decision of the order to pull. That order must be
	// the same agent's, on the same connected account, and must have reached the
	// venue. Refused on every other kind.
	TargetClientOrderId *string `json:"targetClientOrderId,omitempty"`

	// VenueMessage The one-shot path. The agent's signer builds the venue request and
	// signs its half before the proposal leaves the agent's machine, so an
	// allowed order needs no round trip to the signer: the engine decodes
	// `message`, checks it against the proposal and the connected account's venue rules,
	// runs the rules, and only then adds its own half and forwards. It is
	// inside the signed proposal, so nobody can pair a proposal with a
	// message the agent did not mean. The engine spends the commitment named
	// here whatever the outcome: it signs with it when the order is allowed
	// and discards it on a block, a park or a refusal. A parked order is
	// signed again through the signer channel once a person decides, since
	// this message would be stale by then. Without this field the engine
	// asks the signer through the channel.
	VenueMessage *ProposalVenueMessage `json:"venueMessage,omitempty"`
}

ProposalSubmit Every kind but cancel needs side, size, orderType and reduceOnly; a cancel needs targetClientOrderId and must leave the order fields (side, size, price, orderType, leverage, reduceOnly) out. The engine refuses either mistake (422).

type ProposalSubmitOrderType

type ProposalSubmitOrderType string

ProposalSubmitOrderType defines model for ProposalSubmit.OrderType.

const (
	ProposalSubmitOrderTypeLimit  ProposalSubmitOrderType = "limit"
	ProposalSubmitOrderTypeMarket ProposalSubmitOrderType = "market"
)

Defines values for ProposalSubmitOrderType.

func (ProposalSubmitOrderType) Valid

func (e ProposalSubmitOrderType) Valid() bool

Valid indicates whether the value is a known member of the ProposalSubmitOrderType enum.

type ProposalVenueMessage

type ProposalVenueMessage struct {
	// Commitment Base64. FROST only, the signer's own nonce commitment.
	Commitment *string `json:"commitment,omitempty"`

	// EngineCommitmentId The engine commitment (requestCommitments) or presigned slot (signerPresign) this half was computed against. Single use.
	EngineCommitmentId string `json:"engineCommitmentId"`

	// Message Base64 of the venue request before its signature: Binance's
	// parameter string (with its timestamp and recvWindow), which is what
	// its signature covers; Hyperliquid's action, nonce and end time
	// (`expiresAfter`, in milliseconds, after which the venue no longer
	// takes the action) as the exchange endpoint takes them, plus the
	// order's Mishmar client order id, which the cloid on the order is
	// derived from and the venue never sees:
	// `{"action": …, "nonce": …, "expiresAfter": …, "clientOrderId": …}`,
	// no vault, built by the signer from the connected account's venue
	// rules, from which the engine derives the EIP-712 digest itself.
	// The end time is inside the digest. It is the earlier of the
	// proposal's `expiresAt` and one minute after the message is built;
	// a message without one, or with one later than the proposal's
	// `expiresAt` plus one minute, is refused.
	Message string `json:"message"`

	// Scheme frost-ed25519 (Binance) or ecdsa-2p (Hyperliquid, its half from a
	// presigned slot, signerPresign). Never proxy: an HMAC venue's signer
	// holds the whole key and forwards the request itself.
	Scheme SigningScheme `json:"scheme"`

	// Share Base64. The signer's half: its FROST signature share, or for
	// two-party ECDSA the protocol's last message, which proves itself
	// against the slot and the message's digest, so it cannot be moved
	// to another slot or another order.
	Share string `json:"share"`

	// VenueKeyId The agent's trading key on the connected account.
	VenueKeyId string `json:"venueKeyId"`
}

ProposalVenueMessage The one-shot path. The agent's signer builds the venue request and signs its half before the proposal leaves the agent's machine, so an allowed order needs no round trip to the signer: the engine decodes `message`, checks it against the proposal and the connected account's venue rules, runs the rules, and only then adds its own half and forwards. It is inside the signed proposal, so nobody can pair a proposal with a message the agent did not mean. The engine spends the commitment named here whatever the outcome: it signs with it when the order is allowed and discards it on a block, a park or a refusal. A parked order is signed again through the signer channel once a person decides, since this message would be stale by then. Without this field the engine asks the signer through the channel.

type ReassignPositionJSONRequestBody

type ReassignPositionJSONRequestBody = PositionReassign

ReassignPositionJSONRequestBody defines body for ReassignPosition for application/json ContentType.

type RegisterAgentKeyJSONRequestBody added in v0.5.0

type RegisterAgentKeyJSONRequestBody = AgentKeyRegister

RegisterAgentKeyJSONRequestBody defines body for RegisterAgentKey for application/json ContentType.

type RegisterVenueKeyJSONRequestBody

type RegisterVenueKeyJSONRequestBody = VenueKeyRegistration

RegisterVenueKeyJSONRequestBody defines body for RegisterVenueKey for application/json ContentType.

type RejectApprovalJSONRequestBody

type RejectApprovalJSONRequestBody = ApprovalDecide

RejectApprovalJSONRequestBody defines body for RejectApproval for application/json ContentType.

type ReplacePositionsJSONRequestBody

type ReplacePositionsJSONRequestBody = StateImport

ReplacePositionsJSONRequestBody defines body for ReplacePositions for application/json ContentType.

type RequestCommitmentsJSONRequestBody

type RequestCommitmentsJSONRequestBody = CommitmentRequest

RequestCommitmentsJSONRequestBody defines body for RequestCommitments for application/json ContentType.

type ResolveDiscrepancyJSONRequestBody

type ResolveDiscrepancyJSONRequestBody = DiscrepancyResolve

ResolveDiscrepancyJSONRequestBody defines body for ResolveDiscrepancy for application/json ContentType.

type Rule

type Rule struct {
	// AppliesToExits Whether the rule also judges exits (see submitProposal). False by
	// default: the rule is waived for an exit, and the waiver is recorded
	// on the decision's evaluation. Set it for a rule that must hold even
	// while an agent closes, an order-size cap on a thin market, say.
	AppliesToExits bool `json:"appliesToExits"`

	// Asset Narrow the metric to one asset, e.g. `NVDA` or `BTC`.
	Asset     *string   `json:"asset,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	Enabled   bool      `json:"enabled"`
	Id        string    `json:"id"`

	// Metric gross_exposure, net_exposure, daily_loss, daily_realized_loss, order_size are in USD.
	// leverage is a ratio. concentration and drawdown are percentages.
	// net_exposure is the size of the net position whichever way it points (the absolute
	// value of the signed sum), so a short past the cap breaches it like a long.
	// order_size, and the projected book every exposure metric reads, value an order at the
	// higher of its price and the market: a sell priced under the market fills at the market.
	// Proposal.notionalUsd stays size × price; the evaluation's observed value is what was judged.
	// leverage is gross exposure ÷ equity at account, venue connection and connected
	// account scope, and gross exposure ÷ the agent's allocated capital
	// (Agent.capitalUsd) at agent scope, where drawdown is measured against that
	// capital too; an agent without capital cannot have such rules (createRule).
	// The equity is the summed value of the accounts the scope covers that agents
	// trade on, as their venues report it while trading: an account Mishmar only
	// reads (Spot, for now) is not in it, at any scope, so on a Binance login it is
	// the USDⓈ-M Futures account's value, not the login's total. When none of the
	// covered accounts reports a value, a venue connection's and a connected
	// account's rules fall back to the whole account's. drawdown at these scopes is
	// the fall of that value from its own high-water mark, with money moved in or
	// out taken off, so a transfer is never read as a loss: between two accounts in
	// the sum it changes nothing, and to or from any other account it is capital
	// leaving or arriving, which moves the mark with it.
	// net_exposure and concentration accept an `asset` to narrow to one name.
	// daily_loss is today's loss counting open positions at their marks
	// (PnlTotals.netUsd); daily_realized_loss counts only what was closed,
	// with fees and funding (PnlTotals.realizedNetUsd).
	Metric RuleMetric `json:"metric"`
	Name   string     `json:"name"`

	// Outcome What happens when the threshold is breached. `allow` records the breach and lets it through.
	Outcome RuleOutcome `json:"outcome"`

	// Revision The configuration revision that last changed this rule.
	Revision int   `json:"revision"`
	Scope    Scope `json:"scope"`

	// Threshold A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Threshold Decimal   `json:"threshold"`
	Unit      RuleUnit  `json:"unit"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Rule defines model for Rule.

type RuleCreate

type RuleCreate struct {
	AppliesToExits *bool   `json:"appliesToExits,omitempty"`
	Asset          *string `json:"asset,omitempty"`
	Enabled        *bool   `json:"enabled,omitempty"`

	// Metric gross_exposure, net_exposure, daily_loss, daily_realized_loss, order_size are in USD.
	// leverage is a ratio. concentration and drawdown are percentages.
	// net_exposure is the size of the net position whichever way it points (the absolute
	// value of the signed sum), so a short past the cap breaches it like a long.
	// order_size, and the projected book every exposure metric reads, value an order at the
	// higher of its price and the market: a sell priced under the market fills at the market.
	// Proposal.notionalUsd stays size × price; the evaluation's observed value is what was judged.
	// leverage is gross exposure ÷ equity at account, venue connection and connected
	// account scope, and gross exposure ÷ the agent's allocated capital
	// (Agent.capitalUsd) at agent scope, where drawdown is measured against that
	// capital too; an agent without capital cannot have such rules (createRule).
	// The equity is the summed value of the accounts the scope covers that agents
	// trade on, as their venues report it while trading: an account Mishmar only
	// reads (Spot, for now) is not in it, at any scope, so on a Binance login it is
	// the USDⓈ-M Futures account's value, not the login's total. When none of the
	// covered accounts reports a value, a venue connection's and a connected
	// account's rules fall back to the whole account's. drawdown at these scopes is
	// the fall of that value from its own high-water mark, with money moved in or
	// out taken off, so a transfer is never read as a loss: between two accounts in
	// the sum it changes nothing, and to or from any other account it is capital
	// leaving or arriving, which moves the mark with it.
	// net_exposure and concentration accept an `asset` to narrow to one name.
	// daily_loss is today's loss counting open positions at their marks
	// (PnlTotals.netUsd); daily_realized_loss counts only what was closed,
	// with fees and funding (PnlTotals.realizedNetUsd).
	Metric RuleMetric `json:"metric"`
	Name   string     `json:"name"`

	// Outcome What happens when the threshold is breached. `allow` records the breach and lets it through.
	Outcome RuleOutcome `json:"outcome"`
	Scope   Scope       `json:"scope"`

	// Threshold A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Threshold Decimal  `json:"threshold"`
	Unit      RuleUnit `json:"unit"`
}

RuleCreate defines model for RuleCreate.

type RuleEvaluation

type RuleEvaluation struct {
	// Metric gross_exposure, net_exposure, daily_loss, daily_realized_loss, order_size are in USD.
	// leverage is a ratio. concentration and drawdown are percentages.
	// net_exposure is the size of the net position whichever way it points (the absolute
	// value of the signed sum), so a short past the cap breaches it like a long.
	// order_size, and the projected book every exposure metric reads, value an order at the
	// higher of its price and the market: a sell priced under the market fills at the market.
	// Proposal.notionalUsd stays size × price; the evaluation's observed value is what was judged.
	// leverage is gross exposure ÷ equity at account, venue connection and connected
	// account scope, and gross exposure ÷ the agent's allocated capital
	// (Agent.capitalUsd) at agent scope, where drawdown is measured against that
	// capital too; an agent without capital cannot have such rules (createRule).
	// The equity is the summed value of the accounts the scope covers that agents
	// trade on, as their venues report it while trading: an account Mishmar only
	// reads (Spot, for now) is not in it, at any scope, so on a Binance login it is
	// the USDⓈ-M Futures account's value, not the login's total. When none of the
	// covered accounts reports a value, a venue connection's and a connected
	// account's rules fall back to the whole account's. drawdown at these scopes is
	// the fall of that value from its own high-water mark, with money moved in or
	// out taken off, so a transfer is never read as a loss: between two accounts in
	// the sum it changes nothing, and to or from any other account it is capital
	// leaving or arriving, which moves the mark with it.
	// net_exposure and concentration accept an `asset` to narrow to one name.
	// daily_loss is today's loss counting open positions at their marks
	// (PnlTotals.netUsd); daily_realized_loss counts only what was closed,
	// with fees and funding (PnlTotals.realizedNetUsd).
	Metric RuleMetric `json:"metric"`

	// Observed The metric's value after the proposal, as evaluated.
	Observed Decimal `json:"observed"`

	// Outcome What happens when the threshold is breached. `allow` records the breach and lets it through.
	Outcome  RuleOutcome `json:"outcome"`
	Passed   bool        `json:"passed"`
	RuleId   string      `json:"ruleId"`
	RuleName string      `json:"ruleName"`
	Scope    Scope       `json:"scope"`

	// Threshold A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Threshold Decimal  `json:"threshold"`
	Unit      RuleUnit `json:"unit"`

	// Waived True when the order is an exit and the rule does not apply to exits.
	// The rule is still evaluated and `observed` and `passed` recorded, so
	// the ledger shows what was skipped, but a waived evaluation never
	// affects the verdict. Absent when the rule applied.
	Waived *bool `json:"waived,omitempty"`

	// WaivedReason Why the rule was waived, for a person, e.g. "exit of 0.5 BTC; the rule does not apply to exits".
	WaivedReason *string `json:"waivedReason,omitempty"`
}

RuleEvaluation defines model for RuleEvaluation.

type RuleId

type RuleId = string

RuleId defines model for ruleId.

type RuleMetric

type RuleMetric string

RuleMetric gross_exposure, net_exposure, daily_loss, daily_realized_loss, order_size are in USD. leverage is a ratio. concentration and drawdown are percentages. net_exposure is the size of the net position whichever way it points (the absolute value of the signed sum), so a short past the cap breaches it like a long. order_size, and the projected book every exposure metric reads, value an order at the higher of its price and the market: a sell priced under the market fills at the market. Proposal.notionalUsd stays size × price; the evaluation's observed value is what was judged. leverage is gross exposure ÷ equity at account, venue connection and connected account scope, and gross exposure ÷ the agent's allocated capital (Agent.capitalUsd) at agent scope, where drawdown is measured against that capital too; an agent without capital cannot have such rules (createRule). The equity is the summed value of the accounts the scope covers that agents trade on, as their venues report it while trading: an account Mishmar only reads (Spot, for now) is not in it, at any scope, so on a Binance login it is the USDⓈ-M Futures account's value, not the login's total. When none of the covered accounts reports a value, a venue connection's and a connected account's rules fall back to the whole account's. drawdown at these scopes is the fall of that value from its own high-water mark, with money moved in or out taken off, so a transfer is never read as a loss: between two accounts in the sum it changes nothing, and to or from any other account it is capital leaving or arriving, which moves the mark with it. net_exposure and concentration accept an `asset` to narrow to one name. daily_loss is today's loss counting open positions at their marks (PnlTotals.netUsd); daily_realized_loss counts only what was closed, with fees and funding (PnlTotals.realizedNetUsd).

const (
	RuleMetricConcentration     RuleMetric = "concentration"
	RuleMetricDailyLoss         RuleMetric = "daily_loss"
	RuleMetricDailyRealizedLoss RuleMetric = "daily_realized_loss"
	RuleMetricDrawdown          RuleMetric = "drawdown"
	RuleMetricGrossExposure     RuleMetric = "gross_exposure"
	RuleMetricLeverage          RuleMetric = "leverage"
	RuleMetricNetExposure       RuleMetric = "net_exposure"
	RuleMetricOrderSize         RuleMetric = "order_size"
)

Defines values for RuleMetric.

func (RuleMetric) Valid

func (e RuleMetric) Valid() bool

Valid indicates whether the value is a known member of the RuleMetric enum.

type RuleOutcome

type RuleOutcome string

RuleOutcome What happens when the threshold is breached. `allow` records the breach and lets it through.

const (
	RuleOutcomeAllow           RuleOutcome = "allow"
	RuleOutcomeBlock           RuleOutcome = "block"
	RuleOutcomeRequireApproval RuleOutcome = "require_approval"
)

Defines values for RuleOutcome.

func (RuleOutcome) Valid

func (e RuleOutcome) Valid() bool

Valid indicates whether the value is a known member of the RuleOutcome enum.

type RuleUnit

type RuleUnit string

RuleUnit defines model for RuleUnit.

const (
	RuleUnitPct   RuleUnit = "pct"
	RuleUnitRatio RuleUnit = "ratio"
	RuleUnitUsd   RuleUnit = "usd"
)

Defines values for RuleUnit.

func (RuleUnit) Valid

func (e RuleUnit) Valid() bool

Valid indicates whether the value is a known member of the RuleUnit enum.

type RuleUpdate

type RuleUpdate struct {
	AppliesToExits *bool   `json:"appliesToExits,omitempty"`
	Asset          *string `json:"asset,omitempty"`
	Enabled        *bool   `json:"enabled,omitempty"`

	// Metric gross_exposure, net_exposure, daily_loss, daily_realized_loss, order_size are in USD.
	// leverage is a ratio. concentration and drawdown are percentages.
	// net_exposure is the size of the net position whichever way it points (the absolute
	// value of the signed sum), so a short past the cap breaches it like a long.
	// order_size, and the projected book every exposure metric reads, value an order at the
	// higher of its price and the market: a sell priced under the market fills at the market.
	// Proposal.notionalUsd stays size × price; the evaluation's observed value is what was judged.
	// leverage is gross exposure ÷ equity at account, venue connection and connected
	// account scope, and gross exposure ÷ the agent's allocated capital
	// (Agent.capitalUsd) at agent scope, where drawdown is measured against that
	// capital too; an agent without capital cannot have such rules (createRule).
	// The equity is the summed value of the accounts the scope covers that agents
	// trade on, as their venues report it while trading: an account Mishmar only
	// reads (Spot, for now) is not in it, at any scope, so on a Binance login it is
	// the USDⓈ-M Futures account's value, not the login's total. When none of the
	// covered accounts reports a value, a venue connection's and a connected
	// account's rules fall back to the whole account's. drawdown at these scopes is
	// the fall of that value from its own high-water mark, with money moved in or
	// out taken off, so a transfer is never read as a loss: between two accounts in
	// the sum it changes nothing, and to or from any other account it is capital
	// leaving or arriving, which moves the mark with it.
	// net_exposure and concentration accept an `asset` to narrow to one name.
	// daily_loss is today's loss counting open positions at their marks
	// (PnlTotals.netUsd); daily_realized_loss counts only what was closed,
	// with fees and funding (PnlTotals.realizedNetUsd).
	Metric *RuleMetric `json:"metric,omitempty"`
	Name   *string     `json:"name,omitempty"`

	// Outcome What happens when the threshold is breached. `allow` records the breach and lets it through.
	Outcome *RuleOutcome `json:"outcome,omitempty"`
	Scope   *Scope       `json:"scope,omitempty"`

	// Threshold A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Threshold *Decimal  `json:"threshold,omitempty"`
	Unit      *RuleUnit `json:"unit,omitempty"`
}

RuleUpdate defines model for RuleUpdate.

type Scope

type Scope struct {
	Id string `json:"id"`

	// Kind What a rule covers, or a PnL series is of. The order here is of
	// width, not of evaluation: every rule that covers an order is run, and
	// the decision lists each with its scope. account: the
	// whole Mishmar account, every agent on every connected account.
	// venue_connection: one login at a venue and everything under it, its
	// accounts and those of its sub-accounts' connections
	// (`VenueConnection.parentId`); `id` is the connection's.
	// connected_account: one account. agent: one agent's own book, on every
	// account it trades. Before contract 0.21.0 there was also portfolio, a
	// named group of agents; a limit over a group is now a rule on the
	// connection or the account its agents trade on.
	Kind ScopeKind `json:"kind"`
}

Scope defines model for Scope.

type ScopeKind

type ScopeKind string

ScopeKind What a rule covers, or a PnL series is of. The order here is of width, not of evaluation: every rule that covers an order is run, and the decision lists each with its scope. account: the whole Mishmar account, every agent on every connected account. venue_connection: one login at a venue and everything under it, its accounts and those of its sub-accounts' connections (`VenueConnection.parentId`); `id` is the connection's. connected_account: one account. agent: one agent's own book, on every account it trades. Before contract 0.21.0 there was also portfolio, a named group of agents; a limit over a group is now a rule on the connection or the account its agents trade on.

const (
	ScopeKindAccount          ScopeKind = "account"
	ScopeKindAgent            ScopeKind = "agent"
	ScopeKindConnectedAccount ScopeKind = "connected_account"
	ScopeKindVenueConnection  ScopeKind = "venue_connection"
)

Defines values for ScopeKind.

func (ScopeKind) Valid

func (e ScopeKind) Valid() bool

Valid indicates whether the value is a known member of the ScopeKind enum.

type SetAccountEntitlementsJSONRequestBody

type SetAccountEntitlementsJSONRequestBody = Entitlements

SetAccountEntitlementsJSONRequestBody defines body for SetAccountEntitlements for application/json ContentType.

type SetReadKeyJSONRequestBody added in v0.3.0

type SetReadKeyJSONRequestBody = ExchangeReadKey

SetReadKeyJSONRequestBody defines body for SetReadKey for application/json ContentType.

type Side

type Side string

Side defines model for Side.

const (
	SideBuy  Side = "buy"
	SideSell Side = "sell"
)

Defines values for Side.

func (Side) Valid

func (e Side) Valid() bool

Valid indicates whether the value is a known member of the Side enum.

type SignRequest

type SignRequest struct {
	AgentId string `json:"agentId"`

	// Attempt Increments each time the request is handed out again after a signer took it and did not answer.
	Attempt            int     `json:"attempt"`
	ClientOrderId      *string `json:"clientOrderId,omitempty"`
	ConnectedAccountId string  `json:"connectedAccountId"`
	DecisionId         *string `json:"decisionId,omitempty"`

	// Engine The engine's part of the round.
	Engine *SignRequestEngine `json:"engine,omitempty"`

	// ExpiresAt Seconds after `issuedAt` for a fresh proposal. For an order signed
	// again after a person approved it, the grace period, capped by the
	// proposal's own deadline.
	ExpiresAt time.Time `json:"expiresAt"`

	// Id Unique per request; the answer names it.
	Id       string    `json:"id"`
	IssuedAt time.Time `json:"issuedAt"`

	// KeyId The agent key whose signer must answer: the key that proposed
	// (orders, cancels), else the trading key's `agentKeyId`. Only that
	// key's poll is handed the request and only its answer is taken.
	// Absent when the trading key names no key: any of the agent's
	// trade keys.
	KeyId *string `json:"keyId,omitempty"`

	// Message Base64 of the exact bytes the venue will verify: Binance's parameter
	// string, Hyperliquid's EIP-712 digest. The signer decodes them itself
	// and checks them against the order it proposed; `order` is a courtesy,
	// never the thing checked. A digest cannot be decoded, so a
	// two-party ECDSA request also carries the action, nonce and end
	// time (`expiresAfter`) it was computed from in `venueRequest.body`,
	// and the signer recomputes the digest from them before it signs.
	Message string            `json:"message"`
	Order   *SignRequestOrder `json:"order,omitempty"`

	// Proposal The agent's own signed proposal this request serves (orders and
	// cancels), so a signer that is not the proposer (a standalone signer,
	// a proxy) can verify that the agent authorized the order before it
	// signs. Absent for `verify`.
	Proposal *ProposalSubmit `json:"proposal,omitempty"`

	// Purpose What the signature is for. `order` and `cancel` carry the decision
	// and the agent's proposal; `verify` is the harmless read the engine
	// co-signs to prove the key (verifyVenueKey), and carries neither.
	// A signer refuses an `order` it did not propose; it may sign a
	// `verify` whose message decodes to no order at all.
	Purpose SignRequestPurpose `json:"purpose"`
	Round   int                `json:"round"`

	// Scheme The protocol a sign request runs, decided by the venue key's scheme (VenueKeyScheme), never chosen by anyone.
	Scheme SigningScheme `json:"scheme"`

	// SessionId Groups the rounds of one signature. A one-round scheme has one request per session.
	SessionId string `json:"sessionId"`
	Venue     Venue  `json:"venue"`

	// VenueKeyId The agent's trading key on the connected account, so the signer picks the right share.
	VenueKeyId string `json:"venueKeyId"`

	// VenueRequest The venue request the signature serves. For the proxy scheme it is the
	// request the proxy signs with the key it holds and sends to the venue;
	// for the others it is informational (an exchange signs its query string,
	// which does not name the endpoint, so this says what the engine will call).
	VenueRequest *VenueRequest `json:"venueRequest,omitempty"`
}

SignRequest defines model for SignRequest.

type SignRequestEngine

type SignRequestEngine struct {
	// Commitment Base64. The engine's FROST nonce commitment for this signature.
	Commitment *string `json:"commitment,omitempty"`

	// Payload Base64. Round data for the two-party ECDSA and RSA schemes.
	Payload *string `json:"payload,omitempty"`

	// Signature Base64 Ed25519 signature by the engine's key (see getLedgerHead)
	// over `message`. Present for the proxy scheme: the proxy forwards
	// nothing that does not carry it.
	Signature *string `json:"signature,omitempty"`
}

SignRequestEngine The engine's part of the round.

type SignRequestOrder

type SignRequestOrder struct {
	OrderType SignRequestOrderOrderType `json:"orderType"`

	// Price A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Price      *Decimal `json:"price,omitempty"`
	ReduceOnly bool     `json:"reduceOnly"`
	Side       Side     `json:"side"`

	// Size As the venue will receive it, after rounding to its step.
	Size   Decimal `json:"size"`
	Symbol string  `json:"symbol"`
}

SignRequestOrder defines model for SignRequestOrder.

type SignRequestOrderOrderType

type SignRequestOrderOrderType string

SignRequestOrderOrderType defines model for SignRequestOrder.OrderType.

const (
	SignRequestOrderOrderTypeLimit  SignRequestOrderOrderType = "limit"
	SignRequestOrderOrderTypeMarket SignRequestOrderOrderType = "market"
)

Defines values for SignRequestOrderOrderType.

func (SignRequestOrderOrderType) Valid

func (e SignRequestOrderOrderType) Valid() bool

Valid indicates whether the value is a known member of the SignRequestOrderOrderType enum.

type SignRequestPurpose

type SignRequestPurpose string

SignRequestPurpose What the signature is for. `order` and `cancel` carry the decision and the agent's proposal; `verify` is the harmless read the engine co-signs to prove the key (verifyVenueKey), and carries neither. A signer refuses an `order` it did not propose; it may sign a `verify` whose message decodes to no order at all.

const (
	SignRequestPurposeCancel SignRequestPurpose = "cancel"
	SignRequestPurposeOrder  SignRequestPurpose = "order"
	SignRequestPurposeVerify SignRequestPurpose = "verify"
)

Defines values for SignRequestPurpose.

func (SignRequestPurpose) Valid

func (e SignRequestPurpose) Valid() bool

Valid indicates whether the value is a known member of the SignRequestPurpose enum.

type SignerAnswer

type SignerAnswer struct {
	// Commitment Base64. The signer's FROST nonce commitment.
	Commitment *string `json:"commitment,omitempty"`

	// EngineCommitmentId Two-party ECDSA only. The presigned slot (signerPresign) the share was made with; spent whatever the outcome.
	EngineCommitmentId *string `json:"engineCommitmentId,omitempty"`

	// Kind Must fit the request's scheme; `share` for FROST, ECDSA and RSA rounds, `venue_response` for the proxy.
	Kind    SignerAnswerKind `json:"kind"`
	Refusal *struct {
		// Reason Why the signer would not sign; recorded on the decision.
		Reason string `json:"reason"`
	} `json:"refusal,omitempty"`

	// Share Base64. The signer's signature share (FROST), or its round data (two-party ECDSA, RSA).
	Share *string `json:"share,omitempty"`

	// Signature Base64. A whole signature, for a scheme where the signer finishes one.
	Signature     *string        `json:"signature,omitempty"`
	VenueResponse *VenueResponse `json:"venueResponse,omitempty"`
}

SignerAnswer defines model for SignerAnswer.

type SignerAnswerJSONRequestBody

type SignerAnswerJSONRequestBody = SignerAnswer

SignerAnswerJSONRequestBody defines body for SignerAnswer for application/json ContentType.

type SignerAnswerKind

type SignerAnswerKind string

SignerAnswerKind Must fit the request's scheme; `share` for FROST, ECDSA and RSA rounds, `venue_response` for the proxy.

const (
	SignerAnswerKindRefusal       SignerAnswerKind = "refusal"
	SignerAnswerKindShare         SignerAnswerKind = "share"
	SignerAnswerKindSignature     SignerAnswerKind = "signature"
	SignerAnswerKindVenueResponse SignerAnswerKind = "venue_response"
)

Defines values for SignerAnswerKind.

func (SignerAnswerKind) Valid

func (e SignerAnswerKind) Valid() bool

Valid indicates whether the value is a known member of the SignerAnswerKind enum.

type SignerKeygenJSONRequestBody

type SignerKeygenJSONRequestBody = KeygenRound

SignerKeygenJSONRequestBody defines body for SignerKeygen for application/json ContentType.

type SignerPoll

type SignerPoll struct {
	// WaitSeconds How long the engine may hold the poll open waiting for something to sign.
	WaitSeconds *int `json:"waitSeconds,omitempty"`
}

SignerPoll defines model for SignerPoll.

type SignerPollJSONRequestBody

type SignerPollJSONRequestBody = SignerPoll

SignerPollJSONRequestBody defines body for SignerPoll for application/json ContentType.

type SignerPollParams added in v0.6.0

type SignerPollParams struct {
	// MishmarSignerVersion The version of the signer that sends the request, as `mishmar version`
	// prints it (for example `v1.2.3`). A signer sends it with every call.
	// An engine refuses the poll, and the one-shot message, of a signer
	// older than it works with, and of one that names no version, with 426
	// `signer_too_old`; the message names the version to upgrade to. The
	// version is for those words only: what a signer signs is decided by
	// its own checks.
	MishmarSignerVersion *SignerVersion `json:"Mishmar-Signer-Version,omitempty"`
}

SignerPollParams defines parameters for SignerPoll.

type SignerPresence added in v0.3.0

type SignerPresence struct {
	Connected bool `json:"connected"`

	// KeyId The agent key whose signer this is: the one holding the agent's
	// trading keys' shares, when the agent has several keys.
	KeyId      *string    `json:"keyId,omitempty"`
	LastSeenAt *time.Time `json:"lastSeenAt,omitempty"`
}

SignerPresence Whether the agent's signer is reaching this engine: `connected` while it holds a poll open or made a signer call within the last half minute. `lastSeenAt` is its last signer call since the engine started; absent when there was none. Kept in memory, so an engine restart forgets it until the signer polls again, which a running signer does within seconds.

type SignerPresignJSONRequestBody

type SignerPresignJSONRequestBody = PresignRound

SignerPresignJSONRequestBody defines body for SignerPresign for application/json ContentType.

type SignerTransport

type SignerTransport string

SignerTransport How the engine reaches an agent's signer. The messages are the same on every transport.

const (
	SignerTransportLongPoll  SignerTransport = "long_poll"
	SignerTransportQueue     SignerTransport = "queue"
	SignerTransportWebhook   SignerTransport = "webhook"
	SignerTransportWebsocket SignerTransport = "websocket"
)

Defines values for SignerTransport.

func (SignerTransport) Valid

func (e SignerTransport) Valid() bool

Valid indicates whether the value is a known member of the SignerTransport enum.

type SignerVersion added in v0.6.0

type SignerVersion = string

SignerVersion defines model for SignerVersion.

type SigningScheme

type SigningScheme string

SigningScheme The protocol a sign request runs, decided by the venue key's scheme (VenueKeyScheme), never chosen by anyone.

const (
	SigningSchemeEcdsa2p      SigningScheme = "ecdsa-2p"
	SigningSchemeFrostEd25519 SigningScheme = "frost-ed25519"
	SigningSchemeProxy        SigningScheme = "proxy"
	SigningSchemeRsa2p        SigningScheme = "rsa-2p"
)

Defines values for SigningScheme.

func (SigningScheme) Valid

func (e SigningScheme) Valid() bool

Valid indicates whether the value is a known member of the SigningScheme enum.

type SigningStatus

type SigningStatus struct {
	AnsweredAt *time.Time `json:"answeredAt,omitempty"`
	Attempts   *int       `json:"attempts,omitempty"`

	// Detail The signer's refusal reason, or why it could not be reached.
	Detail      *string    `json:"detail,omitempty"`
	RequestedAt *time.Time `json:"requestedAt,omitempty"`

	// Status waiting: the order is with the signer, or a person approved it
	// and the signer holding the trading key's share is not reaching
	// the engine; it is sent when that signer polls, until `waitUntil`.
	// signed, refused: the signer's answer. unreachable: no signer
	// answered by the deadline. A wait ended because something stopped
	// the order (a stop, a pause, a restriction, the rules, a
	// revocation) leaves no signing status: the decision's `reason`
	// says why it was not forwarded.
	Status SigningStatusStatus `json:"status"`

	// WaitUntil Until when an approved order waits for the signer, which is the
	// proposal's `expiresAt`. Absent when it is not waiting on an
	// approval.
	WaitUntil *time.Time `json:"waitUntil,omitempty"`
}

SigningStatus Where an order stands with the agent's signer, on decisions through a connected account whose venue key needs the signer (every exchange and Hyperliquid connected account).

type SigningStatusStatus

type SigningStatusStatus string

SigningStatusStatus waiting: the order is with the signer, or a person approved it and the signer holding the trading key's share is not reaching the engine; it is sent when that signer polls, until `waitUntil`. signed, refused: the signer's answer. unreachable: no signer answered by the deadline. A wait ended because something stopped the order (a stop, a pause, a restriction, the rules, a revocation) leaves no signing status: the decision's `reason` says why it was not forwarded.

const (
	SigningStatusStatusRefused     SigningStatusStatus = "refused"
	SigningStatusStatusSigned      SigningStatusStatus = "signed"
	SigningStatusStatusUnreachable SigningStatusStatus = "unreachable"
	SigningStatusStatusWaiting     SigningStatusStatus = "waiting"
)

Defines values for SigningStatusStatus.

func (SigningStatusStatus) Valid

func (e SigningStatusStatus) Valid() bool

Valid indicates whether the value is a known member of the SigningStatusStatus enum.

type SnapshotSource added in v0.4.0

type SnapshotSource string

SnapshotSource observed: read from the venue at that moment. rebuilt: worked out afterwards, for a moment nobody was reading the account (before it was connected), by replaying its transactions and, for values in USD, the venue's historical prices. No engine rebuilds yet: every reading served today is observed.

const (
	SnapshotSourceObserved SnapshotSource = "observed"
	SnapshotSourceRebuilt  SnapshotSource = "rebuilt"
)

Defines values for SnapshotSource.

func (SnapshotSource) Valid added in v0.4.0

func (e SnapshotSource) Valid() bool

Valid indicates whether the value is a known member of the SnapshotSource enum.

type StateImport

type StateImport struct {
	// EquityUsd Account equity, the denominator for account-scope leverage.
	EquityUsd Decimal `json:"equityUsd"`

	// HighWaterMarkUsd Peak equity, the reference for account-scope drawdown.
	HighWaterMarkUsd Decimal `json:"highWaterMarkUsd"`

	// Marks Last known prices per venue symbol. Market orders are priced at the
	// mark; a symbol without one is blocked. Nothing is assumed, not even
	// that a stablecoin is worth 1.
	Marks     []MarkInput     `json:"marks"`
	Positions []PositionInput `json:"positions"`
}

StateImport defines model for StateImport.

type StateSnapshot

type StateSnapshot struct {
	AsOf time.Time `json:"asOf"`

	// DailyPnlUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	DailyPnlUsd Decimal `json:"dailyPnlUsd"`

	// DrawdownPct A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	DrawdownPct Decimal `json:"drawdownPct"`

	// GrossExposureUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	GrossExposureUsd Decimal `json:"grossExposureUsd"`

	// Leverage A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	Leverage Decimal `json:"leverage"`

	// NetExposureUsd A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	NetExposureUsd Decimal `json:"netExposureUsd"`
}

StateSnapshot The whole Mishmar account's state when the rules ran, before the proposal: every agent on every connected account. What a rule at a narrower scope measured is on its evaluation.

type SubmitProposalJSONRequestBody

type SubmitProposalJSONRequestBody = ProposalSubmit

SubmitProposalJSONRequestBody defines body for SubmitProposal for application/json ContentType.

type SubmitProposalParams added in v0.6.0

type SubmitProposalParams struct {
	// MishmarSignerVersion The version of the signer that sends the request, as `mishmar version`
	// prints it (for example `v1.2.3`). A signer sends it with every call.
	// An engine refuses the poll, and the one-shot message, of a signer
	// older than it works with, and of one that names no version, with 426
	// `signer_too_old`; the message names the version to upgrade to. The
	// version is for those words only: what a signer signs is decided by
	// its own checks.
	MishmarSignerVersion *SignerVersion `json:"Mishmar-Signer-Version,omitempty"`
}

SubmitProposalParams defines parameters for SubmitProposal.

type SubmitWalletApprovalJSONRequestBody

type SubmitWalletApprovalJSONRequestBody = WalletApprovalSignature

SubmitWalletApprovalJSONRequestBody defines body for SubmitWalletApproval for application/json ContentType.

type SymbolRules

type SymbolRules struct {
	// AssetIndex Hyperliquid only. The asset's index, which orders name instead of the symbol.
	AssetIndex *int `json:"assetIndex,omitempty"`

	// MaxLeverage A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MaxLeverage *Decimal `json:"maxLeverage,omitempty"`

	// MinNotional A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MinNotional *Decimal `json:"minNotional,omitempty"`

	// MinSize A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	MinSize *Decimal `json:"minSize,omitempty"`

	// SizeDecimals Hyperliquid only. Decimals a size may have.
	SizeDecimals *int `json:"sizeDecimals,omitempty"`

	// StepSize A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	StepSize *Decimal `json:"stepSize,omitempty"`
	Symbol   string   `json:"symbol"`

	// TickSize A decimal number as a string: "98000.25", "-1234.5", "0.001". Money and
	// quantities are never JSON numbers. A string survives every language's
	// float formatting unchanged, so the bytes an agent signs are the bytes the
	// engine verifies, and sums of cents stay exact.
	TickSize *Decimal `json:"tickSize,omitempty"`
}

SymbolRules One market's rules as the venue states them. Fields the venue does not state are absent. Hyperliquid states no tick: a perp price has at most five significant figures and at most (6 - sizeDecimals) decimals, and any integer price is valid.

type SyncKind added in v0.4.0

type SyncKind string

SyncKind defines model for SyncKind.

const (
	SyncKindBalances     SyncKind = "balances"
	SyncKindEquity       SyncKind = "equity"
	SyncKindPositions    SyncKind = "positions"
	SyncKindTransactions SyncKind = "transactions"
)

Defines values for SyncKind.

func (SyncKind) Valid added in v0.4.0

func (e SyncKind) Valid() bool

Valid indicates whether the value is a known member of the SyncKind enum.

type SyncState added in v0.4.0

type SyncState struct {
	// AsOf The moment the data is complete up to. Absent before the first read.
	AsOf *time.Time `json:"asOf,omitempty"`

	// Error While failing, one line for a person.
	Error *string `json:"error,omitempty"`

	// HistoryFrom How far back the account's history goes, set by the venue's limit, the plan's retention or the account's first activity.
	HistoryFrom *time.Time `json:"historyFrom,omitempty"`
	Kind        SyncKind   `json:"kind"`
	LastReadAt  *time.Time `json:"lastReadAt,omitempty"`

	// Progress While backfilling, the share done, 0 to 1.
	Progress *Decimal `json:"progress,omitempty"`

	// Status backfilling: reading the account's history for the first time, or
	// catching up after a stop. current: read within the plan's freshness. behind: older than that, and catching up.
	// failing: the last reads were refused or failed; `error` says why.
	Status SyncStateStatus `json:"status"`
}

SyncState How current one kind of a venue connection's data is, across its accounts.

type SyncStateStatus added in v0.4.0

type SyncStateStatus string

SyncStateStatus backfilling: reading the account's history for the first time, or catching up after a stop. current: read within the plan's freshness. behind: older than that, and catching up. failing: the last reads were refused or failed; `error` says why.

const (
	SyncStateStatusBackfilling SyncStateStatus = "backfilling"
	SyncStateStatusBehind      SyncStateStatus = "behind"
	SyncStateStatusCurrent     SyncStateStatus = "current"
	SyncStateStatusFailing     SyncStateStatus = "failing"
)

Defines values for SyncStateStatus.

func (SyncStateStatus) Valid added in v0.4.0

func (e SyncStateStatus) Valid() bool

Valid indicates whether the value is a known member of the SyncStateStatus enum.

type Tier

type Tier string

Tier The account's plan: free, plus, pro, or team (by agreement; billing never puts an account on it by itself). Before contract 0.23.0 there was no plus, and team was `enterprise`.

const (
	TierFree Tier = "free"
	TierPlus Tier = "plus"
	TierPro  Tier = "pro"
	TierTeam Tier = "team"
)

Defines values for Tier.

func (Tier) Valid

func (e Tier) Valid() bool

Valid indicates whether the value is a known member of the Tier enum.

type TransactionOrigin added in v0.4.0

type TransactionOrigin struct {
	AgentId   *string `json:"agentId,omitempty"`
	AgentName *string `json:"agentName,omitempty"`

	// DecisionId The decision that allowed it.
	DecisionId *string `json:"decisionId,omitempty"`

	// Kind agent: an agent placed it through Mishmar. outside: Mishmar did not
	// place it: the owner by hand, another program, or the venue itself.
	Kind TransactionOriginKind `json:"kind"`

	// Own On the agent-facing reads only. True when the calling agent placed it.
	Own *bool `json:"own,omitempty"`
}

TransactionOrigin Who placed a trade, so that an agent can tell its own activity from the rest.

type TransactionOriginKind added in v0.4.0

type TransactionOriginKind string

TransactionOriginKind agent: an agent placed it through Mishmar. outside: Mishmar did not place it: the owner by hand, another program, or the venue itself.

const (
	TransactionOriginKindAgent   TransactionOriginKind = "agent"
	TransactionOriginKindOutside TransactionOriginKind = "outside"
)

Defines values for TransactionOriginKind.

func (TransactionOriginKind) Valid added in v0.4.0

func (e TransactionOriginKind) Valid() bool

Valid indicates whether the value is a known member of the TransactionOriginKind enum.

type UpdateAgentJSONRequestBody

type UpdateAgentJSONRequestBody = AgentUpdate

UpdateAgentJSONRequestBody defines body for UpdateAgent for application/json ContentType.

type UpdateConnectedAccountJSONRequestBody added in v0.4.0

type UpdateConnectedAccountJSONRequestBody = ConnectedAccountUpdate

UpdateConnectedAccountJSONRequestBody defines body for UpdateConnectedAccount for application/json ContentType.

type UpdateRuleJSONRequestBody

type UpdateRuleJSONRequestBody = RuleUpdate

UpdateRuleJSONRequestBody defines body for UpdateRule for application/json ContentType.

type UpdateVenueConnectionJSONRequestBody added in v0.5.0

type UpdateVenueConnectionJSONRequestBody = VenueConnectionUpdate

UpdateVenueConnectionJSONRequestBody defines body for UpdateVenueConnection for application/json ContentType.

type Venue

type Venue string

Venue defines model for Venue.

const (
	VenueBinance     Venue = "binance"
	VenueBybit       Venue = "bybit"
	VenueCoinbase    Venue = "coinbase"
	VenueFireblocks  Venue = "fireblocks"
	VenueHyperliquid Venue = "hyperliquid"
	VenueOkx         Venue = "okx"
)

Defines values for Venue.

func (Venue) Valid

func (e Venue) Valid() bool

Valid indicates whether the value is a known member of the Venue enum.

type VenueAccount added in v0.5.0

type VenueAccount struct {
	// Id The venue's own identifier for the login: a Hyperliquid address,
	// a Binance account's UID, a sub-account's email or address, a
	// brokerage account number. Absent until the engine has learnt it
	// (verify), and on a venue that gives none (a co-signer callback
	// uses its API user id). One venue login connects once.
	Id *string `json:"id,omitempty"`

	// Label `id` shortened for a line of text: `0x12ab…9f3c`, `UID …4471`,
	// or a sub-account's own name at the venue.
	Label *string `json:"label,omitempty"`

	// ParentVenueAccountId On a sub-account, its main account's `id` at the venue, connected or not.
	ParentVenueAccountId *string `json:"parentVenueAccountId,omitempty"`

	// Role On Hyperliquid the venue says which. An exchange's read key does
	// not, so an exchange connection is a subaccount when it was
	// connected with a `subaccount` name.
	Role VenueAccountRole `json:"role"`
}

VenueAccount Which login this is at the venue, in the venue's own terms, so that a person or an agent can tell two connections apart without relying on the name someone typed.

type VenueAccountRole added in v0.5.0

type VenueAccountRole string

VenueAccountRole On Hyperliquid the venue says which. An exchange's read key does not, so an exchange connection is a subaccount when it was connected with a `subaccount` name.

const (
	VenueAccountRoleMain       VenueAccountRole = "main"
	VenueAccountRoleSubaccount VenueAccountRole = "subaccount"
)

Defines values for VenueAccountRole.

func (VenueAccountRole) Valid added in v0.5.0

func (e VenueAccountRole) Valid() bool

Valid indicates whether the value is a known member of the VenueAccountRole enum.

type VenueAck

type VenueAck struct {
	// ClientOrderId The id the venue indexed the order under when it is not the proposal's own clientOrderId (Hyperliquid derives a 16-byte cloid from it). Fills the venue reports under it are attributed to this decision, also after the engine restarts.
	ClientOrderId *string   `json:"clientOrderId,omitempty"`
	OrderId       string    `json:"orderId"`
	ReceivedAt    time.Time `json:"receivedAt"`
	Status        string    `json:"status"`
}

VenueAck defines model for VenueAck.

type VenueBudget added in v0.2.0

type VenueBudget struct {
	Venue Venue `json:"venue"`

	// WeightPerMinute Request weight a minute, in the venue's own units: Hyperliquid's
	// and Binance's published weights per request.
	WeightPerMinute int `json:"weightPerMinute"`
}

VenueBudget defines model for VenueBudget.

type VenueConnection added in v0.5.0

type VenueConnection struct {
	// ConnectedAccountIds The connection's accounts, in the venue's own order. Fixed by the
	// venue and what the engine reads there, and created with the
	// connection. A venue that keeps no pools apart, or one the engine
	// reads nothing from (a co-signer callback), has one account.
	ConnectedAccountIds []string   `json:"connectedAccountIds"`
	CreatedAt           time.Time  `json:"createdAt"`
	EquityAsOf          *time.Time `json:"equityAsOf,omitempty"`

	// EquityUsd The connection's value at `equityAsOf`: the sum of its accounts'.
	// Absent until the first reading.
	EquityUsd *Decimal `json:"equityUsd,omitempty"`
	Id        string   `json:"id"`

	// Kind An exchange login reached with API keys, a Hyperliquid address (a
	// master or one of its sub-accounts), or a custodian's co-signer
	// callback. Before contract 0.21.0 this was ConnectedAccountKind.
	Kind VenueConnectionKind `json:"kind"`

	// Name The person's own name for it, e.g. "Carry".
	Name string `json:"name"`

	// ParentId On a sub-account's connection, the connection of its main
	// account, when that is connected too. A main connection does not
	// include its sub-accounts: its accounts and its value are the main
	// login's alone. The engine keeps it in step as the main login is
	// connected or deleted.
	ParentId *string              `json:"parentId,omitempty"`
	Setup    VenueConnectionSetup `json:"setup"`

	// Status pending until `verify` passes.
	Status VenueConnectionStatus `json:"status"`

	// Sync How current each kind of the connection's data is, across its
	// accounts. Absent until the connection is verified.
	Sync *[]SyncState `json:"sync,omitempty"`

	// UnpricedAssets Assets some account of the connection held at `equityAsOf` that
	// the engine had no price for, so `equityUsd` leaves them out.
	// Absent when every asset was priced.
	UnpricedAssets *[]string `json:"unpricedAssets,omitempty"`
	UpdatedAt      time.Time `json:"updatedAt"`
	Venue          Venue     `json:"venue"`

	// VenueAccount Which login this is at the venue, in the venue's own terms, so that
	// a person or an agent can tell two connections apart without relying
	// on the name someone typed.
	VenueAccount VenueAccount                 `json:"venueAccount"`
	Verification *VenueConnectionVerification `json:"verification,omitempty"`
}

VenueConnection One login at a venue, connected with read access: one owner and one identifier there (a Hyperliquid master address or one sub-account's, a Binance main account or one sub-account, one brokerage account number). It is how Mishmar reaches the venue, and it holds one or more accounts (ConnectedAccount), which are where the money is. The read key, verification and sync are the connection's; balances, positions, transactions, value, rules, agents' access and trading keys are each account's. The plan counts connections.

type VenueConnectionCreate added in v0.5.0

type VenueConnectionCreate struct {
	// Exchange An exchange login. The trading keys come later, one per agent
	// and account (VenueKey). The read-only key may come later too
	// (`setReadKey`): without it the connection is created with
	// `readKeyRegistered` false and cannot verify or stream until it has one.
	Exchange *struct {
		// ReadApiKey A key with read permissions only, for the account's margin, positions and fills. Write-only.
		ReadApiKey *string `json:"readApiKey,omitempty"`

		// ReadApiSecret The read-only key's secret (HMAC). Write-only and stored whole; it cannot trade or withdraw.
		ReadApiSecret *string `json:"readApiSecret,omitempty"`
		Subaccount    *string `json:"subaccount,omitempty"`
	} `json:"exchange,omitempty"`
	Fireblocks *struct {
		ApiUserId string `json:"apiUserId"`
	} `json:"fireblocks,omitempty"`
	Hyperliquid *struct {
		// MasterAddress The master account. Absent, the engine learns it from the first
		// API wallet an agent gets on one of this connection's accounts that
		// the master approves at Hyperliquid (`userRole` names the approving
		// account), and verifies the connection then; until that it is pending.
		MasterAddress *string `json:"masterAddress,omitempty"`

		// Network A paper-mode engine accepts testnet only; a live engine accepts mainnet only.
		Network VenueConnectionCreateHyperliquidNetwork `json:"network"`

		// SubaccountAddress To connect one of the master's sub-accounts: its address.
		// `masterAddress` is then required, and verify checks at
		// Hyperliquid that the master owns it.
		SubaccountAddress *string `json:"subaccountAddress,omitempty"`
	} `json:"hyperliquid,omitempty"`

	// Mode The mode its accounts start in. Default agents_only.
	Mode  *ConnectedAccountMode `json:"mode,omitempty"`
	Name  string                `json:"name"`
	Venue Venue                 `json:"venue"`
}

VenueConnectionCreate defines model for VenueConnectionCreate.

type VenueConnectionCreateHyperliquidNetwork added in v0.5.0

type VenueConnectionCreateHyperliquidNetwork string

VenueConnectionCreateHyperliquidNetwork A paper-mode engine accepts testnet only; a live engine accepts mainnet only.

const (
	VenueConnectionCreateHyperliquidNetworkMainnet VenueConnectionCreateHyperliquidNetwork = "mainnet"
	VenueConnectionCreateHyperliquidNetworkTestnet VenueConnectionCreateHyperliquidNetwork = "testnet"
)

Defines values for VenueConnectionCreateHyperliquidNetwork.

func (VenueConnectionCreateHyperliquidNetwork) Valid added in v0.5.0

Valid indicates whether the value is a known member of the VenueConnectionCreateHyperliquidNetwork enum.

type VenueConnectionEquityPoint added in v0.5.0

type VenueConnectionEquityPoint struct {
	// Accounts Each account's value in that reading, in the connection's order.
	Accounts []AccountValue `json:"accounts"`
	At       time.Time      `json:"at"`

	// EquityUsd The sum of `accounts`.
	EquityUsd Decimal `json:"equityUsd"`
}

VenueConnectionEquityPoint defines model for VenueConnectionEquityPoint.

type VenueConnectionEquitySeries added in v0.5.0

type VenueConnectionEquitySeries struct {
	Points            []VenueConnectionEquityPoint `json:"points"`
	Resolution        EquityResolution             `json:"resolution"`
	VenueConnectionId string                       `json:"venueConnectionId"`
}

VenueConnectionEquitySeries Starts at the first reading that covered every account of the connection: for a login connected before contract 0.21.0, at the upgrade.

type VenueConnectionId added in v0.5.0

type VenueConnectionId = string

VenueConnectionId defines model for venueConnectionId.

type VenueConnectionKind added in v0.5.0

type VenueConnectionKind string

VenueConnectionKind An exchange login reached with API keys, a Hyperliquid address (a master or one of its sub-accounts), or a custodian's co-signer callback. Before contract 0.21.0 this was ConnectedAccountKind.

const (
	VenueConnectionKindCosignerCallback VenueConnectionKind = "cosigner_callback"
	VenueConnectionKindExchange         VenueConnectionKind = "exchange"
	VenueConnectionKindHyperliquid      VenueConnectionKind = "hyperliquid"
)

Defines values for VenueConnectionKind.

func (VenueConnectionKind) Valid added in v0.5.0

func (e VenueConnectionKind) Valid() bool

Valid indicates whether the value is a known member of the VenueConnectionKind enum.

type VenueConnectionRef added in v0.5.0

type VenueConnectionRef struct {
	// AccountCount How many accounts the connection has, whether or not the reader
	// was given all of them. An agent given fewer than this sees part
	// of the login, and the sum of what it sees is not the
	// connection's value. 1 means this account is the whole login.
	AccountCount int    `json:"accountCount"`
	Id           string `json:"id"`

	// Kind An exchange login reached with API keys, a Hyperliquid address (a
	// master or one of its sub-accounts), or a custodian's co-signer
	// callback. Before contract 0.21.0 this was ConnectedAccountKind.
	Kind VenueConnectionKind `json:"kind"`
	Name string              `json:"name"`

	// ParentId As on VenueConnection.
	ParentId *string              `json:"parentId,omitempty"`
	Setup    VenueConnectionSetup `json:"setup"`

	// Sync As on VenueConnection: how current each kind of data is, across
	// the connection's accounts. It is how an agent, which reads no
	// connection, tells how fresh an account's data is.
	Sync *[]SyncState `json:"sync,omitempty"`

	// VenueAccount Which login this is at the venue, in the venue's own terms, so that
	// a person or an agent can tell two connections apart without relying
	// on the name someone typed.
	VenueAccount VenueAccount `json:"venueAccount"`
}

VenueConnectionRef What an account says about its connection, so that the account alone is enough to tell which one it is and, for a signer, how to reach the venue. Nothing secret.

type VenueConnectionSetup added in v0.5.0

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

VenueConnectionSetup defines model for VenueConnectionSetup.

func (VenueConnectionSetup) AsCosignerCallbackSetup added in v0.5.0

func (t VenueConnectionSetup) AsCosignerCallbackSetup() (CosignerCallbackSetup, error)

AsCosignerCallbackSetup returns the union data inside the VenueConnectionSetup as a CosignerCallbackSetup

func (VenueConnectionSetup) AsExchangeSetup added in v0.5.0

func (t VenueConnectionSetup) AsExchangeSetup() (ExchangeSetup, error)

AsExchangeSetup returns the union data inside the VenueConnectionSetup as a ExchangeSetup

func (VenueConnectionSetup) AsHyperliquidSetup added in v0.5.0

func (t VenueConnectionSetup) AsHyperliquidSetup() (HyperliquidSetup, error)

AsHyperliquidSetup returns the union data inside the VenueConnectionSetup as a HyperliquidSetup

func (VenueConnectionSetup) Discriminator added in v0.5.0

func (t VenueConnectionSetup) Discriminator() (string, error)

func (*VenueConnectionSetup) FromCosignerCallbackSetup added in v0.5.0

func (t *VenueConnectionSetup) FromCosignerCallbackSetup(v CosignerCallbackSetup) error

FromCosignerCallbackSetup overwrites any union data inside the VenueConnectionSetup as the provided CosignerCallbackSetup

func (*VenueConnectionSetup) FromExchangeSetup added in v0.5.0

func (t *VenueConnectionSetup) FromExchangeSetup(v ExchangeSetup) error

FromExchangeSetup overwrites any union data inside the VenueConnectionSetup as the provided ExchangeSetup

func (*VenueConnectionSetup) FromHyperliquidSetup added in v0.5.0

func (t *VenueConnectionSetup) FromHyperliquidSetup(v HyperliquidSetup) error

FromHyperliquidSetup overwrites any union data inside the VenueConnectionSetup as the provided HyperliquidSetup

func (VenueConnectionSetup) MarshalJSON added in v0.5.0

func (t VenueConnectionSetup) MarshalJSON() ([]byte, error)

func (*VenueConnectionSetup) MergeCosignerCallbackSetup added in v0.5.0

func (t *VenueConnectionSetup) MergeCosignerCallbackSetup(v CosignerCallbackSetup) error

MergeCosignerCallbackSetup performs a merge with any union data inside the VenueConnectionSetup, using the provided CosignerCallbackSetup

func (*VenueConnectionSetup) MergeExchangeSetup added in v0.5.0

func (t *VenueConnectionSetup) MergeExchangeSetup(v ExchangeSetup) error

MergeExchangeSetup performs a merge with any union data inside the VenueConnectionSetup, using the provided ExchangeSetup

func (*VenueConnectionSetup) MergeHyperliquidSetup added in v0.5.0

func (t *VenueConnectionSetup) MergeHyperliquidSetup(v HyperliquidSetup) error

MergeHyperliquidSetup performs a merge with any union data inside the VenueConnectionSetup, using the provided HyperliquidSetup

func (*VenueConnectionSetup) UnmarshalJSON added in v0.5.0

func (t *VenueConnectionSetup) UnmarshalJSON(b []byte) error

func (VenueConnectionSetup) ValueByDiscriminator added in v0.5.0

func (t VenueConnectionSetup) ValueByDiscriminator() (interface{}, error)

type VenueConnectionStatus added in v0.5.0

type VenueConnectionStatus string

VenueConnectionStatus pending until `verify` passes.

const (
	VenueConnectionStatusActive  VenueConnectionStatus = "active"
	VenueConnectionStatusPending VenueConnectionStatus = "pending"
)

Defines values for VenueConnectionStatus.

func (VenueConnectionStatus) Valid added in v0.5.0

func (e VenueConnectionStatus) Valid() bool

Valid indicates whether the value is a known member of the VenueConnectionStatus enum.

type VenueConnectionUpdate added in v0.5.0

type VenueConnectionUpdate struct {
	Name *string `json:"name,omitempty"`
}

VenueConnectionUpdate defines model for VenueConnectionUpdate.

type VenueConnectionVerification added in v0.5.0

type VenueConnectionVerification struct {
	Checks []struct {
		Detail *string `json:"detail,omitempty"`
		Name   string  `json:"name"`
		Passed bool    `json:"passed"`
	} `json:"checks"`
	VerifiedAt *time.Time `json:"verifiedAt,omitempty"`
}

VenueConnectionVerification defines model for VenueConnectionVerification.

type VenueKey

type VenueKey struct {
	AgentId string `json:"agentId"`

	// AgentKeyId The registered agent key whose signer generated this trading
	// key, or must (set at creation when the request names one, else
	// when a registered key's signer generates it): the machine that
	// holds the agent's share. Only that key
	// proposes on it, runs its commitments and presigning (409
	// `conflict` with `details.venueKeyId` for another), and is handed
	// its sign requests. Absent when an issued key's signer generated
	// it (a bot's own machine, whose API key may be replaced), for a
	// key dealt with `mishmar keygen`, and for one from before 0.21.0:
	// any of the agent's trade keys then, and the signer that holds
	// the share is the one that can answer.
	AgentKeyId *string `json:"agentKeyId,omitempty"`

	// ApiKeyRegistered Whether the engine holds the key id the exchange issued (`register`). True from creation for HMAC keys, whose id the signer carries, and for Hyperliquid, which has none.
	ApiKeyRegistered   bool      `json:"apiKeyRegistered"`
	ConnectedAccountId string    `json:"connectedAccountId"`
	CreatedAt          time.Time `json:"createdAt"`

	// ExpiresAt When the key stops working: 100 days after it became active, or
	// the venue's own expiry if that comes first (a Hyperliquid
	// approval carries the same date). The engine stops signing with it
	// then and its status becomes `expired`; the console warns from 7
	// days before. Absent until the key is active.
	ExpiresAt   *time.Time `json:"expiresAt,omitempty"`
	Fingerprint *string    `json:"fingerprint,omitempty"`

	// Hyperliquid Hyperliquid keys only. The master wallet's approval of the API wallet.
	Hyperliquid *struct {
		ApprovalStatus VenueKeyHyperliquidApprovalStatus `json:"approvalStatus"`

		// ApprovedAt When the engine first saw the master account's approval on the venue.
		ApprovedAt *time.Time `json:"approvedAt,omitempty"`

		// ValidUntil When the venue will expire the approval, as the venue reports it.
		ValidUntil *time.Time `json:"validUntil,omitempty"`
	} `json:"hyperliquid,omitempty"`
	Id            string `json:"id"`
	IpAllowlisted *bool  `json:"ipAllowlisted,omitempty"`

	// Keygen Two-party ECDSA keys, which are made by key generation: pending
	// until the agent's signer has run signerKeygen, when `publicKey`
	// appears. Absent for dealt keys and the other schemes.
	Keygen *VenueKeyKeygen `json:"keygen,omitempty"`

	// PublicKey What the venue needs to know the key: the public key to register at an
	// exchange (SPKI PEM), or the API wallet's address for the master wallet
	// to approve on Hyperliquid. Absent for HMAC keys, and for an ECDSA
	// key until its key generation is done.
	PublicKey *string `json:"publicKey,omitempty"`

	// Replaces The key this one replaces (VenueKeyCreate.replaces), revoked when this one became active.
	Replaces  *string    `json:"replaces,omitempty"`
	RevokedAt *time.Time `json:"revokedAt,omitempty"`

	// Scheme The venue's key type, which alone decides how the key is held and used:
	// Ed25519, ECDSA and RSA keys are two-party keys (FROST, two-party ECDSA,
	// two-party RSA) with one share in the engine and one in the agent's
	// signer; HMAC keys are held whole by the signer the customer runs, which
	// signs only what both the agent and the engine signed. Per venue:
	// Binance ed25519, Hyperliquid ecdsa (an API wallet), Bybit rsa, Coinbase
	// ecdsa, OKX hmac.
	Scheme VenueKeyScheme `json:"scheme"`

	// Status pending until the venue accepts a co-signed read, active until
	// `expiresAt` or revocation. An expired key never signs again: the
	// engine forgets its share, as on revocation.
	Status              VenueKeyStatus               `json:"status"`
	Venue               Venue                        `json:"venue"`
	Verification        *VenueConnectionVerification `json:"verification,omitempty"`
	WithdrawalsDisabled *bool                        `json:"withdrawalsDisabled,omitempty"`
}

VenueKey One agent's trading key on one connected account. Created with the engine's share (or nothing, for HMAC venues), registered or approved at the venue, verified by a co-signed read, revoked by the operator.

type VenueKeyCreate

type VenueKeyCreate struct {
	// AgentKeyId The registered agent key (a trading machine) whose signer must
	// generate this trading key. Only that key runs signerKeygen for
	// it: another of the agent's keys, a bot's say, is 409 `conflict`
	// with `details.venueKeyId`, so it cannot take the key first. It
	// must be a live registered key of scope trade on this agent (422
	// `validation` otherwise). A trading key set up for an app's
	// computer names that computer's key. Refused with `engineShare`:
	// a dealt key has no signer behind its generation.
	AgentKeyId         *string `json:"agentKeyId,omitempty"`
	ConnectedAccountId string  `json:"connectedAccountId"`

	// EngineShare The engine's share as `mishmar keygen` printed it (JSON). Required for
	// venues with Ed25519 or RSA keys, refused for HMAC venues. For
	// venues with ECDSA keys leave it out: the key is made by two-party
	// key generation (signerKeygen) and a dealt share is refused.
	// Write-only; the agent's share never passes through the engine, and
	// the public key is derived from this share.
	EngineShare *string `json:"engineShare,omitempty"`

	// Replaces The agent's live key on the same connected account that this one
	// replaces. It must be active and not expired, and nothing else may
	// be replacing it. It keeps signing until this key becomes active,
	// and is revoked then.
	Replaces *string `json:"replaces,omitempty"`
}

VenueKeyCreate defines model for VenueKeyCreate.

type VenueKeyHyperliquidApprovalStatus

type VenueKeyHyperliquidApprovalStatus string

VenueKeyHyperliquidApprovalStatus defines model for VenueKey.Hyperliquid.ApprovalStatus.

const (
	VenueKeyHyperliquidApprovalStatusApproved VenueKeyHyperliquidApprovalStatus = "approved"
	VenueKeyHyperliquidApprovalStatusPending  VenueKeyHyperliquidApprovalStatus = "pending"
)

Defines values for VenueKeyHyperliquidApprovalStatus.

func (VenueKeyHyperliquidApprovalStatus) Valid

Valid indicates whether the value is a known member of the VenueKeyHyperliquidApprovalStatus enum.

type VenueKeyId

type VenueKeyId = string

VenueKeyId defines model for venueKeyId.

type VenueKeyKeygen

type VenueKeyKeygen string

VenueKeyKeygen Two-party ECDSA keys, which are made by key generation: pending until the agent's signer has run signerKeygen, when `publicKey` appears. Absent for dealt keys and the other schemes.

const (
	VenueKeyKeygenDone    VenueKeyKeygen = "done"
	VenueKeyKeygenPending VenueKeyKeygen = "pending"
)

Defines values for VenueKeyKeygen.

func (VenueKeyKeygen) Valid

func (e VenueKeyKeygen) Valid() bool

Valid indicates whether the value is a known member of the VenueKeyKeygen enum.

type VenueKeyRegistration

type VenueKeyRegistration struct {
	// ApiKey The key id the exchange issued when the public key was registered.
	ApiKey string `json:"apiKey"`
}

VenueKeyRegistration defines model for VenueKeyRegistration.

type VenueKeyScheme

type VenueKeyScheme string

VenueKeyScheme The venue's key type, which alone decides how the key is held and used: Ed25519, ECDSA and RSA keys are two-party keys (FROST, two-party ECDSA, two-party RSA) with one share in the engine and one in the agent's signer; HMAC keys are held whole by the signer the customer runs, which signs only what both the agent and the engine signed. Per venue: Binance ed25519, Hyperliquid ecdsa (an API wallet), Bybit rsa, Coinbase ecdsa, OKX hmac.

const (
	VenueKeySchemeEcdsa   VenueKeyScheme = "ecdsa"
	VenueKeySchemeEd25519 VenueKeyScheme = "ed25519"
	VenueKeySchemeHmac    VenueKeyScheme = "hmac"
	VenueKeySchemeRsa     VenueKeyScheme = "rsa"
)

Defines values for VenueKeyScheme.

func (VenueKeyScheme) Valid

func (e VenueKeyScheme) Valid() bool

Valid indicates whether the value is a known member of the VenueKeyScheme enum.

type VenueKeyStatus

type VenueKeyStatus string

VenueKeyStatus pending until the venue accepts a co-signed read, active until `expiresAt` or revocation. An expired key never signs again: the engine forgets its share, as on revocation.

const (
	VenueKeyStatusActive  VenueKeyStatus = "active"
	VenueKeyStatusExpired VenueKeyStatus = "expired"
	VenueKeyStatusPending VenueKeyStatus = "pending"
	VenueKeyStatusRevoked VenueKeyStatus = "revoked"
)

Defines values for VenueKeyStatus.

func (VenueKeyStatus) Valid

func (e VenueKeyStatus) Valid() bool

Valid indicates whether the value is a known member of the VenueKeyStatus enum.

type VenueRequest

type VenueRequest struct {
	// Body Base64.
	Body    *string            `json:"body,omitempty"`
	Headers *map[string]string `json:"headers,omitempty"`
	Method  string             `json:"method"`
	Url     string             `json:"url"`
}

VenueRequest The venue request the signature serves. For the proxy scheme it is the request the proxy signs with the key it holds and sends to the venue; for the others it is informational (an exchange signs its query string, which does not name the endpoint, so this says what the engine will call).

type VenueResponse

type VenueResponse struct {
	// Body Base64.
	Body    string             `json:"body"`
	Headers *map[string]string `json:"headers,omitempty"`
	Status  int                `json:"status"`
}

VenueResponse defines model for VenueResponse.

type VenueRules

type VenueRules struct {
	// AsOf When the engine last read the rules from the venue.
	AsOf               time.Time     `json:"asOf"`
	ConnectedAccountId string        `json:"connectedAccountId"`
	Symbols            []SymbolRules `json:"symbols"`
	Venue              Venue         `json:"venue"`
}

VenueRules defines model for VenueRules.

type Verdict

type Verdict string

Verdict defines model for Verdict.

const (
	VerdictAllow           Verdict = "allow"
	VerdictBlock           Verdict = "block"
	VerdictRequireApproval Verdict = "require_approval"
)

Defines values for Verdict.

func (Verdict) Valid

func (e Verdict) Valid() bool

Valid indicates whether the value is a known member of the Verdict enum.

type WalletApproval

type WalletApproval struct {
	// ApprovalId Correlates the signature with this typed data. Single use.
	ApprovalId string    `json:"approvalId"`
	ExpiresAt  time.Time `json:"expiresAt"`

	// TypedData EIP-712 typed data (domain, types, primaryType, message) for the wallet's signTypedData call.
	TypedData map[string]interface{} `json:"typedData"`
}

WalletApproval defines model for WalletApproval.

type WalletApprovalRequest

type WalletApprovalRequest struct {
	// WalletChainId The chain the browser wallet is connected to, as the wallet reports it
	// (hex, e.g. "0x66eee"). Some wallets refuse typed data for another chain;
	// Hyperliquid accepts any chain id in the signature domain.
	WalletChainId *string `json:"walletChainId,omitempty"`
}

WalletApprovalRequest defines model for WalletApprovalRequest.

type WalletApprovalSignature

type WalletApprovalSignature struct {
	ApprovalId string `json:"approvalId"`

	// Signature The 65-byte hex signature the master wallet produced, 0x-prefixed.
	Signature string `json:"signature"`
}

WalletApprovalSignature defines model for WalletApprovalSignature.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL