Skip to main content

Curve Service

The curve resource contains all your managed forward curve configurations

Curve REST API

The Curve REST API is a full CRUD API allowing you to search and filter curve configurations and build information.

It is accessed through the following URL:

https://api.opendatadsl.com/api/curve

The API is broken into these sections:

  • info - curve management configuration
  • build - curve build information
  • group - curve group information

General

MethodPathExampleDescription
GETGet the build information for this service

Curve info API

MethodPathExampleDescription
GET{release}/infov1/infoList all the curve management configurations
GET{release}/info/{key}v1/info/TEST:CURVERetrieve a single curve configuration using it’s unique id
PUT{release}/info/tag/{tag}v1/info/tag/PRODTag multiple curves with the same tag - body is a list of curve ids
POST{release}/infov1/infoCreate or update a curve configuration, the curve configuration is the JSON body of the POST request
POST{release}/info/{curve}v1/info/TEST:CURVEManage a curve - no json body, info is generated from the real curve
DELETE{release}/info/{key}v1/info/TEST:CURVEDelete (unmanage) a curve configuration

Curve build API

MethodPathExampleDescription
GET{release}/buildv1/buildList all the curve build information for the current ondate
GET{release}/build/{key}v1/build/TEST:CURVE:2024-06-12Retrieve a single curve build information for the specified ondate
GET{release}/build/{ondate}v1/build/2024-06-12List all curve build information for the specified ondate
POST{release}/buildv1/buildUpdate build information, the curve build information is the JSON body of the POST request - used for updates from external build applications
DELETE{release}/build/{key}v1/build/TEST:CURVE:2024-06-12Delete the curve build information

Group API

The curve management group API contains an extra url path section called type - referring to the group type, one of:

  • build
  • quality
  • approval
  • export
MethodPathExampleDescription
GET{release}/group/{type}v1/group/buildList all the groups of the supplied type
GET{release}/group/{type}/{key}v1/group/build/defaultRetrieve a group
PUT{release}/group/{type}/{key}v1/group/build/defaultAdd curves to this group, body is an array of curve ids
POST{release}/group/{type}v1/group/buildCreate/Update group information, the group information is the JSON body of the POST request
DELETE{release}/group/{type}/{key}v1/group/build/defaultDelete the named group

Curve Approval API

This API is used to approve/unapprove curves

MethodPathExampleDescription
GET{release}/approval/{ondate}v1/approval/2024-06-12List all the curves I need to approve for the supplied ondate
POST{release}/approvalv1/approvalApprove curves, body is an array of either string ids or objects with {curve, message}
POST{release}/rejectionv1/rejectionUnapprove curves, body is an array of either string ids or objects with {curve, message}

Curve management entities

Curve management Configuration

NameDescriptionType
_idUnique id for the curve configurationString
_typeThe type of the curveString
childrenThe list of child curvesList
parentsThe list of parent curvesList
nameThe name of the curveString
descriptionThe description of the curveString
buildGroupThe name of the build group this curve belongs toString
qualityGroupThe name of the quality group this curve belongs toString
approvalGroupThe name of the approval group this curve belongs toString
exportGroupsThe names of the export groups this curve belongs toList

Curve build information

NameDescriptionType
_idUnique id for the curve build information (obj:curve:date)String
curveThe curve management idString
ondateThe curve build ondateString
messageThe status messageString
scoreA number representing the score for the day 4=No Issues, 3=Failed Checks, 2=Curve was substituted, 1=Curve Failed, 0=HolidayInteger
scoreInfoInfo about the scoreString
statusAn object of status information approval/build/qualityString
timestampThe last time this build was updatedString
timelineA log of all actions taken on this buildList
buildsA list of all the build attempts for this curveObject(build)
lastBuildIdThe id of the last build attemptString
checksA list of the quality checks performedObject(check)

Curve build group

