﻿CREATE PROCEDURE [dbo].[USP_CRT_GetLiveData]

AS
		SELECT 
		 [CRTD_CreationDate] as 'Timestamp'
		,[CRTD_BidOpeningValue] as 'BidOpen'
		,[CRTD_BidClosingValue] as 'BidClose'
		,[CRTD_BidLowValue] as 'BidLow'
		,[CRTD_BidHighValue] as 'BidHigh'

		,[CRTD_MidOpeningValue] as 'MidOpen'
		,[CRTD_MidClosingValue] as 'MidClose'
		,[CRTD_MidLowValue] as 'MidLow'
		,[CRTD_MidHighValue] as 'MidHigh'

		,[CRTD_PairSymbol] as 'PairSymbol'
		,CASE [CRTD_TargetName] 
			WHEN '5Minutes' THEN '5'
			WHEN '15Minutes' THEN '15'
			WHEN '30Minutes' THEN '30'
			WHEN '1Hour' THEN '60'
			WHEN '2Hours' THEN '120'
			WHEN '4Hours' THEN '240'
			WHEN '8Hours' THEN '480'
			WHEN '1Day' THEN 'D'
			WHEN '1Week' THEN 'W'
			WHEN '1Month' THEN 'M'
			ELSE 'LiveChart'
		 END as 'Interval'

	FROM [dbo].[CRT_Data_LiveChart] 
RETURN 0