# Integration

This guide will help you quickly get connected to the TRADE data stream via RabbitMQ.

## **Step 1: Access Credentials**

**Contact Your CSM:** Your dedicated Customer Success Manager (CSM) will provide you with your login credentials (Username, Password, Package ID).

## **Step 2: Enable Distribution**

* **API Request:** You must enable your distribution before starting to consume messages.
* **Request Endpoint:**
  * **Enable:** `https://stm-api.lsports.eu/Distribution/Start`
  * **Disable:** `https://stm-api.lsports.eu/Distribution/Stop`
* **Request Body:**

  ```json
  {
      "PackageId": "YOUR_PACKAGE_ID",
      "UserName": "YOUR_USERNAME",
      "Password": "YOUR_PASSWORD"
  }
  ```
* **Response:**

  ```json
  {
      "Header": {
          "HttpStatusCode": 200 // Or other status code
      },
      "Body": {
          "Message": "Success" // Or other message
      }
  }
  ```

## **Step 3: Establish a Connection**

**RabbitMQ:** LSports uses RabbitMQ for real-time data delivery.

### **Connection Strings:**

{% content-ref url="/pages/YuBPr6CZyTQQhWk3U45q" %}
[RMQ Consumer (PHP)](/u/trade/integration/code-samples/rmq-consumer-php.md)
{% endcontent-ref %}

{% content-ref url="/pages/WFxsm6i2ejTJZANiuLaF" %}
[RMQ Consumer (GO)](/u/trade/integration/code-samples/rmq-consumer-go.md)
{% endcontent-ref %}

{% content-ref url="/pages/Asf7bdTH7nAO8izOhPQd" %}
[RMQ Consumer (Node.js)](/u/trade/integration/code-samples/rmq-consumer-node.js.md)
{% endcontent-ref %}

{% content-ref url="/pages/gHCDqfCEtHyAkeip24Et" %}
[RMQ Consumer (Python)](/u/trade/integration/code-samples/rmq-consumer-python.md)
{% endcontent-ref %}

{% content-ref url="/pages/K0HUjh7x9XMq31hb6GtP" %}
[RMQ Consumer (JavaScript)](/u/trade/integration/code-samples/rmq-consumer-javascript.md)
{% endcontent-ref %}

{% content-ref url="/pages/TUUxfiIPA51PnrsmVqCs" %}
[RMQ Consumer (C#)](/u/trade/integration/code-samples/rmq-consumer-c.md)
{% endcontent-ref %}

### **Connection Setup (Example using C#):**

```csharp
// 1. Create a connection
IConnection connection = _connectionFactory.CreateConnection();

// 2. Create a model
IModel model = connection.CreateModel();

// 3. Configure Quality of Service
model.BasicQos(prefetchSize: 0, prefetchCount: 100, global: false);

// 4. Consume Messages 
EventingBasicConsumer consumer = new EventingBasicConsumer(model);

consumer.Received += (sender, eventArgs) =>
{
    // Deserialize Message
    // Call method to handle deserialized message
};

// 5. Start message consumption (Replace '_102030_' with your Package ID)
model.BasicConsume(queue: '_YOUR_PACKAGE_ID_', noAck: true, consumer: consumer);
```

##

## **Step 4: Data Mapping**

**Lsports Markets:** Ensure your internal market mapping aligns with Lsports' market structure. Use the `GetMarkets` method to obtain a comprehensive list of available markets, or contact your CSM.

## **Step 5: Stress Test**

* **Simulate High-Volume Traffic:** Once your system is running, perform a stress test to simulate high-volume traffic.
* **Schedule with Your CSM:** Contact your CSM or Solution Engineer to schedule a stress test.

## **Step 6: Go Live**

* **Production Readiness:** Once your system is ready, contact your CSM to schedule a go-live date.
* **Production Setup:** We will switch your account from testing to production and set up the ordered quota.

**Congratulations!** You've successfully integrated with TRADE! Now, you're ready to unlock the exciting possibilities of our product and enhance your offerings.

***

## Integration Resources

### Connection & Messaging

* [RabbitMQ Connection Setup](/u/trade/integration/rmq-connection/connection-and-consumption-setup.md)
* [Message Deserializing](/u/trade/integration/rmq-connection/message-deserializing.md)
* [Market/Bet Message Handling](/u/trade/integration/rmq-connection/market-bet-message-handling.md)
* [How to Work with TRADE Feed](/u/trade/integration/rmq-connection/how-to-work-with-trade-feed.md)

### Message Structure

* [Message Types Overview](/u/trade/integration/message-structure/message-types-overview.md)
* [Fixture Messages](/u/trade/integration/message-structure/fixture.md)
* [Market Messages](/u/trade/integration/message-structure/market.md)
* [Livescore Messages](/u/trade/integration/message-structure/livescore.md)
* [Settlement Messages](/u/trade/integration/message-structure/settlement.md)

### APIs

* [Metadata API](/u/trade/integration/apis/metadata.md)
* [Subscription API](/u/trade/integration/apis/subscription.md)
* [Distribution API](/u/trade/integration/apis/distribution.md)
* [ComboBuilder API](/u/trade/combo-builder.md)
* [Snapshot API](/u/trade/integration/apis/snapshot.md)

### SDKs

* [SDK Overview](/u/trade/integration/sdk/sdk-overview.md)
* [.NET SDK](/u/trade/integration/sdk/sdk-installation-guide-.net.md)
* [Java SDK](/u/trade/integration/sdk/sdk-installation-guide-java.md)
* [Node.js SDK](/u/trade/integration/sdk/sdk-installation-guide-nodejs.md)

### Code Samples

* [PHP](/u/trade/integration/code-samples/rmq-consumer-php.md)
* [Go](/u/trade/integration/code-samples/rmq-consumer-go.md)
* [Python](/u/trade/integration/code-samples/rmq-consumer-python.md)
* [Node.js](/u/trade/integration/code-samples/rmq-consumer-node.js.md)
* [C#](/u/trade/integration/code-samples/rmq-consumer-c.md)


---

# Agent Instructions: 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:

```
GET https://docs.lsports.eu/u/trade/integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
