# Configuration

This topic describes the configuration options for the Barracuda Order Adapter.

## Editing the configuration file

On deployment, the adapter’s configuration file is copied to the Deployment Framework directory: `<framework-root>/global_config/overrides/BarracudaOrderAdapter/etc/Adapter.conf`.

Any customisations you make to the configuration file will be retained on upgrading the adapter if you follow the steps outlined in [Upgrading the Barracuda Order Adapter](barracuda-upgrading-the-barracuda-order-adapter.md).

## Configuration reference

The Barracuda Order Adapter’s configuration file is written in [Human Optimised Config Object Notation](https://github.com/lightbend/config/blob/master/HOCON.md) (HOCON).

Configuration stanzas:

* [barracuda](#barracuda)
* [broker](#broker)
* [datebounds](#datebounds)
* [notifications](#notifications)
* [orderStateActions](#orderstateactions)
* [precision](#orderstateactions)
* [serverTimezone](#servertimezone)
* [strategy](#strategy)
* [timezoneMappings](#timezonemappings)

### barracuda

Host and port of the Barracuda Order Management System.

Example configuration:

```
barracuda {
  host = "89.101.155.13:5279"
  messageport = 5295
}
```

### broker

Barracuda Order Management System connection credentials.

Example configuration:

```
broker {
  username = "the username"
  password = "the password"
}
```

### datebounds

Limits the age of orders displayed in client blotters:

* `dateBounds.cancelRejectedOrders.lowerbound` limits the display of cancelled and rejected orders to orders that were cancelled or rejected within the previous `lowerbound` days.
* `dateBounds.expiredOrders.lowerbound` limits the display of expired orders to orders that expired within the previous `lowerbound` days.
* `dateBounds.filledOrders.lowerbound` limits the display of filled orders to orders that were filled within the previous `lowerbound` days.

Example configuration:

```
datebounds {
  cancelRejectedOrders {
    lowerbound: 30
  },
  expiredOrders {
    lowerBound: 30
  },
  filledOrders {
    lowerBound: 30
  }
}
```

### notifications

A list of statuses that trigger notifications.

Valid statuses:

* "Active"
* "Cancelling"
* "Cancelled"
* "Completed"
* "Expired"
* "Rejected"
* "Pending Acceptance"
* "Partial-Filled"
* "Accepted"
* "Pending Modify"
* "Filled"
* "Priced"
* "Saved"
* "Pricing"
* "Fill Error"
* "Fill Expired"
* "Gamma Mid Pending"
* "None"
* "Failed"
* "Unknown"

Example configuration:

```
notifications {
  statuses = [
    "Cancelled",
    "Filled",
    "Completed",
    "Expired",
    "Rejected",
    "Partial-Filled"
  ]
}
```

### orderStateActions

Defines the actions available for zero or more order states. By default, no actions are available for an order state.

There are two possible actions at each order state. One or both actions may be specified.

* "Edit" (recognised by single-leg orders; ignored by multi-leg orders)
* "Cancel"

Order states that you may define available actions for are listed below:

* NONE
* MODIFY_ACCEPTANCE_NEEDED
* CANCEL_ACCEPTANCE_NEEDED
* IN_MODIFICATION
* MANUAL_PRICING
* DELETED
* PENDING
* PRICED
* SAVED
* ACTIVE
* FILLED
* CANCELLED
* EXPORTED
* TRIGGERED
* CREDIT_CHECKING
* DI_NEEDED
* ACCEPTANCE_NEEDED
* REJECTED
* PRICING
* FILL_ERROR
* FILL_EXPIRED
* PENDING_CANCELLATION
* DI_APPROVED
* GAMMA_MID_PENDING
* MIGRATION_ACCEPTANCE_NEEDED
* ENTRYPRICING
* SUSPENDED

Example configuration:

```
orderStateActions {
    PENDING:                     {actions: ["Edit","Cancel"]},
    MODIFY_ACCEPTANCE_NEEDED:    {actions: ["Edit","Cancel"]},
    ACCEPTANCE_NEEDED:           {actions: ["Cancel"]},
    MIGRATION_ACCEPTANCE_NEEDED: {actions: ["Edit","Cancel"]},
    CANCEL_ACCEPTANCE_NEEDED:    {actions: ["Edit","Cancel"]},
    PENDING_CANCELLATION:        {actions: ["Edit","Cancel"]},
    ACTIVE:                      {actions: ["Edit","Cancel"]},
}
```

### precision

Configures the Barracuda Adapter’s default precision manager ([`com.caplin.orders.barracuda.extension.PrecisionManager`](https://docs.caplin.com/developer/api/barracuda_order_adapter/latest/com/caplin/orders/barracuda/extension/PrecisionManager.html)). Precision managers supply decimal precision and pip-conversion multipliers for currency pairs.

**📌 NOTE**\
The recommended way to manage precision is to write your own precision manager. This provides more flexibility than configuring the default precision manager. For more details, see [Customising the Barracuda Order Adapter](barracuda-customising-the-barracuda-order-adapter.md).

The role of a precision manager is to provide the following information for the spot rate of any given currency pair:

* The number of decimal places to round the currency pair’s spot rate to
* The multiplier, expressed as a power of 10, to convert a difference in the currency pair’s spot rate from a decimal value to [price interest points](https://en.wikipedia.org/wiki/Percentage_in_point) (pips).

  For example, if the currency pair EURGBP has a multiplier of 4, then a difference of 0.0002 EURGBP equates to $0.0002 xx 10^4 = 2$ pips.

The tables below define the specification of the `precision` configuration object:

**Precision object**

| Property | Type | Description |
| --- | --- | --- |
| default | Object | Default configuration values. Used by the precision manager if values specific to a currency pair cannot be found. See [precision-default](#precision-default) below. |
| ccypair | Array of objects | Configuration values for specific currency pairs. See [precision-ccypair](#precision-ccypair) below. |

**Precision.default object**

| Property | Type | Description |
| --- | --- | --- |
| spot_rate_pip_multiplier | Integer | Multiplier, expressed as a power of 10, to convert a price difference from a decimal value to pips. |
| spot_rate_dps | Integer | Number of decimal places to round spot rate values to. |

**Precision.ccypair array elements**

| Property | Type | Description |
| --- | --- | --- |
| currency_pair | String | Six character currency-pair code. For example, `EURUSD`. |
| spot_rate_pip_multiplier | Integer | Multiplier, expressed as a power of 10, to convert a price difference from a decimal value to pips. |
| spot_rate_dps | Integer | Number of decimal places to round spot rate values to. |
| invert_spot_rate_pip_multiplier | Integer | Optional shorthand to configure the inverse of this currency pair. Multiplier, expressed as a power of 10, to convert a price difference from a decimal value to pips. |
| invert_spot_rate_dps | Integer | Optional shorthand to configure the inverse of this currency pair. Number of decimal places to round spot rate values to. |

Example configuration:

```
precision {
  default: {
    spot_rate_pip_multiplier=4,
    spot_rate_dps=5
  }
  ccypair: [
    {
      currency_pair=EURUSD,
      spot_rate_pip_multiplier=3,
      spot_rate_dps=4,
      invert_spot_rate_pip_multiplier=6,
      invert_spot_rate_dps=7
    },
    {
      currency_pair=USDJPY,
      spot_rate_pip_multiplier=2,
      spot_rate_dps=3,
      invert_spot_rate_pip_multiplier=6,
      invert_spot_rate_dps=7
    },
    {
      currency_pair=EURJPY,
      spot_rate_pip_multiplier=2,
      spot_rate_dps=3,
      invert_spot_rate_pip_multiplier=6,
      invert_spot_rate_dps=7
    }
  ]
}
```

### serverTimezone

The time zone in which to display Activation Date and Expiration Date values in an order blotter. Takes a valid [tz-database time zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

We recommend that you set `serverTimezone` to the time zone of your Barracuda server.

Example configuration:

```
serverTimezone = "Europe/London"
```

### strategy

Defines whether the account, the activation date, and the expiration date should be defined per strategy or per leg.

Example configuration:

```
strategy {
  account_per_leg = false
  activation_date_per_leg = false
  expiration_date_per_leg = false
}
```

### timezoneMappings

Maps non-tz-database time zone strings to valid tz-database time zone strings. Use this if your front-end uses non-tz-database strings.

For a list of valid tz-database time zone strings, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

Example configuration:

```
timezoneMappings {
    "America/New York": "America/New_York",
    "Europe/Milan": "Europe/Rome",
    "London": "Europe/London"
}
```