NameDescriptionType
typeAlways 'build'String
nameUnique name for the curve build groupString
descriptionDescription of this groupString
cronThe cron expression defining the cut-off time for curves in this groupCron String
offsetThe day offset from the cron to the ondate (0=same day, -1=previous day)Integer
useLatestA boolean indicating to use the latest valid build, false indicates to use the script instead to generate a substitute curveBoolean
scriptThe ODSL script name to use if useLatest=falseString
calendarThe holiday calendar for the curvesString
timezoneThe timezone of the curvesString

Curve quality group

NameDescriptionType
typeAlways 'quality'String
nameUnique name for the curve quality groupString
descriptionDescription of this groupString
scriptThe name of the script containing the checks to performString
checksA list of check functions to run - objects as {expression,name}List(Object)

Curve approval group

NameDescriptionType
typeAlways 'approval'String
nameUnique name for the curve approval groupString
descriptionDescription of this groupString
approversA list of user emails that can approve these curvesList(String)
versionA name to tag the curve version with after being approvedString

Curve export group

NameDescriptionType
typeAlways 'export'String
nameUnique name for the curve export groupString
descriptionDescription of this groupString
cronThe cron expression defining when to run the export group scriptCron String
offsetThe day offset from the cron to the ondate (0=same day, -1=previous day)Integer
scriptThe ODSL script name to useString
expressionThe expression to execute - usually a function call in the script e.g. export()String
calendarThe holiday calendar for the curvesString

Functions

FunctionExampleDescription
initialisev1/2024-06-12Initialise curves for the specified ondate, ignores any curves already initialised
initialisev1/2024-06-12/TEST:CURVEInitialise specified curve for the specified ondate
buildv1/TEST:CURVE:2024-06-12Build a curve
buildv1/TEST:CURVE with query param _range=between(2023-10-15,2023-10-20)Build a curve for a range of dates
checkv1/TEST:CURVE:2024-06-12Quality check a curve
checkv1/default/2024-06-12Run all quality checks for the named quality group
exportv1/ETRM/2024-06-12Export all curves in the named export group
cutoffv1/Oil/2024-06-12Run the build cut-off - substitute missing curves
cutoffv1/TEST:CURVE:2024-06-12Run the build cut-off for the named curve

Examples

In the following examples {{url}} is the curve management REST URL:

https://api.opendatadsl.com/api/curve

Curve Info

### Get curve infos
GET {{url}}/curve/v1/info
Authorization: Bearer {{token}}

### Get curve info for a specific curve
GET {{url}}/curve/v1/info/AAA:EC
Authorization: Bearer {{token}}

### Generate curve info from a curve
POST {{url}}/curve/v1/info/AAA:ECS
Authorization: Bearer {{token}}

### Update curve info
POST {{url}}/curve/v1/info
Authorization: Bearer {{token}}

{
"_id":"#CLALIT.AMF.AVGAUC.WP:PRICE",
"name": "Anhydrous Milk Fat Average Auction Winning Price Curve Biweekly Italy",
"description":"Anhydrous Milk Fat Average Auction Winning Price Curve Biweekly Italy"
}

### Update multi curve info
POST {{url}}/curve/v1/info
Authorization: Bearer {{token}}

[
{
"_id":"IPEX.EL.IT.BL.MTE:ALL_TRADERS",
"tags": ["trader","smart"],
"description": "Combination of all MTE trader curves"
},
{
"_id":"IPEX.EL.IT.BL.MTE:COMBINED",
"tags": ["smart"]
}
]

### Bulk update tags
PUT {{url}}/curve/v1/info/tag/PROD
Authorization: Bearer {{token}}

[ "AAA:EC","AAA:ECS" ]

### Delete a curve info
DELETE {{url}}/curve/v1/info/%23CLALIT.AMF.AVGAUC.WP:PRICE
Authorization: Bearer {{token}}

Curve Build

### Get build infos for current ondate
GET {{url}}/curve/v1/build
Authorization: Bearer {{token}}

### Get build infos for specific ondate
GET {{url}}/curve/v1/build/2023-10-23
Authorization: Bearer {{token}}

### Get build infos for specific ondate - filtered
GET {{url}}/curve/v1/build/2023-10-23
?_filter={"$and":[{"status.build":{"$exists":true,"$in":["built"]}}]}
&_sort={"_timestamp":-1}
&_limit=-1
Authorization: Bearer {{token}}

