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

Getting resolveSymbol to work #3

Open
maxthilen opened this issue May 30, 2020 · 4 comments
Open

Getting resolveSymbol to work #3

maxthilen opened this issue May 30, 2020 · 4 comments

Comments

@maxthilen
Copy link

maxthilen commented May 30, 2020

Not sure if Polygon changed data format since this was built but I was having some issues integrating the adapter into tradingview charts. Updating resolveSymbol as follows solved the problem for me. Figured I'd share in case anyone else is having the same problem.

	resolveSymbol( symbol, cb, cberr ){
		console.log('resolve symbol:', symbol)
		let TickerTypeMap = {
			'STOCKS': 'stock',
			'FX': 'forex',
			'CRYPTO': 'bitcoin',
		}
		axios.get(`${BASE_URL}/v2/reference/tickers?search=${symbol}&perpage=50&page=1&apiKey=${this.apikey}`).then(( data ) => {
			console.log('DATAAA', data)
			let c = Get( data, 'data.tickers[0]', {} )
			console.log('c',c)
			cb({
				name: c.name,
				ticker: c.ticker,
				type: TickerTypeMap[ c.market ] || 'stocks',
				exchange: c.primaryExch,
				minmov: 1,
				pricescale: 100,
				session:'0900-1630',
				timezone: 'America/New_York',
				has_intraday: true,
				supported_resolutions: SUPPORTED_RESOLUTIONS,
			})
		})
	}
@MrKalten
Copy link

Same problem here.

I found some data using this :

axios.get(${BASE_URL}/v1/meta/symbols/${symbol}/company?apiKey=${this.apikey}).then(( data ) => {

But some data are missing, like "first_intraday"

@platformsfx
Copy link

Same problem, We informed polygon to this error 6 months ago ! with no solution until now.
@qrpike @stacho
Can you please Fix this ?

@maxthilen
Copy link
Author

So as far as I can tell that code snippet above solves the issue - not sure if those fields are required or if it's possible to make it work without? Separately (and forgive me if this is a noob question), the comments in this code say it only supports 1 minute polling. Looking at the chart pre-market here, it doesn't appear to be grabbing the data immediately as its streamed in. Any suggestions on what needs to be changed to get this to stream as real time as possible?

@MrYutz
Copy link

MrYutz commented Mar 24, 2021

They are making some API changes again.

This code allows the adapter to work correctly:

axios.get(`${BASE_URL}/v1/meta/symbols/${symbol}/company?apiKey=${this.apikey}`).then(( data ) => {
			console.log('Polygon Resolve Data:', data.data)
			let c = data.data;
			let intFirst = false
			let dayFirst = false
			cb({
				name: c.name,
				ticker: c.symbol,
				type: TickerTypeMap[ c.type ] || 'stocks',
				exchange: c.exchange,
				timezone: 'America/New_York',
				first_intraday: intFirst,
				has_intraday: true,
				first_daily: dayFirst,
				has_daily: true,
				supported_resolutions: SUPPORTED_RESOLUTIONS,
			})
		})
	}

michaelschultzdev pushed a commit to michaelschultzdev/tradingview-adapter that referenced this issue Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants