Import Gain/Loss

API Overview

This API enables the batch import of Gain/Loss records into the system, supporting the import of multiple data entries in a single request.

  • Request Method:POST

  • Request URL:https://openapi.elven.com/open/v3/transaction/gainloss

Request Headers

Parameter Name
Type
Required
Description

elven-api-key

String

Yes

The API key assigned to you

elven-api-sign

String

Yes

Request signature, used to verify the legitimacy of the request

elven-api-timestamp

String

Yes

Request timestamp, in milliseconds

View Details

Request Parameters

Body Parameters (JSON Format)

Parameter Name
Type
Required
Description

entityAccountId

String

Yes

The primary key of the account.

sourceId

String

Yes

The primary key of the source.

timezone

String

No

list

Array

Yes

Transaction record list, containing multiple transaction objects, with a maximum of 1000 records supported per request.

Elements in the List

Parameter Name
Type
Required
Description

datetime

String

Yes

Transaction time in the format YYYY-MM-DD HH:mm:ss

gainLossID

String

No

Unique identifier for the gain or loss record.

type

String

Yes

Type of gain or loss transaction.

positionSide

String

No

Future position direction (values: LONG/SHORT). Required only when type is FUTURE_REALIZED or FUTURE_UNREALIZED.

asset

String

Yes

Name of the underlying asset (maximum 200 characters).

gainLossAsset

String

Yes

Name of the asset used to measure gain or loss (case-sensitive).

gainLossAmount

Number

Yes

Amount of gain or loss.

memo

String

No

Additional notes or information.

Type Parameter Description

Type
Description

FUTURE_REALIZED

Realized gain or loss from contracts.

FUTURE_UNREALIZED

Unrealized gain or loss from contracts.

OPTIONS_REALIZED

Realized gain or loss from options.

OPTIONS_UNREALIZED

Unrealized gain or loss from options.


PositionSide Parameter Description

Type
Is positionSide required?

FUTURE_OPEN

Required

FUTURE_CLOSE

Required

Other Types

Must be left empty

Example Request

{
    "entityAccountId": "QfgBd6vH2ptevhqZjNTn06MiJOFUXGcD",
    "sourceId": "RHFjsy6UIgM1rdxvefXVsJy8L3NOhBmQ",
    "timezone": "UTC",
    "list": [
        {
            "datetime": "2024-08-01 15:59:00",
            "gainLossID": "123458",
            "type": "FUTURE_UNREALIZED",
            "asset": "ETHUSDT-PERP1",
            "positionSide": "LONG",
            "gainLossAsset": "USDT",
            "gainLossAmount": 500,
            "memo": ""
        },
        {
            "datetime": "2024-08-01 16:00:00",
            "gainLossID": "123459",
            "type": "FUTURE_REALIZED",
            "asset": "ETHUSDT-PERP1",
            "positionSide": "LONG",
            "gainLossAsset": "USDT",
            "gainLossAmount": 600,
            "memo": ""
        }
    ]
}

Response Parameters

Parameter Name
Type
Description

success

String

Request status (e.g., success).

data

Boolean

Request result (e.g., true indicates success).

Example Response

{
    "status": "success",
    "data": true
}

Notes

  • Asynchronous Processing: This API only imports the transaction data into a pre-processing database. The system processes the data asynchronously, and the imported transactions will appear in the user's transaction list after processing is complete.

  • Record Limit: Each request supports importing up to 1000 transaction records. For larger datasets, split them into multiple requests.

  • Data Integrity: Ensure the transaction data is complete and accurate to avoid import errors.

  • Datetime Format: The datetime field must strictly follow the format YYYY-MM-DD HH:mm:ss. Parsing errors may occur if the format is incorrect.

Last updated