> For the complete documentation index, see [llms.txt](https://developer.aiodds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.aiodds.com/trading-odds/websocket/ai-trading.md).

# AI Trading

**Topic:**

{% code expandable="true" %}

```
topic: "aiodds/<category>/<user>"

category: 1/2 (1 = in-play, 2 = pre-match)  

example:  
"aiodds/1/qjiaw19qs"
"aiodds/2/qjiaw19qs"
```

{% endcode %}

**Return data structure:**

{% code expandable="true" %}

```protobuf
syntax = "proto3";
package aiodds;

message Outcome {
    uint32 id = 1; // outcome id
    string name = 2; // outcome name
    string line = 3; // betting line value
    uint32 status = 4; //outcome status, 0-Open, 1-Suspended
    string value = 6; // odds price
    uint32 uptime = 7; // unix timestamp of the update, in seconds
    int32 change = 9; // price movement, 0-Unchanged, 1-Increased, 2-Decreased
    uint32 lost = 10; // removal flag for the outcome, 0-Not removed, 1-Removed from the odds feed
    repeated string trans = 11; // outcome name translate params
    uint64 uptime_ms = 12; // unix timestamp of the update, in milliseconds
}

message CustomBookmaker{
    uint32 bookmaker_id = 1; // bookmaker id
    map<string, Outcome> outcomes = 2; //outcomes
}

message AiOdds {
    uint32 market_id = 1; // market id
    string name = 2; // market name
    uint32 sport_id = 3; // sport id
    uint32 match_id = 4; // match id
    map<string, Outcome> outcomes = 5; //outcomes
    uint32 uptime = 6; // unix timestamp of the update, in seconds
    uint32 category = 8; // 1-in-play 2-pre-match
    string score = 10; // score when the handicap odds were recorded, only available for markets 4 and 499
    int32 line_score = 11; // whether score is available, 0-No, 1-Yes
    uint32 bookmaker_id = 13; // bookmaker id
    string main_line = 14; // main line
    repeated CustomBookmaker bookmakers = 15; // original odds from bookmakers used to calculate the AiOdds trading odds

    repeated string trans = 16;  // market translate params
    uint64 uptime_ms = 17; // unix timestamp of the update, in milliseconds
    uint32 backup = 18;    // 0/empty-raw bookmaker odds data; 1-when raw bookmaker has no data, alternative backup odds data.
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.aiodds.com/trading-odds/websocket/ai-trading.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
