# markets/actions
Documentation: next (source: develop).

Install the preview: `pnpm add @aephia/atlas-kit@next`. These docs follow develop and may include changes not yet published to npm.

Markdown source of https://develop.atlas-kit-docs.pages.dev/reference/markets/actions/ — see https://develop.atlas-kit-docs.pages.dev/ai/ for the full machine-readable surface.

## Interfaces

<a id="plancancellocalmarketordersoptions"></a>

### PlanCancelLocalMarketOrdersOptions

Defined in: [packages/sage/src/markets/actions/index.ts:79](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L79)

Inputs for cancelling owned Local Market orders and withdrawing filled escrow.

`orderIds` is a dense, unique list of non-negative safe integers. Pass an
empty list to request withdrawal of filled escrow without cancelling an open
order. The chain remains authoritative about whether escrow is available.

#### Example

```ts
declare const authorization: PlanAuthorization;
const options: PlanCancelLocalMarketOrdersOptions = {
  authorization,
  orderIds: [4, 9],
};
```

#### Properties

<a id="authorization"></a>

##### authorization

```ts
readonly authorization: PlanAuthorization;
```

Defined in: [packages/sage/src/markets/actions/index.ts:80](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L80)

<a id="orderids"></a>

##### orderIds

```ts
readonly orderIds: readonly number[];
```

Defined in: [packages/sage/src/markets/actions/index.ts:81](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L81)

***

<a id="planplacelocalmarketorderoptions"></a>

### PlanPlaceLocalMarketOrderOptions

Defined in: [packages/sage/src/markets/actions/index.ts:57](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L57)

Inputs for placing one exact Local Market order.

`priceRaw` is the positive raw ATLAS price per cargo unit and `quantity` is
the positive raw cargo quantity. Both values are unsigned-u64 integers.

#### Example

```ts
declare const authorization: PlanAuthorization;
const options: PlanPlaceLocalMarketOrderOptions = {
  authorization,
  side: 'bid',
  priceRaw: 100_000_000n,
  quantity: 5n,
};
```

#### Properties

<a id="authorization-1"></a>

##### authorization

```ts
readonly authorization: PlanAuthorization;
```

Defined in: [packages/sage/src/markets/actions/index.ts:58](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L58)

<a id="priceraw"></a>

##### priceRaw

```ts
readonly priceRaw: bigint;
```

Defined in: [packages/sage/src/markets/actions/index.ts:60](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L60)

<a id="quantity"></a>

##### quantity

```ts
readonly quantity: bigint;
```

Defined in: [packages/sage/src/markets/actions/index.ts:61](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L61)

<a id="side"></a>

##### side

```ts
readonly side: "bid" | "ask";
```

Defined in: [packages/sage/src/markets/actions/index.ts:59](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L59)

## Functions

<a id="plancancellocalmarketorders"></a>

### planCancelLocalMarketOrders()

```ts
function planCancelLocalMarketOrders(
   ctx, 
   market, 
   player, 
input): Promise<Plan>;
```

Defined in: [packages/sage/src/markets/actions/index.ts:581](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L581)

Plans cancellation of owned Local Market orders and filled-escrow withdrawal.

The planner validates the loaded Local Market and Starbase Player, their
canonical Profile/Character/System/Game graph, and each selected order's
ownership and price. An empty selection requests filled-escrow withdrawal.
Final escrow availability and order races remain chain-authoritative.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `ctx` | [`SageContext`](/reference/#sagecontext) |
| `market` | [`LocalMarketSnapshot`](/reference/markets/#localmarketsnapshot) |
| `player` | `StarbasePlayerSnapshot` |
| `input` | [`PlanCancelLocalMarketOrdersOptions`](/reference/markets/actions/#plancancellocalmarketordersoptions) |

#### Returns

`Promise`\<[`Plan`](/reference/planning/#plan)\>

#### Example

```ts
declare const ctx: SageContext;
declare const market: LocalMarketSnapshot;
declare const player: StarbasePlayerSnapshot;
declare const options: PlanCancelLocalMarketOrdersOptions;
const plan = await planCancelLocalMarketOrders(ctx, market, player, options);
console.log(plan.describe());
```

***

<a id="planplacelocalmarketorder"></a>

### planPlaceLocalMarketOrder()

```ts
function planPlaceLocalMarketOrder(
   ctx, 
   market, 
   player, 
input): Promise<Plan>;
```

Defined in: [packages/sage/src/markets/actions/index.ts:334](https://github.com/Aephia/atlas-kit/blob/develop/packages/sage/src/markets/actions/index.ts#L334)

Plans one Local Market bid or ask without signing, simulation, or writes.

The planner validates the loaded Local Market and Starbase Player, their
canonical Character/System/Game graph, the current market-enabled Starbase
incarnation, and the known bid ATLAS or ask cargo balance. Matching, rent,
final capacity, permissions, and state races remain chain-authoritative.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `ctx` | [`SageContext`](/reference/#sagecontext) |
| `market` | [`LocalMarketSnapshot`](/reference/markets/#localmarketsnapshot) |
| `player` | `StarbasePlayerSnapshot` |
| `input` | [`PlanPlaceLocalMarketOrderOptions`](/reference/markets/actions/#planplacelocalmarketorderoptions) |

#### Returns

`Promise`\<[`Plan`](/reference/planning/#plan)\>

#### Example

```ts
declare const ctx: SageContext;
declare const market: LocalMarketSnapshot;
declare const player: StarbasePlayerSnapshot;
declare const options: PlanPlaceLocalMarketOrderOptions;
const plan = await planPlaceLocalMarketOrder(ctx, market, player, options);
console.log(plan.describe());
```

## References

<a id="planauthorization"></a>

### PlanAuthorization

Re-exports [PlanAuthorization](/reference/cargo/actions/#planauthorization)
