Trade/Full Margin Contract

Place an order

post

Description: Contract full position trading order group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.addMarketOrder

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Game ID, should be filled with 1 for this game

accountIdinteger · longOptional

Account ID, optional. If filled, trading will be conducted with this account

bizTypeinteger · int32Required

Business type, 1-Market price open; 2-Market price close; 10-Limit price pending order; 11-Stop loss pending order; 12-Limit price open

directioninteger · int32Required

Order buy/sell direction, 1-Buy; 2-Sell;

symbolIdinteger · longRequired

Product ID, product ID

positionIdinteger · longOptional

Position ID, required when placing a closing order

requestTimeinteger · longRequired

Order request time, 13-digit timestamp

requestPricestringRequired

Price at the time of order placement, needs to be multiplied by 10 to the power of 'product price decimal places', converted to an integer for input. Only for order recording, not the actual transaction price.

requestNumstringRequired

Order quantity

stopLossstringOptional

Stop loss unit price, need to multiply by 10 to the power of 'product quote decimal places', and process it as an integer input.

takeProfitstringOptional

Take profit unit price, need to multiply by 10 to the power of 'product quote decimal places', and process it as an integer input.

expireTypeinteger · int32Optional

Expiration type, only valid for pending orders. 1-Valid for the day; 2-Valid for the week; 3-30 days; 4-90 days; Default 2

remarkstringOptional

Remarks

accountCurrencystringRequired

Account currency

accountDigitsinteger · int32Required

Account Decimal Places

crossLevelNuminteger · int32Optional

Leverage ratio, only valid for opening positions, there should only be one leverage ratio for the same product

sourcestringOptional

H5: mobile web; PC_Web: pcweb; System: system; Android: Android native app; iOS: Apple native app; HOS: Hongmeng OS; PC_Win: pcwindows client; PC_Mac: pcmac client; default is the same as login source. (limited to 255 characters, enumeration is for reference only,Only letters, numbers, and underscores can be used)

thirdPartyOrderstringOptional

(limited to 255 characters,Only letters, numbers, and underscores can be used)

slippagestringOptional

Only market orders are valid. It can be a percentage (only supports 2 decimal places, rounding off any excess) or a floating-point type that only supports 4 decimal places, rounding off any excess). Other formats are not supported.

Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMOrderApiService.addMarketOrder
POST /api/global/tradeapi.app.CfdMMOrderApiService.addMarketOrder HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 330

{
  "tradeType": 1,
  "accountId": 1,
  "bizType": 1,
  "direction": 1,
  "symbolId": 1,
  "positionId": 1,
  "requestTime": 1,
  "requestPrice": "text",
  "requestNum": "text",
  "stopLoss": "text",
  "takeProfit": "text",
  "expireType": 1,
  "remark": "text",
  "accountCurrency": "text",
  "accountDigits": 1,
  "crossLevelNum": 1,
  "source": "text",
  "thirdPartyOrder": "text",
  "slippage": "text"
}
200Success
{
  "msg": "Success",
  "fail": false,
  "trace": "x-dqxq8-qu20y7y-dq58lhn-39i483-1677570581",
  "code": "0",
  "data": {
    "tradeVolume": "0.1",
    "symbolId": 720,
    "orderId": 14460002,
    "fee": "-0.0668",
    "openOrClose": 1,
    "openPrice": "22.25",
    "takeProfit": "0",
    "positionId": 2023022819810,
    "interest": "0",
    "openDirection": 1,
    "stopLoss": "0",
    "executePrice": "22.25",
    "digits": 2,
    "symbolName": "BINAN_SOL_USDT",
    "profit": "0",
    "direction": 1
  },
  "bizCode": "",
  "tm": 162,
  "msgParams": null,
  "ok": true
}

Modify Pending Order

post

group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.updatePboOrder

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

accountIdinteger · longOptional

Optional. If filled, trading will be conducted with this account

pboIdstringRequired
stopLossnumberOptional

Needs to be multiplied by 10 to the power of 'product quote decimal places', processed as an integer and passed in.

takeProfitnumberOptional

Needs to be multiplied by 10 to the power of 'product quote decimal places', processed as an integer and passed in.

