Machine Trading Protocol/guides

Glossary

Status
guide
Source
github.com/lgalabru/machine-trading/tree/main/specs

The words the guides use, grouped by topic. In every guide, a word defined here is underlined: hover it, or tap it, to read its definition. The first paragraph of each entry is what the hover shows.

Where a mandate defines a term, the mandate is normative and this page only explains it.

1. Positions

1.1. Long

A position that gains when the price rises and loses when it falls. You are long when you own something, or hold a contract that behaves as if you did. In the specs a long position is a positive quantity.

1.2. Short

A position that gains when the price falls and loses when it rises. On a perp you go short by selling a contract you don't hold. In the specs a short position is a negative quantity.

A short's loss has no ceiling, because a price can rise without limit, while a long can lose at most what the price was.

1.3. Position

What an account holds in an instrument: a signed quantity, positive when long and negative when short. The instrument profile defines how it is measured.

1.4. Underlying

What a contract's price follows: a token such as SOL, one share of a company such as SpaceX, a stock index such as the S&P 500, a commodity such as gold, or even a private company's valuation. The perp tracks it without anyone holding it.

1.5. Base units

What a position is counted in: shares or tokens, not dollars. A position of 70 SPCX is 70 base units, whatever SPCX is worth. The mandate's max_position is in base units.

1.6. Lot size

The smallest step a venue lets a position change by. A venue profile says how to convert lots to base units.

1.7. Notional

A position's size in dollars: its quantity times the price. A position of 50 units at $100 has a notional of $5,000, however little margin backs it.

1.8. Entry price

The average price a position was opened at. PnL is measured from it.

1.9. PnL

Profit and loss: what a position has made or lost. Unrealized PnL is what it would make if closed at the current price; realized PnL is what closed trades actually made.

1.10. Base and quote

The two assets of a spot market, written base-quote: in SOL-USDC, SOL is the base, what the market trades, and USDC the quote, what prices are in.

1.11. Wallet

The agent authority's own token accounts, outside any venue. Tokens move between the wallet and a venue's accounts as the agent deposits, trades and settles.

1.12. Wrapped SOL

SOL in the form of a token, which venues can trade like any other. Native SOL also pays transaction fees, so the venue profiles count only the wrapped kind as a holding.

1.13. Hedge

A position held to offset the risk of another. A short perp hedges a holding of the same token: what one loses, the other gains.

2. Prices

2.1. Spot price

The price for buying or selling the asset itself, now, as opposed to a contract on it.

2.2. Mark price

The price a venue values positions at, and liquidates them at. It is usually built from the index price rather than the venue's last trade, so a single odd trade can't liquidate anyone. The venue profile defines it.

2.3. Index price

The underlying's price, combined from other markets. A perp's mark and funding follow it.

2.4. Market hours

The hours an underlying's own market trades. A perp trades around the clock, so outside them the venue prices it on its own: on Phoenix, equity perps use external prices 24 hours a day, 5 days a week, and their own order book, within a cap, over weekends and holidays.

2.5. Mid price

Halfway between the best bid and the best ask.

2.6. Arrival price

The price when a sale or a purchase starts, which its result is measured against.

2.7. Last price

The price of the most recent trade on the venue. It can differ from the mark, especially in a thin market.

2.8. Premium

How far a perp's price is above its index, or below it when negative. A premium makes funding positive, so longs pay shorts until it closes.

2.9. Bid and ask

The highest price a buyer is offering (the bid) and the lowest a seller is asking (the ask). A market order buys at the ask and sells at the bid.

2.10. Spread

The gap between the best ask and the best bid. Crossing it is a cost every taker pays.

2.11. Oracle

A service that publishes prices from outside a blockchain onto it, so a program can use them. On-chain venues build their mark and index from oracles, and a wrong oracle price can liquidate positions.

3. Futures and perpetuals

3.1. Future

A contract to buy or sell an asset at a set price on a set date, its expiry. At expiry it settles at the underlying's price, which pulls its price toward spot as the date nears.

3.2. Expiry

The date a dated future settles. A perpetual has none.

3.3. Perpetual future

A future with no expiry, held near the underlying's price by funding instead. It is the instrument kind perp; see the guide.

