Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
ts-api-demo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wmvm
ts-api-demo
Commits
17c356ce
Commit
17c356ce
authored
Oct 15, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合约交易对配置修改
parent
94108a6a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
23 deletions
+81
-23
contractPair.service.ts
src/functional/mvc/service/contractPair.service.ts
+46
-13
spotPair.service.ts
src/functional/mvc/service/spotPair.service.ts
+29
-6
access-limit.ts
src/setting/access-limit.ts
+6
-4
No files found.
src/functional/mvc/service/contractPair.service.ts
View file @
17c356ce
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
contractPairs
,
madContractOrmDB
,
coinType
}
from
"@madex/ex-ts-dao"
;
import
{
contractPairs
,
madContractOrmDB
,
coinType
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
import
{
NUMBER
}
from
"sequelize"
;
import
{
addPairToCore
}
from
"../../../utils/coreSystemUtils"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
...
...
@@ -48,19 +48,37 @@ export interface AddParam {
quantity_increment
?:
number
;
default_initial_margin
?:
number
;
//"0.01",
base_initial_margin
?:
number
;
//"0.01",
base_maintenance_margin
?:
number
;
//"0.01",
settlement_asset
?:
number
;
// "USDT", 结算币种
index
?:
string
;
base_interest
:
number
;
//"0.0003",
quote_interest
?:
number
;
//"0.0006",
quote_interest
?:
number
;
//"0.0006",
impact_notional
?:
number
;
// "600000",
base_risk_limit
?:
number
;
// "1000000",
risk_limit_step
?:
number
;
//"1000000",
funding_times_perday
:
number
;
// 3
status
?:
number
min_order_size
?:
number
max_order_size
?:
number
min_order_value
?:
number
max_order_value
?:
number
view_precision
?:
number
createdAt
?:
Date
|
any
,
...
...
@@ -93,10 +111,25 @@ export async function list(param: ListParam) {
export
const
save
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
param
.
updatedAt
=
new
Date
();
param
.
createdAt
=
new
Date
();
let
dbInfo
=
await
contractPairs
.
prototype
.
findOne
({
where
:
{
symbol
:
param
.
symbol
},
raw
:
true
});
if
(
dbInfo
)
{
throw
ErrorCode
.
DATA_EXIST
;
}
if
(
!
param
.
price_increment
)
{
param
.
price_increment
=
1
;
}
if
(
!
param
.
quantity_increment
)
{
param
.
quantity_increment
=
1
;
}
await
contractPairs
.
prototype
.
create
(
param
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'
交易对配置新增'
,
ip
,
JSON
.
stringify
(
param
),
'交易对
配置'
);
addOptLog
(
currentUserId
,
0
,
'
合约代码配置新增'
,
ip
,
JSON
.
stringify
(
param
),
'合约代码
配置'
);
return
'ok'
;
};
...
...
@@ -115,12 +148,12 @@ export const update = async (param: AddParam, currentUserId: any, ip: any) => {
if
(
param
.
view_precision
||
param
.
view_precision
===
0
)
{
updateInfo
[
'view_precision'
]
=
param
.
view_precision
}
// if (param.price_increment || param.price_increment === 0
) {
//
updateInfo['price_increment'] = param.price_increment
//
}
// if (param.quantity_increment || param.quantity_increment === 0
) {
//
updateInfo['quantity_increment'] = param.quantity_increment
//
}
if
(
param
.
price_increment
)
{
updateInfo
[
'price_increment'
]
=
param
.
price_increment
}
if
(
param
.
quantity_increment
)
{
updateInfo
[
'quantity_increment'
]
=
param
.
quantity_increment
}
await
contractPairs
.
prototype
.
update
(
updateInfo
,
{
where
:
{
...
...
@@ -128,7 +161,7 @@ export const update = async (param: AddParam, currentUserId: any, ip: any) => {
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'
交易对配置更新'
,
ip
,
JSON
.
stringify
(
param
),
'交易对
配置'
);
addOptLog
(
currentUserId
,
0
,
'
合约代码配置更新'
,
ip
,
JSON
.
stringify
(
param
),
'合约代码
配置'
);
return
'ok'
;
};
...
...
@@ -146,7 +179,7 @@ export const pushToCoreSystem = async (id: any, currentUserId: any, ip: any) =>
let
base
=
sps
[
0
];
let
quote
=
sps
[
1
]
let
param
=
{
"market_type"
:
2
,
"market_type"
:
2
,
"base"
:
base
,
"quote"
:
quote
,
"symbol"
:
symbol
,
"name"
:
symbol
,
"price_scale"
:
cfg
.
price_scale
,
"quantity_scale"
:
cfg
.
quantity_scale
,
"maker_fee"
:
cfg
.
maker_fee
,
"taker_fee"
:
cfg
.
taker_fee
,
...
...
@@ -177,7 +210,7 @@ export const pushToCoreSystem = async (id: any, currentUserId: any, ip: any) =>
let
optResult
=
await
addPairToCore
(
param
);
if
(
!
optResult
.
is_success
)
{
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'提交
交易对到撮合-失败'
,
ip
,
`pair:
${
symbol
}
,error_msg:
${
optResult
.
err_msg
}
`
,
'交易对
配置'
);
addOptLog
(
currentUserId
,
0
,
'提交
合约交易对到撮合-失败'
,
ip
,
`pair:
${
symbol
}
,error_msg:
${
optResult
.
err_msg
}
`
,
'合约代码
配置'
);
throw
ErrorCode
.
ADD_PAIR_TO_CORE_ERR
;
}
...
...
@@ -185,7 +218,7 @@ export const pushToCoreSystem = async (id: any, currentUserId: any, ip: any) =>
where
:
where
});
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'提交
交易对到撮合-成功'
,
ip
,
JSON
.
stringify
(
param
),
'交易对
配置'
);
addOptLog
(
currentUserId
,
0
,
'提交
合约交易对到撮合-成功'
,
ip
,
JSON
.
stringify
(
param
),
'合约代码
配置'
);
return
'ok'
;
};
...
...
src/functional/mvc/service/spotPair.service.ts
View file @
17c356ce
...
...
@@ -50,6 +50,14 @@ export interface AddParam {
view_precision
?:
number
min_order_size
?:
number
max_order_size
?:
number
min_order_value
?:
number
max_order_value
?:
number
createdAt
?:
Date
|
any
,
updatedAt
?:
Date
|
any
,
...
...
@@ -80,7 +88,22 @@ export async function list(param: ListParam) {
export
const
save
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
param
.
updatedAt
=
new
Date
();
param
.
createdAt
=
new
Date
();
let
dbInfo
=
await
spotPairs
.
prototype
.
findOne
({
where
:
{
symbol
:
param
.
symbol
},
raw
:
true
});
if
(
dbInfo
)
{
throw
ErrorCode
.
DATA_EXIST
;
}
if
(
!
param
.
price_increment
)
{
param
.
price_increment
=
1
;
}
if
(
!
param
.
quantity_increment
)
{
param
.
quantity_increment
=
1
;
}
await
spotPairs
.
prototype
.
create
(
param
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'交易对配置新增'
,
ip
,
JSON
.
stringify
(
param
),
'交易对配置'
);
...
...
@@ -102,12 +125,12 @@ export const update = async (param: AddParam, currentUserId: any, ip: any) => {
if
(
param
.
view_precision
||
param
.
view_precision
===
0
)
{
updateInfo
[
'view_precision'
]
=
param
.
view_precision
}
// if (param.price_increment || param.price_increment === 0
) {
//
updateInfo['price_increment'] = param.price_increment
//
}
// if (param.quantity_increment || param.quantity_increment === 0
) {
//
updateInfo['quantity_increment'] = param.quantity_increment
//
}
if
(
param
.
price_increment
)
{
updateInfo
[
'price_increment'
]
=
param
.
price_increment
}
if
(
param
.
quantity_increment
)
{
updateInfo
[
'quantity_increment'
]
=
param
.
quantity_increment
}
await
spotPairs
.
prototype
.
update
(
updateInfo
,
{
where
:
{
...
...
src/setting/access-limit.ts
View file @
17c356ce
...
...
@@ -22,6 +22,12 @@ let cmdWhiteList = {
'spotPair/list'
:
1
,
'spotPair/pushToCoreSystem'
:
1
,
'spotPair/getAllSubmitSuccess'
:
1
,
//金融部-交易管理-合约代码配置
'contractPair/save'
:
1
,
'contractPair/update'
:
1
,
'contractPair/list'
:
1
,
'contractPair/pushToCoreSystem'
:
1
,
'contractPair/getAllSubmitSuccess'
:
1
,
//运营部-其他管理-币种管理
'coinType/save'
:
1
,
'coinType/update'
:
1
,
...
...
@@ -146,10 +152,6 @@ let cmdWhiteList = {
'tech/other/apikey/strict/add'
:
1
,
'tech/other/apikey/strict/update'
:
1
,
'tech/other/apikey/strict/del'
:
1
,
//金融部-交易管理-合约代码配置
'finance/trade/contract/pair/set'
:
1
,
'finance/trade/contract/pair/update'
:
1
,
'finance/trade/contract/pair/query'
:
1
,
//金融部-其他管理-现货做市参数配置
'fiance/other/spot/market/maker/set'
:
1
,
'fiance/other/spot/market/maker/list'
:
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment