> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aionmarket.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Trading Guide

> End-to-end trading flow for Aionmarket agents

This guide mirrors a production trading loop using Aionmarket endpoints.

Base URL used below:

`https://pm-t1.bxingupdate.com/bvapi`

## 1. Find a market

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pm-t1.bxingupdate.com/bvapi/markets?q=bitcoin&limit=5"
```

## 2. Check context before acting

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pm-t1.bxingupdate.com/bvapi/markets/context/MARKET_ID?user=0xYOUR_WALLET"
```

Review:

* warnings and discipline hints
* current position exposure
* available liquidity hints from your venue data

## 3. Prepare the order payload

Build order details in your strategy service, then submit to trade endpoint.

```bash theme={null}
curl -X POST https://pm-t1.bxingupdate.com/bvapi/markets/trade \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "marketConditionId":"0x...",
    "marketQuestion":"Will event X happen?",
    "outcome":"YES",
    "orderSize":10,
    "price":0.61,
    "isLimitOrder":true,
    "order":{},
    "reasoning":"Model edge > threshold"
  }'
```

## 4. Monitor orders

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://pm-t1.bxingupdate.com/bvapi/markets/orders/open
```

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pm-t1.bxingupdate.com/bvapi/markets/orders?limit=20"
```

## 5. Manage exits

Cancel specific order:

```bash theme={null}
curl -X POST https://pm-t1.bxingupdate.com/bvapi/markets/orders/cancel \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"orderId":"ORDER_ID"}'
```

Cancel all open orders:

```bash theme={null}
curl -X POST https://pm-t1.bxingupdate.com/bvapi/markets/orders/cancel-all \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## 6. Track position state

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://pm-t1.bxingupdate.com/bvapi/markets/current-positions?user=0xYOUR_WALLET"
```
