For agents and developers
API reference
Every endpoint, grouped by what it does. All paths start at https://motion.trading/api/v1.
mode is "practice" and some answers carry "practice": true: the path and the field keep the word practice. Live markets on the same paths: open. The same list as a machine readable file: openapi.jsonStatus
GET/status
Which mode the API is in, and whether the paper trading market's books balance. In paper trading mode, mode is practice: the path and the field keep the word practice. On live markets the answer also carries chain, the name of the chain the way wallets spell it, such as solana:mainnet; program, the program's address; priority_fee, what an order built now bids for its place in a block (micro_lamports, source, floor, cap); push, whether the node is pushing news; and orders_on_their_way against orders_limit, the orders the relay is still with against the most it takes at once. The fields wallets, start_balance and keeper_delay_seconds are sent in paper trading mode only. history says how far the service's history is behind the chain: behind is how many of the program's transactions it has not read yet, oldest_waiting the chain's time of the oldest of them in seconds, null when none waits. Trades, feeds and candles are behind the chain by that much. In paper trading mode nothing ever waits.
{
"mode": "practice",
"live": false,
"version": "1",
"time": 1795475139000,
"slot": 4488687847,
"markets": 3,
"wallets": 1,
"books_balanced": true,
"start_balance": "10",
"keeper_delay_seconds": 2,
"order_valid_seconds": 60,
"history": {
"behind": 0,
"oldest_waiting": null
},
"note": "Paper trading mode. Play SOL, one shared market, a simulated crowd. Nothing here is on chain."
}Markets
GET/markets
Every market with its live numbers and its limits. band_low and band_high are the two prices the market can never leave. average_price is the 10 minute average price and average_seconds the seconds it averages over; liquidation_rule says the rule in words. band_close_gate is how far, as a share, the price may stand from the average on an owner's wrong side before a band rule close waits. waiting is the SOL in this market set aside for owners of positions the band rule closed (always 0 in paper trading mode, where it goes back to the wallet at once). smallest_order is the smallest order in SOL of size. long_full and short_full say how full each side is, from 0 to 1: at 1 the side is at the edge of the band and opens on it are refused. long_units and short_units are the units each side holds. side_cap is the most one side may hold, in SOL at today's price. funding has paying_side, rate_hour (what the crowded side pays now, a share of size an hour), max_rate_hour (the setting it is drawn from) and receiver_cap (how many times the payers' rate the light side may receive). Each tier's max_size is the largest position, in SOL, that may use that tier's leverage. max_leverage_long and max_leverage_short are the most leverage a new position of 1 SOL of size is offered on each side at the price of that second, to one decimal and never rounded up, and null when that side is full: away from the middle of the band it is under the tier's top leverage. image is the account's picture, listed_at when the market was listed, and change_24h, volume_24h and trades_24h what it did in the last 24 hours (the change against the start price for a market younger than a day).
{
"markets": [
{
"id": "ansem",
"name": "Ansem",
"platform": "x",
"handle": "blknoiz06",
"account_id": null,
"image": "assets/img/blknoiz06.jpg",
"listed_at": 1795474218000,
"change_24h": "0.000589",
"volume_24h": "10229.771490719",
"trades_24h": 1818,
"address": "7JyrvHnbBLLyYS9VhY8W5G4gugP6MR8ShJ9P597KmFcM",
"vault": "GTH7GAbseKEZL7zGyNiThGCR81V9Cj8eNbEwR4eWryg2",
"price": "1.000588909",
"start_price": "1",
"depth": "15000",
"average_price": "1.003055167",
"average_seconds": 600,
"band_close_gate": "0.002",
"liquidation_rule": "A position is liquidated only when its line is crossed by the price and by the 10 minute average of the price, both.",
"waiting": "0",
"smallest_order": "0.01",
"long_size": "154.044839031",
"short_size": "149.530484554",
"long_units": "153.554103597",
"short_units": "149.139235263",
"long_full": "0.8531",
"short_full": "0.8286",
"side_cap": "180.10600362",
"band_low": "0.97642519",
"band_high": "1.024439017",
"max_transaction": "75.02208084",
"funding": {
"paying_side": "long",
"rate_hour": "0.00000729",
"max_rate_hour": "0.0005",
"receiver_cap": 10
},
"cushion": "10.224779319",
"cushion_cap": "20",
"opens_paused": false,
"fee": "0.001",
"min_margin": "0.05",
"max_leverage_long": 20.0,
"max_leverage_short": 20.0,
"tiers": [
{
"max_size": "15",
"max_leverage": 20,
"open_margin": "0.05",
"liquidation_line": "0.02"
},
{
"max_size": "60",
"max_leverage": 10,
"open_margin": "0.1",
"liquidation_line": "0.05"
},
{
"max_size": "150",
"max_leverage": 5,
"open_margin": "0.2",
"liquidation_line": "0.1"
}
]
}
]
}GET/markets/{id}
One market. The same fields as an entry of the list.
| Field | In | Required | What |
|---|---|---|---|
id | path | yes | ansem, alon or slingoor |
{
"id": "ansem",
"name": "Ansem",
"platform": "x",
"handle": "blknoiz06",
"account_id": null,
"image": "assets/img/blknoiz06.jpg",
"listed_at": 1795474218000,
"change_24h": "0.000589",
"volume_24h": "10229.771490719",
"trades_24h": 1818,
"address": "7JyrvHnbBLLyYS9VhY8W5G4gugP6MR8ShJ9P597KmFcM",
"vault": "GTH7GAbseKEZL7zGyNiThGCR81V9Cj8eNbEwR4eWryg2",
"price": "1.000588909",
"start_price": "1",
"depth": "15000",
"average_price": "1.003055167",
"average_seconds": 600,
"band_close_gate": "0.002",
"liquidation_rule": "A position is liquidated only when its line is crossed by the price and by the 10 minute average of the price, both.",
"waiting": "0",
"smallest_order": "0.01",
"long_size": "154.044839031",
"short_size": "149.530484554",
"long_units": "153.554103597",
"short_units": "149.139235263",
"long_full": "0.8531",
"short_full": "0.8286",
"side_cap": "180.10600362",
"band_low": "0.97642519",
"band_high": "1.024439017",
"max_transaction": "75.02208084",
"funding": {
"paying_side": "long",
"rate_hour": "0.00000729",
"max_rate_hour": "0.0005",
"receiver_cap": 10
},
"cushion": "10.224779319",
"cushion_cap": "20",
"opens_paused": false,
"fee": "0.001",
"min_margin": "0.05",
"max_leverage_long": 20.0,
"max_leverage_short": 20.0,
"tiers": [
{
"max_size": "15",
"max_leverage": 20,
"open_margin": "0.05",
"liquidation_line": "0.02"
},
{
"max_size": "60",
"max_leverage": 10,
"open_margin": "0.1",
"liquidation_line": "0.05"
},
{
"max_size": "150",
"max_leverage": 5,
"open_margin": "0.2",
"liquidation_line": "0.1"
}
]
}GET/markets/{id}/candles
Price history in candles. Up to seven days of one minute candles are kept.
| Field | In | Required | What |
|---|---|---|---|
id | path | yes | market id |
interval | query | no | 1m, 5m, 1h or 1d. Default 1m. |
limit | query | no | how many, newest last. Default 200, at most 1000. |
{
"market": "ansem",
"interval": "1m",
"candles": [
{
"time": 1795475100000,
"open": "1.007737546",
"high": "1.013600043",
"low": "0.995427579",
"close": "1.000588909",
"size": "522.827512701"
}
]
}GET/markets/{id}/trades
The latest opens, closes, liquidations and band rule closes, newest first. Trades by the simulated crowd say so. A liquidation also carries sender, who sent it, and bounty, what that earned. A band rule close has kind band_close and carries sender; in paper trading mode it also carries returned, what went back to the wallet, bounty, and a note that it was closed by the band rule, not liquidated.
| Field | In | Required | What |
|---|---|---|---|
id | path | yes | market id |
limit | query | no | default 50, at most 500 |
before | query | no | return trades older than this trade id |
{
"trades": [
{
"id": 4751,
"market": "ansem",
"kind": "open",
"side": "long",
"size": "4.820851168",
"price": "1.000588909",
"wallet": "GK9BgP7WDcyPA7NmVQRcVh89nJzTGwNF1ghpQRQDZvhb",
"simulated": true,
"signature": null,
"time": 1795475139751
}
]
}GET/markets/{id}/positions
Open positions in a market. Every position is public. liquidatable is true when the position is under its line at the market price and at the 10 minute average price, which is what a liquidation needs; under_line_now is true when it is under its line at the market price alone, which is not enough. band_need is what the position must hold at all times, in SOL: what the price could still cost it inside the band, and its liquidation line counted at the far edge of the band. band_short is true when the margin, after funding, is under band_need: the position can be closed by the band rule. band_close_in_hours is the hours until funding wears the margin under band_need at the present funding rate, and null while the position receives funding or pays none. band_closable is true when a band rule close would be taken at this second: the position is band_short, it is not liquidatable, and the price stands no further than band_close_gate from its 10 minute average on the owner's wrong side. held is SOL that already waits for this wallet in this market from an earlier band rule close (always 0 in paper trading mode).
| Field | In | Required | What |
|---|---|---|---|
id | path | yes | market id |
side | query | no | long or short |
sort | query | no | nearest (to liquidation, the default) or size |
limit | query | no | default 100, at most 1000 |
{
"positions": [
{
"address": "5Zs1hAqKxJTnpYv3mDCaErWbUf7NTgLq2XeVoHiB9wRk",
"market": "ansem",
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"simulated": false,
"side": "long",
"size": "2.5",
"units": "2.498112364",
"margin": "0.5",
"entry_price": "1.000755624",
"liquidation_price": "0.816943",
"equity": "0.5",
"profit": "0",
"liquidatable": false,
"under_line_now": false,
"band_need": "0.109564557",
"band_short": false,
"band_close_in_hours": "13787.0",
"band_closable": false,
"held": "0"
}
]
}GET/markets/{id}/liquidation_map
How much size gets liquidated at each price level, and how much buying or selling it would take to move the price there. A level's price is the middle of the level. The price cannot leave the band, so a level below the market's band_low or above its band_high cannot be reached by a price move: reachable is false for it.
| Field | In | Required | What |
|---|---|---|---|
id | path | yes | market id |
levels | query | no | how many price levels across 10% either side of the price. Default 40. |
{
"market": "ansem",
"price": "1.000922368",
"levels": [
{
"price": "1.028448",
"side": "short",
"size": "20.649508067",
"size_to_reach": "204.94565189",
"reachable": false
},
{
"price": "0.973397",
"side": "long",
"size": "17.44108221",
"size_to_reach": "207.783567765",
"reachable": false
}
]
}GET/snapshot
Everything one screen needs about a market, in one answer: the three markets with a short price line each, the chosen market's price for the last four minutes, its liquidation map, its last trades, and the fund. This is what the app asks for once a second. On live markets the answer also carries chain, the name of the chain the way wallets spell it.
| Field | In | Required | What |
|---|---|---|---|
market | query | no | market id. Default ansem. |
{
"time": 1795475139000,
"mode": "practice",
"market": "ansem",
"markets": [
{
"id": "ansem",
"name": "Ansem",
"platform": "x",
"handle": "blknoiz06",
"account_id": null,
"image": "assets/img/blknoiz06.jpg",
"listed_at": 1795474218000,
"change_24h": "0.000589",
"volume_24h": "10229.771490719",
"trades_24h": 1818,
"address": "7JyrvHnbBLLyYS9VhY8W5G4gugP6MR8ShJ9P597KmFcM",
"vault": "GTH7GAbseKEZL7zGyNiThGCR81V9Cj8eNbEwR4eWryg2",
"price": "1.000588909",
"start_price": "1",
"depth": "15000",
"average_price": "1.003055167",
"average_seconds": 600,
"band_close_gate": "0.002",
"liquidation_rule": "A position is liquidated only when its line is crossed by the price and by the 10 minute average of the price, both.",
"waiting": "0",
"smallest_order": "0.01",
"long_size": "154.044839031",
"short_size": "149.530484554",
"long_units": "153.554103597",
"short_units": "149.139235263",
"long_full": "0.8531",
"short_full": "0.8286",
"side_cap": "180.10600362",
"band_low": "0.97642519",
"band_high": "1.024439017",
"max_transaction": "75.02208084",
"funding": {
"paying_side": "long",
"rate_hour": "0.00000729",
"max_rate_hour": "0.0005",
"receiver_cap": 10
},
"cushion": "10.224779319",
"cushion_cap": "20",
"opens_paused": false,
"fee": "0.001",
"min_margin": "0.05",
"max_leverage_long": 20.0,
"max_leverage_short": 20.0,
"tiers": [
{
"max_size": "15",
"max_leverage": 20,
"open_margin": "0.05",
"liquidation_line": "0.02"
},
{
"max_size": "60",
"max_leverage": 10,
"open_margin": "0.1",
"liquidation_line": "0.05"
},
{
"max_size": "150",
"max_leverage": 5,
"open_margin": "0.2",
"liquidation_line": "0.1"
}
],
"spark": [
"1.000589",
"1.000589"
]
}
],
"series": {
"step_seconds": 1,
"prices": [
"1.000589",
"1.000589"
]
},
"liquidation_map": [
{
"price": "1.028448",
"side": "short",
"size": "20.649508067",
"size_to_reach": "204.94565189",
"reachable": false
},
{
"price": "0.973397",
"side": "long",
"size": "17.44108221",
"size_to_reach": "207.783567765",
"reachable": false
}
],
"trades": [
{
"id": 4751,
"market": "ansem",
"kind": "open",
"side": "long",
"size": "4.820851168",
"price": "1.000588909",
"wallet": "GK9BgP7WDcyPA7NmVQRcVh89nJzTGwNF1ghpQRQDZvhb",
"simulated": true,
"signature": null,
"time": 1795475139751
}
],
"fund": {
"practice": true,
"received": "110.971491946",
"pending": "0.510985913",
"released_sol": "88.266206219",
"burned_sol": "88.266206219",
"burned_motion": "4336752",
"team_sol": "22.194299814",
"supply": "995663248",
"last_burn": {
"sol": "88.266206219",
"motion": "4336752",
"signature": null,
"buy_signature": null,
"time": 1795475117000
},
"next_burn_at": 1795478717000,
"fees_total": "110.615436947",
"liquidations_total": "0.375404734",
"paid_all": "110.990841681",
"week_pool": "7000000"
}
}Quotes
GET/quote
What an order would do right now. Changes nothing. If the order would be refused, allowed is false and reason holds the error code. max_leverage is the largest leverage, to one decimal and never rounded up, at which this margin opens in this market right now, by the same check the order goes through; it depends on where in the band the order fills, is under 20 away from the middle of the band, and is null when this margin opens nothing. Past it the order is refused with band_margin. An order added to a position the wallet already holds, and an order of more than one transaction, is held one part in a thousand under its tier's limit: for a small addition to a large position max_leverage is a little under the tier's top, an order over that limit by no more than half a percent of its own size is sized down to fit (size says the size it will have), and one further over is refused with tier_limit. liquidation_price is an estimate; when it lies outside the market's band_low and band_high, a price move alone cannot liquidate the position.
| Field | In | Required | What |
|---|---|---|---|
market | query | yes | market id |
side | query | yes | long or short |
margin | query | yes | SOL of margin |
leverage | query | yes | from 1 to 20 |
wallet | query | no | your wallet, so its balance and any position it holds are counted in |
{
"market": "ansem",
"side": "long",
"margin": "0.5",
"leverage": 5.0,
"size": "2.5",
"price_before": "1.000588909",
"max_leverage": 20.0,
"entry_price": "1.000755624",
"price_after": "1.000922368",
"liquidation_price": "0.816943",
"fee": "0.0025",
"you_pay": "0.5025",
"transactions": 1,
"allowed": true
}Wallets
GET/wallets/{address}
A wallet's balance and how many positions it holds. In paper trading mode every wallet starts with 10 play SOL.
| Field | In | Required | What |
|---|---|---|---|
address | path | yes | wallet address |
{
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"practice": true,
"known": true,
"balance": "9.4975",
"positions": 1
}GET/wallets/{address}/positions
A wallet's open positions with live profit, with the same fields as a market's list of positions.
| Field | In | Required | What |
|---|---|---|---|
address | path | yes | wallet address |
{
"positions": [
{
"address": "5Zs1hAqKxJTnpYv3mDCaErWbUf7NTgLq2XeVoHiB9wRk",
"market": "ansem",
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"simulated": false,
"side": "long",
"size": "2.5",
"units": "2.498112364",
"margin": "0.5",
"entry_price": "1.000755624",
"liquidation_price": "0.816943",
"equity": "0.5",
"profit": "0",
"liquidatable": false,
"under_line_now": false,
"band_need": "0.109564557",
"band_short": false,
"band_close_in_hours": "13787.0",
"band_closable": false,
"held": "0"
}
]
}GET/wallets/{address}/history
A wallet's past trades, newest first, a band rule close among them.
| Field | In | Required | What |
|---|---|---|---|
address | path | yes | wallet address |
limit | query | no | default 50, at most 200 |
before | query | no | return trades older than this trade id |
{
"trades": [
{
"id": 4753,
"market": "ansem",
"kind": "open",
"side": "long",
"size": "2.5",
"price": "1.000922368",
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"simulated": false,
"signature": "32e4Z4omWxqcy4XyQp7dRk1nTtVb8sLhGa5uJfYc9mEwZ2xNvB6oKiPj3rHsD4tAgWqUeM7yLcF1zXn8bVhRkTp",
"time": 1795475139753
}
]
}GET/wallets/{address}/rewards
What Motion has kept from a wallet this week (paid) and the wallet's share of the pool. An estimate in paper trading mode, where it counts trading fees and what a liquidation took.
| Field | In | Required | What |
|---|---|---|---|
address | path | yes | wallet address |
{
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"practice": true,
"periods": [
{
"period": "practice_week",
"paid": "0.0025",
"all_paid": "26.408898709",
"pool": "7000000",
"estimate": "662",
"status": "open"
}
],
"claimable": "0",
"referral": {
"earned": "0",
"claimable": "0"
},
"note": "Paper trading rewards are an estimate. Nothing can be claimed in paper trading mode."
}GET/wallets/{address}/state
Everything about one wallet in one answer: balance, open positions, its last ten trades, its share of the week's rewards, and waiting: money that waits for this wallet in a market, one entry for each market with market, held (what a band rule close set aside; it is the wallet's already) and owed (what a close could not be paid at the time). Collect it with /tx/claim, kind waiting. In paper trading mode waiting is always empty, because what the band rule returns is in the balance at once.
| Field | In | Required | What |
|---|---|---|---|
address | path | yes | wallet address |
{
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"practice": true,
"known": true,
"balance": "9.4975",
"positions": [
{
"address": "5Zs1hAqKxJTnpYv3mDCaErWbUf7NTgLq2XeVoHiB9wRk",
"market": "ansem",
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"simulated": false,
"side": "long",
"size": "2.5",
"units": "2.498112364",
"margin": "0.5",
"entry_price": "1.000755624",
"liquidation_price": "0.816943",
"equity": "0.5",
"profit": "0",
"liquidatable": false,
"under_line_now": false,
"band_need": "0.109564557",
"band_short": false,
"band_close_in_hours": "13787.0",
"band_closable": false,
"held": "0"
}
],
"history": [
{
"id": 4753,
"market": "ansem",
"kind": "open",
"side": "long",
"size": "2.5",
"price": "1.000922368",
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"simulated": false,
"signature": "32e4Z4omWxqcy4XyQp7dRk1nTtVb8sLhGa5uJfYc9mEwZ2xNvB6oKiPj3rHsD4tAgWqUeM7yLcF1zXn8bVhRkTp",
"time": 1795475139753
}
],
"rewards": {
"paid": "0.0025",
"all_paid": "26.408898709",
"pool": "7000000",
"estimate": "662"
},
"waiting": []
}The fund
GET/fund
The motion fund: what came in, what it paid out, what the buy and burn spent and burned, and what went to the team. released_sol is the SOL the fund has paid out to the buy and burn wallet so far. burned_sol is the SOL the buy and burn's buys have spent; the $motion page prints it as SOL spent. The two can differ either way: a release waits in the wallet until the next hourly run, and on live markets the first buy spends SOL the team put into that wallet before launch, not a release of the fund. burned_motion is the $motion burned, and supply the 1,000,000,000 less what was burned. last_burn is the newest burn, with the fields of a row of /fund/burns. next_burn_at is the next full hour once the first run has happened, and null before it; a run may start up to ten minutes after the hour. On live markets the answer also carries address, the fund's own address, and amounts of $motion can carry up to six decimal places. In paper trading mode each release is spent at once, so released_sol equals burned_sol, and the burn buys from a stand in pool.
{
"practice": true,
"received": "110.971491946",
"pending": "0.510985913",
"released_sol": "88.266206219",
"burned_sol": "88.266206219",
"burned_motion": "4336752",
"team_sol": "22.194299814",
"supply": "995663248",
"last_burn": {
"sol": "88.266206219",
"motion": "4336752",
"signature": null,
"buy_signature": null,
"time": 1795475117000
},
"next_burn_at": 1795478717000,
"fees_total": "110.615436947",
"liquidations_total": "0.375404734",
"paid_all": "110.990841681",
"week_pool": "7000000"
}GET/fund/burns
Every buy and burn, newest first. sol is what the buy spent, "0" for a burn of coins that were already in the wallet; motion is what was burned, "0" for a buy whose burn has not happened yet. signature is the burn's transaction and buy_signature the buy's, each null when there is none; both are null in paper trading mode, where nothing is on chain. On live markets each row is a line of the buy and burn's own ledger that the chain has confirmed: a row whose transactions the chain does not know yet is left out until it does.
| Field | In | Required | What |
|---|---|---|---|
limit | query | no | default 50, at most 500 |
{
"burns": [
{
"sol": "88.266206219",
"motion": "4336752",
"signature": null,
"buy_signature": null,
"time": 1795475117000
}
]
}Build transactions
POST/tx/open
Build the transactions that open a position or add to one. Returns them unsigned. They stay valid until expires_at, order_valid_seconds of /status after they are built: 60 in paper trading mode, about half a minute on live markets, where it follows the chain's block time. /tx/send refuses one past it with expired. worst_prices holds each transaction's own worst fill: that part's own expected fill plus the slippage. worst_price is the last of them, the furthest any part may fill. On live markets the answer also carries version.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign |
market | body | yes | market id |
side | body | yes | long or short |
margin | body | yes | SOL of margin |
leverage | body | yes | from 1 to 20 |
slippage_bps | body | no | worst fill, in hundredths of a percent. Default 50, at most 300; past that the answer is bad_request. |
expected_entry | body | no | the entry price your ticket showed. When the order would fill further from it than slippage_bps, it is refused with slippage instead of filled at a price you never saw. |
version | body | no | live markets: the transaction version, 0 (the default, which every wallet signs) or 1. |
referrer | body | no | a referral code, which is a wallet address. Accepted and ignored in paper trading mode. On live markets it counts on the wallet's first trade and stays with the wallet from then on. |
{
"transactions": [
"AQAAAA...base64..."
],
"worst_price": "1.005759402",
"worst_prices": [
"1.005759402"
],
"expires_at": 1795475199000,
"quote": {
"market": "ansem",
"side": "long",
"margin": "0.5",
"leverage": 5.0,
"size": "2.5",
"price_before": "1.000588909",
"max_leverage": 20.0,
"entry_price": "1.000755624",
"price_after": "1.000922368",
"liquidation_price": "0.816943",
"fee": "0.0025",
"you_pay": "0.5025",
"transactions": 1,
"allowed": true
}
}POST/tx/close
Build the transactions that close a position, or part of one. A close that would leave less than 0.01 SOL of size closes the whole position. worst_prices holds each transaction's own worst fill and worst_price the last of them. On live markets the answer also carries version.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign |
market | body | yes | market id |
fraction | body | no | share to close, above 0 and up to 1. Default 1. |
slippage_bps | body | no | worst fill. Default 50, at most 300. |
expected_exit | body | no | the exit price your ticket showed; the close is refused with slippage when it would fill further from it than slippage_bps. |
version | body | no | live markets: 0 (the default) or 1. |
{
"transactions": [
"AQAAAA...base64..."
],
"worst_price": "0.995766057",
"worst_prices": [
"0.995766057"
],
"expected_return": "0.497535628",
"expires_at": 1795475201000
}POST/tx/margin
Build the transaction that adds margin to a position or removes it. Margin can be removed down to what the position needs to open at its size (past that: tier_limit) and never under what it must keep: what the band could cost it, its liquidation line at the far edge of the band, and 0.30% of its size (past that: band_margin). Adding margin pushes back the moment the band rule could close the position.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign |
market | body | yes | market id |
add | body | no | SOL to add |
remove | body | no | SOL to remove; give add or remove, not both |
{
"transactions": [
"AQAAAA...base64..."
],
"margin_after": "0.75",
"liquidation_price_after": "0.714825",
"expires_at": 1795475199000
}POST/tx/send
Send a transaction you have signed. In paper trading mode this is the only place a transaction can go. Send the transactions of one order in the order they were given. The answer comes within about two seconds: the fill in result, or a refusal as an error. commitment says how final the answer is, slot is where it landed, and timing is how long each step took, in milliseconds. In paper trading mode an order is decided at once. On live markets, when the chain has not confirmed it in that time, result.kind is pending, with signature, poll (the /tx/status address to ask), last_valid_block_height and a note: it can still land, so do not send it again; ask /tx/status until the status is no longer pending. A wallet that already has an order on its way, or a relay with too many orders on their way, is answered rate_limited (429) at once.
| Field | In | Required | What |
|---|---|---|---|
transaction | body | yes | the signed transaction, base64 |
wait | body | no | live markets: confirmed (the default) or processed. With processed the answer comes as soon as the transaction is in a block, with result.kind processed: that block can still be dropped, so no fill is promised. |
{
"signature": "32e4Z4omWxqcy4XyQp7dRk1nTtVb8sLhGa5uJfYc9mEwZ2xNvB6oKiPj3rHsD4tAgWqUeM7yLcF1zXn8bVhRkTp",
"practice": true,
"result": {
"kind": "open",
"market": "ansem",
"units": "2.498112364",
"price": "1.000755624",
"fee": "0.0025"
},
"commitment": "confirmed",
"slot": 4488687850,
"timing": {
"check_ms": 0.176,
"send_ms": 0.0,
"land_ms": 0.0,
"confirm_ms": 0.093,
"result_ms": 0.0,
"total_ms": 0.269,
"sends": 1,
"preflight": false,
"confirmed_by": "practice"
}
}POST/tx/claim
Live markets only. With kind waiting it builds the transaction that pays an owner what waits for them in a market: what a band rule close set aside, and what a close could not be paid at the time. Anyone may send it; the SOL goes only to the owner. The answer holds transactions, amount (what was set aside), owed, owner, expires_at and version; with nothing waiting it is conditions_not_met. With kind referral it builds the transaction that pays a wallet its referral earnings; the answer holds transactions, amount, expires_at and version, and with nothing to claim it is conditions_not_met. With kind rewards it answers not_open until season one closes. Not open in paper trading mode, where what the band rule returns is in the balance at once: it answers not_open for every kind.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign |
kind | body | yes | waiting, referral or rewards |
market | body | no | kind waiting: the market id |
owner | body | no | kind waiting: the wallet the money waits for. Default: the signing wallet. |
{
"error": {
"code": "not_open",
"message": "Claims are not open in paper trading mode. coming soon."
}
}POST/tx/referral_code
Live markets only. Build the transaction that makes the wallet a referral code. The wallet's address is the code. The answer holds transactions, code, expires_at and version; a wallet that is already a code gets conditions_not_met. Not in paper trading mode: there the path answers not_found.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign and become the code |
{
"error": {
"code": "not_found",
"message": "No such endpoint. See https://motion.trading/docs/reference.html"
}
}Open to anyone
POST/tx/liquidate
Build the transaction that liquidates one piece of a position under its line at the market price and at the 10 minute average price. The sender earns the bounty: 5% of what the position has left, at least 0.001 SOL and never more than what is left. A large position takes several.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign and receive the bounty |
position | body | yes | the position's address |
{
"transactions": [
"AQAAAA...base64..."
],
"bounty_estimate": "0.018512505",
"expires_at": 1795475199000
}POST/tx/band_close
Live markets only. Build the transaction that closes a position by the band rule: one whose margin funding has worn under what it must hold at all times (its band_need). Anyone may send it. The whole position closes at the market price; what it is worth, less the closing fee and 0.0005 SOL for the sender (bounty), is set aside for its owner, who collects it with /tx/claim, kind waiting. It is not a liquidation. A position that still holds its band_need, or that is under its line and is liquidated instead, answers not_band_short; while the price stands more than band_close_gate from the 10 minute average on the owner's wrong side it answers price_gate. The example is a live answer. In paper trading mode the keeper sends every band rule close itself and this path answers conditions_not_met.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign and receive the 0.0005 SOL |
position | body | yes | the position's address |
version | body | no | 0 (the default) or 1 |
{
"transactions": [
"AQAAAA...base64..."
],
"bounty": "0.0005",
"expires_at": 1795475199000,
"version": 0
}POST/tx/grow_depth
A market's depth does not change: the depth rule is switched off, in paper trading mode as on live markets, and this always answers conditions_not_met. The path is kept so that an older client gets an answer in words.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign |
market | body | yes | market id |
{
"error": {
"code": "conditions_not_met",
"message": "A market's depth does not change: the depth rule is switched off."
}
}POST/tx/sweep
Build the transaction that moves a market's cushion above its cap to the motion fund. In paper trading mode a cushion is swept the moment it passes its cap, so this answers conditions_not_met.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet that will sign |
market | body | yes | market id |
{
"error": {
"code": "conditions_not_met",
"message": "Nothing to sweep. In paper trading mode a cushion is swept the moment it passes its cap."
}
}Paper trading mode
POST/practice/faucet
Refill a paper trading wallet with 10 play SOL. Works when the wallet holds under 1 play SOL, once every 10 minutes.
| Field | In | Required | What |
|---|---|---|---|
wallet | body | yes | the wallet to refill |
{
"wallet": "8G41iMm6W5KfVWiJvfYLU6PnRYkQ9Y8K4SBzBdq9J8WV",
"added": "10",
"balance": "10.3"
}Stream
GET/stream
Server sent events: trade, liquidation, band_close (a band rule close, with its sender; on live markets also set_aside, what waits for the owner) and price, which comes right after every trade with the trade's id, and whenever else the price moves. burn carries a row of /fund/burns, whatever markets you named; on live markets it comes once the chain has confirmed that row. In paper trading mode also funding, once a minute. There is no depth event: a market's depth does not change. Reconnect with the id of the last event you saw and nothing is missed. Four streams for each address.
| Field | In | Required | What |
|---|---|---|---|
markets | query | no | market ids separated by commas. Default all. |
events | query | no | event names separated by commas. Default all. |
last_id | query | no | resume after this event id |
event: price
id: 48213
data: {"market":"ansem","price":"1.000588909","time":1795475139751,"trade":4751}Order status
GET/tx/status
What became of a transaction, by its signature: the address a pending answer of /tx/send points to in poll. status is confirmed (with the same result its send would have given), failed (with error, as the send would have answered), expired (it is in no block and can no longer land: nothing was filled), pending (still on its way) or unknown (never seen here). In paper trading mode an order is decided the moment it is sent, so this is confirmed or unknown.
| Field | In | Required | What |
|---|---|---|---|
signature | query | yes | the transaction's signature |
{
"signature": "cXhEuPtZhmRJiGXfv38y4xY74PNQHSCKq3EemPmgAg4Yie4TFkERk3QHV2x9WnQCJBuRjQ5opkhN3vxc7HTxWti",
"practice": true,
"status": "confirmed",
"result": {
"kind": "open",
"market": "ansem",
"units": "2.498112364",
"price": "1.000755624",
"fee": "0.0025"
},
"error": null,
"slot": 4488687850
}