### Get curve build info
GET {{url}}/curve/v1/build/2023-10-24/AAA:EC
Authorization: Bearer {{token}}

### Update curve build
POST {{url}}/curve/v1/build
Authorization: Bearer {{token}}

{
"_id":"IPEX.EL.IT.BL.MTE:MONTHLY:2023-09-21",
"notes": "Built by hand"
}

### Update curve build from external build application
POST {{url}}/curve/v1/build
Authorization: Bearer {{token}}

{
"_id":"AAA:MATLAB:2023-10-24",
"builds": {
"af1b4366-8752-4446-90c5-ca176eccec6f":{
"log":["complete"],
"message": "Built by MATLAB",
"status": "built"
}
},
"status": {
"build": "built",
"buildMessage": "Built by MATLAB"
}
}

### Update multi curve builds
POST {{url}}/curve/v1/build
Authorization: Bearer {{token}}

[
{
"_id":"IPEX.EL.IT.BL.MTE:ALL_TRADERS:2023-09-21",
"tags": ["trader","smart"]
},
{
"_id":"IPEX.EL.IT.BL.MTE:MONTHLY:2023-09-21",
"tags": ["smart"]
}
]

### Add a comment on a build
POST {{url}}/curve/v1/build
Authorization: Bearer {{token}}

{
"_id":"AAA:MATLAB:2023-11-24",
"warning":"Jeff was off work, so couldn't provide data"
}

Build Groups

### Add a Build group
POST {{url}}/curve/v1/group/build
Authorization: Bearer {{token}}

{
"type": "build",
"name": "default",
"description": "Default Build Group",
"calendar": "BUSINESS",
"cron": "45 23 ? * MON-FRI * EU1",
"offset": 0,
"timezone": "Europe/London",
"useLatest": true,
}

### Get all build groups
GET {{url}}/curve/v1/group/build
Authorization: Bearer {{token}}

### Get a build group
GET {{url}}/curve/v1/group/build/default
Authorization: Bearer {{token}}

### Delete a build group
DELETE {{url}}/curve/v1/group/build/default
Authorization: Bearer {{token}}

### Bulk set group
PUT {{url}}/curve/v1/group/build/default
Authorization: Bearer {{token}}

[ "AAA:EC","AAA:ECS" ]

Quality Groups

### Add a quality group
POST {{url}}/curve/v1/group/quality
Authorization: Bearer {{token}}

{
"name":"default",
"script":"QualityCheckCurves",
"checks": [
{"name":"missing","expression":"missingCheck()"}
]
}

### Get all quality groups
GET {{url}}/curve/v1/group/quality
Authorization: Bearer {{token}}

### Get a quality group
GET {{url}}/curve/v1/group/quality/default
Authorization: Bearer {{token}}

### Delete a quality group
DELETE {{url}}/curve/v1/group/quality/default
Authorization: Bearer {{token}}

### Bulk set group
PUT {{url}}/curve/v1/group/quality/Agriculture
Authorization: Bearer {{token}}

[
"#MATBAROFEX.AR.CRN.CME.FUT:LAST",
"#MATBAROFEX.AR.CRN.CME.FUT:OI"
]

Approval Groups

### Add a approval group
POST {{url}}/curve/v1/group/approval
Authorization: Bearer {{token}}

{
"name":"default",
"versionName":"APPROVED",
"approvers": [
"colin.hartley@opendatadsl.com",
"39c6cccd-d6ea-4ac1-b564-8e4d1e28d75d"
]
}

### Get all approval groups
GET {{url}}/curve/v1/group/approval
Authorization: Bearer {{token}}

### Get a approval group
GET {{url}}/curve/v1/group/approval/default
Authorization: Bearer {{token}}

### Delete a approval group
DELETE {{url}}/curve/v1/group/approval/default
Authorization: Bearer {{token}}

### Bulk set group
PUT {{url}}/curve/v1/group/approval/default
Authorization: Bearer {{token}}

