> For the complete documentation index, see [llms.txt](https://docs.evedex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.evedex.com/developers/developers/toolkit.md). Agents can also search and read this documentation through its [MCP server](https://docs.evedex.com/~gitbook/mcp).

# Toolkit

## REST API

The exchange uses the REST API of two services for interaction:

1. [Auth Service](https://swagger.evedex.com/?urls.primaryName=Auth) – required for user registration/authorization on the exchange
2. [Exchange Service](https://swagger.evedex.com/?urls.primaryName=Exchange) – required for interacting with the exchange

## Async API

Asynchronous exchange events are delivered using the [Centrifugo](https://centrifugal.dev/) service, which provides the following features on top of the standard WS protocol:

* Message channels
* JWT-based channel access rights
* Epochs and state recovery in case of connection loss to the server

## Snapshot updates

To maintain data consistency on the client, the "Initial snapshot with real-time updates" approach is used. First, the client subscribes to asynchronous state updates of an entity via the WS protocol, then it requests the initial state of the entity using the REST API, and finally, the entity state is merged into a final state using the latest `updatedAt`.

## Crypto

To confirm the user’s intent when submitting orders to the exchange, a cryptographic signature is used based on the [EIP-712: Ethereum typed structured data hashing and signing](https://eips.ethereum.org/EIPS/eip-712) standard.

Each order must be accompanied by a `signature` field containing a signature of the order made with the user's crypto wallet. The exchange will reject any user order if:

1. The signature is missing
2. The signature format does not comply with EIP-712
3. The signature was made with a wallet not belonging to the sender
4. The data in the order differs from that used during signature creation

It is recommended to use the [Ethers](https://docs.ethers.org/v6/) library and its [Signer.signTypedData](https://docs.ethers.org/v6/api/providers/#Signer-signTypedData) method, or any similar library that implements typed data signing according to the EIP-712 standard.

Schema description for generating a signature:

* Use the [following structure](https://github.com/evedex-official/exchange-crypto/blob/master/src/utils/crypto.ts#L5-L9) for `domain`.
* Use the appropriate [data structure](https://github.com/evedex-official/exchange-crypto/blob/master/src/utils/crypto.ts#L10-L82) for `types` - for example, use [this schema](https://github.com/evedex-official/exchange-crypto/blob/master/src/utils/crypto.ts#L16) for signing a new limit order, and [this one](https://github.com/evedex-official/exchange-crypto/blob/master/src/utils/crypto.ts#L50-L58) for a position close request.
* Use the transformed order data as the data to be signed.

**Important:** Order data must not contain floating-point numbers when generating the signature. You must transform the data passed to the `signTypedData` method so that all floating-point values are converted to integers using the following formula:\
`normalizeNumber = Round(floatValue * 10 ^ 8, HalfUp)`\
This formula applies everywhere except for withdrawal requests from the trading balance, where rounding must always be done as `Down`.

Examples of order preparation and signing can be [found here](https://github.com/evedex-official/exchange-crypto/blob/master/src/index.ts)

<details>

<summary>Example of signature generation using GoLang libraries</summary>

```go
import (
    "github.com/ethereum/go-ethereum/signer/core/apitypes"
    "github.com/ethereum/go-ethereum/crypto"
    "math/big"
)

domain := apitypes.TypedDataDomain{
    Name:              "MyDapp",
    Version:           "1",
    ChainId:           big.NewInt(1),
    VerifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
}

typedData := apitypes.TypedData{
    Types: apitypes.Types{
        "Mail": {
            {Name: "from", Type: "Person"},
            {Name: "to", Type: "Person"},
            {Name: "contents", Type: "string"},
        },
        "Person": {
            {Name: "name", Type: "string"},
            {Name: "wallet", Type: "address"},
        },
    },
    PrimaryType: "Mail",
    Domain:      domain,
    Message: map[string]interface{}{
        "from": map[string]interface{}{
            "name":   "Alice",
            "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
        },
        "to": map[string]interface{}{
            "name":   "Bob",
            "wallet": "0xaBbACaBaa0000000000000000000000000000000",
        },
        "contents": "Hello, Bob!",
    },
}

hash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message)
domainSeparator, _ := typedData.HashDomain()

finalHash := crypto.Keccak256(
    []byte("\x19\x01"),
    domainSeparator,
    hash,
)

privateKey, _ := crypto.HexToECDSA("your_private_key")
signature, _ := crypto.Sign(finalHash, privateKey)
```

</details>

## Rate limits

The exchange API enforces the following operational limits:

* A single account can have up to **500 active regular orders**.
* A single account can have up to **500 active TP/SL (take-profit/stop-loss) orders**.
* The **minimum order notional** is **5 USD** (orders below this value are rejected).
* There is a **rate limit of 30 heavy requests per 60 seconds** per account. Heavy requests include:
  * order creation
  * order cancellation
  * order repalcement
  * position closure
  * TP/SL creation
  * TP/SL cancellation
  * TP/SL replacement
  * withdrawal request


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.evedex.com/developers/developers/toolkit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
