refactor: 字段与接口路径改用中性演示命名,并扩充下单用例矩阵

This commit is contained in:
2026-09-21 22:38:59 +08:00
parent 4f39f6cef2
commit e3afd2e46c
8 changed files with 389 additions and 105 deletions
+259 -20
View File
@@ -11,7 +11,7 @@ creatOrderTrueTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -25,7 +25,7 @@ creatOrderTrueTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -39,7 +39,7 @@ creatOrderTrueTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 2
marginRate: '0.01'
orderSourceType: 1
@@ -53,12 +53,167 @@ creatOrderTrueTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.005'
orderSourceType: 1
- code: 0
msg: OK
# ---- 矩阵扩充:全仓/逐仓 × 多空 × 起始保证金率三档(0.005/0.02/0.05) ----
# 全仓-卖出-0.005(20 倍杠杆)
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.005'
orderSourceType: 1
- code: 0
msg: OK
# 全仓-买入-0.02(50 倍杠杆)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.02'
orderSourceType: 1
- code: 0
msg: OK
# 全仓-卖出-0.02
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.02'
orderSourceType: 1
- code: 0
msg: OK
# 全仓-买入-0.05(20 倍杠杆)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.05'
orderSourceType: 1
- code: 0
msg: OK
# 全仓-卖出-0.05
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.05'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-买入-0.005(20 倍杠杆)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 2
marginRate: '0.005'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-卖出-0.005
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 2
marginRate: '0.005'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-买入-0.02(50 倍杠杆)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 2
marginRate: '0.02'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-卖出-0.02
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 2
marginRate: '0.02'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-买入-0.05(20 倍杠杆)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 2
marginRate: '0.05'
orderSourceType: 1
- code: 0
msg: OK
# 逐仓-卖出-0.05
- - userId: 1001
contractId: 1
side: ask
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 2
marginRate: '0.05'
orderSourceType: 1
- code: 0
msg: OK
creatOrderFalseTestdata:
# userId 非数值
@@ -69,7 +224,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -83,7 +238,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -97,7 +252,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -111,7 +266,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -125,7 +280,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -139,7 +294,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -153,7 +308,7 @@ creatOrderFalseTestdata:
price: ''
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -167,7 +322,7 @@ creatOrderFalseTestdata:
price: -1
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -181,7 +336,7 @@ creatOrderFalseTestdata:
price: abc
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -195,7 +350,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 0
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -209,7 +364,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 5
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
@@ -223,7 +378,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 3
marginRate: '0.01'
orderSourceType: 1
@@ -237,7 +392,7 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '2'
orderSourceType: 1
@@ -251,12 +406,12 @@ creatOrderFalseTestdata:
price: 100
quantity: 10
orderType: 1
durationQualifiers: SDFSDF
timeInForce: SDFSDF
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:durationQualifiers"
msg: "参数错误:timeInForce"
# 余额不足(冻结金额超过账户资金)
- - userId: 1001
contractId: 1
@@ -265,9 +420,93 @@ creatOrderFalseTestdata:
price: 99999999
quantity: 10
orderType: 1
durationQualifiers: GTC
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 2001
msg: 余额不足
# ---- 负例扩充 ----
# 数量为负数
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: -10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:quantity"
# 保证金率为 0
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0'
orderSourceType: 1
- code: 1003
msg: "参数错误:marginRate"
# 保证金率非法字符串
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: abc
orderSourceType: 1
- code: 1003
msg: "参数错误:marginRate"
# 平仓方向(positionEffect != 1)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 2
price: 100
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:positionEffect"
# 缺 price 参数(限价单必传)
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '0.01'
orderSourceType: 1
- code: 1003
msg: "参数错误:price"
# 余额不足边界:冻结额(本金+孰高手续费)恰好略超账户总资金
- - userId: 1001
contractId: 1
side: bid
positionEffect: 1
price: 100001
quantity: 10
orderType: 1
timeInForce: GTC
marginType: 1
marginRate: '1'
orderSourceType: 1
- code: 2001
msg: 余额不足