requestNumnumberOptional
requestPricenumberOptional
Responses
200Success
application/json
post
/global/tradeapi.app.OrderApiService.updatePboOrder
POST /api/global/tradeapi.app.OrderApiService.updatePboOrder HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 108

{
  "tradeType": 22,
  "pboId": "63",
  "requestPrice": 16,
  "takeProfit": 57,
  "accountId": 98,
  "stopLoss": 18,
  "requestNum": 35
}
200Success
{
  "msg": "Success",
  "fail": false,
  "trace": "x-dqxq8-qu20y7y-dq58lhn-39i483-1677570581",
  "code": "0",
  "data": {
    "tradeVolume": "0.1",
    "symbolId": 720,
    "orderId": 14460002,
    "fee": "-0.0668",
    "openOrClose": 1,
    "openPrice": "22.25",
    "takeProfit": "0",
    "positionId": 2023022819810,
    "interest": "0",
    "openDirection": 1,
    "stopLoss": "0",
    "executePrice": "22.25",
    "digits": 2,
    "symbolName": "BINAN_SOL_USDT",
    "profit": "0",
    "direction": 1
  },
  "bizCode": "",
  "tm": 162,
  "msgParams": null,
  "ok": true
}

Set position stop loss and take profit

post

Explanation: Set position stop loss and take profit group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.updateOrder

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

accountIdinteger · longOptional

Account ID, must fill in either account currency

accountCurrencystringOptional

Account currency, must fill in either account ID

orderIdinteger · longRequired

Order ID

positionIdinteger · longRequired

Position ID

accountDigitsinteger · longRequired

Account Decimal Places

stopLossstringOptional

Stop loss unit price, need to multiply by 10 to the power of 'product quote decimal places', and process it as an integer input.

takeProfitstringOptional

Take profit unit price, need to multiply by 10 to the power of 'product quote decimal places', and process it as an integer input.

remarkstringOptional

Remarks

Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMOrderApiService.updateOrder
POST /api/global/tradeapi.app.CfdMMOrderApiService.updateOrder HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 153

{
  "tradeType": 1,
  "accountId": 1,
  "accountCurrency": "text",
  "orderId": 1,
  "positionId": 1,
  "accountDigits": 1,
  "stopLoss": "text",
  "takeProfit": "text",
  "remark": "text"
}
200Success
{
  "msg": "Account balance is 0",
  "fail": true,
  "trace": "x-0ei175a-x4dh9u2-1g8s95r-m2708212-1677570735",
  "code": "E000031",
  "data": "tradeapi.app.OrderApiService.updateOrder",
  "bizCode": "CFD",
  "tm": 7,
  "msgParams": null,
  "ok": false
}

Closing record

post

Explanation: Query historical closing records

group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.queryHistoryCloseOrderList

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

accountIdinteger · longOptional
sortFieldNamestringRequired

pnl-Profit; openTime-Opening time; closeTime-Closing time; orderId-Order ID; symbolId-Product ID;

sortTypestringRequired

desc-Descending order; asc-Ascending order;

symbolIdinteger · longOptional
openStartTimeinteger · longOptional

13-digit timestamp

openEndTimeinteger · longOptional

13-digit timestamp

closeStartTimeinteger · longOptional

13-digit timestamp

closeEndTimeinteger · longOptional

13-digit timestamp

currentinteger · int32Optional

Default 1

sizeinteger · int32Optional

Default 20

querySourcestringOptional

H5: mobile web; PC_Web: pcweb; System: system; Android: Android native app; iOS: Apple native app; HOS: Hongmeng OS; PC_Win: pcwindows client; PC_Mac: pcmac client; default is the same as login source. (The enumeration is for reference only)

thirdPartyOrderstringOptional
Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMOrderApiService.queryHistoryCloseOrderList
POST /api/global/tradeapi.app.CfdMMOrderApiService.queryHistoryCloseOrderList HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 220

