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
c7bac0ff
Commit
c7bac0ff
authored
Nov 08, 2024
by
ml
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
9185640d
d819e3c4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
7 deletions
+27
-7
coinAndPairSetting.ts
cron/task/coinAndPairSetting.ts
+1
-1
contractPair.service.ts
src/functional/mvc/service/contractPair.service.ts
+1
-1
mUserOrderPendingAndHistory.service.ts
...tional/mvc/service/mUserOrderPendingAndHistory.service.ts
+6
-2
pairApply.service.ts
src/functional/mvc/service/pairApply.service.ts
+1
-1
coreSystemUtils.ts
src/utils/coreSystemUtils.ts
+18
-2
No files found.
cron/task/coinAndPairSetting.ts
View file @
c7bac0ff
...
...
@@ -48,7 +48,7 @@ const syncPair = async () => {
if
(
cfg
)
{
await
pairModel
.
prototype
.
update
({
status
:
2
,
product_id
:
cfg
.
i
d
,
product_id
:
cfg
.
productI
d
,
price_scale
:
cfg
[
"priceScale"
],
price_increment
:
cfg
[
"priceIncrement"
],
quantity_scale
:
cfg
[
"quantityScale"
],
...
...
src/functional/mvc/service/contractPair.service.ts
View file @
c7bac0ff
...
...
@@ -183,7 +183,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
"
:
"lpc"
,
"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
,
...
...
src/functional/mvc/service/mUserOrderPendingAndHistory.service.ts
View file @
c7bac0ff
...
...
@@ -7,6 +7,8 @@ import { getUserFillsFromCore, getUserOrdersFromCore } from "../../../utils/core
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
export
interface
QueryVo
{
market
?:
string
user_id
?:
number
before
?:
string
...
...
@@ -19,7 +21,8 @@ export interface QueryVo {
export
const
pendingList
=
async
(
queryVo
:
QueryVo
)
=>
{
let
param
=
{
user_id
:
queryVo
.
user_id
,
status
:
"unsettled"
//当前委托
status
:
"unsettled"
,
//当前委托
market
:
queryVo
.
market
}
let
res
=
await
getUserOrdersFromCore
(
param
);
return
res
;
...
...
@@ -28,7 +31,8 @@ export const pendingList = async (queryVo: QueryVo) => {
export
const
historyList
=
async
(
queryVo
:
QueryVo
)
=>
{
let
param
=
{
user_id
:
queryVo
.
user_id
,
status
:
"settled"
//历史委托
status
:
"settled"
,
//历史委托
market
:
queryVo
.
market
}
if
(
queryVo
.
before
)
{
param
[
'before'
]
=
queryVo
.
before
...
...
src/functional/mvc/service/pairApply.service.ts
View file @
c7bac0ff
...
...
@@ -331,7 +331,7 @@ export async function review(id: any, currentUser: any, ip: string | undefined)
}
else
{
param
=
{
"market
_type"
:
2
,
"market
"
:
"lpc"
,
"base"
:
base
,
"quote"
:
quote
,
"symbol"
:
dbPair
.
symbol
,
"name"
:
dbPair
.
symbol
,
"price_scale"
:
dbPair
.
price_scale
,
"quantity_scale"
:
dbPair
.
quantity_scale
,
"maker_fee"
:
dbPair
.
maker_fee
,
"taker_fee"
:
dbPair
.
taker_fee
,
...
...
src/utils/coreSystemUtils.ts
View file @
c7bac0ff
...
...
@@ -30,10 +30,17 @@ export const getCoinFromCore = async (symbol) => {
// "priceScale":4,
// "maxOrderSize":"0",
// "maxOrderValue":"0",
// "minOrderValue":"0"}
// "minOrderValue":"0"
// "productId:1"
// }
// 合约的话还有多余对应db字段 predictedFundingRate nextFundingTime ...
export
const
getPairFromCore
=
async
(
symbol
)
=>
{
const
url
=
`
${
webadmin_endpoint
}
/pair/by_symbol?symbol=
${
symbol
}
`
let
market
=
"spot"
if
(
symbol
.
endsWith
(
"_SWAP"
))
{
market
=
"lpc"
}
const
url
=
`
${
webadmin_endpoint
}
/pair/by_symbol?symbol=
${
symbol
}
&market=
${
market
}
`
let
{
data
}
=
await
axios
.
get
(
url
);
if
(
data
.
state
!=
0
)
{
logger
.
error
(
"getPairFromCore"
,
data
.
msg
);
...
...
@@ -75,6 +82,7 @@ export const getUserAccountFromCore = async (userId, withName = true) => {
return
assets
;
}
// market 默认spot 合约为lpc
// user_id
// status, // 必须 unsettled或者settled
// symbol, // 可选,交易对
...
...
@@ -96,6 +104,7 @@ export const getUserOrdersFromCore = async (params) => {
return
data
.
result
}
// market 默认spot 合约为lpc
// user_id
// symbol, // 可选,交易对
// start_time, // 成交时间
...
...
@@ -154,10 +163,17 @@ export const addPairToCore = async (body) => {
// 设置手续费 至少指定user_id 和 symbol 二者其一
export
const
changeTradingFee
=
async
(
symbol
,
user_id
,
maker_fee
,
taker_fee
)
=>
{
let
body
=
{
maker_fee
,
taker_fee
,
}
if
(
symbol
)
{
let
market
=
"spot"
if
(
symbol
.
endsWith
(
"_SWAP"
))
{
market
=
"lpc"
}
body
[
"market"
]
=
market
;
body
[
"symbol"
]
=
symbol
;
}
if
(
user_id
>
0
)
{
...
...
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