3.4. Funding

Payments between longs and shorts that keep a perp's price near its index. When the perp trades above the index, funding is positive and longs pay shorts; below it, shorts pay longs. Funding is paid on the notional.

3.5. Funding rate

The share of notional paid in funding each interval, in basis points or percent. A rate of 1 bp an hour is about 88% a year.

3.6. Funding interval

How often funding is paid: every hour, or every eight, depending on the venue. The venue profile says.

4. Margin and risk

4.1. Margin

The deposit that backs a position and absorbs its losses. Opening a perp needs initial margin; keeping it open needs maintenance margin.

4.2. Initial margin

The margin a venue requires to open a position, as a share of its notional. It sets the highest leverage you can open at.

4.3. Maintenance margin

The least equity a position may have, as a share of its notional. Below it, the venue liquidates the position. It is lower than the initial margin, so a new position has some room to lose.

4.4. Cross margin

One pool of margin backs every position in the account, so a gain on one supports a loss on another, and a big enough loss on one can liquidate them all. On Phoenix, equity perps such as SPCX are cross-margined.

4.5. Isolated margin

Each position has its own margin, and losing it liquidates only that position. The guides' figures use isolated margin, since it is simpler to show.

4.6. Equity

Margin plus unrealized PnL: what the account would be worth if every position were closed at the mark.

4.7. Leverage

Notional divided by margin. At 5× leverage, $1,000 of margin backs $5,000 of position, and a 1% move is 5% of the margin.

4.8. Liquidation

The venue closing a position whose equity fell below maintenance margin, or, on a money market, anyone repaying part of a borrow and taking collateral for it once the borrow's LTV reaches the liquidation LTV. It is forced, and what it takes doesn't come back if the price recovers.

4.9. Liquidation price

The mark price at which a position would be liquidated. Higher leverage moves it closer to the entry price.

4.10. Insurance fund

A venue's reserve for losses a liquidation doesn't cover, when the price gaps past the liquidation price before the position can be closed.

4.11. Auto-deleveraging

When the insurance fund can't cover a loss, some venues close part of the most profitable opposing positions instead. A risk of winning on a perp that a spot holder doesn't have.

4.12. Volatility

How much a price moves, usually measured as the typical size of its daily moves. Over time, moves grow roughly with the square root of how long you wait.

4.13. Drawdown

How far an account's value is below its running peak. The mandate's max_drawdown_usd limits it.

4.14. High-water mark

The highest value an account has reached. A drawdown is measured from it, not from where the account started.

5. Trading

5.1. Order book

The list of buy and sell orders resting on a venue, by price. A thin book has few orders near the price, so large orders move it.

5.2. Limit order

An order to trade at a set price or better. It rests on the book until it fills or is cancelled.

5.3. Market order

An order to trade now at the best available price. It fills at once, at whatever the book offers.

5.4. Maker and taker

A maker's order rests on the book and adds liquidity; a taker's fills against it. Venues usually charge takers more, and sometimes pay makers.

5.5. Open orders account

On OpenBook, the account that holds a trader's orders and balances on one market: what its fills paid it, and what its resting orders lock.

5.6. Seat

On a Phoenix spot market, a trader's place in the market account, holding its free and locked balances.

5.7. Settle

Moving what a venue holds for you back to your wallet. Unsettled balances are still yours, and still count as your holdings.

5.8. Slippage

The difference between the price you expected and the price you got, because your order moved through the book or the price moved before it filled.

5.9. Liquidity

How much can be traded near the current price without moving it. A thin market has little.

5.10. Basis point

One hundredth of a percent: 0.01%. 100 bp is 1%.

5.11. Bull and bear

A bull expects prices to rise, a bear expects them to fall. A bull market rises for a long time, and a bear market falls.

5.12. Flash crash

A sharp fall in price within minutes, followed by a fast recovery. The benchmark's phoenix-flash-crash task replays such sessions.

5.13. Short squeeze

A fast rise that forces shorts to buy back, which pushes the price higher and forces more of them out.

6. Money markets

6.1. Money market

A program that pools an asset from lenders and lends it to borrowers against collateral. See the guide.