{
  "tradeType": 1,
  "accountId": 1,
  "sortFieldName": "text",
  "sortType": "text",
  "symbolId": 1,
  "openStartTime": 1,
  "openEndTime": 1,
  "closeStartTime": 1,
  "closeEndTime": 1,
  "current": 1,
  "size": 1,
  "querySource": "text",
  "thirdPartyOrder": "text"
}
200Success
{
  "msg": "Success",
  "fail": false,
  "trace": "x-77q3ivej-u4wi1d3a-5pbl5v-ypwj0-1677573497",
  "code": "0",
  "data": {
    "accountId": null,
    "trace": "x-77q3ivej-u4wi1d3a-5pbl5v-ypwj0-1677573497",
    "companyId": 360,
    "current": 1,
    "size": 20,
    "totalPage": 0,
    "ip": "47.242.92.158",
    "customerId": 1176,
    "list": [],
    "lang": "en-US",
    "totalPnl": 0,
    "customerNo": "86001175"
  },
  "bizCode": "",
  "tm": 6,
  "msgParams": null,
  "ok": true
}

Set leverage multiplier

post

Description: Contract-full position gameplay, set the customer's leverage multiplier for the product, affecting all positions of the product

group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.setCrossLevelNum

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

companyIdinteger · longRequired
customerIdinteger · longRequired
customerNostringRequired
customerGroupIdinteger · longRequired
symbolIdinteger · longRequired
requestTimeinteger · int32Required
tracestringOptional
Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMOrderApiService.setCrossLevelNum
POST /api/global/tradeapi.app.CfdMMOrderApiService.setCrossLevelNum HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 128

{
  "tradeType": 1,
  "companyId": 1,
  "customerId": 1,
  "customerNo": "text",
  "customerGroupId": 1,
  "symbolId": 1,
  "requestTime": 1,
  "trace": "text"
}
200Success
{
  "msg": "Success",
  "fail": false,
  "trace": "x-6s8tc-2v65-i8270878-1727-1677574098",
  "code": "0",
  "data": {
    "crossLevelNum": 11
  },
  "bizCode": "",
  "tm": 17,
  "msgParams": null,
  "ok": true
}

Order Trial Calculation

post

Explanation: Calculate margin and commission for placing orders group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.calculateMarketOrder

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

accountIdinteger · longOptional

Optional. If filled, trading will be conducted with this account

bizTypeinteger · int32Required

1-Market price open; 2-Market price close; 10-Limit price pending order; 11-Stop loss pending order; 12-Limit price open

directioninteger · int32Required

1-Buy; 2-Sell;

symbolIdinteger · longRequired
positionIdinteger · longOptional

Required when placing a closing order

requestTimeinteger · longRequired

13-digit timestamp

requestPricestringRequired

For order record only, not the actual transaction price*

requestNumstringRequired
expireTypeinteger · int32Optional

Only valid for pending orders. 1-Valid for the day; 2-Valid for the week;

remarkstringOptional
accountCurrencystringRequired
accountDigitsinteger · int32Required
crossLevelNuminteger · int32Optional

Only valid for opening positions, only one leverage ratio should be set for the same product

Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMOrderApiService.calculateMarketOrder
POST /api/global/tradeapi.app.CfdMMOrderApiService.calculateMarketOrder HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 233

{
  "tradeType": 1,
  "accountId": 1,
  "bizType": 1,
  "direction": 1,
  "symbolId": 1,
  "positionId": 1,
  "requestTime": 1,
  "requestPrice": "text",
  "requestNum": "text",
  "expireType": 1,
  "remark": "text",
  "accountCurrency": "text",
  "accountDigits": 1,
  "crossLevelNum": 1
}
200Success
{
  "msg": "Success",
  "fail": false,
  "trace": "x-7rf727-m64d8ar-72dn4ij-23o3vt-1677574738",
  "code": "0",
  "data": {
    "margin": "10000.6584",
    "calculatePrice": "136.719",
    "fee": "0.0000"
  },
  "bizCode": "",
  "tm": 31,
  "msgParams": null,
  "ok": true
}

Position Details

post

Description: Query position details

group=tradeApi version=0.0.1 bizType=tradeapi.app.PositionApiService.queryPositionDetail

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

accountIdinteger · longOptional
positionIdinteger · longRequired
Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMPositionApiService.queryPositionDetail
POST /api/global/tradeapi.app.CfdMMPositionApiService.queryPositionDetail HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 44

