> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gains.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# IUpdatePositionSizeUtils

*Interface for position size updates*

## PositionSizeUpdateInitiated

```solidity theme={null}
event PositionSizeUpdateInitiated(struct ITradingStorage.Id orderId, address trader, uint256 pairIndex, uint256 index, bool isIncrease, uint256 collateralDelta, uint256 leverageDelta)
```

### Parameters

| Name | Type | Description |
| - | - | - |
| orderId | struct ITradingStorage.Id | request order id |
| trader | address | address of the trader |
| pairIndex | uint256 | index of the pair |
| index | uint256 | index of user trades |
| isIncrease | bool | true if increase position size, false if decrease |
| collateralDelta | uint256 | collateral delta (collateral precision) |
| leverageDelta | uint256 | leverage delta (1e3) |

## PositionSizeIncreaseExecuted

```solidity theme={null}
event PositionSizeIncreaseExecuted(struct ITradingStorage.Id orderId, enum ITradingCallbacks.CancelReason cancelReason, uint8 collateralIndex, address trader, uint256 pairIndex, uint256 index, bool long, uint256 oraclePrice, uint256 collateralPriceUsd, uint256 collateralDelta, uint256 leverageDelta, struct IUpdatePositionSize.IncreasePositionSizeValues values)
```

### Parameters

| Name | Type | Description |
| - | - | - |
| orderId | struct ITradingStorage.Id | request order id |
| cancelReason | enum ITradingCallbacks.CancelReason | cancel reason if canceled or none if executed |
| collateralIndex | uint8 | collateral index |
| trader | address | address of trader |
| pairIndex | uint256 | index of pair |
| index | uint256 | index of trade |
| long | bool | true for long, false for short |
| oraclePrice | uint256 | oracle price (1e10) |
| collateralPriceUsd | uint256 | collateral price in USD (1e8) |
| collateralDelta | uint256 | collateral delta (collateral precision) |
| leverageDelta | uint256 | leverage delta (1e3) |
| values | struct IUpdatePositionSize.IncreasePositionSizeValues | important values (new open price, new leverage, new collateral, etc.) |

## PositionSizeDecreaseExecuted

```solidity theme={null}
event PositionSizeDecreaseExecuted(struct ITradingStorage.Id orderId, enum ITradingCallbacks.CancelReason cancelReason, uint8 collateralIndex, address trader, uint256 pairIndex, uint256 index, bool long, uint256 oraclePrice, uint256 collateralPriceUsd, uint256 collateralDelta, uint256 leverageDelta, struct IUpdatePositionSize.DecreasePositionSizeValues values)
```

### Parameters

| Name | Type | Description |
| - | - | - |
| orderId | struct ITradingStorage.Id | request order id |
| cancelReason | enum ITradingCallbacks.CancelReason | cancel reason if canceled or none if executed |
| collateralIndex | uint8 | collateral index |
| trader | address | address of trader |
| pairIndex | uint256 | index of pair |
| index | uint256 | index of trade |
| long | bool | true for long, false for short |
| oraclePrice | uint256 | oracle price (1e10) |
| collateralPriceUsd | uint256 | collateral price in USD (1e8) |
| collateralDelta | uint256 | collateral delta (collateral precision) |
| leverageDelta | uint256 | leverage delta (1e3) |
| values | struct IUpdatePositionSize.DecreasePositionSizeValues | important values (pnl, new leverage, new collateral, etc.) |

## InvalidIncreasePositionSizeInput

```solidity theme={null}
error InvalidIncreasePositionSizeInput()
```

## InvalidDecreasePositionSizeInput

```solidity theme={null}
error InvalidDecreasePositionSizeInput()
```

## NewPositionSizeSmaller

```solidity theme={null}
error NewPositionSizeSmaller()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.