6.2. Reserve

One asset's pool in a lending market: everyone's supply of it, and everyone's borrows from it.

6.3. Supply

Lending an asset to a money market's pool, to earn interest on it.

6.4. Borrow

Taking an asset from a money market's pool against collateral, and paying interest on it until it's repaid.

6.5. Collateral

What a borrower has supplied and the venue holds as security. On Kamino, supplying gives you collateral tokens, a claim on the pool that rises in value as interest comes in.

6.6. Obligation

On Kamino, the account that holds one owner's deposits and borrows in a lending market, and their values as of its last refresh.

6.7. LTV

Loan to value: debt divided by collateral value. Below the max LTV you may borrow more; at the liquidation LTV, the venue may liquidate.

6.8. Health

The liquidation LTV divided by the current LTV. Above 1 a borrow is safe; at 1 or below, the venue may liquidate it.

6.9. Borrow factor

A weight on risky borrowed assets: with a borrow factor of 1.25, $100 borrowed counts as $125 of debt in the LTV.

6.10. Utilization

The share of a pool's supply that is lent out. Borrow rates rise with it, slowly up to the curve's kink, steeply after.

6.11. Liquidation bonus

The extra collateral a liquidator takes for repaying part of a borrow: what the borrower pays for being liquidated.

6.12. Close factor

The most of a borrow's debt one liquidation may repay: 20% on Kamino, unless the borrow is near insolvency.

6.13. Bad debt

A borrow worth more than its collateral: liquidation can no longer repay it, and the pool's lenders take the loss.

7. Strategies

7.1. Strategy

A repeatable rule for when to trade, which side to take, and how much. A mandate bounds what a strategy may do, but never says what it is.

7.2. Arbitrage

Buying something where it is cheap and selling it where it is dear, at the same time, so the profit doesn't depend on which way the price moves next. See the guide.

7.3. Leg

One of the positions in a trade made of several. An arbitrage has two legs whose price risks cancel.

7.4. Delta-neutral

Holding positions whose gains and losses from a price move cancel, so the total doesn't change when the price does.

7.5. Cash and carry

Buying an asset and shorting a future or perp on it, to earn the premium or the funding without exposure to the price.

7.6. Market making

Quoting both a price to buy and a price to sell, and earning the gap between them from the traders who take the quotes. The market maker ends up holding whatever those traders didn't want.

7.7. Implementation shortfall

What a sale or purchase lost against its arrival price: the paper value minus the proceeds and the value of whatever is left. See the guide.

7.8. Market impact

How far your own trading moves the price. Temporary impact fades as the book refills; permanent impact stays, because the market has learned there is a seller or a buyer.

7.9. TWAP

Selling, or buying, the same amount in every period of a session, so the result is roughly the market's average price over it.

7.10. Schedule

How much a large order trades when: a slice in each period, sized by a rule.

7.11. Front-running

Trading just ahead of an order you've seen or predicted, to profit from the price move it causes.

8. Mandates

8.1. Mandate

A JSON document stating what an agent may trade on someone's behalf, and the limits it must stay within. See the mandate.

8.2. Principal

The person or fund whose capital the agent trades.

8.3. Agent

The program that trades under a mandate, such as a bot an AI agent wrote.

8.4. Universe

The instruments a mandate allows. Holding or ordering anything outside it breaks the mandate.

8.5. Position cap

The range a mandate allows an instrument's position, in base units: up to max_position, and down to min_position, which is −max_position unless the mandate sets it. Open orders don't count until they fill.

8.6. Minimum health

The lowest health a mandate lets any of the account's borrows reach: min_health. Set above 1, it makes the agent act before the venue could liquidate it.

8.7. Drawdown limit

The most, in USD, an account's value may fall below its running peak: max_drawdown_usd. It covers the whole account.

8.8. Sides

Whether a mandate lets the agent buy, sell, or both, in an instrument. It covers resting orders as well as fills.

8.9. Limit price

The worst price at which a mandate lets the agent sell (min_sell_price) or buy (max_buy_price). It applies to every fill, not the average.

8.10. Enforcer

Whatever checks an agent against its mandate without trusting it. In the benchmark, the grader.