{
  "tradeType": 1,
  "accountId": 1,
  "positionId": 1
}
200Success
{
  "msg": "Success",
  "fail": false,
  "trace": "x-11wdkt-kg9i-ld2y-53mz854-1677571927",
  "code": "0",
  "data": {
    "symbolId": 720,
    "orderId": 14460003,
    "dealId": 94870543,
    "canReduceMargin": "0.0000",
    "openPrice": "22.18",
    "remark": null,
    "takeProfitDecimal": "0.00",
    "closeNum": 0,
    "closeFee": "0.0000",
    "takeProfit": "0",
    "occupyTheMargin": "0.0000",
    "interest": "0.0000",
    "maintenanceMargin": "0.0000",
    "closeVolume": 0,
    "openVolume": 0.1,
    "closeTime": 0,
    "closeAccountDigits": 4,
    "symbolName": "BINAN_SOL_USDT",
    "openTime": 1677571033093,
    "profit": null,
    "tradeType": 1,
    "direction": 1,
    "singleMargin": null,
    "margin": null,
    "openContractSize": 1,
    "resp": null,
    "openMargin": "0.2209",
    "openNum": 0.1,
    "openFee": "0.0665",
    "closeSymbolDigits": 2,
    "warningMargin": "0.0000",
    "stopLossDecimal": "0.00",
    "adjustCrossLevel": "1-100",
    "openSymbolDigits": 2,
    "volume": 0.1,
    "accountId": 1031767,
    "companyId": 360,
    "positionId": 2023022819827,
    "closeFreeDigits": null,
    "stopLoss": "0",
    "minVolume": null,
    "marginSetType": "2",
    "crossLevelNum": 10,
    "openAccountDigits": 4,
    "closePrice": "0.0000",
    "status": "1"
  },
  "bizCode": "C",
  "tm": 27,
  "msgParams": null,
  "ok": true
}

Fund Flow

post

Explanation: Pagination query account capital flow group=tradeApi version=0.0.1 bizType=tradeapi.app.OrderApiService.queryCapitalFlowList

Header parameters
companyIdstringOptionalExample: {{company}}
tokenstringOptionalExample: {{LoginResult.data.token}}
langstringOptionalExample: en-US
groupstringOptionalExample: tradeApi
tracestringOptionalExample: {{mock_trace}}
versionstringOptionalExample: 0.0.1
Body
tradeTypeinteger · longRequired

Should be filled with 1 under this gameplay

accountIdinteger · longOptional
sizeinteger · longOptional
currentinteger · longOptional
businessTypeinteger · int32Optional

0-Unrestricted; 1-Deposit; 2-Withdrawal; 3-System reset; 4-Limit adjustment; 5-Freeze; 6-Transaction; 36-Transfer; 42-Reward;

statusinteger · int32Optional

0-Unrestricted; 1-Initialization; 2-Processing successful; 3-Processing failed;

startTimeinteger · longOptional

13-digit timestamp

endTimeinteger · longOptional

13-digit timestamp

operateinteger · int32Optional

0-Unrestricted; 1-Increase; 2-Decrease;

assetsIdinteger · longOptional
langstringOptional
Responses
200Success
application/json
post
/global/tradeapi.app.CfdMMOrderApiService.queryCapitalFlowList
POST /api/global/tradeapi.app.CfdMMOrderApiService.queryCapitalFlowList HTTP/1.1
Host: prewppc-3.cmfbl.com
Content-Type: application/json
Accept: */*
Content-Length: 143

{
  "tradeType": 1,
  "accountId": 1,
  "size": 1,
  "current": 1,
  "businessType": 1,
  "status": 1,
  "startTime": 1,
  "endTime": 1,
  "operate": 1,
  "assetsId": 1,
  "lang": "text"
}
200Success
{
  "msg": "System error",
  "fail": true,
  "trace": "x-q7pj-8jiln-310518-4l0c69-1677572511",
  "code": "500",
  "data": "tradeapi.app.OrderApiService.queryCapitalFlowList",
  "bizCode": "TA",
  "tm": 0,
  "msgParams": null,
  "ok": false
}

Last updated