# Market Data

## Spot rates

### Subscribe rates

Subscribe to a stream of real-time spot rates for a given symbol. In response this channel sends an aggregated list of rates, which may include prices from multiple liquidity providers or external market data sources.

> Subscribe rates request example



```json
{ "rateSubscriptions":
    [ { "symbol":"EUR/USD",
        "type":"RAW",
        "org":"pfOrg"
        "requestId":1
        "tiers":[1000000,2000000.0,3000000.0]
      }
    ]
}
```

> Request body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string: (required)** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `requestId` | **string: (required)** ID assigned by you to your request, returned in the response. |
| `type` | **string:** The type of rates requested: `RAW`: Raw rates, `FULL`: Full book, `TOB`: Top of book, `VWAP`: Value-weighted average price. |
| `org` | **string:** Organization ID. If specified, then rates are sourced from the liquidity providers configured for this org. If not specified, rates are sourced from preconfigured liquidity providers. |
| `tiers` | **string:** Price tier amounts. Conditional: Applicable when `type=VWAP`. |


> Subscribe rates response example



```json
{ "rateSubscriptionsResponses":
    [ { "request":
        { "symbol":"EUR/USD",
          "type":"RAW",
          "requestId":1
        },
        "status":"success"
      }
    ]
}
```

> Response body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `type` | **string:** The type of rates requested: `RAW`: Raw rates, `FULL`: Full book, `TOB`: Top of book, `VWAP`: Value-weighted average price. |
| `requestId` | **string:** ID assigned by you to your request, returned in the response. |
| `status` | **string:** The status of the request. |


> Returns


> Rate example



```json
{ "rate": 
  { "symbol": "EUR/USD",
    "bid": [1.18631],
    "offer": [1.18639],
    "bidLimit": [1000000.0],
    "offerLimit": [1000000.0],
    "bidProviders": ["LP1","LP2","LP3"],
    "offerProviders": ["LP2","LP3","LP1"],   
    "time": 1604046862425,
    "requestId": 1
  }
}
```

| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `bid` | **array [double]:** Bid rate. |
| `offer` | **array [double]:** Offer rate. |
| `bidLimit` | **array [double]:** Bid size in base. |
| `offerLimit` | **array [double]:** Offer size in base. |
| `bidProviders` | **array [double]:** Bid price providers. Applies when `type=RAW` on the request. |
| `offerProviders` | **array [string]:** Offer price providers. Applies when `type=RAW` on the request. |
| `time` | **int:** Rate timestamp in milliseconds since the Unix epoch in the UTC timezone. |


### Unsubscribe rates

Unsubscribe from a real-time rate stream.

> Unsubscribe rates request example



```json
{ "rateUnsubscriptions":
    [ { "requestId":1
      }
    ]
}
```

> Request body


| Attribute  | Description |
|  --- | --- |
| `requestId` | **string: (required)** ID assigned by you to your request, returned in the response. |


> Unsubscribe rates response example



```json
{ "rateUnsubscriptionsResponses":
    [ { "request":
        { "requestId":1
        },
        "status":"success"
      }
    ]
}
```

> Response body


| Attribute  | Description |
|  --- | --- |
| `requestId` | **string:** ID assigned by you to your request, returned in the response |
| `status` | **string:** The status of the request. |


## Benchmark rates

### Subscribe benchmark

Subscribe to a stream of benchmark rates for a symbol and price source. Returns Benchmark Rate or Grid Mid Rate.

> Subscribe benchmark rates request example



```json
{ "fxbenchmarkSubscriptions":[{ 
    "symbol":"AUD/CAD",
    "priceSource":"FXB"
    }]
}
```

> Request body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string: (required)** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `priceSource` | **string:** The price source: `FXB`: Benchmark, `GMR`: Grid mid rate. If not specified, the default `FXB` is used. |


> Subscribe benchmark rates response example



