{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://api-evangelist.github.io/deribit/json-schema/transaction_log.json",
  "title": "Transaction Log",
  "properties": {
    "id": {
      "$ref": "#/components/schemas/id"
    },
    "currency": {
      "$ref": "#/components/schemas/currency"
    },
    "timestamp": {
      "$ref": "#/components/schemas/timestamp"
    },
    "user_id": {
      "$ref": "#/components/schemas/user_id"
    },
    "username": {
      "$ref": "#/components/schemas/username"
    },
    "commission": {
      "$ref": "#/components/schemas/commission"
    },
    "cashflow": {
      "type": "number",
      "description": "For futures and perpetual contracts: Realized session PNL (since last settlement). For options: the amount paid or received for the options traded."
    },
    "balance": {
      "type": "number",
      "description": "Cash balance after the transaction"
    },
    "change": {
      "type": "number",
      "description": "Change in cash balance. For trades: fees and options premium paid/received. For settlement: Futures session PNL and perpetual session funding."
    },
    "user_seq": {
      "type": "integer",
      "description": "Sequential identifier of user transaction"
    },
    "type": {
      "type": "string",
      "description": "Transaction category/type. The most common are: `trade`, `deposit`, `withdrawal`, `settlement`, `delivery`, `transfer`, `swap`, `correction`. New types can be added any time in the future"
    },
    "info": {
      "type": "object",
      "description": "Additional information regarding transaction. Strongly dependent on the log entry type"
    },
    "equity": {
      "type": "number",
      "description": "Updated equity value after the transaction"
    },
    "mark_price": {
      "type": "number",
      "description": "Market price during the trade"
    },
    "settlement_price": {
      "type": "number",
      "description": "The settlement price for the instrument during the delivery"
    },
    "index_price": {
      "type": "number",
      "description": "The index price for the instrument during the delivery"
    },
    "instrument_name": {
      "$ref": "#/components/schemas/instrument_name"
    },
    "position": {
      "type": "number",
      "description": "Updated position size after the transaction"
    },
    "side": {
      "type": "string",
      "description": "One of: `short` or `long` in case of settlements, `close sell` or `close buy` in case of deliveries, `open sell`, `open buy`, `close sell`, `close buy` in case of trades"
    },
    "amount": {
      "type": "number",
      "description": "It represents the requested order size. For perpetual and inverse futures the amount is in USD units. For options and linear futures it is the underlying base currency coin."
    },
    "price": {
      "type": "number",
      "description": "Settlement/delivery price or the price level of the traded contracts"
    },
    "price_currency": {
      "type": "string",
      "description": "Currency symbol associated with the `price` field value"
    },
    "trade_id": {
      "$ref": "#/components/schemas/trade_id"
    },
    "order_id": {
      "$ref": "#/components/schemas/order_id"
    },
    "user_role": {
      "$ref": "#/components/schemas/role"
    },
    "fee_role": {
      "$ref": "#/components/schemas/fee_role"
    },
    "profit_as_cashflow": {
      "type": "boolean",
      "description": "Indicator informing whether the cashflow is waiting for settlement or not"
    },
    "interest_pl": {
      "type": "number",
      "description": "Actual funding rate of trades and settlements on perpetual instruments"
    },
    "block_rfq_id": {
      "type": "integer",
      "description": "ID of the Block RFQ - when trade was part of the Block RFQ"
    },
    "ip": {
      "type": "string",
      "description": "The IP address from which the trade was initiated"
    },
    "session_rpl": {
      "$ref": "#/components/schemas/rpl"
    },
    "session_upl": {
      "$ref": "#/components/schemas/upl"
    },
    "total_interest_pl": {
      "type": "number",
      "description": "Total session funding rate"
    },
    "contracts": {
      "$ref": "#/components/schemas/contracts"
    }
  },
  "required": [
    "id",
    "currency",
    "timestamp",
    "user_id",
    "commission",
    "cashflow",
    "balance",
    "change",
    "user_seq",
    "type"
  ],
  "type": "object"
}