FX cross in Turn Dates in API

Hi team,

Specialist here from Customer Support.

Related to this q&a

Is there a way to retrieve Turn Dates for a specific currency pair directly on Python ? — LSEG Developer Community

there is a specific parameter if you want to calculate CCy1 or CCy2 which is then discussed in this guide:

developers.lseg.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis/documentation/manuals-and-guides/ipa-financial-contracts/ipa-financialc-contracts-fx-cross-contracts#output_TurnsArray

So if the pair is EURUSD, we use TurnsCcy1Array. If the pair is USDCZK, we use TurnsCcy2Array


IF the pair we want to use is EURGBP, the FWDS app in Workspace calculates the turn dates by EURUSD and GBPUSD (Separate tables). The question is, can we combine both TurnsCcy1Array and TurnsCcy2Array in a single code?

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @HannaCP

    Thank you for reaching out to us.

    Can you share the request message used in the https://api.refinitiv.com/data/quantitative-analytics/v1/financial-contracts endpoint?

    Then, I can convert it to the Python code.

  • Hi Jirapongse!

    Sorry I only have this from Codebook

    import refinitiv.data as rdp
    from refinitiv.data.content.ipa.financial_contracts import cross
    rdp.open_session()

    response = cross.Definition(
    instrument_tag="Fx-Forward",
    fx_cross_type=cross.FxCrossType.FX_FORWARD,
    fx_cross_code="USDCZK",
    legs=[
    cross.LegDefinition(end_date="2026-10-01")
    ],
    pricing_parameters=cross.PricingParameters(
    valuation_date="2025-08-18"),
    extended_params={
    "marketData":{
    "fxSwapPoints":[
    {
    "curveDefinition":{
    "fxCrossCode":"USDCZK"
    },
    "curveParameters":
    {
    "turnsCalibration":"Month-ends",
    "UserTurnDates":["2025-08-01"]
    }
    }
    ]
    }
    },
    fields=[
    "TurnsCcy2Array",

    ]).get_data()
    response.data.raw

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    You need to contact the Instrument Pricing Analytics - Delivery Platform support team directly via LSEG Support to obtain the request message used with the financial-contracts endpoint to retrieve the required data.

  • Thank you Jirapongse, can you convert this one to API code then? I got a sample from the same endpoint you indicated, thanks!

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @HannaCP

    The request message contains few pricing parameters which are not available in the cross.PricingParameters class.

    Therefore, to use the request message with the EndPoint interface in the LSEG Data Library for Python. The code looks like this.

    import lseg.data as ld
    from lseg.data.delivery import endpoint_request
    ld.open_session()
    
    financial_contracts_url = '/data/quantitative-analytics/v1/financial-contracts'
    
    request = {
      "fields": [
        "InstrumentTag",
        "ValuationDate",
        "StartDate",
        "EndDate",
        "Tenor",
        "NonAdjustedStartDate",
        "NonAdjustedEndDate",
        "StartDateAdjustmentFlag",
        "EndDateAdjustmentFlag",
        "SpotDecimals",
        "SpotDecimalsCcy1",
        "SpotDecimalsCcy2",
        "FxSwapPointScalingFactor",
        "FxSpot_BidMidAsk",
        "FxSpotCcy1_BidMidAsk",
        "FxSpotCcy2_BidMidAsk",
        "FxSwapsCcy1_BidMidAsk",
        "FxSwapsCcy2_BidMidAsk",
        "FxSwapsCcy1Ccy2_BidMidAsk",
        "FxOutrightCcy1Ccy2_BidMidAsk",
        "TurnsCcy1Array",
        "TurnsCcy2Array",
        "Ccy1SpotDate",
        "Ccy2SpotDate",
        "ErrorMessage"
      ],
      "outputs": [
        "Data",
        "Statuses",
        "Headers"
      ],
      "universe": [
        {
          "instrumentType": "FxCross",
          "instrumentDefinition": {
            "instrumentTag": "standardperiods",
            "fxCrossCode": "EURGBP",
            "fxCrossType": "FxMultileg",
            "legs": [
              {
                "tenor": "ON"
              },
              {
                "tenor": "TN"
              },
              {
                "tenor": "SN"
              },
              {
                "tenor": "SW"
              },
              {
                "tenor": "2W"
              },
              {
                "tenor": "3W"
              },
              {
                "tenor": "1M"
              },
              {
                "tenor": "2M"
              },
              {
                "tenor": "3M"
              },
              {
                "tenor": "4M"
              },
              {
                "tenor": "5M"
              },
              {
                "tenor": "6M"
              },
              {
                "tenor": "7M"
              },
              {
                "tenor": "8M"
              },
              {
                "tenor": "9M"
              },
              {
                "tenor": "10M"
              },
              {
                "tenor": "11M"
              },
              {
                "tenor": "1Y"
              },
              {
                "tenor": "15M"
              },
              {
                "tenor": "18M"
              },
              {
                "tenor": "21M"
              },
              {
                "tenor": "2Y"
              }
            ]
          },
          "pricingParameters": {
            "valuationDate": "2025-08-19"
          }
        },
        {
          "instrumentType": "FxCross",
          "instrumentDefinition": {
            "fxCrossCode": "EURGBP",
            "fxCrossType": "FxForward",
            "legs": [
              {
                "startTenor": "0D",
                "tenor": "1M15D"
              }
            ],
            "instrumentTag": "brokendates-0-fxSwap"
          },
          "pricingParameters": {
            "valuationDate": "2025-08-19",
            "adjustAllSwapPointsToCrossCalendars": False
          }
        },
        {
          "instrumentType": "FxCross",
          "instrumentDefinition": {
            "fxCrossCode": "EURGBP",
            "fxCrossType": "FxForward",
            "legs": [
              {
                "startTenor": "0D",
                "tenor": "90D"
              }
            ],
            "instrumentTag": "brokendates-1-fxSwap"
          },
          "pricingParameters": {
            "valuationDate": "2025-08-19",
            "adjustAllSwapPointsToCrossCalendars": False
          }
        },
        {
          "instrumentType": "FxCross",
          "instrumentDefinition": {
            "fxCrossCode": "EURGBP",
            "fxCrossType": "FxForward",
            "legs": [
              {
                "startTenor": "0D",
                "tenor": "3M"
              }
            ],
            "instrumentTag": "brokendates-2-fxSwap"
          },
          "pricingParameters": {
            "valuationDate": "2025-08-19",
            "adjustAllSwapPointsToCrossCalendars": False
          }
        },
        {
          "instrumentType": "FxCross",
          "instrumentDefinition": {
            "fxCrossCode": "EURGBP",
            "fxCrossType": "FxForward",
            "legs": [
              {
                "startTenor": "0D",
                "tenor": "7M"
              }
            ],
            "instrumentTag": "brokendates-3-fxSwap"
          },
          "pricingParameters": {
            "valuationDate": "2025-08-19",
            "adjustAllSwapPointsToCrossCalendars": False
          }
        },
        {
          "instrumentType": "FxCross",
          "instrumentDefinition": {
            "fxCrossCode": "EURGBP",
            "fxCrossType": "FxForward",
            "legs": [
              {
                "startTenor": "3M",
                "tenor": "6M"
              }
            ],
            "instrumentTag": "brokendates-4-fxSwap"
          },
          "pricingParameters": {
            "valuationDate": "2025-08-19",
            "adjustAllSwapPointsToCrossCalendars": False,
            "preSpotEndTenorReferenceDate": "StartDate",
            "endTenorReferenceDate": "SpotDate"
          }
        }
      ],
      "marketData": {
        "fxSpots": [
          {
            "spotDefinition": {
              "fxCrossCode": "EURUSD",
              "source": "Composite"
            }
          },
          {
            "spotDefinition": {
              "fxCrossCode": "GBPUSD",
              "source": "Composite"
            }
          },
          {
            "spotDefinition": {
              "fxCrossCode": "EURGBP",
              "source": "Calculated"
            }
          }
        ],
        "fxSwapPoints": [
          {
            "curveDefinition": {
              "fxCrossCode": "EURUSD",
              "source": "Composite"
            },
            "curveParameters": {
              "twoLayersTurnsCalculation": True,
              "excludeLongPeriods": True,
              "turnsCalibration": "Month-ends"
            }
          },
          {
            "curveDefinition": {
              "fxCrossCode": "GBPUSD",
              "source": "Composite"
            },
            "curveParameters": {
              "twoLayersTurnsCalculation": True,
              "excludeLongPeriods": True,
              "turnsCalibration": "Month-ends"
            }
          },
          {
            "curveDefinition": {
              "fxCrossCode": "EURGBP"
            },
            "curveParameters": {
              "excludeLongPeriods": True,
              "interpolationMode": "Linear"
            }
          }
        ]
      }
    }
    
    request_definition = endpoint_request.Definition(
        method = ld.delivery.endpoint_request.RequestMethod.POST,
        url = financial_contracts_url,
        body_parameters = request
    )
    response = request_definition.get_data()
    response.data.raw
    
  • NicolasC
    NicolasC Newcomer

    Hello,

    I am working on this script. I am not having the good output.

    Should I get EURGBP swap points for month ends ?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @NicolasC

    Please contact the owner of the submitted case to verify the output and request message.