forked from kriasoft/market-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reference data for the Exchange and Security
- Loading branch information
Showing
10 changed files
with
567 additions
and
146 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:r .\ReferenceData.Exchange.sql | ||
:r .\ReferenceData.Security.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
SET IDENTITY_INSERT [dbo].[Exchange] ON; | ||
GO | ||
|
||
MERGE INTO [dbo].[Exchange] AS Target | ||
USING (VALUES | ||
( 1, N'NYSE', N'NYSE Euronext', N'US,EU', N'New York City', 14242, 20161), | ||
( 2, N'NASDAQ', N'NASDAQ OMX', N'US,EU', N'New York City', 4687, 13552), | ||
( 3, N'TSE', N'Tokyo Stock Exchange', N'JP', N'Tokyo', 3325, 3972), | ||
(17, N'MICEX', N'Moscow Exchange', N'RU', N'Moscow', 800, 514) | ||
) | ||
AS Source ([ExchangeID], [Code], [Name], [Economy], [Headquarters], [MarketCap], [TradeValue]) | ||
ON Target.[ExchangeID] = Source.[ExchangeID] | ||
-- update matched rows | ||
WHEN MATCHED THEN | ||
UPDATE SET [Code] = Source.[Code], [Name] = Source.[Name], [Economy] = Source.[Economy], [Headquarters] = Source.[Headquarters], [MarketCap] = Source.[MarketCap], [TradeValue] = Source.[TradeValue] | ||
-- insert new rows | ||
WHEN NOT MATCHED BY TARGET THEN | ||
INSERT ([ExchangeID], [Code], [Name], [Economy], [Headquarters], [MarketCap], [TradeValue]) | ||
VALUES ([ExchangeID], [Code], [Name], [Economy], [Headquarters], [MarketCap], [TradeValue]) | ||
-- delete rows that are in the target but not the source | ||
WHEN NOT MATCHED BY SOURCE THEN | ||
DELETE; | ||
GO | ||
|
||
SET IDENTITY_INSERT [dbo].[Exchange] OFF; | ||
GO |
Oops, something went wrong.