@@ -163,7 +163,8 @@ def download_asset_prices(self, start_timestamp, end_timestamp, sources_list):
163163 MarketDataFeed .GB : self .YahooLSE_Downloader ,
164164 MarketDataFeed .FRA : self .YahooFRA_Downloader ,
165165 MarketDataFeed .SMA_VICTORIA : self .Victoria_Downloader ,
166- MarketDataFeed .COIN : self .Coinbase_Downloader
166+ MarketDataFeed .COIN : self .Coinbase_Downloader ,
167+ MarketDataFeed .MILAN : self .EuronextMilan_DataReader
167168 }
168169 assets = JalAsset .get_active_assets (start_timestamp , end_timestamp )
169170 assets = [(x ['asset' ], x ['currency' ]) for x in assets if x ['asset' ].quote_source (x ['currency' ]) in sources_list ]
@@ -527,6 +528,39 @@ def Euronext_DataReader(self, asset, currency_id, start_timestamp, end_timestamp
527528 close .sort_index (inplace = True )
528529 return close
529530
531+ # noinspection PyMethodMayBeStatic
532+ def EuronextMilan_DataReader (self , asset , currency_id , start_timestamp , end_timestamp ):
533+ suffix = "ETF" if asset .type () == PredefinedAsset .ETF else "MTA"
534+ url = "https://charts.borsaitaliana.it/charts/services/ChartWService.asmx/GetPricesWithVolume"
535+ params = {
536+ "request" : {
537+ "SampleTime" :"1d" ,
538+ "TimeFrame" :None ,
539+ "RequestedDataSetType" :"ohlc" ,
540+ "ChartPriceType" :"price" ,
541+ "Key" : asset .symbol () + "." + suffix ,
542+ "OffSet" :0 ,
543+ "FromDate" :start_timestamp ,
544+ "ToDate" :end_timestamp ,
545+ "UseDelay" :False ,
546+ "KeyType" :"Topic" ,
547+ "KeyType2" :"Topic" ,
548+ "Language" :"en-US"
549+ }
550+ }
551+ self ._request = WebRequest (WebRequest .POST_JSON , url , params = params , headers = {'Accept' : 'text/csv' })
552+ self ._wait_for_event ()
553+ json_content = json .loads (self ._request .data ())
554+ if 'd' not in json_content :
555+ return None
556+ data = pd .DataFrame (json_content ['d' ], columns = ["Date" , "Unk" , "O" , "H" , "L" , "Close" , "V" ])
557+ data = data .drop (columns = ["Unk" , "O" , "H" , "L" , "V" ], errors = 'ignore' )
558+ data ['Date' ] = pd .to_datetime (data ['Date' ], unit = 'ms' , utc = True )
559+ data ['Close' ] = data ['Close' ].astype ('str' ).apply (Decimal )
560+ close = data .set_index ("Date" )
561+ close .sort_index (inplace = True )
562+ return close
563+
530564 # noinspection PyMethodMayBeStatic
531565 def TMX_Downloader (self , asset , _currency_id , start_timestamp , end_timestamp ):
532566 url = 'https://app-money.tmx.com/graphql'
0 commit comments