Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CL-1406: Removing full_name from symbol #111

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/datafeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function getAllSymbols() {
const symbol = generateSymbol(exchange.value, leftPairPart, rightPairPart);
return {
symbol: symbol.short,
full_name: symbol.full,
ticker: symbol.short,
KatPierce marked this conversation as resolved.
Show resolved Hide resolved
description: symbol.short,
exchange: exchange.value,
type: 'crypto',
Expand Down Expand Up @@ -78,7 +78,8 @@ export default {
const symbols = await getAllSymbols();
const newSymbols = symbols.filter(symbol => {
const isExchangeValid = exchange === '' || symbol.exchange === exchange;
const isFullSymbolContainsInput = symbol.full_name
const fullName = `${symbol.exchange}:${symbol.ticker}`;
const isFullSymbolContainsInput = fullName
.toLowerCase()
.indexOf(userInput.toLowerCase()) !== -1;
return isExchangeValid && isFullSymbolContainsInput;
Expand All @@ -95,16 +96,16 @@ export default {
console.log('[resolveSymbol]: Method call', symbolName);
const symbols = await getAllSymbols();
const symbolItem = symbols.find(({
full_name,
}) => full_name === symbolName);
ticker
}) => ticker === symbolName);
if (!symbolItem) {
console.log('[resolveSymbol]: Cannot resolve symbol', symbolName);
onResolveErrorCallback('cannot resolve symbol');
return;
}
// Symbol information object
const symbolInfo = {
ticker: symbolItem.full_name,
ticker: symbolItem.ticker,
name: symbolItem.symbol,
description: symbolItem.description,
type: symbolItem.type,
Expand Down
1 change: 0 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export function generateSymbol(exchange, fromSymbol, toSymbol) {
const short = `${fromSymbol}/${toSymbol}`;
return {
short,
full: `${exchange}:${short}`,
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Datafeed from './datafeed.js';

window.tvWidget = new TradingView.widget({
symbol: 'Bitfinex:BTC/USD', // Default symbol
symbol: 'BTC/EUR', // Default symbol
interval: '1D', // Default interval
fullscreen: true, // Displays the chart in the fullscreen mode
container: 'tv_chart_container', // Reference to an attribute of the DOM element
Expand Down