Adding switch for rated-seller check
This commit is contained in:
parent
ae8cbd85e8
commit
6c86c0a94b
@ -19,6 +19,7 @@ module.exports = {
|
||||
UP_RATE: 0.5 / 100, //0.5 % inc
|
||||
MAX_DOWN_PER_DAY: 4.8 / 100, //max 4.8% dec
|
||||
MAX_UP_PER_DAY: 12 / 100, //max 12% inc
|
||||
CHECK_RATED_SELLER: false,
|
||||
TOP_RANGE: 10 / 100, //top 10%
|
||||
REC_HISTORY_INTERVAL: 1 * 60 * 60 * 1000, // 1 hr
|
||||
},
|
||||
|
||||
@ -68,14 +68,14 @@ function refreshDataFromBlockchain() {
|
||||
for (let id of content.Trusted.add)
|
||||
promises.push(DB.query("INSERT INTO TrustedList (floID) VALUE (?) ON DUPLICATE KEY UPDATE floID=floID", [id]));
|
||||
}
|
||||
//Tag List with priority and API
|
||||
//Tag List with priority
|
||||
if (content.Tag) {
|
||||
if (content.Tag.remove)
|
||||
for (let t of content.Tag.remove)
|
||||
promises.push(DB.query("DELETE FROM TagList WHERE tag=?", [t]));
|
||||
if (content.Tag.add)
|
||||
for (let t in content.Tag.add)
|
||||
promises.push(DB.query("INSERT INTO TagList (tag, sellPriority, buyPriority) VALUE (?, ?, ?) ON DUPLICATE KEY UPDATE tag=tag", [t, content.Tag.add[t].sellPriority, content.Tag.add[t].buyPriority, content.Tag.add[t].api]));
|
||||
promises.push(DB.query("INSERT INTO TagList (tag, sellPriority, buyPriority) VALUE (?, ?, ?) ON DUPLICATE KEY UPDATE tag=tag", [t, content.Tag.add[t].sellPriority, content.Tag.add[t].buyPriority]));
|
||||
if (content.Tag.update)
|
||||
for (let t in content.Tag.update)
|
||||
for (let a in content.Tag.update[t])
|
||||
|
||||
@ -6,6 +6,7 @@ const {
|
||||
UP_RATE,
|
||||
MAX_DOWN_PER_DAY,
|
||||
MAX_UP_PER_DAY,
|
||||
CHECK_RATED_SELLER,
|
||||
TOP_RANGE,
|
||||
REC_HISTORY_INTERVAL
|
||||
} = require("./_constants")["price"];
|
||||
@ -181,6 +182,8 @@ function getRates(asset) {
|
||||
function checkForRatedSellers(asset) {
|
||||
//Check if there are best rated sellers?
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!CHECK_RATED_SELLER) //switch for the check case
|
||||
return resolve(true);
|
||||
DB.query("SELECT MAX(sellPriority) as max_p FROM TagList").then(result => {
|
||||
let ratedMin = result[0].max_p * (1 - TOP_RANGE);
|
||||
DB.query("SELECT COUNT(*) as value FROM SellOrder WHERE floID IN (" +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user