nefertiti-node
Version:
ES module to work with Nefertiti crypto trade bot.
103 lines (72 loc) • 3.61 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>functions/filterMarketsByCurrency.js - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#deleteBot">deleteBot</a></li><li><a href="global.html#downloadNefertiti">downloadNefertiti</a></li><li><a href="global.html#filterMarketsByCurrency">filterMarketsByCurrency</a></li><li><a href="global.html#getAvailableMarkets">getAvailableMarkets</a></li><li><a href="global.html#getCurrentNefVersion">getCurrentNefVersion</a></li><li><a href="global.html#getSupportedExchanges">getSupportedExchanges</a></li><li><a href="global.html#pingBot">pingBot</a></li><li><a href="global.html#pingHub">pingHub</a></li><li><a href="global.html#postBot">postBot</a></li><li><a href="global.html#sendNotificationsTest">sendNotificationsTest</a></li><li><a href="global.html#updateBot">updateBot</a></li><li><a href="global.html#updateNef">updateNef</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">functions/filterMarketsByCurrency.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import getAvailableMarkets from './getAvailableMarkets.js';
/**
* @function filterMarketsByCurrency
* @description Filter all of the markets that match a string
* @param {string} exchangeCode - Can be exchange code (KUCN)or full name
* @param {string} filterCurrency - Case-sensitive market to search
* Can be used as a quote currency with a hyphen in the correct place ('-BTC')
* @returns an array of market objects that contain a string including @filterCurrency
* @example
* const gdaxEthMarkets = filtermarketsByCurrency('gdax', 'ETH-')
* console.log(gdaxEthMarkets)
*[
* { name: 'ETH-USDT' },
* { name: 'ETH-GBP' },
* { name: 'ETH-EUR' },
* { name: 'ETH-DAI' },
* { name: 'ETH-BTC' },
* { name: 'ETH-USDC' },
* { name: 'ETH-USD' }
*]
*
*/
export default function filterMarketsByCurrency(exchangeCode, filterCurrency) {
const array = getAvailableMarkets(exchangeCode);
const results = array.filter(
(markets) => Object.values(markets)
.toString().includes(filterCurrency.toUpperCase()),
// eslint-disable-next-line function-paren-newline
);
return results;
}
</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Sat Dec 18 2021 15:50:34 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>