[docs]defset_dataset(self,dataset):"""Sets the dataset to be used for the correlation coefficient calculation. Args: dataset (Any): The dataset on which the correlation coefficient will be computed. """ifisinstance(dataset,list):foritemindataset:if'dateTime'initem:date_time=item['dateTime']ifisinstance(date_time,datetime):item['dateTime']=date_time.isoformat()elifisinstance(date_time,str):try:parsed_date=parse(date_time)item['dateTime']=parsed_date.isoformat()except(ValueError,OverflowError):passelifisinstance(date_time,(float,int)):try:item['dateTime']=datetime.fromtimestamp(date_time).isoformat()except(OverflowError,ValueError):item['dateTime']=Noneself.instance.send(self.id,'setDataset',{'dataset':dataset})returnself
[docs]defset_symbol(self,symbol:str):"""Sets the symbol to be used in the correlation coefficient calculation. Args: symbol (str): The symbol representing the financial instrument. """self.instance.send(self.id,'setSymbol',{'symbol':symbol})returnself