Use tushare Interface to get historical data of stocks :ts.set_token You need to register on the official website , Then you can get your own token
Save the acquired data to the local
Delete df in Unnamed Column data for
take trade_date To time series type
take trade_date As the row index of the source data
(df['open'] - df['close']) / df['open'] > 0.03
: You can set the date when the condition is met to True, Discontented is False
take boolean Value as the index of the source data
Take out the date data
Click to download jupyter note