bbgo_origin/apps/frontend/src/utils.js

38 lines
747 B
JavaScript
Raw Permalink Normal View History

2021-01-25 10:29:31 +00:00
export function currencyColor(currency) {
2022-06-11 00:57:54 +00:00
switch (currency) {
case 'BTC':
return '#f69c3d';
case 'ETH':
return '#497493';
case 'MCO':
return '#032144';
case 'OMG':
return '#2159ec';
case 'LTC':
return '#949494';
case 'USDT':
return '#2ea07b';
case 'SAND':
return '#2E9AD0';
case 'XRP':
return '#00AAE4';
case 'BCH':
return '#8DC351';
case 'MAX':
return '#2D4692';
case 'TWD':
return '#4A7DED';
}
2021-01-25 10:29:31 +00:00
}
2022-06-14 04:36:31 +00:00
export function throttle(fn, delayMillis) {
let permitted = true;
return () => {
if (permitted) {
2022-06-14 07:33:22 +00:00
fn.apply(this, arguments);
permitted = false;
setTimeout(() => (permitted = true), delayMillis);
2022-06-14 04:36:31 +00:00
}
2022-06-14 07:33:22 +00:00
};
2022-06-14 04:36:31 +00:00
}