Total Complexity | 2 |
Total Lines | 85 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """ |
||
2 | Mapping for Factset exchange codes to Reuter's RICs. |
||
3 | |||
4 | -- Yahoo Reference with exchange name and RIC suffixes |
||
5 | https://help.yahoo.com/kb/SLN2310.html |
||
6 | |||
7 | -- Reuters company lookup |
||
8 | https://www.reuters.com/finance/stocks/lookup |
||
9 | """ |
||
10 | |||
11 | |||
12 | # Factset exchange code to RIC suffix |
||
13 | FACTSET_EXCHANGE_TO_SUFFIX_MAP = { |
||
14 | 'AMS': 'AS', |
||
15 | 'ASX': 'AX', |
||
16 | 'ATH': 'AT', |
||
17 | 'BAR': 'BC', |
||
18 | 'BER': 'BE', |
||
19 | 'BKK': 'BK', |
||
20 | 'BOM': 'BO', |
||
21 | 'BRU': 'BR', |
||
22 | 'BSP': 'SA', |
||
23 | 'BUE': 'BA', |
||
24 | 'CAI': 'CA', |
||
25 | 'CAR': 'CR', |
||
26 | 'CSE': 'CO', |
||
27 | 'DSMD': 'QA', |
||
28 | 'DUB': 'IR', |
||
29 | 'DUS': 'DU', |
||
30 | 'ETR': 'DE', |
||
31 | 'FRA': 'F', |
||
32 | 'HAM': 'HM', |
||
33 | 'HEL': 'HE', |
||
34 | 'HKG': 'HK', |
||
35 | 'ICE': 'IC', |
||
36 | 'IST': 'IS', |
||
37 | 'JKT': 'JK', |
||
38 | 'JSE': 'JO', |
||
39 | 'KLS': 'KL', |
||
40 | 'KRX': 'KS', |
||
41 | 'LIS': 'LS', |
||
42 | 'LIT': 'VS', |
||
43 | 'LON': 'L', |
||
44 | 'MAD': 'MA', |
||
45 | 'MEX': 'MX', |
||
46 | 'MIC': 'ME', |
||
47 | 'MIL': 'MI', |
||
48 | 'MUN': 'MU', |
||
49 | 'NAS': None, |
||
50 | 'NSE': 'NS', |
||
51 | 'NYS': None, |
||
52 | 'NZE': 'NZ', |
||
53 | 'OME': 'ST', |
||
54 | 'OSL': 'OL', |
||
55 | 'OTC': None, |
||
56 | 'PAR': 'PA', |
||
57 | 'PRA': 'PR', |
||
58 | 'RIS': 'RG', |
||
59 | 'SAU': 'SAU', |
||
60 | 'SES': 'SI', |
||
61 | 'SGO': 'SN', |
||
62 | 'SHE': 'SZ', |
||
63 | 'SHG': 'SS', |
||
64 | 'STU': 'SG', |
||
65 | 'SWX': 'SW', |
||
66 | 'TAE': 'TA', |
||
67 | 'TAI': 'TW', |
||
68 | 'TAL': 'TL', |
||
69 | 'TKS': 'T', |
||
70 | 'TSE': 'TO', |
||
71 | 'TSX': 'V', |
||
72 | 'WBO': 'VI' |
||
73 | } |
||
74 | |||
75 | |||
76 | def format_ric_ticker(ticker, exchange_code): |
||
77 | """Format RIC ticker from Factset exchange code.""" |
||
78 | |||
79 | suffix = FACTSET_EXCHANGE_TO_SUFFIX_MAP[exchange_code] |
||
80 | |||
81 | if suffix: |
||
82 | ticker = f'{ticker}.{suffix}' |
||
|
|||
83 | |||
84 | return ticker |
||
85 |