Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  Апдейт версии
  Фикс longTermDebt
  Фикс запроса тикера
  Bump mongoose from 5.12.5 to 5.12.6
  • Loading branch information
samgozman committed Apr 28, 2021
2 parents 6c74712 + dc1cf4c commit b5b41c0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "short-fork",
"description": "Stock market helper: display a Short Float & Volume percentage indicator from three different data sources in one place.",
"version": "1.2.0",
"version": "1.2.1",
"type": "module",
"main": "index.mjs",
"exports": "./index.mjs",
Expand All @@ -13,7 +13,7 @@
"express-rate-limit": "^5.2.6",
"finvizor": "^1.0.5",
"is-on-tinkoff-invest": "^1.0.0",
"mongoose": "^5.12.5",
"mongoose": "^5.12.6",
"nakedshort": "^1.0.4",
"p-timeout": "^5.0.0",
"shortsqueeze": "^1.0.3"
Expand Down
10 changes: 4 additions & 6 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ const checkForThemeSettings = () => {
* @return {void}
*/
const techWidget = (ticker = '') => {
const quote = ticker.toUpperCase()
const theme = checkForThemeSettings()

const html = `
<!-- TradingView Widget BEGIN -->
<div class='tradingview-widget-container'>
<div class='tradingview-widget-container__widget'></div>
<div class='tradingview-widget-copyright'><a href='https://www.tradingview.com/symbols/${quote}/technicals/'
rel='noopener' target='_blank'><span class='blue-text'>Technical Analysis for ${quote}</span></a> by
<div class='tradingview-widget-copyright'><a href='https://www.tradingview.com/symbols/${ticker}/technicals/'
rel='noopener' target='_blank'><span class='blue-text'>Technical Analysis for ${ticker}</span></a> by
TradingView</div>
<script type='text/javascript'
src='https://s3.tradingview.com/external-embedding/embed-widget-technical-analysis.js' async>
Expand All @@ -69,7 +68,7 @@ const techWidget = (ticker = '') => {
"width": "100%",
"isTransparent": false,
"height": "100%",
"symbol": "${quote}",
"symbol": "${ticker}",
"showIntervalTabs": true,
"locale": "ru",
"colorTheme": "${theme}"
Expand All @@ -88,10 +87,9 @@ const techWidget = (ticker = '') => {
* @return {void}
*/
const chartWidget = (ticker = '') => {
const quote = ticker.toUpperCase()
const theme = checkForThemeSettings()

iframe_chart.src = 'charts/chart.html?stock=' + quote + '&theme=' + theme
iframe_chart.src = 'charts/chart.html?stock=' + ticker + '&theme=' + theme
}

// DOM object of elements which should be changed during request
Expand Down
5 changes: 4 additions & 1 deletion src/middleware/findStock.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const findStock = async (req, res, next) => {
})
}
try {
ticker = ticker.toUpperCase().trim()
ticker = ticker.toUpperCase()

// Replace every non-word except dot
ticker = ticker.replace(/[^\w.]/g,'')

// ! 2. Find ticker in data base
let stock = await Stock.findOne({
Expand Down
2 changes: 1 addition & 1 deletion src/models/barchartFinancials.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ barchartFinancialsSchema.statics.getFromSource = async function (ticker) {
}

const liabilities = barchartFinancialsBalance.liabilities
const liabLongTermDebt = liabilities.nonCurrentLiabilities.longTermDebt ? liabilities.nonCurrentLiabilities.longTermDebt : null
const liabLongTermDebt = liabilities.nonCurrentLiabilities ? liabilities.nonCurrentLiabilities.longTermDebt : null
const basicLongTermDebt = liabilities.longTermDebt ? liabilities.longTermDebt : null

const longDebt = liabLongTermDebt ? liabLongTermDebt : basicLongTermDebt
Expand Down

0 comments on commit b5b41c0

Please sign in to comment.