[ "AAA:EC","AAA:ECS" ]

Approvals

### Add an approval group to a curve info
POST {{url}}/curve/v1/info
Authorization: Bearer {{token}}

{
"_id":"IPEX.EL.IT.BL.MTE:ALL_TRADERS",
"approvalGroup": "default"
}

### Get my curves to approve
GET {{url}}/curve/v1/approval/2023-11-09
Authorization: Bearer {{token}}

### Approve curves
POST {{url}}/curve/v1/approval
Authorization: Bearer {{token}}

[
{
"curve":"IPEX.EL.IT.BL.MTE:ALL_TRADERS:2023-10-09",
"message": "Approved message"
}
]

### Approve curves
POST {{url}}/curve/v1/approval
Authorization: Bearer {{token}}

["IPEX.EL.IT.BL.MTE:ALL_TRADERS:2023-10-09"]

### Reject curves
POST {{url}}/curve/v1/rejection
Authorization: Bearer {{token}}

[
{
"curve":"AAA:MATLAB:2023-11-13",
"message": "Incorrect Data"
}
]

Export Groups

### Add a export group
POST {{url}}/curve/v1/group/export
Authorization: Bearer {{token}}

{
"name":"default",
"cron":"00 02 ? * MON-FRI *",
"script":"daily_export_report",
"expression":"exportCSV()"
}

### Get all export groups
GET {{url}}/curve/v1/group/export
Authorization: Bearer {{token}}

### Get an export group
GET {{url}}/curve/v1/group/export/SAP
Authorization: Bearer {{token}}

### Delete an export group
DELETE {{url}}/curve/v1/group/export/default
Authorization: Bearer {{token}}

### Bulk set group
PUT {{url}}/curve/v1/group/export/SAP
Authorization: Bearer {{token}}

[ "AAA:EC","AAA:ECS" ]

### Remove export groups from a curve
POST {{url}}/curve/v1/info
Authorization: Bearer {{token}}

{
"_id": "SMART_TEST:CURVE",
"exportGroups": null
}

Functions

### Initialise ondate
GET {{url}}/curve/v1/2023-10-26
?_function=initialise
Authorization: Bearer {{token}}

### Initialise ondate for a specific curve
GET {{url}}/curve/v1/2023-11-28/EEX.EM.FEUA.FUT:SC_BST_SETTLE
?_function=initialise
Authorization: Bearer {{token}}

### Substitute a curve
GET {{url}}/curve/v1/AAA:CURVE:2023-11-10
?_function=substitute
Authorization: Bearer {{token}}

### Build a curve
GET {{url}}/curve/v1/CORN_TEST_TYPE:CLOSE:2023-11-30
?_function=build
Authorization: Bearer {{token}}

### Build curve history
GET {{url}}/curve/v1/AAA:ECS
?_function=build
&_range=between(2023-10-15,2023-10-20)
Authorization: Bearer token

### Check a curve
GET {{url}}/curve/v1/ODSL.TRADER.AR.CRN.CME.FUT.TRADES:CURVE:2023-12-07
?_function=check
Authorization: Bearer {{token}}

### Check a group of curves
GET {{url}}/curve/v1/default/2023-11-16
?_function=check
Authorization: Bearer {{token}}

### Approve a group of curves
GET {{url}}/curve/v1/default/2023-11-16
?_function=approve
Authorization: Bearer {{token}}

### Export curves
GET {{url}}/curve/v1/ETRM/2023-11-10
?_function=export
Authorization: Bearer {{token}}

### Individual curve export
GET {{url}}/curve/v1/ETRM/EEX.EM.FEUA.FUT:HIGH:2024-01-03
?_function=export
Authorization: Bearer {{token}}

### Build group cut-off
GET {{url}}/curve/v1/Oil/2023-12-07
?_function=cutoff
Authorization: Bearer {{token}}

### Individual curve cut-off
GET {{url}}/curve/v1/EEX.EM.FEUA.FUT:HIGH:2024-01-03
?_function=cutoff
Authorization: Bearer {{token}}