|
@@ -22,7 +22,8 @@ import {
|
|
getSignature_GT,
|
|
getSignature_GT,
|
|
getSignature_XG,
|
|
getSignature_XG,
|
|
getSignature_CN,
|
|
getSignature_CN,
|
|
- getSignature_BM, getSignature_CM,
|
|
|
|
|
|
+ getSignature_BM,
|
|
|
|
+ getSignature_CM,
|
|
getToken_GX,
|
|
getToken_GX,
|
|
startWebSocket,
|
|
startWebSocket,
|
|
} from '../utilities';
|
|
} from '../utilities';
|
|
@@ -50,6 +51,7 @@ import {
|
|
TEXT_CONSTANTS,
|
|
TEXT_CONSTANTS,
|
|
TICKER_CONSTANTS as tickers,
|
|
TICKER_CONSTANTS as tickers,
|
|
HTML_XG as html_XG,
|
|
HTML_XG as html_XG,
|
|
|
|
+ HTX_ORDERS as htx_orders,
|
|
} from '../constants';
|
|
} from '../constants';
|
|
|
|
|
|
// получение текущего времени + 5
|
|
// получение текущего времени + 5
|
|
@@ -243,6 +245,7 @@ export const getMerchantOrders = async (params) => {
|
|
};
|
|
};
|
|
|
|
|
|
// prefix === 'BG_API' ? console.log(params) : null;
|
|
// prefix === 'BG_API' ? console.log(params) : null;
|
|
|
|
+ if (prefix === 'HB') result = htx_orders;
|
|
await axios(config)
|
|
await axios(config)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
// prefix === 'AX_API' ? console.log(response.data) : null;
|
|
// prefix === 'AX_API' ? console.log(response.data) : null;
|
|
@@ -258,7 +261,7 @@ export const getMerchantOrders = async (params) => {
|
|
response.data.message === 'success' ? response.data.data : [];
|
|
response.data.message === 'success' ? response.data.data : [];
|
|
} else if (prefix === 'KX') {
|
|
} else if (prefix === 'KX') {
|
|
result = response.data.data.items ? response.data.data.items : [];
|
|
result = response.data.data.items ? response.data.data.items : [];
|
|
- } else if (prefix === 'HB') {
|
|
|
|
|
|
+ } else if (prefix === '_HB') {
|
|
result =
|
|
result =
|
|
response.data.success === false || response.data.data[0] === null
|
|
response.data.success === false || response.data.data[0] === null
|
|
? []
|
|
? []
|
|
@@ -349,17 +352,17 @@ export const getMerchantOrdersNomalized = (
|
|
if (params.prefix === 'BN') {
|
|
if (params.prefix === 'BN') {
|
|
const externalPayMethod = orders[i].payMethods
|
|
const externalPayMethod = orders[i].payMethods
|
|
? orders[i].payMethods.filter((item) => {
|
|
? orders[i].payMethods.filter((item) => {
|
|
- return item.id === orders[i].selectedPayId;
|
|
|
|
- })
|
|
|
|
|
|
+ return item.id === orders[i].selectedPayId;
|
|
|
|
+ })
|
|
: [];
|
|
: [];
|
|
const PayMethodProps =
|
|
const PayMethodProps =
|
|
externalPayMethod.length === 0
|
|
externalPayMethod.length === 0
|
|
? { payId: '', payName: '' }
|
|
? { payId: '', payName: '' }
|
|
: getPayMethodProps(
|
|
: getPayMethodProps(
|
|
- params.exchangeId,
|
|
|
|
- externalPayMethod[0].identifier,
|
|
|
|
- arrPayTypes
|
|
|
|
- );
|
|
|
|
|
|
+ params.exchangeId,
|
|
|
|
+ externalPayMethod[0].identifier,
|
|
|
|
+ arrPayTypes
|
|
|
|
+ );
|
|
const orderStatus =
|
|
const orderStatus =
|
|
typeof orders[i].orderStatus === 'number'
|
|
typeof orders[i].orderStatus === 'number'
|
|
? orders[i].orderStatus.toString()
|
|
? orders[i].orderStatus.toString()
|
|
@@ -661,10 +664,10 @@ export const getMerchantOrdersNomalized = (
|
|
externalPayMethod.length === 0
|
|
externalPayMethod.length === 0
|
|
? { payId: '', payName: '' }
|
|
? { payId: '', payName: '' }
|
|
: getPayMethodProps(
|
|
: getPayMethodProps(
|
|
- params.exchangeId,
|
|
|
|
- externalPayMethod[0].identifier,
|
|
|
|
- arrPayTypes
|
|
|
|
- );
|
|
|
|
|
|
+ params.exchangeId,
|
|
|
|
+ externalPayMethod[0].identifier,
|
|
|
|
+ arrPayTypes
|
|
|
|
+ );
|
|
item.orderId = orders[i].orderNo;
|
|
item.orderId = orders[i].orderNo;
|
|
item.statusProps = getStatusProps(orders[i].orderStatus.toString());
|
|
item.statusProps = getStatusProps(orders[i].orderStatus.toString());
|
|
item.price = orders[i].price;
|
|
item.price = orders[i].price;
|
|
@@ -779,7 +782,7 @@ export const getMerchantOrdersNomalized = (
|
|
);
|
|
);
|
|
const statusProps =
|
|
const statusProps =
|
|
orders[i].status === 'PAYED_MONEY' &&
|
|
orders[i].status === 'PAYED_MONEY' &&
|
|
- orders[i].appealStatus === 'APPEALING'
|
|
|
|
|
|
+ orders[i].appealStatus === 'APPEALING'
|
|
? { value: 'Appealing', color: 'danger' }
|
|
? { value: 'Appealing', color: 'danger' }
|
|
: getStatusProps(orders[i].status);
|
|
: getStatusProps(orders[i].status);
|
|
item.orderId = orders[i].id;
|
|
item.orderId = orders[i].id;
|
|
@@ -1380,11 +1383,11 @@ export const getP2POrdersNomalized = (orders, params, arrPayTypes) => {
|
|
arrPayProps.length === 0
|
|
arrPayProps.length === 0
|
|
? [{ payName: 'Sberbank', payId: '62ab3f114399fc08ec9725b6' }]
|
|
? [{ payName: 'Sberbank', payId: '62ab3f114399fc08ec9725b6' }]
|
|
: [
|
|
: [
|
|
- {
|
|
|
|
- payName: arrPayProps[0].payType,
|
|
|
|
- payId: arrPayProps[0].id,
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
|
|
+ {
|
|
|
|
+ payName: arrPayProps[0].payType,
|
|
|
|
+ payId: arrPayProps[0].id,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
item.conterpartInfo = {
|
|
item.conterpartInfo = {
|
|
uid: orders[i].member,
|
|
uid: orders[i].member,
|
|
uidPublic: '',
|
|
uidPublic: '',
|
|
@@ -1512,15 +1515,15 @@ export const getP2POrdersNomalized = (orders, params, arrPayTypes) => {
|
|
allOrderCount:
|
|
allOrderCount:
|
|
orders[i].advertiserVo.userStatsRet.completedOrderNum !== null
|
|
orders[i].advertiserVo.userStatsRet.completedOrderNum !== null
|
|
? orders[
|
|
? orders[
|
|
- i
|
|
|
|
- ].advertiserVo.userStatsRet.completedOrderNum.toString()
|
|
|
|
|
|
+ i
|
|
|
|
+ ].advertiserVo.userStatsRet.completedOrderNum.toString()
|
|
: '',
|
|
: '',
|
|
monthOrderCount:
|
|
monthOrderCount:
|
|
orders[i].advertiserVo.userStatsRet
|
|
orders[i].advertiserVo.userStatsRet
|
|
.completedOrderNumOfLatest30day !== null
|
|
.completedOrderNumOfLatest30day !== null
|
|
? orders[
|
|
? orders[
|
|
- i
|
|
|
|
- ].advertiserVo.userStatsRet.completedOrderNumOfLatest30day.toString()
|
|
|
|
|
|
+ i
|
|
|
|
+ ].advertiserVo.userStatsRet.completedOrderNumOfLatest30day.toString()
|
|
: '',
|
|
: '',
|
|
finishRate:
|
|
finishRate:
|
|
orders[i].advertiserVo.userStatsRet.finishRate !== null
|
|
orders[i].advertiserVo.userStatsRet.finishRate !== null
|
|
@@ -1534,15 +1537,15 @@ export const getP2POrdersNomalized = (orders, params, arrPayTypes) => {
|
|
orders[i].advertiserVo.userStatsRet
|
|
orders[i].advertiserVo.userStatsRet
|
|
.completedBuyOrderNumOfLatest30day !== null
|
|
.completedBuyOrderNumOfLatest30day !== null
|
|
? orders[
|
|
? orders[
|
|
- i
|
|
|
|
- ].advertiserVo.userStatsRet.completedBuyOrderNumOfLatest30day.toString()
|
|
|
|
|
|
+ i
|
|
|
|
+ ].advertiserVo.userStatsRet.completedBuyOrderNumOfLatest30day.toString()
|
|
: '',
|
|
: '',
|
|
sellOrdersCompleted:
|
|
sellOrdersCompleted:
|
|
orders[i].advertiserVo.userStatsRet
|
|
orders[i].advertiserVo.userStatsRet
|
|
.completedSellOrderNumOfLatest30day !== null
|
|
.completedSellOrderNumOfLatest30day !== null
|
|
? orders[
|
|
? orders[
|
|
- i
|
|
|
|
- ].advertiserVo.userStatsRet.completedSellOrderNumOfLatest30day.toString()
|
|
|
|
|
|
+ i
|
|
|
|
+ ].advertiserVo.userStatsRet.completedSellOrderNumOfLatest30day.toString()
|
|
: '',
|
|
: '',
|
|
};
|
|
};
|
|
} else if (params.prefix === 'MG') {
|
|
} else if (params.prefix === 'MG') {
|
|
@@ -2448,8 +2451,10 @@ export const getBalance = async (params) => {
|
|
balance = response.data.data === null ? [] : response.data.data;
|
|
balance = response.data.data === null ? [] : response.data.data;
|
|
} else if (prefix === 'HB_API') {
|
|
} else if (prefix === 'HB_API') {
|
|
response.data.status === 'ok'
|
|
response.data.status === 'ok'
|
|
- ? balance = response.data.data
|
|
|
|
- : console.log(`${prefix}: ${TEXT_CONSTANTS.BALANCE_ER}\n${response.data['err-msg']}`);
|
|
|
|
|
|
+ ? (balance = response.data.data)
|
|
|
|
+ : console.log(
|
|
|
|
+ `${prefix}: ${TEXT_CONSTANTS.BALANCE_ER}\n${response.data['err-msg']}`
|
|
|
|
+ );
|
|
} else if (prefix === 'BZ') {
|
|
} else if (prefix === 'BZ') {
|
|
balance = response.data.errors ? [] : response.data;
|
|
balance = response.data.errors ? [] : response.data;
|
|
balance = Array.isArray(balance) ? balance : [];
|
|
balance = Array.isArray(balance) ? balance : [];
|
|
@@ -2474,12 +2479,12 @@ export const getBalance = async (params) => {
|
|
balance =
|
|
balance =
|
|
response.data.message === 'success'
|
|
response.data.message === 'success'
|
|
? [
|
|
? [
|
|
- {
|
|
|
|
- currency: 'USDT',
|
|
|
|
- available: '0',
|
|
|
|
- frozen: response.data.data.spot.usd,
|
|
|
|
- },
|
|
|
|
- ]
|
|
|
|
|
|
+ {
|
|
|
|
+ currency: 'USDT',
|
|
|
|
+ available: '0',
|
|
|
|
+ frozen: response.data.data.spot.usd,
|
|
|
|
+ },
|
|
|
|
+ ]
|
|
: [];
|
|
: [];
|
|
} else if (prefix === 'AX_API') {
|
|
} else if (prefix === 'AX_API') {
|
|
balance = response.data.data;
|
|
balance = response.data.data;
|
|
@@ -2497,31 +2502,31 @@ export const getBalance = async (params) => {
|
|
} else if (prefix === 'BP') {
|
|
} else if (prefix === 'BP') {
|
|
balance = response.data.user.balance
|
|
balance = response.data.user.balance
|
|
? [
|
|
? [
|
|
- {
|
|
|
|
- code: response.data.user.balance.XMR.code,
|
|
|
|
- value: response.data.user.balance.XMR.value,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- code: response.data.user.balance.USDT.code,
|
|
|
|
- value: response.data.user.balance.USDT.value,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- code: response.data.user.balance.USDC.code,
|
|
|
|
- value: response.data.user.balance.USDC.value,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- code: response.data.user.balance.TON.code,
|
|
|
|
- value: response.data.user.balance.TON.value,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- code: response.data.user.balance.ETH.code,
|
|
|
|
- value: response.data.user.balance.ETH.value,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- code: response.data.user.balance.BTC.code,
|
|
|
|
- value: response.data.user.balance.BTC.value,
|
|
|
|
- },
|
|
|
|
- ]
|
|
|
|
|
|
+ {
|
|
|
|
+ code: response.data.user.balance.XMR.code,
|
|
|
|
+ value: response.data.user.balance.XMR.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ code: response.data.user.balance.USDT.code,
|
|
|
|
+ value: response.data.user.balance.USDT.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ code: response.data.user.balance.USDC.code,
|
|
|
|
+ value: response.data.user.balance.USDC.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ code: response.data.user.balance.TON.code,
|
|
|
|
+ value: response.data.user.balance.TON.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ code: response.data.user.balance.ETH.code,
|
|
|
|
+ value: response.data.user.balance.ETH.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ code: response.data.user.balance.BTC.code,
|
|
|
|
+ value: response.data.user.balance.BTC.value,
|
|
|
|
+ },
|
|
|
|
+ ]
|
|
: [];
|
|
: [];
|
|
} else if (prefix === 'XG_API') {
|
|
} else if (prefix === 'XG_API') {
|
|
balance = response.data;
|
|
balance = response.data;
|
|
@@ -3805,7 +3810,8 @@ export const getResultAdvUpdate = async (config, postfix) => {
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
console.log(
|
|
console.log(
|
|
- `=======// ${getTimestamps()} //=======\n${postfix}: ${TEXT_CONSTANTS.ADV_EDIT_ER
|
|
|
|
|
|
+ `=======// ${getTimestamps()} //=======\n${postfix}: ${
|
|
|
|
+ TEXT_CONSTANTS.ADV_EDIT_ER
|
|
}\n${error}`
|
|
}\n${error}`
|
|
);
|
|
);
|
|
});
|
|
});
|
|
@@ -4007,12 +4013,12 @@ export const getTickerPriceUSDT = (asset, fiat, arrTickers) => {
|
|
let price = '0.0000';
|
|
let price = '0.0000';
|
|
let nameTicker =
|
|
let nameTicker =
|
|
fiat === 'RUB' &&
|
|
fiat === 'RUB' &&
|
|
- (asset === 'DAI' ||
|
|
|
|
- asset === 'HUSD' ||
|
|
|
|
- asset === 'BUSD' ||
|
|
|
|
- asset === 'TUSD' ||
|
|
|
|
- asset === 'USDC' ||
|
|
|
|
- asset === 'USDT')
|
|
|
|
|
|
+ (asset === 'DAI' ||
|
|
|
|
+ asset === 'HUSD' ||
|
|
|
|
+ asset === 'BUSD' ||
|
|
|
|
+ asset === 'TUSD' ||
|
|
|
|
+ asset === 'USDC' ||
|
|
|
|
+ asset === 'USDT')
|
|
? asset + fiat
|
|
? asset + fiat
|
|
: asset + 'USDT';
|
|
: asset + 'USDT';
|
|
if (
|
|
if (
|
|
@@ -4050,15 +4056,17 @@ export const getPriceTicker = async (exchange, ticker) => {
|
|
|
|
|
|
if (exchange === 'Huobi') {
|
|
if (exchange === 'Huobi') {
|
|
reqConfig.method = CONSTANTS_HB.GET_DATA_TICKER.method;
|
|
reqConfig.method = CONSTANTS_HB.GET_DATA_TICKER.method;
|
|
- reqConfig.url = `${CONSTANTS_HB.GET_DATA_TICKER.url
|
|
|
|
- }?symbol=${ticker.toLowerCase()}`;
|
|
|
|
|
|
+ reqConfig.url = `${
|
|
|
|
+ CONSTANTS_HB.GET_DATA_TICKER.url
|
|
|
|
+ }?symbol=${ticker.toLowerCase()}`;
|
|
} else if (exchange === 'Mexc') {
|
|
} else if (exchange === 'Mexc') {
|
|
reqConfig.method = CONSTANTS_MG.GET_DATA_TICKER.method;
|
|
reqConfig.method = CONSTANTS_MG.GET_DATA_TICKER.method;
|
|
reqConfig.url = `${CONSTANTS_MG.GET_DATA_TICKER.url}?symbol=${ticker}`;
|
|
reqConfig.url = `${CONSTANTS_MG.GET_DATA_TICKER.url}?symbol=${ticker}`;
|
|
} else if (exchange === 'Garantex') {
|
|
} else if (exchange === 'Garantex') {
|
|
reqConfig.method = CONSTANTS_GX.GET_DATA_TICKER.method;
|
|
reqConfig.method = CONSTANTS_GX.GET_DATA_TICKER.method;
|
|
- reqConfig.url = `${CONSTANTS_GX.GET_DATA_TICKER.url
|
|
|
|
- }?market=${ticker.toLowerCase()}&limit=1`;
|
|
|
|
|
|
+ reqConfig.url = `${
|
|
|
|
+ CONSTANTS_GX.GET_DATA_TICKER.url
|
|
|
|
+ }?market=${ticker.toLowerCase()}&limit=1`;
|
|
} else if (exchange === 'Xeggex') {
|
|
} else if (exchange === 'Xeggex') {
|
|
const xg_ticker = ticker.replace('USDT', '_USDT');
|
|
const xg_ticker = ticker.replace('USDT', '_USDT');
|
|
reqConfig.method = CONSTANTS_XG.GET_DATA_TICKER.method;
|
|
reqConfig.method = CONSTANTS_XG.GET_DATA_TICKER.method;
|
|
@@ -4104,9 +4112,9 @@ export const getValuationUSDT = (coursesArray, assetName, assetVolume) => {
|
|
if (coursesArray.length !== 0 && assetName) {
|
|
if (coursesArray.length !== 0 && assetName) {
|
|
const tickerName =
|
|
const tickerName =
|
|
assetName === 'DAI' ||
|
|
assetName === 'DAI' ||
|
|
- assetName === 'RUB' ||
|
|
|
|
- assetName === 'UAH' ||
|
|
|
|
- assetName === 'HUSD'
|
|
|
|
|
|
+ assetName === 'RUB' ||
|
|
|
|
+ assetName === 'UAH' ||
|
|
|
|
+ assetName === 'HUSD'
|
|
? 'USDT' + assetName
|
|
? 'USDT' + assetName
|
|
: assetName + 'USDT';
|
|
: assetName + 'USDT';
|
|
for (let i = 0; i < coursesArray.length; i++) {
|
|
for (let i = 0; i < coursesArray.length; i++) {
|
|
@@ -4334,7 +4342,7 @@ export const getPaySubAccount = (payMethodId) => {
|
|
payMethodId === '66853219e2cbdd2170e30356' ||
|
|
payMethodId === '66853219e2cbdd2170e30356' ||
|
|
payMethodId === '668532a2e2cbdd2170e30358' ||
|
|
payMethodId === '668532a2e2cbdd2170e30358' ||
|
|
payMethodId === '6685332ae2cbdd2170e3035a' ||
|
|
payMethodId === '6685332ae2cbdd2170e3035a' ||
|
|
- payMethodId === '6685339ce2cbdd2170e3035c' || // Bakai
|
|
|
|
|
|
+ payMethodId === '6685339ce2cbdd2170e3035c' || // Bakai
|
|
payMethodId === '66853442e2cbdd2170e30360' ||
|
|
payMethodId === '66853442e2cbdd2170e30360' ||
|
|
payMethodId === '6685349ee2cbdd2170e30362' ||
|
|
payMethodId === '6685349ee2cbdd2170e30362' ||
|
|
payMethodId === '668534f8e2cbdd2170e30364' ||
|
|
payMethodId === '668534f8e2cbdd2170e30364' ||
|
|
@@ -4345,7 +4353,7 @@ export const getPaySubAccount = (payMethodId) => {
|
|
else if (
|
|
else if (
|
|
payMethodId === '671b4bf400b2dc0de491a832' || // Kaspi
|
|
payMethodId === '671b4bf400b2dc0de491a832' || // Kaspi
|
|
payMethodId === '671b4d1400b2dc0de491a834' || // Forte
|
|
payMethodId === '671b4d1400b2dc0de491a834' || // Forte
|
|
- payMethodId === '671b4d9600b2dc0de491a837' // Freedom
|
|
|
|
|
|
+ payMethodId === '671b4d9600b2dc0de491a837' // Freedom
|
|
)
|
|
)
|
|
sub = 'KZT';
|
|
sub = 'KZT';
|
|
return sub;
|
|
return sub;
|
|
@@ -4926,8 +4934,9 @@ export const getObjectRequestParams = (params) => {
|
|
} else if (prefix === 'p2p_GX') {
|
|
} else if (prefix === 'p2p_GX') {
|
|
} else if (prefix === 'advs_GX') {
|
|
} else if (prefix === 'advs_GX') {
|
|
} else if (prefix === 'otc_BT') {
|
|
} else if (prefix === 'otc_BT') {
|
|
- const query_string = `tokenId=${additionals.token
|
|
|
|
- }&page=${1}&size=${20}`;
|
|
|
|
|
|
+ const query_string = `tokenId=${
|
|
|
|
+ additionals.token
|
|
|
|
+ }&page=${1}&size=${20}`;
|
|
objParams.prefix = 'BT';
|
|
objParams.prefix = 'BT';
|
|
objParams.config = {
|
|
objParams.config = {
|
|
// withCredentials:true,
|
|
// withCredentials:true,
|
|
@@ -5853,18 +5862,18 @@ export const getObjectRequestParams = (params) => {
|
|
const data =
|
|
const data =
|
|
additionals.typeRequest === 'running'
|
|
additionals.typeRequest === 'running'
|
|
? {
|
|
? {
|
|
- facilitator: 2,
|
|
|
|
- messageStatus: 0,
|
|
|
|
- pageId: 0,
|
|
|
|
- pageSize: 10,
|
|
|
|
- type: 1,
|
|
|
|
- }
|
|
|
|
|
|
+ facilitator: 2,
|
|
|
|
+ messageStatus: 0,
|
|
|
|
+ pageId: 0,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ type: 1,
|
|
|
|
+ }
|
|
: {
|
|
: {
|
|
- facilitator: 2,
|
|
|
|
- pageId: 0,
|
|
|
|
- pageSize: 10,
|
|
|
|
- type: 4,
|
|
|
|
- };
|
|
|
|
|
|
+ facilitator: 2,
|
|
|
|
+ pageId: 0,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ type: 4,
|
|
|
|
+ };
|
|
objParams.prefix = 'BX';
|
|
objParams.prefix = 'BX';
|
|
objParams.config = {
|
|
objParams.config = {
|
|
withCredentials: true,
|
|
withCredentials: true,
|
|
@@ -6359,9 +6368,9 @@ export const getObjectRequestParams = (params) => {
|
|
},
|
|
},
|
|
};
|
|
};
|
|
} else if (prefix === 'balance_CM_API') {
|
|
} else if (prefix === 'balance_CM_API') {
|
|
- const query_string = "";
|
|
|
|
- const secretKey = "bb4a1a09a8b34d6fc3d70e20b3dc652050034987"
|
|
|
|
- const user_id = "2131b9ff-f419-4601-9c03-e008f8cf8569"
|
|
|
|
|
|
+ const query_string = '';
|
|
|
|
+ const secretKey = 'bb4a1a09a8b34d6fc3d70e20b3dc652050034987';
|
|
|
|
+ const user_id = '2131b9ff-f419-4601-9c03-e008f8cf8569';
|
|
// const signature = getSignature_CM(query_string, apiKeys.secretKey);
|
|
// const signature = getSignature_CM(query_string, apiKeys.secretKey);
|
|
const signature = getSignature_CM(query_string, secretKey);
|
|
const signature = getSignature_CM(query_string, secretKey);
|
|
objParams.prefix = 'CM_API';
|
|
objParams.prefix = 'CM_API';
|
|
@@ -6388,8 +6397,8 @@ export const getOrdersCompleted = (arrOrders) => {
|
|
arrOrders.length === 0 || arrOrders[0] === null
|
|
arrOrders.length === 0 || arrOrders[0] === null
|
|
? []
|
|
? []
|
|
: arrOrders.filter((item) => {
|
|
: arrOrders.filter((item) => {
|
|
- return item.statusProps.value === 'Completed';
|
|
|
|
- });
|
|
|
|
|
|
+ return item.statusProps.value === 'Completed';
|
|
|
|
+ });
|
|
return result.map((item) => {
|
|
return result.map((item) => {
|
|
// если GT, BG, BX, XG, CN - возвращаем детальный ордер, а не только orderId
|
|
// если GT, BG, BX, XG, CN - возвращаем детальный ордер, а не только orderId
|
|
return arrOrders[0].exchange === 'GT' ||
|
|
return arrOrders[0].exchange === 'GT' ||
|
|
@@ -6419,10 +6428,10 @@ export const getANDinsertAllOtcOrders = async (params) => {
|
|
for (let i = 0; i < orders.length; i++) {
|
|
for (let i = 0; i < orders.length; i++) {
|
|
const orderId =
|
|
const orderId =
|
|
shortName === 'GT' ||
|
|
shortName === 'GT' ||
|
|
- shortName === 'BG' ||
|
|
|
|
- shortName === 'BX' ||
|
|
|
|
- shortName === 'XG' ||
|
|
|
|
- shortName === 'CN'
|
|
|
|
|
|
+ shortName === 'BG' ||
|
|
|
|
+ shortName === 'BX' ||
|
|
|
|
+ shortName === 'XG' ||
|
|
|
|
+ shortName === 'CN'
|
|
? orders[i].orderId
|
|
? orders[i].orderId
|
|
: orders[i];
|
|
: orders[i];
|
|
const result = await checkOrderInDB(
|
|
const result = await checkOrderInDB(
|
|
@@ -6449,16 +6458,16 @@ export const getANDinsertAllOtcOrders = async (params) => {
|
|
// получение данных об ордере с биржи
|
|
// получение данных об ордере с биржи
|
|
const orderDetails =
|
|
const orderDetails =
|
|
shortName === 'GT' ||
|
|
shortName === 'GT' ||
|
|
- shortName === 'BG' ||
|
|
|
|
- shortName === 'BX' ||
|
|
|
|
- shortName === 'XG' ||
|
|
|
|
- shortName === 'CN'
|
|
|
|
|
|
+ shortName === 'BG' ||
|
|
|
|
+ shortName === 'BX' ||
|
|
|
|
+ shortName === 'XG' ||
|
|
|
|
+ shortName === 'CN'
|
|
? orders[i]
|
|
? orders[i]
|
|
: await getOrderDetails(
|
|
: await getOrderDetails(
|
|
- objReqParams.config,
|
|
|
|
- shortName,
|
|
|
|
- typeOrder
|
|
|
|
- );
|
|
|
|
|
|
+ objReqParams.config,
|
|
|
|
+ shortName,
|
|
|
|
+ typeOrder
|
|
|
|
+ );
|
|
// если статус ордера "Completed" вставляем в БД
|
|
// если статус ордера "Completed" вставляем в БД
|
|
const paramsNomalized = {
|
|
const paramsNomalized = {
|
|
userId,
|
|
userId,
|
|
@@ -6615,18 +6624,18 @@ export const startHandlerAllOtcOrders = async (params) => {
|
|
arrData.length === 0
|
|
arrData.length === 0
|
|
? []
|
|
? []
|
|
: getMerchantOrdersNomalized(
|
|
: getMerchantOrdersNomalized(
|
|
- arrData,
|
|
|
|
- {
|
|
|
|
- userId,
|
|
|
|
- exchangeId,
|
|
|
|
- prefix:
|
|
|
|
- shortName === 'BN' || shortName === 'CX'
|
|
|
|
- ? `${shortName}_API`
|
|
|
|
- : shortName,
|
|
|
|
- },
|
|
|
|
- arrPayTypes,
|
|
|
|
- arrOrderStatus
|
|
|
|
- );
|
|
|
|
|
|
+ arrData,
|
|
|
|
+ {
|
|
|
|
+ userId,
|
|
|
|
+ exchangeId,
|
|
|
|
+ prefix:
|
|
|
|
+ shortName === 'BN' || shortName === 'CX'
|
|
|
|
+ ? `${shortName}_API`
|
|
|
|
+ : shortName,
|
|
|
|
+ },
|
|
|
|
+ arrPayTypes,
|
|
|
|
+ arrOrderStatus
|
|
|
|
+ );
|
|
// получение массива отсортированных ордеров для BN
|
|
// получение массива отсортированных ордеров для BN
|
|
const sortedOrders =
|
|
const sortedOrders =
|
|
shortName === 'BN'
|
|
shortName === 'BN'
|
|
@@ -6774,8 +6783,8 @@ export const startHandlerAllSpotOrders = async (params) => {
|
|
} else if (shortName === 'GT') {
|
|
} else if (shortName === 'GT') {
|
|
objParams.prefix = isInsertOrders
|
|
objParams.prefix = isInsertOrders
|
|
? // ? `history_${shortName}_API`
|
|
? // ? `history_${shortName}_API`
|
|
- // : `active_${shortName}_API`;
|
|
|
|
- `history_${shortName}`
|
|
|
|
|
|
+ // : `active_${shortName}_API`;
|
|
|
|
+ `history_${shortName}`
|
|
: `active_${shortName}`;
|
|
: `active_${shortName}`;
|
|
objParams.constants = CONSTANTS_GT;
|
|
objParams.constants = CONSTANTS_GT;
|
|
const objReqParams = getObjectRequestParams(objParams);
|
|
const objReqParams = getObjectRequestParams(objParams);
|
|
@@ -7053,16 +7062,16 @@ export const handlerTotalBalance = async (params) => {
|
|
spotBalance === null
|
|
spotBalance === null
|
|
? []
|
|
? []
|
|
: getItemBalanceNormalizedHB({
|
|
: getItemBalanceNormalizedHB({
|
|
- arrItems: spotBalance.list,
|
|
|
|
- arrCurrencies,
|
|
|
|
- });
|
|
|
|
|
|
+ arrItems: spotBalance.list,
|
|
|
|
+ arrCurrencies,
|
|
|
|
+ });
|
|
const p2pBalanceFiltered =
|
|
const p2pBalanceFiltered =
|
|
p2pBalance === null
|
|
p2pBalance === null
|
|
? []
|
|
? []
|
|
: getItemBalanceNormalizedHB({
|
|
: getItemBalanceNormalizedHB({
|
|
- arrItems: p2pBalance.list,
|
|
|
|
- arrCurrencies,
|
|
|
|
- });
|
|
|
|
|
|
+ arrItems: p2pBalance.list,
|
|
|
|
+ arrCurrencies,
|
|
|
|
+ });
|
|
totalBalance.spotBalance = spotBalanceFiltered;
|
|
totalBalance.spotBalance = spotBalanceFiltered;
|
|
totalBalance.p2pBalance = p2pBalanceFiltered;
|
|
totalBalance.p2pBalance = p2pBalanceFiltered;
|
|
}
|
|
}
|
|
@@ -7124,15 +7133,15 @@ export const handlerTotalBalance = async (params) => {
|
|
spotBalance === null
|
|
spotBalance === null
|
|
? []
|
|
? []
|
|
: getItemBalanceNormalizedHB({
|
|
: getItemBalanceNormalizedHB({
|
|
- spotArrItems: spotBalance.list,
|
|
|
|
- arrCurrencies,
|
|
|
|
- });
|
|
|
|
|
|
+ spotArrItems: spotBalance.list,
|
|
|
|
+ arrCurrencies,
|
|
|
|
+ });
|
|
const p2pBalanceFiltered =
|
|
const p2pBalanceFiltered =
|
|
p2pBalance === null
|
|
p2pBalance === null
|
|
? []
|
|
? []
|
|
: p2pBalance.filter((item) => {
|
|
: p2pBalance.filter((item) => {
|
|
- return +item.total !== 0;
|
|
|
|
- });
|
|
|
|
|
|
+ return +item.total !== 0;
|
|
|
|
+ });
|
|
totalBalance.spotBalance = spotBalanceFiltered;
|
|
totalBalance.spotBalance = spotBalanceFiltered;
|
|
totalBalance.p2pBalance = getBalancesNormalized(
|
|
totalBalance.p2pBalance = getBalancesNormalized(
|
|
p2pBalanceFiltered,
|
|
p2pBalanceFiltered,
|
|
@@ -7144,16 +7153,16 @@ export const handlerTotalBalance = async (params) => {
|
|
balance.length === 0
|
|
balance.length === 0
|
|
? []
|
|
? []
|
|
: getBalancesNormalized(
|
|
: getBalancesNormalized(
|
|
- balance.bizBalances.trading,
|
|
|
|
- `${shortName}_spot`
|
|
|
|
- );
|
|
|
|
|
|
+ balance.bizBalances.trading,
|
|
|
|
+ `${shortName}_spot`
|
|
|
|
+ );
|
|
totalBalance.p2pBalance =
|
|
totalBalance.p2pBalance =
|
|
balance.length === 0
|
|
balance.length === 0
|
|
? []
|
|
? []
|
|
: getBalancesNormalized(
|
|
: getBalancesNormalized(
|
|
- balance.bizBalances.funding,
|
|
|
|
- `${shortName}_otc`
|
|
|
|
- );
|
|
|
|
|
|
+ balance.bizBalances.funding,
|
|
|
|
+ `${shortName}_otc`
|
|
|
|
+ );
|
|
} else if (shortName === 'BZ') {
|
|
} else if (shortName === 'BZ') {
|
|
} else if (shortName === 'GX') {
|
|
} else if (shortName === 'GX') {
|
|
const p2pBalance = await getBalance(getObjectRequestParams(params));
|
|
const p2pBalance = await getBalance(getObjectRequestParams(params));
|
|
@@ -7185,8 +7194,8 @@ export const handlerTotalBalance = async (params) => {
|
|
);
|
|
);
|
|
const spotBalanceFiltered = spotBalance.coinList
|
|
const spotBalanceFiltered = spotBalance.coinList
|
|
? spotBalance.coinList.filter((item) => {
|
|
? spotBalance.coinList.filter((item) => {
|
|
- return +item.equity !== 0;
|
|
|
|
- })
|
|
|
|
|
|
+ return +item.equity !== 0;
|
|
|
|
+ })
|
|
: [];
|
|
: [];
|
|
const p2pBalanceFiltered = p2pBalance.filter((item) => {
|
|
const p2pBalanceFiltered = p2pBalance.filter((item) => {
|
|
return +item.totalBalance !== 0;
|
|
return +item.totalBalance !== 0;
|
|
@@ -7306,24 +7315,24 @@ export const handlerTotalBalance = async (params) => {
|
|
const merchantAdvs =
|
|
const merchantAdvs =
|
|
arrData.length !== 0
|
|
arrData.length !== 0
|
|
? getMerchantAdvsNomalized(
|
|
? getMerchantAdvsNomalized(
|
|
- arrData,
|
|
|
|
- {
|
|
|
|
- userId: params.userId,
|
|
|
|
- exchangeId: params.additionals.exchangeId,
|
|
|
|
- prefix: shortName,
|
|
|
|
- },
|
|
|
|
- arrPayTypes
|
|
|
|
- )
|
|
|
|
- .filter((item) => {
|
|
|
|
- return item.tradeType === 'SELL';
|
|
|
|
- })
|
|
|
|
- .map((item) => {
|
|
|
|
- return {
|
|
|
|
- currency: item.asset,
|
|
|
|
- available: '0',
|
|
|
|
- frozen: item.volume,
|
|
|
|
- };
|
|
|
|
- })
|
|
|
|
|
|
+ arrData,
|
|
|
|
+ {
|
|
|
|
+ userId: params.userId,
|
|
|
|
+ exchangeId: params.additionals.exchangeId,
|
|
|
|
+ prefix: shortName,
|
|
|
|
+ },
|
|
|
|
+ arrPayTypes
|
|
|
|
+ )
|
|
|
|
+ .filter((item) => {
|
|
|
|
+ return item.tradeType === 'SELL';
|
|
|
|
+ })
|
|
|
|
+ .map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ currency: item.asset,
|
|
|
|
+ available: '0',
|
|
|
|
+ frozen: item.volume,
|
|
|
|
+ };
|
|
|
|
+ })
|
|
: [];
|
|
: [];
|
|
|
|
|
|
totalBalance.p2pBalance = getBalancesNormalized(
|
|
totalBalance.p2pBalance = getBalancesNormalized(
|
|
@@ -7404,9 +7413,9 @@ export const handlerTotalBalance = async (params) => {
|
|
spotBalanceFiltered.length === 0
|
|
spotBalanceFiltered.length === 0
|
|
? []
|
|
? []
|
|
: getBalancesNormalized(
|
|
: getBalancesNormalized(
|
|
- spotBalanceFiltered,
|
|
|
|
- `${shortName}_spot`
|
|
|
|
- );
|
|
|
|
|
|
+ spotBalanceFiltered,
|
|
|
|
+ `${shortName}_spot`
|
|
|
|
+ );
|
|
totalBalance.p2pBalance =
|
|
totalBalance.p2pBalance =
|
|
p2pBalanceFiltered.length === 0
|
|
p2pBalanceFiltered.length === 0
|
|
? []
|
|
? []
|
|
@@ -7467,14 +7476,14 @@ export const handlerTotalBalance = async (params) => {
|
|
const merchantAdvs =
|
|
const merchantAdvs =
|
|
arrData.length !== 0
|
|
arrData.length !== 0
|
|
? getMerchantAdvsNomalized(
|
|
? getMerchantAdvsNomalized(
|
|
- arrData,
|
|
|
|
- {
|
|
|
|
- userId: params.userId,
|
|
|
|
- exchangeId: params.additionals.exchangeId,
|
|
|
|
- prefix: shortName,
|
|
|
|
- },
|
|
|
|
- arrPayTypes
|
|
|
|
- )
|
|
|
|
|
|
+ arrData,
|
|
|
|
+ {
|
|
|
|
+ userId: params.userId,
|
|
|
|
+ exchangeId: params.additionals.exchangeId,
|
|
|
|
+ prefix: shortName,
|
|
|
|
+ },
|
|
|
|
+ arrPayTypes
|
|
|
|
+ )
|
|
: [];
|
|
: [];
|
|
|
|
|
|
const p2pBalanceFiltered = merchantAdvs.filter((item) => {
|
|
const p2pBalanceFiltered = merchantAdvs.filter((item) => {
|
|
@@ -7696,23 +7705,23 @@ const getCurrentCourseAssetUSDT = async (arrTickers) => {
|
|
TG_BOT
|
|
TG_BOT
|
|
? console.log('=== setInterval() orders|tickers is false ===')
|
|
? console.log('=== setInterval() orders|tickers is false ===')
|
|
: setInterval(async () => {
|
|
: setInterval(async () => {
|
|
- console.log(
|
|
|
|
- '+++++++|tickers|+++++++ ' +
|
|
|
|
- getTimestamps() +
|
|
|
|
- ' +++++++|timer|+++++++'
|
|
|
|
- );
|
|
|
|
- // обновление курсов тикеров
|
|
|
|
- getCurrentCourseAssetUSDT(tickers);
|
|
|
|
- // Проверка новых завершенных otc-orders
|
|
|
|
- await startHandlerAllOtcOrders({
|
|
|
|
- userId: '6086427c72453019ec72dbb3',
|
|
|
|
- isInsertOrders: true,
|
|
|
|
- typeOrder: 'MERCHANT',
|
|
|
|
- });
|
|
|
|
- // Проверка новых завершенных spot-orders
|
|
|
|
- await startHandlerAllSpotOrders({
|
|
|
|
- userId: '6086427c72453019ec72dbb3',
|
|
|
|
- isInsertOrders: true,
|
|
|
|
- typeOrder: 'SPOT',
|
|
|
|
- });
|
|
|
|
- }, 60000 * 29);
|
|
|
|
|
|
+ console.log(
|
|
|
|
+ '+++++++|tickers|+++++++ ' +
|
|
|
|
+ getTimestamps() +
|
|
|
|
+ ' +++++++|timer|+++++++'
|
|
|
|
+ );
|
|
|
|
+ // обновление курсов тикеров
|
|
|
|
+ getCurrentCourseAssetUSDT(tickers);
|
|
|
|
+ // Проверка новых завершенных otc-orders
|
|
|
|
+ await startHandlerAllOtcOrders({
|
|
|
|
+ userId: '6086427c72453019ec72dbb3',
|
|
|
|
+ isInsertOrders: true,
|
|
|
|
+ typeOrder: 'MERCHANT',
|
|
|
|
+ });
|
|
|
|
+ // Проверка новых завершенных spot-orders
|
|
|
|
+ await startHandlerAllSpotOrders({
|
|
|
|
+ userId: '6086427c72453019ec72dbb3',
|
|
|
|
+ isInsertOrders: true,
|
|
|
|
+ typeOrder: 'SPOT',
|
|
|
|
+ });
|
|
|
|
+ }, 60000 * 29);
|