tradingview-screener-ts
Version:
TypeScript port of TradingView Screener with 100% Python parity - Based on the original Python library by shner-elmo (https://github.com/shner-elmo/TradingView-Screener)
42 lines • 1.09 kB
JavaScript
;
/**
* Utility functions for TradingView Screener
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatTechnicalRating = void 0;
/**
* Formats a numeric technical rating into a human-readable string
*
* @param rating - Numeric rating value
* @returns Human-readable technical rating
*
* @example
* ```typescript
* formatTechnicalRating(0.7) // 'Strong Buy'
* formatTechnicalRating(0.2) // 'Buy'
* formatTechnicalRating(0.0) // 'Neutral'
* formatTechnicalRating(-0.2) // 'Sell'
* formatTechnicalRating(-0.7) // 'Strong Sell'
* ```
*
* @see https://github.com/shner-elmo/TradingView-Screener/issues/12
*/
function formatTechnicalRating(rating) {
if (rating >= 0.5) {
return 'Strong Buy';
}
else if (rating >= 0.1) {
return 'Buy';
}
else if (rating >= -0.1) {
return 'Neutral';
}
else if (rating >= -0.5) {
return 'Sell';
}
else {
return 'Strong Sell';
}
}
exports.formatTechnicalRating = formatTechnicalRating;
//# sourceMappingURL=util.js.map