```json
{ "fxbenchmarkSubscriptionResponses":[{
    "request":{ 
      "symbol":"AUD/CAD",
      "priceSource":"FXB"
    },
  "status":"success"
  }]
}
```

> Response body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `type` | **string:** The price source of the benchmark. |
| `status` | **string:** The status of the request. |


> Returns


> Benchmark rate example



```json
{ "fxbenchmark":
    { "currencyPair":"AUD/CAD",
      "rate":1.18842,
      "guid":"G-4796976cd-171343c4903-FXB-d7ba48",
      "timestamp":1585719298307
    }
}
```

> Mid rate example



```json
{ "gridmidrate":
    { "currencyPair":"AUD/CAD",
      "rate":1.18842,
      "guid":"G-4796976cd-171343c4903-FXB-d7ba48",
      "timestamp":1585719298307
    }
}
```

| Attribute  | Description |
|  --- | --- |
| `currencyPair` | **string:** Currency pair in the format `base`/`term`. |
| `priceSource` | **double:** The rate. |
| `guid` | **string:** Unique ID of the rate. |
| `timestamp` | **integral:** The timestamp of the rate in milliseconds (Unix time). |


### Unsubscribe benchmark

Unsubscribe from a stream of benchmark rates for a symbol and price source.

> Unsubscribe benchmark rates request example



```json
{ "fxbenchmarkUnsubscriptions":
    [ { "symbol":"AUD/CAD",
        "priceSource":"FXB"
      }
   ]
}
```

> Request body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string: (required)** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `priceSource` | **string** The price source: `FXB`: Benchmark, `GMR`: Grid mid rate. If not specified, the default `FXB` is used. |


> Unsubscribe benchmark rates response example



```json
{ "fxbenchmarkUnsubscriptionResponses":
    [ { "request":
          { "symbol":"AUD/CAD",
            "priceSource":"FXB"
          },
        "status":"success"
      }
    ]
}
```

> Response body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `priceSource` | **string:** The price source: FXB: BenchmarkGMR: Grid mid rate |
| `status` | **string:** The status of the request. |


## Ticker

### Subscribe ticker

Subscribe to a stream of last-traded prices for a symbol. Returns Trade Ticker.

> Subscribe ticker request example



```json
{ "tradeTickerSubscriptions":
  [ {"symbol":"EUR/USD"}
  ]
}
```

> Request body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string: (required)** Base and term currency separated by a dash "-" (for example `EUR/USD` or `GER30-USD`). |


> Subscribe ticker response example



```json
{ "tradeTickerSubscriptionResponses":
  [ { "request":
      { "symbol":"EUR/USD"
      },
      "status":"success"
    }
  ]
}
```

> Response body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `status` | **string:** The status of the request. |


> Ticker example



```json
{ "tradeticker":
  { "symbol":"AUD/CAD",
    "rate":1.18842,
    "isBid":true,
    "time":1585719298307
  }
}
```

> Returns


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Currency pair in the format `base`/`term`. |
| `rate` | **double:** The rate at which the trade was done. |
| `isBid` | **boolean:** `true`=Trade rate is bid, `false`=Trade rate is offer. |
| `time` | **string:** TThe timestamp of the trade in milliseconds (Unix time). |


### Unsubscribe ticker

Unsubscribe from a stream of last traded prices on this venue for a symbol.

> Unsubscribe ticker request example



```json
{ "tradeTickerUnsubscriptions":
  [ { "symbol":"EUR/USD"
    }
  ]
}
```

> Request body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string: (required)** Base and term currency separated by a slash "/" (for example `EUR/USD`). |


> Unsubscribe ticker response example



```json
{ "tradeTickerUnsubscriptionResponses":
  [ { "request":
      {
        "symbol":"EUR/USD"
      },
      "status":"success"
    }
  ]
}
```

> Response body


| Attribute  | Description |
|  --- | --- |
| `symbol` | **string:** Base and term currency separated by a slash "/" (for example `EUR/USD`). |
| `status` | **string:** The status of the request. |