chore: import upstream snapshot with attribution
CI / ci (3.11) (push) Has been cancelled
CI / ci (3.10) (push) Has been cancelled
CI / dependabot (push) Has been cancelled
Release / release_and_publish (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:36:15 +08:00
commit e64161ec32
892 changed files with 116950 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

+332
View File
@@ -0,0 +1,332 @@
{
"alpha053_15": {
"description": "Reversal class factor, negative delta of a ratio involving close, low, and high prices over 15 days.",
"formulation": "-1 times Deltaleft(frac{(text{close} - text{low}) - (text{high} - text{close})}{text{close} - text{low}}, 15right)",
"variables": {
"Delta(x, d)": "Change in 'x' over 'd' days.",
"text{close}": "Closing price of the stock.",
"text{low}": "Lowest price of the stock for the day.",
"text{high}": "Highest price of the stock for the day."
},
"Category": "Volume&Price",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha053\nnew_df['ratio'] = (new_df['$close'] - new_df['$low'] - (new_df['$high'] - new_df['$close'])) / (new_df['$close'] - new_df['$low'])\n# the change of ratio in new_df over the 15 days\nnew_df['result']=-new_df['ratio'].diff(15)\n# transfer the result to series\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"liquidity_imbalance": {
"description": "liquidity_imbalance=std(minute trading liquidity_imbalance)/mean(minute trading liquidity_imbalance).",
"formulation": "liquidity_imbalance = frac{text{std}(text{minute trading liquidity_imbalance})}{text{mean}(text{minute liquidity_imbalance})}",
"variables": {
"std(minute liquidity_imbalance)": "Standard deviation of trading liquidity_imbalance for each minute of the trading day.",
"mean(minute liquidity_imbalance)": "Mean of trading liquidity_imbalance for each minute of the trading day.",
"liquidity_imbalance": "(bid_size-ask_size)/(bid_size+ask_size), we use something like bidV for the size"
},
"Category": "High-Frequency",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['liquidity_imbalance']=(sample_df['bidV']-sample_df['askV'])/(sample_df['bidV']+sample_df['askV'])\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['liquidity_imbalance']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\n# Calculate Z value for each instrument per day\nstats['liquidity_imbalance'] = stats['std'] / stats['mean']\n# Display the calculated Z values\nresult=stats['liquidity_imbalance']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"liquidity_imbalance_2": {
"description": "liquidity_imbalance=std(minute trading liquidity_imbalance)/mean(minute trading liquidity_imbalance).",
"formulation": "liquidity_imbalance = frac{text{std}(text{minute trading liquidity_imbalance})}{text{mean}(text{minute liquidity_imbalance})}",
"variables": {
"std(minute liquidity_imbalance)": "Standard deviation of trading liquidity_imbalance for each minute of the trading day.",
"mean(minute liquidity_imbalance)": "Mean of trading liquidity_imbalance for each minute of the trading day.",
"liquidity_imbalance": "(bid_size-ask_size)/2*(bid_size+ask_size), we use something like bidV for the size"
},
"Category": "High-Frequency",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['liquidity_imbalance']=(sample_df['bidV']-sample_df['askV'])/((sample_df['bidV']+sample_df['askV'])*2)\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['liquidity_imbalance']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\n# Calculate Z value for each instrument per day\nstats['liquidity_imbalance'] = stats['std'] / stats['mean']\n# Display the calculated Z values\nresult=stats['liquidity_imbalance']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"liquidity_imbalance_3": {
"description": "liquidity_imbalance=std(minute trading liquidity_imbalance)/mean(minute trading liquidity_imbalance).",
"formulation": "liquidity_imbalance = frac{text{std}(text{minute trading liquidity_imbalance})}{text{mean}(text{minute liquidity_imbalance})}",
"variables": {
"std(minute liquidity_imbalance)": "Standard deviation of trading liquidity_imbalance for each minute of the trading day.",
"mean(minute liquidity_imbalance)": "Mean of trading liquidity_imbalance for each minute of the trading day.",
"liquidity_imbalance": "(bid_size-ask_size)/3*(bid_size+ask_size), we use something like bidV for the size"
},
"Category": "High-Frequency",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['liquidity_imbalance']=(sample_df['bidV']-sample_df['askV'])/((sample_df['bidV']+sample_df['askV'])*3)\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['liquidity_imbalance']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\n# Calculate Z value for each instrument per day\nstats['liquidity_imbalance'] = stats['std'] / stats['mean']\n# Display the calculated Z values\nresult=stats['liquidity_imbalance']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"micro_price": {
"description": "micro_price=std(minute trading micro_price)/mean(minute trading micro_price).",
"formulation": "micro_price = frac{text{std}(text{minute trading micro_price})}{text{mean}(text{minute micro_price})}",
"variables": {
"std(minute micro_price)": "Standard deviation of trading micro_price for each minute of the trading day.",
"mean(minute micro_price)": "Mean of trading micro_price for each minute of the trading day.",
"micro_price": "((df['bid_price'] * df['ask_size']) + (df['ask_price'] * df['bid_size'])) / (df['bid_size'] + df['ask_size'])"
},
"Category": "High-Frequency",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['micro_price']=(sample_df['bid']*sample_df['askV']+sample_df['ask']*sample_df['bidV'])/(sample_df['bidV']+sample_df['askV'])\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['micro_price']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\n# Calculate Z value for each instrument per day\nstats['micro_price'] = stats['std'] / stats['mean']\n# Display the calculated Z values\nresult=stats['micro_price']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"micro_price_2": {
"description": "micro_price_2=std(minute trading micro_price)/mean(minute trading micro_price).",
"formulation": "micro_price_2 = frac{text{std}(text{minute trading micro_price})}{text{mean}(text{minute micro_price})}",
"variables": {
"std(minute micro_price)": "Standard deviation of trading micro_price for each minute of the trading day.",
"mean(minute micro_price)": "Mean of trading micro_price for each minute of the trading day.",
"micro_price": "((df['bid_price'] * df['ask_size']) + (df['ask_price'] * df['bid_size'])) / 2*(df['bid_size'] + df['ask_size']), we use something like bidV for the size"
},
"Category": "High-Frequency",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['micro_price']=(sample_df['bid']*sample_df['askV']+sample_df['ask']*sample_df['bidV'])/((sample_df['bidV']+sample_df['askV'])*2)\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['micro_price']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\n# Calculate Z value for each instrument per day\nstats['micro_price'] = stats['std'] / stats['mean']\n# Display the calculated Z values\nresult=stats['micro_price']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"micro_price_3": {
"description": "micro_price_3=std(minute trading micro_price)/mean(minute trading micro_price).",
"formulation": "micro_price_3 = frac{text{std}(text{minute trading micro_price})}{text{mean}(text{minute micro_price})}",
"variables": {
"std(minute micro_price)": "Standard deviation of trading micro_price for each minute of the trading day.",
"mean(minute micro_price)": "Mean of trading micro_price for each minute of the trading day.",
"micro_price": "((df['bid_price'] * df['ask_size']) + (df['ask_price'] * df['bid_size'])) / 3*(df['bid_size'] + df['ask_size']), we use something like bidV for the size"
},
"Category": "High-Frequency",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['micro_price']=(sample_df['bid']*sample_df['askV']+sample_df['ask']*sample_df['bidV'])/((sample_df['bidV']+sample_df['askV'])*3)\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['micro_price']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\n# Calculate Z value for each instrument per day\nstats['micro_price'] = stats['std'] / stats['mean']\n# Display the calculated Z values\nresult=stats['micro_price']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"mid_price": {
"description": "mid_price=std(minute trading mid_price)/mean(minute trading mid_price).",
"formulation": "mid_price = frac{text{std}(text{minute trading mid price})}{text{mean}(text{minute mid price})}",
"variables": {
"std(minute mid_price)": "Standard deviation of trading mid_price for each minute of the trading day.",
"mean(minute mid_price)": "Mean of trading mid_price for each minute of the trading day.",
"mid_price": "The average of the bid and ask prices."
},
"Category": "High-Frequency",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['mid_price']=(sample_df['bid']+sample_df['ask'])/2\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['mid_price']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\nstats['mid_price'] = stats['std'] / stats['mean']\nresult=stats['mid_price']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"mid_price_2": {
"description": "mid_price=std(minute trading mid_price)/mean(minute trading mid_price).",
"formulation": "mid_price = frac{text{std}(text{minute trading mid price})}{text{mean}(text{minute mid price})}",
"variables": {
"std(minute mid_price)": "Standard deviation of trading mid_price for each minute of the trading day.",
"mean(minute mid_price)": "Mean of trading mid_price for each minute of the trading day.",
"mid_price_2": "the average of the bid and ask prices plus the the average of the bid and ask size (bidV and askV)."
},
"Category": "High-Frequency",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['mid_price']=(sample_df['bid']+sample_df['ask'])/2+(sample_df['bidV']+sample_df['askV'])/2\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['mid_price']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\nstats['mid_price'] = stats['std'] / stats['mean']\nresult=stats['mid_price']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"mid_price_3": {
"description": "mid_price=std(minute trading mid_price)/mean(minute trading mid_price).",
"formulation": "mid_price = frac{text{std}(text{minute trading mid price})}{text{mean}(text{minute mid price})}",
"variables": {
"std(minute mid_price)": "Standard deviation of trading mid_price for each minute of the trading day.",
"mean(minute mid_price)": "Mean of trading mid_price for each minute of the trading day.",
"mid_price_3": "The coefficient of variation (CV) of the mid-price for each minute of the trading day, calculated as the standard deviation of the mid-price divided by the mean mid-price."
},
"Category": "High-Frequency",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_hf = pd.read_hdf('high_freq.h5')\nsample_df= data_hf.reset_index()\n# Convert 'datetime' column to datetime and extract date for grouping\nsample_df['date'] = sample_df['datetime'].dt.date\nsample_df['mid_price']=(sample_df['bid']+sample_df['ask'])/3\n# Group by instrument and date\ngrouped = sample_df.groupby(['date','instrument'])['mid_price']\n# Calculate mean and standard deviation of the volume for each group\nstats = grouped.agg(['mean', 'std'])\nstats['mid_price'] = stats['std'] / stats['mean']\nresult=stats['mid_price']\nresult.index.names = ['datetime','instrument']\n# result = result.swaplevel().sort_index()\nresult.to_hdf('result.h5', key='data')"
},
"PB_ROE": {
"description": "Constructed using the ranking difference between PB and ROE, with regression versions of PB and ROE replacing original PB and ROE to obtain reconstructed factor values.",
"formulation": "text{rank}(PB_t) - rank(ROE_t)",
"variables": {
"text{rank}(PB_t)": "Ranking of regression version PB on cross-section at time t.",
"text{rank}(ROE_t)": "Ranking of regression version single-quarter ROE on cross-section at time t."
},
"Category": "Fundamentals",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\ndata = data_f.reset_index()\n# Calculate the rank of PB and ROE\ndata['PB_rank'] = data.groupby('datetime')['B/P'].rank()\ndata['ROE_rank'] = data.groupby('datetime')['ROE'].rank()\n# Calculate the difference between the ranks\ndata['PB_ROE'] = data['PB_rank'] - data['ROE_rank']\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(data['PB_ROE']).set_index(data_f.index)\n# transfer the result to series\nresult=result['PB_ROE']\nresult.to_hdf('result.h5', key='data')"
},
"PB_ROE_2": {
"description": "Constructed using the ranking difference between PB/2 and ROE, with regression versions of PB and ROE replacing original PB and ROE to obtain reconstructed factor values.",
"formulation": "text{rank}(PB_t)/2 - rank(ROE_t)",
"variables": {
"text{rank}(PB_t)": "Ranking of regression version PB on cross-section at time t.",
"text{rank}(ROE_t)": "Ranking of regression version single-quarter ROE on cross-section at time t."
},
"Category": "Fundamentals",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\ndata = data_f.reset_index()\n# Calculate the rank of PB and ROE\ndata['PB_rank'] = data.groupby('datetime')['B/P'].rank()\ndata['ROE_rank'] = data.groupby('datetime')['ROE'].rank()\n# Calculate the difference between the ranks\ndata['PB_ROE'] = data['PB_rank']/2 - data['ROE_rank']\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(data['PB_ROE']).set_index(data_f.index)\n# transfer the result to series\nresult=result['PB_ROE']\nresult.to_hdf('result.h5', key='data')"
},
"PB_ROE_3": {
"description": "Constructed using the ranking difference between PB/3 and ROE, with regression versions of PB and ROE replacing original PB and ROE to obtain reconstructed factor values.",
"formulation": "text{rank}(PB_t)/3 - rank(ROE_t)",
"variables": {
"text{rank}(PB_t)": "Ranking of regression version PB on cross-section at time t.",
"text{rank}(ROE_t)": "Ranking of regression version single-quarter ROE on cross-section at time t."
},
"Category": "Fundamentals",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\ndata = data_f.reset_index()\n# Calculate the rank of PB and ROE\ndata['PB_rank'] = data.groupby('datetime')['B/P'].rank()\ndata['ROE_rank'] = data.groupby('datetime')['ROE'].rank()\n# Calculate the difference between the ranks\ndata['PB_ROE'] = data['PB_rank']/3 - data['ROE_rank']\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(data['PB_ROE']).set_index(data_f.index)\n# transfer the result to series\nresult=result['PB_ROE']\nresult.to_hdf('result.h5', key='data')"
},
"PB_ROE_movement": {
"description": "PB_ROE_movement=five day PB_ROE movement indicator(-1 and 1 or 0).",
"formulation": "PB_ROE_movement = 5_day_movement(PB_ROE), PB_ROE = text{rank}(PB_t) - rank(ROE_t)",
"variables": {
"PB_ROE": "the ranking difference between PB and ROE.",
"5_day_PB_ROE_movement": "1 if PB_ROE is higher than the PB_ROE 5 days ago, -1 if PB_ROE is lower than the PB_ROE 5 days ago, 0 if PB_ROE is the same as the PB_ROE 5 days ago.",
"text{rank}(PB_t)": "Ranking of regression version PB on cross-section at time t.",
"text{rank}(ROE_t)": "Ranking of regression version single-quarter ROE on cross-section at time t."
},
"Category": "Fundamentals",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\nsample_df = data_f.reset_index()\n# Calculate the rank of PB and ROE\nsample_df['PB_rank'] = sample_df.groupby('datetime')['B/P'].rank()\nsample_df['ROE_rank'] = sample_df.groupby('datetime')['ROE'].rank()\nsample_df['PB_ROE'] = sample_df['PB_rank'] - sample_df['ROE_rank']\n# Group by instrument and date\nsample_df['PB_ROE_movement'] = sample_df['PB_ROE'].diff(periods=5).apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))\n#calculate the mid_price_movement ratio for each day\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(sample_df['PB_ROE_movement']).set_index(data_f.index)\n# transfer the result to series\nresult=result['PB_ROE_movement']\nresult.to_hdf('result.h5', key='data')"
},
"PB_ROE_movement_10": {
"description": "PB_ROE_movement=10 days PB_ROE movement indicator(-1 and 1 or 0).",
"formulation": "PB_ROE_movement = 10_day_movement(PB_ROE), PB_ROE = text{rank}(PB_t) - rank(ROE_t)",
"variables": {
"PB_ROE": "the ranking difference between PB and ROE.",
"10_day_PB_ROE_movement": "1 if PB_ROE is higher than the PB_ROE 10 days ago, -1 if PB_ROE is lower than the PB_ROE 10 days ago, 0 if PB_ROE is the same as the PB_ROE 10 days ago.",
"text{rank}(PB_t)": "Ranking of regression version PB on cross-section at time t.",
"text{rank}(ROE_t)": "Ranking of regression version single-quarter ROE on cross-section at time t."
},
"Category": "Fundamentals",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\nsample_df = data_f.reset_index()\n# Calculate the rank of PB and ROE\nsample_df['PB_rank'] = sample_df.groupby('datetime')['B/P'].rank()\nsample_df['ROE_rank'] = sample_df.groupby('datetime')['ROE'].rank()\nsample_df['PB_ROE'] = sample_df['PB_rank'] - sample_df['ROE_rank']\n# Group by instrument and date\nsample_df['PB_ROE_movement'] = sample_df['PB_ROE'].diff(periods=10).apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))\n#calculate the mid_price_movement ratio for each day\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(sample_df['PB_ROE_movement']).set_index(data_f.index)\n# transfer the result to series\nresult=result['PB_ROE_movement']\nresult.to_hdf('result.h5', key='data')"
},
"PB_ROE_movement_20": {
"description": "PB_ROE_movement=20 days PB_ROE movement indicator(-1 and 1 or 0).",
"formulation": "PB_ROE_movement = 20_day_movement(PB_ROE), PB_ROE = text{rank}(PB_t) - rank(ROE_t)",
"variables": {
"PB_ROE": "the ranking difference between PB and ROE.",
"20_day_PB_ROE_movement": "1 if PB_ROE is higher than the PB_ROE 20 days ago, -1 if PB_ROE is lower than the PB_ROE 20 days ago, 0 if PB_ROE is the same as the PB_ROE 20 days ago.",
"text{rank}(PB_t)": "Ranking of regression version PB on cross-section at time t.",
"text{rank}(ROE_t)": "Ranking of regression version single-quarter ROE on cross-section at time t."
},
"Category": "Fundamentals",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\nsample_df = data_f.reset_index()\n# Calculate the rank of PB and ROE\nsample_df['PB_rank'] = sample_df.groupby('datetime')['B/P'].rank()\nsample_df['ROE_rank'] = sample_df.groupby('datetime')['ROE'].rank()\nsample_df['PB_ROE'] = sample_df['PB_rank'] - sample_df['ROE_rank']\n# Group by instrument and date\nsample_df['PB_ROE_movement'] = sample_df['PB_ROE'].diff(periods=20).apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))\n#calculate the mid_price_movement ratio for each day\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(sample_df['PB_ROE_movement']).set_index(data_f.index)\n# transfer the result to series\nresult=result['PB_ROE_movement']\nresult.to_hdf('result.h5', key='data')"
},
"ROE_movement": {
"description": "ROE_movement=five day ROE movement indicator(-1 and 1 or 0).",
"formulation": "ROE_movement = 5_day_movement(ROE)",
"variables": {
"ROE": "ROE in fundamental statistics.",
"5_day_ROE_movement": "1 if ROE is higher than the ROE 5 days ago, -1 if ROE is lower than the ROE 5 days ago, 0 if ROE is the same as the ROE 5 days ago."
},
"Category": "Fundamentals",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\nsample_df = data_f.reset_index()\n# Group by instrument and date\nsample_df['ROE_movement'] = sample_df['ROE'].diff(periods=5).apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))\n#calculate the mid_price_movement ratio for each day\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(sample_df['ROE_movement']).set_index(data_f.index)\n# transfer the result to series\nresult=result['ROE_movement']\nresult.to_hdf('result.h5', key='data')"
},
"ROE_movement_10": {
"description": "ROE_movement_10=ten day ROE movement indicator(-1 and 1 or 0).",
"formulation": "ROE_movement = 10_day_movement(ROE)",
"variables": {
"ROE": "ROE in fundamental statistics.",
"10_day_ROE_movement": "1 if ROE is higher than the ROE 10 days ago, -1 if ROE is lower than the ROE 10 days ago, 0 if ROE is the same as the ROE 10 days ago."
},
"Category": "Fundamentals",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\nsample_df = data_f.reset_index()\n# Group by instrument and date\nsample_df['ROE_movement'] = sample_df['ROE'].diff(periods=10).apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))\n#calculate the mid_price_movement ratio for each day\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(sample_df['ROE_movement']).set_index(data_f.index)\n# transfer the result to series\nresult=result['ROE_movement']\nresult.to_hdf('result.h5', key='data')"
},
"ROE_movement_20": {
"description": "ROE_movement_20=20 day ROE movement indicator(-1 and 1 or 0).",
"formulation": "ROE_movement_20 = 20_day_movement(ROE)",
"variables": {
"ROE": "ROE in fundamental statistics.",
"20_day_ROE_movement": "1 if ROE is higher than the ROE 20 days ago, -1 if ROE is lower than the ROE 20 days ago, 0 if ROE is the same as the ROE 20 days ago."
},
"Category": "Fundamentals",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_f = pd.read_hdf('daily_f.h5')\nsample_df = data_f.reset_index()\n# Group by instrument and date\nsample_df['ROE_movement'] = sample_df['ROE'].diff(periods=20).apply(lambda x: 1 if x > 0 else (-1 if x < 0 else 0))\n#calculate the mid_price_movement ratio for each day\n# set the datetime and instrument as index and drop the original index\nresult=pd.DataFrame(sample_df['ROE_movement']).set_index(data_f.index)\n# transfer the result to series\nresult=result['ROE_movement']\nresult.to_hdf('result.h5', key='data')"
},
"alpha_pv_diff": {
"description": "alpha_pv_diff is defined as the ratio of the difference between close prices 10 days change and open prices 10 days change to the sum of the highest minus lowest prices plus a small constant.",
"formulation": "frac{(text{close_diff10} - text{open_diff10})}{(text{high} - text{low} + 0.001)}",
"variables": {
"close": "Closing price of the stock",
"open": "Opening price of the stock",
"high": "Highest price of the stock during the day",
"low": "Lowest price of the stock during the day"
},
"Category": "Volume&Price",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha101\nnew_df['result'] = (new_df['$close'].diff(10) - new_df['$open'].diff(10)) / (new_df['$high'] - new_df['$low'] + 0.001)\n# keep the index of the original dataframe\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\n# transfer the result to series\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha_pv_diff_15": {
"description": "alpha_pv_diff is defined as the ratio of the difference between close prices 15 days change and open prices 15 days change to the sum of the highest minus lowest prices plus a small constant.",
"formulation": "frac{(text{close_diff15} - text{open_diff15})}{(text{high} - text{low} + 0.001)}",
"variables": {
"close": "Closing price of the stock",
"open": "Opening price of the stock",
"high": "Highest price of the stock during the day",
"low": "Lowest price of the stock during the day"
},
"Category": "Volume&Price",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha101\nnew_df['result'] = (new_df['$close'].diff(15) - new_df['$open'].diff(15)) / (new_df['$high'] - new_df['$low'] + 0.001)\n# keep the index of the original dataframe\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\n# transfer the result to series\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha_pv_diff_20": {
"description": "alpha_pv_diff is defined as the ratio of the difference between close prices 20 days change and open prices 20 days change to the sum of the highest minus lowest prices plus a small constant.",
"formulation": "frac{(text{close_diff20} - text{open_diff20})}{(text{high} - text{low} + 0.001)}",
"variables": {
"close": "Closing price of the stock",
"open": "Opening price of the stock",
"high": "Highest price of the stock during the day",
"low": "Lowest price of the stock during the day"
},
"Category": "Volume&Price",
"Difficulty": "Medium",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha101\nnew_df['result'] = (new_df['$close'].diff(20) - new_df['$open'].diff(20)) / (new_df['$high'] - new_df['$low'] + 0.001)\n# keep the index of the original dataframe\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\n# transfer the result to series\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha_pv_diff_pct": {
"description": "alpha_pv is defined as the ratio of the difference between close prices 10 days change and open prices 10 days change to the sum of the highest prices 10 days change ratio minus lowest prices 10 days change ratio plus a small constant.",
"formulation": "frac{(text{close_diff10} - text{open_diff10})}{(text{high_pct10} - text{low_pct10} + 0.001)}",
"variables": {
"close": "Closing price of the stock",
"open": "Opening price of the stock",
"high": "Highest price of the stock during the day",
"low": "Lowest price of the stock during the day"
},
"Category": "Volume&Price",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha101\nnew_df['result'] = (new_df['$close'].diff(10) - new_df['$open'].diff(10)) / (new_df['$high'].pct_change(10) - new_df['$low'].pct_change(10) + 0.001)\n# keep the index of the original dataframe\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\n# transfer the result to series\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha_pv_diff_pct_15": {
"description": "alpha_pv is defined as the ratio of the difference between close prices 15 days change and open prices 15 days change to the sum of the highest prices 10 days change ratio minus lowest prices 10 days change ratio plus a small constant.",
"formulation": "frac{(text{close_diff15} - text{open_diff15})}{(text{high_pct10} - text{low_pct10} + 0.001)}",
"variables": {
"close": "Closing price of the stock",
"open": "Opening price of the stock",
"high": "Highest price of the stock during the day",
"low": "Lowest price of the stock during the day"
},
"Category": "Volume&Price",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha101\nnew_df['result'] = (new_df['$close'].diff(15) - new_df['$open'].diff(15)) / (new_df['$high'].pct_change(10) - new_df['$low'].pct_change(10) + 0.001)\n# keep the index of the original dataframe\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\n# transfer the result to series\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha_pv_diff_pct_20": {
"description": "alpha_pv is defined as the ratio of the difference between close prices 20 days change and open prices 20 days change to the sum of the highest prices 10 days change ratio minus lowest prices 10 days change ratio plus a small constant.",
"formulation": "frac{(text{close_diff20} - text{open_diff20})}{(text{high_pct10} - text{low_pct10} + 0.001)}",
"variables": {
"close": "Closing price of the stock",
"open": "Opening price of the stock",
"high": "Highest price of the stock during the day",
"low": "Lowest price of the stock during the day"
},
"Category": "Volume&Price",
"Difficulty": "Hard",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha101\nnew_df['result'] = (new_df['$close'].diff(20) - new_df['$open'].diff(20)) / (new_df['$high'].pct_change(10) - new_df['$low'].pct_change(10) + 0.001)\n# keep the index of the original dataframe\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\n# transfer the result to series\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha053": {
"description": "Reversal class factor, negative delta of a ratio involving close, low, and high prices over 9 days.",
"formulation": "-1 times Deltaleft(frac{(text{close} - text{low}) - (text{high} - text{close})}{text{close} - text{low}}, 9right)",
"variables": {
"Delta(x, d)": "Change in 'x' over 'd' days.",
"text{close}": "Closing price of the stock.",
"text{low}": "Lowest price of the stock for the day.",
"text{high}": "Highest price of the stock for the day."
},
"Category": "Volume&Price",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha053\nnew_df['ratio'] = (new_df['$close'] - new_df['$low'] - (new_df['$high'] - new_df['$close'])) / (new_df['$close'] - new_df['$low'])\n# the change of ratio in new_df over the 9 days\nnew_df['result']=-new_df['ratio'].diff(9)\n# transfer the result to series\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
},
"alpha053_5": {
"description": "Reversal class factor, negative delta of a ratio involving close, low, and high prices over 5 days.",
"formulation": "-1 times Deltaleft(frac{(text{close} - text{low}) - (text{high} - text{close})}{text{close} - text{low}}, 5right)",
"variables": {
"Delta(x, d)": "Change in 'x' over 'd' days.",
"text{close}": "Closing price of the stock.",
"text{low}": "Lowest price of the stock for the day.",
"text{high}": "Highest price of the stock for the day."
},
"Category": "Volume&Price",
"Difficulty": "Easy",
"gt_code": "import pandas as pd\ndata_pv = pd.read_hdf('daily_pv.h5')\nnew_df= data_pv.reset_index()\n# Calculate Alpha053\nnew_df['ratio'] = (new_df['$close'] - new_df['$low'] - (new_df['$high'] - new_df['$close'])) / (new_df['$close'] - new_df['$low'])\n# the change of ratio in new_df over the 5 days\nnew_df['result']=-new_df['ratio'].diff(5)\n# transfer the result to series\nresult=pd.DataFrame(new_df['result']).set_index(data_pv.index)\nresult=result['result']\nresult.to_hdf('result.h5', key='data')"
}
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 507 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

+15
View File
@@ -0,0 +1,15 @@
=============
API Reference
=============
Here you can find all ``RDAgent``'s interfaces.
RD Loop
=======
Research
--------
.. automodule:: rdagent.core.proposal
:members:
+4
View File
@@ -0,0 +1,4 @@
# Changelog
## [Unreleased]
<!-- insertion marker -->
+72
View File
@@ -0,0 +1,72 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import subprocess
latest_tag = subprocess.check_output(["git", "describe", "--tags", "--abbrev=0"], text=True).strip()
project = "RDAgent"
copyright = "2024, Microsoft"
author = "Microsoft"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ["sphinx.ext.autodoc", "sphinxcontrib.autodoc_pydantic"]
autodoc_member_order = "bysource"
# The suffix of source filenames.
source_suffix = {".rst": "restructuredtext"}
# The encoding of source files.
source_encoding = "utf-8"
# The main toctree document.
master_doc = "index"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = latest_tag
release = latest_tag
# The language for content autogenerated by Sphinx. Refer to documentation for
# a list of supported languages.
language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["build"]
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
try:
import furo
html_theme = "furo"
html_theme_options = {
"navigation_with_keys": True,
}
except ImportError:
html_theme = "default"
html_logo = "_static/logo.png"
html_static_path = ["_static"]
html_favicon = "_static/favicon.ico"
html_theme_options = {
"source_repository": "https://github.com/microsoft/RD-Agent",
"source_branch": "main",
"source_directory": "docs/",
}
+85
View File
@@ -0,0 +1,85 @@
=========================
For Development
=========================
If you want to try the latest version or contribute to RD-Agent. You can install it from the source and follow the commands in this page.
.. code-block:: bash
git clone https://github.com/microsoft/RD-Agent
🔧Prepare for development
=========================
- Set up the development environment.
.. code-block:: bash
make dev
- Run linting and checking.
.. code-block:: bash
make lint
- Some linting issues can be fixed automatically. We have added a command in the Makefile for easy use.
.. code-block:: bash
make auto-lint
Code Structure
=========================
.. code-block:: text
📂 src
➥ 📂 <project name>: avoid namespace conflict
➥ 📁 core
➥ 📁 components/A
➥ 📁 components/B
➥ 📁 components/C
➥ 📁 scenarios/X
➥ 📁 scenarios/Y
➥ 📂 app
➥ 📁 scripts
.. list-table::
:header-rows: 1
* - Folder Name
- Description
* - 📁 core
- The core framework of the system. All classes should be abstract and usually can't be used directly.
* - 📁 component/A
- Useful components that can be used by others (e.g., scenarios). Many subclasses of core classes are located here.
* - 📁 scenarios/X
- Concrete features for specific scenarios (usually built based on components or core). These modules are often unreusable across scenarios.
* - 📁 app
- Applications for specific scenarios (usually built based on components or scenarios). Removing any of them does not affect the system's completeness or other scenarios.
* - 📁 scripts
- Quick and dirty things. These are candidates for core, components, scenarios, and apps.
Conventions
===========
File Naming Convention
----------------------
.. list-table::
:header-rows: 1
* - Name
- Description
* - `conf.py`
- The configuration for the module, app, and project.
.. <!-- TODO: renaming files -->
+34
View File
@@ -0,0 +1,34 @@
.. RDAgent documentation master file, created by
sphinx-quickstart on Mon Jul 15 04:27:50 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to RDAgent's documentation!
===================================
.. image:: _static/logo.png
:alt: RD-Agent Logo
.. toctree::
:maxdepth: 3
:caption: Doctree:
introduction
installation_and_configuration
scens/catalog
project_framework_introduction
ui
research/catalog
development
api_reference
policy
GitHub <https://github.com/microsoft/RD-Agent>
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
+446
View File
@@ -0,0 +1,446 @@
==============================
Installation and Configuration
==============================
Installation
============
**Install RDAgent**: For different scenarios
- for purely users: please use ``pip install rdagent`` to install RDAgent
- for dev users: `See development <development.html>`_
**Install Docker**: RDAgent is designed for research and development, acting like a human researcher and developer. It can write and run code in various environments, primarily using Docker for code execution. This keeps the remaining dependencies simple. Users must ensure Docker is installed before attempting most scenarios. Please refer to the `official 🐳Docker page <https://docs.docker.com/engine/install/>`_ for installation instructions.
Ensure the current user can run Docker commands **without using sudo**. You can verify this by executing `docker run hello-world`.
LiteLLM Backend Configuration (Default)
=======================================
.. note::
🔥 **Attention**: We now provide experimental support for **DeepSeek** models! You can use DeepSeek's official API for cost-effective and high-performance inference. See the configuration example below for DeepSeek setup.
Option 1: Unified API base for both models
------------------------------------------
.. code-block:: Properties
# Set to any model supported by LiteLLM.
CHAT_MODEL=gpt-4o
EMBEDDING_MODEL=text-embedding-3-small
# Configure unified API base
# The backend api_key fully follows the convention of litellm.
OPENAI_API_BASE=<your_unified_api_base>
OPENAI_API_KEY=<replace_with_your_openai_api_key>
Option 2: Separate API bases for Chat and Embedding models
----------------------------------------------------------
.. code-block:: Properties
# Set to any model supported by LiteLLM.
# CHAT MODEL:
CHAT_MODEL=gpt-4o
OPENAI_API_BASE=<your_chat_api_base>
OPENAI_API_KEY=<replace_with_your_openai_api_key>
# EMBEDDING MODEL:
# TAKE siliconflow as an example, you can use other providers.
# Note: embedding requires litellm_proxy prefix
EMBEDDING_MODEL=litellm_proxy/BAAI/bge-large-en-v1.5
LITELLM_PROXY_API_KEY=<replace_with_your_siliconflow_api_key>
LITELLM_PROXY_API_BASE=https://api.siliconflow.cn/v1
Configuration Example: DeepSeek Setup
-------------------------------------
Many users encounter configuration errors when setting up DeepSeek. Here's a complete working example:
.. code-block:: Properties
# CHAT MODEL: Using DeepSeek Official API
CHAT_MODEL=deepseek/deepseek-chat
DEEPSEEK_API_KEY=<replace_with_your_deepseek_api_key>
# EMBEDDING MODEL: Using SiliconFlow for embedding since DeepSeek has no embedding model.
# Note: embedding requires litellm_proxy prefix
EMBEDDING_MODEL=litellm_proxy/BAAI/bge-m3
LITELLM_PROXY_API_KEY=<replace_with_your_siliconflow_api_key>
LITELLM_PROXY_API_BASE=https://api.siliconflow.cn/v1
Necessary parameters include:
- `CHAT_MODEL`: The model name of the chat model.
- `EMBEDDING_MODEL`: The model name of the embedding model.
- `OPENAI_API_BASE`: The base URL of the API. If `EMBEDDING_MODEL` does not start with `litellm_proxy/`, this is used for both chat and embedding models; otherwise, it is used for `CHAT_MODEL` only.
Optional parameters (required if your embedding model is provided by a different provider than `CHAT_MODEL`):
- `LITELLM_PROXY_API_KEY`: The API key for the embedding model, required if `EMBEDDING_MODEL` starts with `litellm_proxy/`.
- `LITELLM_PROXY_API_BASE`: The base URL for the embedding model, required if `EMBEDDING_MODEL` starts with `litellm_proxy/`.
**Note:** If you are using an embedding model from a provider different from the chat model, remember to add the `litellm_proxy/` prefix to the `EMBEDDING_MODEL` name.
The `CHAT_MODEL` and `EMBEDDING_MODEL` parameters will be passed into LiteLLM's completion function.
Therefore, when utilizing models provided by different providers, first review the interface configuration of LiteLLM. The model names must match those allowed by LiteLLM.
Additionally, you need to set up the the additional parameters for the respective model provider, and the parameter names must align with those required by LiteLLM.
For example, if you are using a DeepSeek model, you need to set as follows:
.. code-block:: Properties
# For some models LiteLLM requires a prefix to the model name.
CHAT_MODEL=deepseek/deepseek-chat
DEEPSEEK_API_KEY=<replace_with_your_deepseek_api_key>
Besides, when you are using reasoning models, the response might include the thought process. For this case, you need to set the following environment variable:
.. code-block:: Properties
REASONING_THINK_RM=True
For more details on LiteLLM requirements, refer to the `official LiteLLM documentation <https://docs.litellm.ai/docs>`_.
Configuration Example 2: Azure OpenAI Setup
-------------------------------------------
Heres a sample configuration specifically for Azure OpenAI, based on the `official LiteLLM documentation <https://docs.litellm.ai/docs>`_:
If you're using Azure OpenAI, below is a working example using the Python SDK, following the `LiteLLM Azure OpenAI documentation <https://docs.litellm.ai/docs/providers/azure/>`_:
.. code-block:: Properties
from litellm import completion
import os
# Set Azure OpenAI environment variables
os.environ["AZURE_API_KEY"] = "<your_azure_api_key>"
os.environ["AZURE_API_BASE"] = "<your_azure_api_base>"
os.environ["AZURE_API_VERSION"] = "<version>"
# Make a request to your Azure deployment
response = completion(
"azure/<your_deployment_name>",
messages = [{ "content": "Hello, how are you?", "role": "user" }]
)
To align with the Python SDK example above, you can configure the `CHAT_MODEL` based on the `response` model setting and use the corresponding `os.environ` variables by writing them into your local `.env` file as follows:
.. code-block:: Properties
cat << EOF > .env
# CHAT MODEL: Azure OpenAI via LiteLLM
CHAT_MODEL=azure/<your_deployment_name>
AZURE_API_BASE=https://<your_azure_base>.openai.azure.com/
AZURE_API_KEY=<your_azure_api_key>
AZURE_API_VERSION=<version>
# EMBEDDING MODEL: Using SiliconFlow via litellm_proxy
EMBEDDING_MODEL=litellm_proxy/BAAI/bge-large-en-v1.5
LITELLM_PROXY_API_KEY=<your_siliconflow_api_key>
LITELLM_PROXY_API_BASE=https://api.siliconflow.cn/v1
EOF
This configuration allows you to call Azure OpenAI through LiteLLM while using an external provider (e.g., SiliconFlow) for embeddings.
If your `Azure OpenAI API Key`` supports `embedding model`, you can refer to the following configuration example.
.. code-block:: Properties
cat << EOF > .env
EMBEDDING_MODEL=azure/<Model deployment supporting embedding>
CHAT_MODEL=azure/<your deployment name>
AZURE_API_KEY=<replace_with_your_openai_api_key>
AZURE_API_BASE=<your_unified_api_base>
AZURE_API_VERSION=<azure api version>
Execution Environment Configuration
===================================
Coder Environment Configuration (Docker vs. Conda)
RD-Agent's coders can execute code in different environments. You can control this behavior by setting environment variables in your ``.env`` file. This is useful for switching between a local Conda environment and an isolated Docker container.
To configure the environment, add the corresponding line to your ``.env`` file based on the scenario you are running.
**For the Model (Quant) Scenario:**
The execution environment is determined by the ``MODEL_COSTEER_ENV_TYPE`` variable, which is read from ``rdagent/components/coder/model_coder/conf.py``.
* **To use Docker** (recommended for isolated execution):
.. code-block:: properties
MODEL_COSTEER_ENV_TYPE=docker
* **To use Conda** (for running in a local Conda environment):
.. code-block:: properties
MODEL_COSTEER_ENV_TYPE=conda
**For the Data Science Scenario:**
The execution environment is determined by the ``DS_CODER_COSTEER_ENV_TYPE`` variable, which is read from ``rdagent/components/coder/data_science/conf.py``.
* **To use Docker** (recommended for isolated execution):
.. code-block:: properties
DS_CODER_COSTEER_ENV_TYPE=docker
* **To use Conda** (for running in a local Conda environment):
.. code-block:: properties
DS_CODER_COSTEER_ENV_TYPE=conda
Custom Time Segment Configuration (Train / Valid / Test)
=========================================================
RD-Agent now supports user-defined time segments for training, validation,
and testing (backtesting). Users can customize these segments via environment
variables in the ``.env`` file, depending on the scenario being executed.
This feature allows greater flexibility when running experiments on different
time ranges without modifying code or YAML configurations.
Fin-Factor Scenario
-------------------
When running the **fin_factor** scenario, you can configure the time segments
using the following environment variables. These variables are read by the
Factor-related PropSettings and directly affect the execution process.
Add the following entries to your ``.env`` file as needed:
.. code-block:: properties
QLIB_FACTOR_TRAIN_START=<train start date, default is 2008-01-01>
QLIB_FACTOR_TRAIN_END=<train end date, default is 2014-12-31>
QLIB_FACTOR_VALID_START=<valid start date, default is 2015-01-01>
QLIB_FACTOR_VALID_END=<valid end date, default is 2016-12-31>
QLIB_FACTOR_TEST_START=<test / backtest start date, default is 2017-01-01>
QLIB_FACTOR_TEST_END=<test / backtest end date, default is 2020-12-31>
Fin-Model Scenario
------------------
When running the **fin_model** scenario, the model training, validation, and
testing time segments can be configured independently via the following
environment variables:
.. code-block:: properties
QLIB_MODEL_TRAIN_START=<train start date, default is 2008-01-01>
QLIB_MODEL_TRAIN_END=<train end date, default is 2014-12-31>
QLIB_MODEL_VALID_START=<valid start date, default is 2015-01-01>
QLIB_MODEL_VALID_END=<valid end date, default is 2016-12-31>
QLIB_MODEL_TEST_START=<test / backtest start date, default is 2017-01-01>
QLIB_MODEL_TEST_END=<test / backtest end date, default is 2020-12-31>
These settings are used during model training and evaluation and directly
impact the execution workflow.
Fin-Quant Scenario
------------------
When running the **fin_quant** scenario, RD-Agent supports configuring time
segments for factor, model, and quant stages simultaneously.
**Note:** The ``QLIB_QUANT_*`` variables are only used for front-end UI display
purposes and do **not** affect the actual execution process.
You may configure the following variables in your ``.env`` file:
.. code-block:: properties
QLIB_FACTOR_TRAIN_START=<train start date, default is 2008-01-01>
QLIB_FACTOR_TRAIN_END=<train end date, default is 2014-12-31>
QLIB_FACTOR_VALID_START=<valid start date, default is 2015-01-01>
QLIB_FACTOR_VALID_END=<valid end date, default is 2016-12-31>
QLIB_FACTOR_TEST_START=<test / backtest start date, default is 2017-01-01>
QLIB_FACTOR_TEST_END=<test / backtest end date, default is 2020-12-31>
QLIB_MODEL_TRAIN_START=<train start date, default is 2008-01-01>
QLIB_MODEL_TRAIN_END=<train end date, default is 2014-12-31>
QLIB_MODEL_VALID_START=<valid start date, default is 2015-01-01>
QLIB_MODEL_VALID_END=<valid end date, default is 2016-12-31>
QLIB_MODEL_TEST_START=<test / backtest start date, default is 2017-01-01>
QLIB_MODEL_TEST_END=<test / backtest end date, default is 2020-12-31>
QLIB_QUANT_TRAIN_START=<train start date, default is 2008-01-01>
QLIB_QUANT_TRAIN_END=<train end date, default is 2014-12-31>
QLIB_QUANT_VALID_START=<valid start date, default is 2015-01-01>
QLIB_QUANT_VALID_END=<valid end date, default is 2016-12-31>
QLIB_QUANT_TEST_START=<test / backtest start date, default is 2017-01-01>
QLIB_QUANT_TEST_END=<test / backtest end date, default is 2020-12-31>
This setup allows the front-end to display consistent segment information
across different stages while keeping execution logic unchanged.
Configuration(deprecated)
=========================
To run the application, please create a `.env` file in the root directory of the project and add environment variables according to your requirements.
If you are using this deprecated version, you should set `BACKEND` to `rdagent.oai.backend.DeprecBackend`.
.. code-block:: Properties
BACKEND=rdagent.oai.backend.DeprecBackend
Here are some other configuration options that you can use:
OpenAI API
------------
Here is a standard configuration for the user using the OpenAI API.
.. code-block:: Properties
OPENAI_API_KEY=<your_api_key>
EMBEDDING_MODEL=text-embedding-3-small
CHAT_MODEL=gpt-4-turbo
Azure OpenAI
------------
The following environment variables are standard configuration options for the user using the OpenAI API.
.. code-block:: Properties
USE_AZURE=True
EMBEDDING_OPENAI_API_KEY=<replace_with_your_azure_openai_api_key>
EMBEDDING_AZURE_API_BASE= # The endpoint for the Azure OpenAI API.
EMBEDDING_AZURE_API_VERSION= # The version of the Azure OpenAI API.
EMBEDDING_MODEL=text-embedding-3-small
CHAT_OPENAI_API_KEY=<replace_with_your_azure_openai_api_key>
CHAT_AZURE_API_BASE= # The endpoint for the Azure OpenAI API.
CHAT_AZURE_API_VERSION= # The version of the Azure OpenAI API.
CHAT_MODEL= # The model name of the Azure OpenAI API.
Use Azure Token Provider
------------------------
If you are using the Azure token provider, you need to set the `CHAT_USE_AZURE_TOKEN_PROVIDER` and `EMBEDDING_USE_AZURE_TOKEN_PROVIDER` environment variable to `True`. then
use the environment variables provided in the `Azure Configuration section <installation_and_configuration.html#azure-openai>`_.
☁️ Azure Configuration
- Install Azure CLI:
```sh
curl -L https://aka.ms/InstallAzureCli | bash
```
- Log in to Azure:
```sh
az login --use-device-code
```
- `exit` and re-login to your environment (this step may not be necessary).
Configuration List
------------------
.. TODO: use `autodoc-pydantic` .
- OpenAI API Setting
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| Configuration Option | Meaning | Default Value |
+===================================+=================================================================+=========================+
| OPENAI_API_KEY | API key for both chat and embedding models | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| EMBEDDING_OPENAI_API_KEY | Use a different API key for embedding model | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| CHAT_OPENAI_API_KEY | Set to use a different API key for chat model | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| EMBEDDING_MODEL | Name of the embedding model | text-embedding-3-small |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| CHAT_MODEL | Name of the chat model | gpt-4-turbo |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| EMBEDDING_AZURE_API_BASE | Base URL for the Azure OpenAI API | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| EMBEDDING_AZURE_API_VERSION | Version of the Azure OpenAI API | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| CHAT_AZURE_API_BASE | Base URL for the Azure OpenAI API | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| CHAT_AZURE_API_VERSION | Version of the Azure OpenAI API | None |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| USE_AZURE | True if you are using Azure OpenAI | False |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| CHAT_USE_AZURE_TOKEN_PROVIDER | True if you are using an Azure Token Provider in chat model | False |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
| EMBEDDING_USE_AZURE_TOKEN_PROVIDER| True if you are using an Azure Token Provider in embedding model| False |
+-----------------------------------+-----------------------------------------------------------------+-------------------------+
- Globol Setting
+-----------------------------+--------------------------------------------------+-------------------------+
| Configuration Option | Meaning | Default Value |
+=============================+==================================================+=========================+
| max_retry | Maximum number of times to retry | 10 |
+-----------------------------+--------------------------------------------------+-------------------------+
| retry_wait_seconds | Number of seconds to wait before retrying | 1 |
+-----------------------------+--------------------------------------------------+-------------------------+
+ log_trace_path | Path to log trace file | None |
+-----------------------------+--------------------------------------------------+-------------------------+
+ log_llm_chat_content | Flag to indicate if chat content is logged | True |
+-----------------------------+--------------------------------------------------+-------------------------+
- Cache Setting
.. TODO: update Meaning for caches
+------------------------------+--------------------------------------------------+-------------------------+
| Configuration Option | Meaning | Default Value |
+==============================+==================================================+=========================+
| dump_chat_cache | Flag to indicate if chat cache is dumped | False |
+------------------------------+--------------------------------------------------+-------------------------+
| dump_embedding_cache | Flag to indicate if embedding cache is dumped | False |
+------------------------------+--------------------------------------------------+-------------------------+
| use_chat_cache | Flag to indicate if chat cache is used | False |
+------------------------------+--------------------------------------------------+-------------------------+
| use_embedding_cache | Flag to indicate if embedding cache is used | False |
+------------------------------+--------------------------------------------------+-------------------------+
| prompt_cache_path | Path to prompt cache | ./prompt_cache.db |
+------------------------------+--------------------------------------------------+-------------------------+
| max_past_message_include | Maximum number of past messages to include | 10 |
+------------------------------+--------------------------------------------------+-------------------------+
Loading Configuration
---------------------
For users' convenience, we provide a CLI interface called `rdagent`, which automatically runs `load_dotenv()` to load environment variables from the `.env` file.
However, this feature is not enabled by default for other scripts. We recommend users load the environment with the following steps:
- ⚙️ Environment Configuration
- Place the `.env` file in the same directory as the `.env.example` file.
- The `.env.example` file contains the environment variables required for users using the OpenAI API (Please note that `.env.example` is an example file. `.env` is the one that will be finally used.)
- Export each variable in the .env file:
.. code-block:: sh
export $(grep -v '^#' .env | xargs)
- If you want to change the default environment variables, you can refer to the above configuration and edith the `.env` file.
+18
View File
@@ -0,0 +1,18 @@
=========================
Introduction
=========================
In modern industry, research and development (R&D) is crucial for the enhancement of industrial productivity, especially in the AI era, where the core aspects of R&D are mainly focused on data and models. We are committed to automate these high-value generic R&D processes through our open source R&D automation tool RDAgent, which let AI drive data-driven AI.
.. image:: _static/scen.png
:alt: Our focused scenario
Our RDAgent is designed to automate the most critical industrial R&D processes, focusing first on data-driven scenarios, to greatly boost the development productivity of models and data.
Methodologically, we propose an autonomous agent framework that consists of two key parts: (R)esearch stands for actively exploring by proposing new ideas, and (D)evelopment stands for realizing these ideas. The effectiveness of these two components will ultimately get feedbacks through practice, and both research and development capabilities can continuously learn and grow in the process.
For a quick start, visit `our GitHub home page <https://github.com/microsoft/RD-Agent>`_ ⚡. If you've already checked it out and want more details, please keep reading.
+35
View File
@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=build
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
if "%1" == "" goto help
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd
+24
View File
@@ -0,0 +1,24 @@
======
Policy
======
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
Trademarks
==========
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
+27
View File
@@ -0,0 +1,27 @@
===============================
Framework Design & Components
===============================
Framework & Components
=========================
.. NOTE: This depends on the correctness of `c-v` of github.
.. image:: _static/Framework-RDAgent.png
:alt: Components & Feature Level
The image above shows the overall framework of RDAgent.
In a data mining expert's daily research and development process, they propose a hypothesis (e.g., a model structure like RNN can capture patterns in time-series data), design experiments (e.g., finance data contains time-series and we can verify the hypothesis in this scenario), implement the experiment as code (e.g., Pytorch model structure), and then execute the code to get feedback (e.g., metrics, loss curve, etc.). The experts learn from the feedback and improve in the next iteration.
We have established a basic method framework that continuously proposes hypotheses, verifies them, and gets feedback from the real world. This is the first scientific research automation framework that supports linking with real-world verification.
.. image:: https://github.com/user-attachments/assets/60cc2712-c32a-4492-a137-8aec59cdc66e
:alt: Class Level Figure
The figure above shows the main classes and how they fit into the workflow for those interested in the detailed code.
.. Detailed Design
.. ===============
+4
View File
@@ -0,0 +1,4 @@
sphinx
sphinx_rtd_theme
furo
importlib.metadata
+109
View File
@@ -0,0 +1,109 @@
==============================
Benchmark
==============================
Introduction
=============
Benchmarking the capabilities of R&D is a crucial research problem in this area. We are continuously exploring methods to benchmark these capabilities. The current benchmarks are listed on this page.
Development Capability Benchmarking
===================================
Benchmarking is used to evaluate the effectiveness of factors with fixed data. It mainly includes the following steps:
1. :ref:`read and prepare the eval_data <data>`
2. :ref:`declare the method to be tested and pass the arguments <config>`
3. :ref:`declare the eval method and pass the arguments <config>`
4. :ref:`run the eval <run>`
5. :ref:`save and show the result <show>`
Configuration
-------------
.. _config:
.. autopydantic_settings:: rdagent.components.benchmark.conf.BenchmarkSettings
Example
+++++++
.. _example:
The default value for ``bench_test_round`` is 10, which takes about 2 hours to run. To modify it from ``10`` to ``2``, adjust the environment variables in the .env file as shown below.
.. code-block:: Properties
BENCHMARK_BENCH_TEST_ROUND=2
Data Format
-------------
.. _data:
The sample data in ``bench_data_path`` is a dictionary where each key represents a factor name. The value associated with each key is factor data containing the following information:
- **description**: A textual description of the factor.
- **formulation**: A LaTeX formula representing the model's formulation.
- **variables**: A dictionary of variables involved in the factor.
- **Category**: The category or classification of the factor.
- **Difficulty**: The difficulty level of implementing or understanding the factor.
- **gt_code**: A piece of code associated with the factor.
Here is an example of this data format:
.. literalinclude:: ../../rdagent/components/benchmark/example.json
:language: json
Ensure the data is placed in the ``FACTOR_COSTEER_SETTINGS.data_folder_debug``. The data files should be in ``.h5`` or ``.md`` format and must not be stored in any subfolders. LLM-Agents will review the file content and implement the tasks.
.. TODO: Add a script to automatically generate the data in the `rdagent/app/quant_factor_benchmark/data` folder.
Run Benchmark
-------------
.. _run:
Start the benchmark after completing the :doc:`../installation_and_configuration`.
.. code-block:: Properties
dotenv run -- python rdagent/app/benchmark/factor/eval.py
Once completed, a pkl file will be generated, and its path will be printed on the last line of the console.
Show Result
-------------
.. _show:
The ``analysis.py`` script reads data from the pkl file and converts it to an image. Modify the Python code in ``rdagent/app/quant_factor_benchmark/analysis.py`` to specify the path to the pkl file and the output path for the png file.
.. code-block:: Properties
dotenv run -- python rdagent/app/benchmark/factor/analysis.py <log/path to.pkl>
A png file will be saved to the designated path as shown below.
.. image:: ../_static/benchmark.png
Related Paper
-------------
- `Towards Data-Centric Automatic R&D <https://arxiv.org/abs/2404.11276>`_:
We have developed a comprehensive benchmark called RD2Bench to assess data and model R&D capabilities. This benchmark includes a series of tasks that outline the features or structures of models. These tasks are used to evaluate the ability of LLM-Agents to implement them.
.. code-block:: bibtex
@misc{chen2024datacentric,
title={Towards Data-Centric Automatic R&D},
author={Haotian Chen and Xinjie Shen and Zeqi Ye and Wenjun Feng and Haoxue Wang and Xiao Yang and Xu Yang and Weiqing Liu and Jiang Bian},
year={2024},
eprint={2404.11276},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
.. image:: https://github.com/user-attachments/assets/494f55d3-de9e-4e73-ba3d-a787e8f9e841
To replicate the benchmark detailed in the paper, please consult the factors listed in the following file: `RD2bench.json <../_static/RD2bench.json>`_.
Please note use ``only_correct_format=False`` when evaluating the results.
+34
View File
@@ -0,0 +1,34 @@
===========
Research
===========
To achieve the good effects and improve R&D capabilities, we face multiple challenges, the most important of which is the continuous evolution capability. Existing large language models (LLMs) find it difficult to continue growing their capabilities after training is completed. Moreover, the training process of LLMs focuses more on general knowledge, and the lack of depth in more specialized knowledge becomes an obstacle to solving professional R&D problems within the industry. This specialized knowledge needs to be learned and acquired from in-depth industry practice.
Our RD-Agent, on the other hand, can continuously acquire in-depth domain knowledge through deep exploration during the R&D phase, allowing its R&D capabilities to keep growing.
To address these key challenges and achieve industrial value, a series of research work needs to be completed.
.. list-table:: Research Areas and Descriptions
:header-rows: 1
* - Research Area
- Description
* - :doc:`Benchmark <benchmark>`
- Benchmark the R&D abilities
* - Research
- Idea proposal: Explore new ideas or refine existing ones
* - :doc:`Development <dev>`
- Ability to realize ideas: Implement and execute ideas
.. toctree::
:maxdepth: 1
:caption: Doctree:
:hidden:
benchmark
dev
+25
View File
@@ -0,0 +1,25 @@
==============================
Development
==============================
Related Paper
-------------
- `Collaborative Evolving Strategy for Automatic Data-Centric Development <https://arxiv.org/abs/2407.18690>`_
Co-STEER is a method to tackle data-centric development (AD2) tasks and highlight its main challenges, which need expert-like implementation (i.e., learning domain knowledge from practice) and task scheduling capability (e.g., starting with easier tasks for better overall efficiency), areas that previous work has largely overlooked. Our Co-STEER agent enhances its domain knowledge through our evolving strategy and improves both its scheduling and implementation skills by gathering and using domain-specific practical experience. With a better schedule, implementation becomes faster. At the same time, as implementation feedback becomes more detailed, scheduling accuracy improves. These two capabilities grow together through practical feedback, enabling a collaborative evolution process.
.. code-block:: bibtex
@misc{yang2024collaborative,
title={Collaborative Evolving Strategy for Automatic Data-Centric Development},
author={Xu Yang and Haotian Chen and Wenjun Feng and Haoxue Wang and Zeqi Ye and Xinjie Shen and Xiao Yang and Shizhao Sun and Weiqing Liu and Jiang Bian},
year={2024},
eprint={2407.18690},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
.. image:: https://github.com/user-attachments/assets/75d9769b-0edd-4caf-9d45-57d1e577054b
:alt: Collaborative Evolving Strategy for Automatic Data-Centric Development
+47
View File
@@ -0,0 +1,47 @@
=========================
Scenarios
=========================
Scenario lists
=========================
In the two key areas of data-driven scenarios, model implementation and data building, our system aims to serve two main roles: 🦾copilot and 🤖agent.
- The 🦾copilot follows human instructions to automate repetitive tasks.
- The 🤖agent, being more autonomous, actively proposes ideas for better results in the future.
The supported scenarios are listed below:
.. list-table::
:header-rows: 1
* - Scenario/Target
- Model Implementation
- Data Building
* - 💹 Finance
- :ref:`🥇The First Data-Centric Quant Multi-Agent Framework <quant_agent_fin>`
- :ref:`🤖Iteratively Proposing Ideas & Evolving <model_agent_fin>`
:ref:`🦾Auto reports reading & implementation <data_copilot_fin>`
:ref:`🤖Iteratively Proposing Ideas & Evolving <data_agent_fin>`
* - 🏭 General
- :ref:`🦾Auto paper reading & implementation <model_copilot_general>`
:ref:`🧪FT-Agent for LLM fine-tuning <finetune_agent>`
- :ref:`🤖 Data Science <data_science_agent>`
.. toctree::
:maxdepth: 1
:caption: Doctree:
:hidden:
quant_agent_fin
data_agent_fin
data_copilot_fin
model_agent_fin
model_copilot_general
data_science
finetune
+138
View File
@@ -0,0 +1,138 @@
.. _data_agent_fin:
=====================
Finance Data Agent
=====================
**🤖 Automated Quantitative Trading & Iterative Factors Evolution**
-------------------------------------------------------------------
📖 Background
~~~~~~~~~~~~~~
In the dynamic world of quantitative trading, **factors** serve as the strategic tools that enable traders to exploit market inefficiencies.
These factors—ranging from simple metrics like price-to-earnings ratios to complex models like discounted cash flows—are the key to predicting stock prices with a high degree of accuracy.
By leveraging these factors, quantitative traders can develop sophisticated strategies that not only identify market patterns but also significantly enhance trading efficiency and precision.
The ability to systematically analyze and apply these factors is what separates ordinary trading from truly strategic market outmaneuvering.
And this is where the **Finance Model Agent** comes into play.
🎥 `Demo <https://rdagent.azurewebsites.net/factor_loop>`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. raw:: html
<div style="display: flex; justify-content: center; align-items: center;">
<video width="600" controls>
<source src="https://rdagent.azurewebsites.net/media/65bb598f1372c1857ccbf09b2acf5d55830911625048c03102291098.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
🌟 Introduction
~~~~~~~~~~~~~~~~
In this scenario, our agent illustrates the iterative process of hypothesis generation, knowledge construction, and decision-making.
It highlights how financial factors evolve through continuous feedback and refinement.
Here's an enhanced outline of the steps:
**Step 1 : Hypothesis Generation 🔍**
- Generate and propose initial hypotheses based on previous experiment analysis and domain expertise, with thorough reasoning and financial justification.
**Step 2 : Factor Creation ✨**
- Based on the hypothesis, divide the tasks.
- Each task involves developing, defining, and implementing a new financial factor, including its name, description, formulation, and variables.
**Step 3 : Factor Implementation 👨‍💻**
- Implement the factor code based on the description, evolving it as a developer would.
- Quantitatively validate the newly created factors.
**Step 4 : Backtesting with Qlib 📉**
- Integrate the full dataset into the factor implementation code and prepare the factor library.
- Conduct backtesting using the Alpha158 plus newly developed factors and LGBModel in Qlib to evaluate the new factors' effectiveness and performance.
+----------------+------------+----------------+----------------------------------------------------+
| Dataset | Model | Factors | Data Split |
+================+============+================+====================================================+
| CSI300 | LGBModel | Alpha158 Plus | +-----------+--------------------------+ |
| | | | | Train | 2008-01-01 to 2014-12-31 | |
| | | | +-----------+--------------------------+ |
| | | | | Valid | 2015-01-01 to 2016-12-31 | |
| | | | +-----------+--------------------------+ |
| | | | | Test | 2017-01-01 to 2020-08-01 | |
| | | | +-----------+--------------------------+ |
+----------------+------------+----------------+----------------------------------------------------+
**Step 5 : Feedback Analysis 🔍**
- Analyze backtest results to assess performance.
- Incorporate feedback to refine hypotheses and improve the model.
**Step 6 :Hypothesis Refinement ♻️**
- Refine hypotheses based on feedback from backtesting.
- Repeat the process to continuously improve the model.
⚡ Quick Start
~~~~~~~~~~~~~~~~~
Please refer to the installation part in :doc:`../installation_and_configuration` to prepare your system dependency.
You can try our demo by running the following command:
- 🐍 Create a Conda Environment
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
.. code-block:: sh
conda create -n rdagent python=3.10
- Activate the environment:
.. code-block:: sh
conda activate rdagent
- 📦 Install the RDAgent
- You can install the RDAgent package from PyPI:
.. code-block:: sh
pip install rdagent
- 🚀 Run the Application
- You can directly run the application by using the following command:
.. code-block:: sh
rdagent fin_factor
🛠️ Usage of modules
~~~~~~~~~~~~~~~~~~~~~
.. _Env Config:
- **Env Config**
The following environment variables can be set in the `.env` file to customize the application's behavior:
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.FactorBasePropSetting
:settings-show-field-summary: False
:exclude-members: Config
.. autopydantic_settings:: rdagent.components.coder.factor_coder.config.FactorCoSTEERSettings
:settings-show-field-summary: False
:members: coder_use_cache, data_folder, data_folder_debug, file_based_execution_timeout, select_method, max_loop, knowledge_base_path, new_knowledge_base_path
:exclude-members: Config, fail_task_trial_limit, v1_query_former_trace_limit, v1_query_similar_success_limit, v2_query_component_limit, v2_query_error_limit, v2_query_former_trace_limit, v2_error_summary, v2_knowledge_sampler
:no-index:
+164
View File
@@ -0,0 +1,164 @@
.. _data_copilot_fin:
=====================
Finance Data Copilot
=====================
**🤖 Automated Quantitative Trading & Factors Extraction from Financial Reports**
---------------------------------------------------------------------------------
📖 Background
~~~~~~~~~~~~~~
**Research reports** are treasure troves of insights, often unveiling potential **factors** that can drive successful quantitative trading strategies.
Yet, with the sheer volume of reports available, extracting the most valuable insights efficiently becomes a daunting task.
Furthermore, rather than hastily replicating factors from a report, it's essential to delve into the underlying logic of their construction.
Does the factor capture the essential market dynamics? How unique is it compared to the factors already in your library?
Therefore, there is an urgent need for a systematic approach to design a framework that can effectively manage this process.
And this is where the **Finance Data Copilot** steps in.
🎥 `Demo <https://rdagent.azurewebsites.net/report_factor>`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. raw:: html
<div style="display: flex; justify-content: center; align-items: center;">
<video width="600" controls>
<source src="https://rdagent.azurewebsites.net/media/7b14b2bd3d8771da9cf7eb799b6d96729cec3d35c8d4f68060f3e2fd.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
🌟 Introduction
~~~~~~~~~~~~~~~~
In this scenario, RDAgent demonstrates the process of extracting factors from financial research reports, implementing these factors, and analyzing their performance through Qlib backtesting.
This process continually expands and refines the factor library.
Here's an enhanced outline of the steps:
**Step 1 : Hypothesis Generation 🔍**
- Generate and propose initial hypotheses based on insights from financial reports with thorough reasoning and financial justification.
**Step 2 : Factor Creation ✨**
- Based on the hypothesis and financial reports, divide the tasks.
- Each task involves developing, defining, and implementing a new financial factor, including its name, description, formulation, and variables.
**Step 3 : Factor Implementation 👨‍💻**
- Implement the factor code based on the description, evolving it as a developer would.
- Quantitatively validate the newly created factors.
**Step 4 : Backtesting with Qlib 📉**
- Integrate the full dataset into the factor implementation code and prepare the factor library.
- Conduct backtesting using the Alpha158 plus newly developed factors and LGBModel in Qlib to evaluate the new factors' effectiveness and performance.
+----------------+------------+----------------+----------------------------------------------------+
| Dataset | Model | Factors | Data Split |
+================+============+================+====================================================+
| CSI300 | LGBModel | Alpha158 Plus | +-----------+--------------------------+ |
| | | | | Train | 2008-01-01 to 2014-12-31 | |
| | | | +-----------+--------------------------+ |
| | | | | Valid | 2015-01-01 to 2016-12-31 | |
| | | | +-----------+--------------------------+ |
| | | | | Test | 2017-01-01 to 2020-08-01 | |
| | | | +-----------+--------------------------+ |
+----------------+------------+----------------+----------------------------------------------------+
**Step 5 : Feedback Analysis 🔍**
- Analyze backtest results to assess performance.
- Incorporate feedback to refine hypotheses and improve the model.
**Step 6 :Hypothesis Refinement ♻️**
- Refine hypotheses based on feedback from backtesting.
- Repeat the process to continuously improve the model.
⚡ Quick Start
~~~~~~~~~~~~~~~~~
Please refer to the installation part in :doc:`../installation_and_configuration` to prepare your system dependency.
You can try our demo by running the following command:
- 🐍 Create a Conda Environment
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
.. code-block:: sh
conda create -n rdagent python=3.10
- Activate the environment:
.. code-block:: sh
conda activate rdagent
- 📦 Install the RDAgent
- You can install the RDAgent package from PyPI:
.. code-block:: sh
pip install rdagent
- 🚀 Run the Application
- Download the financial reports you wish to extract factors from and store them in your preferred folder.
- Specifically, you can follow this example, or use your own method:
.. code-block:: sh
wget https://github.com/SunsetWolf/rdagent_resource/releases/download/reports/all_reports.zip
unzip all_reports.zip -d git_ignore_folder/reports
- Run the application with the following command:
.. code-block:: sh
rdagent fin_factor_report --report-folder=git_ignore_folder/reports
- Alternatively, you can store the paths of the reports in `report_result_json_file_path`. The format should be:
.. code-block:: json
[
"git_ignore_folder/report/fin_report1.pdf",
"git_ignore_folder/report/fin_report2.pdf",
"git_ignore_folder/report/fin_report3.pdf"
]
- Then, run the application using the following command:
.. code-block:: sh
rdagent fin_factor_report
🛠️ Usage of modules
~~~~~~~~~~~~~~~~~~~~~
.. _Env Config:
- **Env Config**
The following environment variables can be set in the `.env` file to customize the application's behavior:
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.FactorFromReportPropSetting
:settings-show-field-summary: False
:show-inheritance:
:exclude-members: Config
.. autopydantic_settings:: rdagent.components.coder.factor_coder.config.FactorCoSTEERSettings
:settings-show-field-summary: False
:members: coder_use_cache, data_folder, data_folder_debug, file_based_execution_timeout, select_method, max_loop, knowledge_base_path, new_knowledge_base_path
:exclude-members: Config, python_bin, fail_task_trial_limit, v1_query_former_trace_limit, v1_query_similar_success_limit, v2_query_component_limit, v2_query_error_limit, v2_query_former_trace_limit, v2_error_summary, v2_knowledge_sampler
:no-index:
+566
View File
@@ -0,0 +1,566 @@
.. _data_science_agent:
=======================
Data Science Agent
=======================
**🤖 Automated Feature Engineering & Model Tuning Evolution**
------------------------------------------------------------------------------------------
The Data Science Agent is an agent that can automatically perform feature engineering and model tuning. It can be used to solve various data science problems, such as image classification, time series forecasting, and text classification.
🌟 Introduction
~~~~~~~~~~~~~~~~~~
In this scenario, our automated system proposes hypothesis, choose action, implements code, conducts validation, and utilizes feedback in a continuous, iterative process.
The goal is to automatically optimize performance metrics within the validation set or Kaggle Leaderboard, ultimately discovering the most efficient features and models through autonomous research and development.
Here's an enhanced outline of the steps:
**Step 1 : Hypothesis Generation 🔍**
- Generate and propose initial hypotheses based on previous experiment analysis and domain expertise, with thorough reasoning and financial justification.
**Step 2 : Experiment Creation ✨**
- Transform the hypothesis into a task.
- Choose a specific action within feature engineering or model tuning.
- Develop, define, and implement a new feature or model, including its name, description, and formulation.
**Step 3 : Model/Feature Implementation 👨‍💻**
- Implement the model code based on the detailed description.
- Evolve the model iteratively as a developer would, ensuring accuracy and efficiency.
**Step 4 : Validation on Test Set or Kaggle 📉**
- Validate the newly developed model using the test set or Kaggle dataset.
- Assess the model's effectiveness and performance based on the validation results.
**Step 5: Feedback Analysis 🔍**
- Analyze validation results to assess performance.
- Use insights to refine hypotheses and enhance the model.
**Step 6: Hypothesis Refinement ♻️**
- Adjust hypotheses based on validation feedback.
- Iterate the process to continuously improve the model.
📖 Data Science Background
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the evolving landscape of artificial intelligence, **Data Science** represents a powerful paradigm where machines engage in autonomous exploration, hypothesis testing, and model development across diverse domains — from healthcare and finance to logistics and research.
The **Data Science** Agent stands as a central engine in this transformation, enabling users to automate the entire machine learning workflow: from hypothesis generation to code implementation, validation, and refinement — all guided by performance feedback.
By leveraging the **Data Science** Agent, researchers and developers can accelerate experimentation cycles. Whether fine-tuning custom models or competing in high-stakes benchmarks like Kaggle, the Data Science Agent unlocks new frontiers in intelligent, self-directed discovery.
🧭 Example Guide - Customized dataset
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔧 **Set up RD-Agent Environment**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Before you start, please make sure you have installed RD-Agent and configured the environment for RD-Agent correctly. If you want to know how to install and configure the RD-Agent, please refer to the `documentation <../installation_and_configuration.html>`_.
- 🔩 **Setting the Environment variables at .env file**
- Determine the path where the data will be stored and add it to the ``.env`` file.
.. code-block:: sh
dotenv set DS_LOCAL_DATA_PATH <your local directory>/ds_data
dotenv set DS_SCEN rdagent.scenarios.data_science.scen.DataScienceScen
📥 **Prepare Customized datasets**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- A data science competition dataset usually consists of two parts: ``competition dataset`` and ``evaluation dataset``. (We provide `a sample <https://github.com/microsoft/RD-Agent/tree/main/rdagent/scenarios/data_science/example>`_ of a customized dataset named: `arf-12-hours-prediction-task as a reference`.)
- The ``competition dataset`` contains **training data**, **test data**, **description files**, **formatted submission files**, **data sampling codes**.
- The ``evaluation dataset`` contains **standard answer file**, **data checking codes**, and **Code for calculation of scores**.
- We use the ``arf-12-hours-prediction-task`` data as a sample to introduce the preparation workflow for the competition dataset.
- Create a ``ds_data/source_data/arf-12-hours-prediction-task`` folder, which will be used to store your raw dataset.
- The raw files for the competition ``arf-12-hours-prediction-task`` have two files: ``ARF_12h.csv`` and ``X.npz``.
- Create a ``ds_data/source_data/arf-12-hours-prediction-task/prepare.py`` file that splits your raw data into **training data**, **test data**, **formatted submission file**, and **standard answer file**. (You will need to write a script based on your raw data.)
- The following shows the preprocessing code for the raw data of ``arf-12-hours-prediction-task``.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/source_data/arf-12-hours-prediction-task/prepare.py
:language: python
:caption: ds_data/source_data/arf-12-hours-prediction-task/prepare.py
:linenos:
- At the end of program execution, the ``ds_data`` folder structure will look like this:
.. code-block:: text
ds_data
├── arf-12-hours-prediction-task
│ ├── train
│ │ ├── ARF_12h.csv
│ │ └── X.npz
│ ├── test
│ │ ├── ARF_12h.csv
│ │ └── X.npz
│ └── sample_submission.csv
├── eval
│ └── arf-12-hours-prediction-task
│ └── submission_test.csv
└── source_data
└── arf-12-hours-prediction-task
├── ARF_12h.csv
├── prepare.py
└── X.npz
- Create a ``ds_data/arf-12-hours-prediction-task/description.md`` file to describe your competition, Objective, dataset, and other information.
- The following shows the description file for ``arf-12-hours-prediction-task``
.. literalinclude:: ../../rdagent/scenarios/data_science/example/arf-12-hours-prediction-task/description.md
:language: markdown
:caption: ds_data/arf-12-hours-prediction-task/description.md
:linenos:
- Create a ``ds_data/arf-12-hours-prediction-task/sample.py`` file to construct the debugging sample data.
- The following shows the script for constructing the debugging sample data based on the ``arf-12-hours-prediction-task`` dataset implementation.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/arf-12-hours-prediction-task/sample.py
:language: markdown
:caption: ds_data/arf-12-hours-prediction-task/sample.py
:linenos:
- Create a ``ds_data/eval/arf-12-hours-prediction-task/valid.py`` file, which is used to check the validity of the submission files to ensure that their formatting is consistent with the reference file.
- The following shows a script that checks the validity of a submission based on the ``arf-12-hours-prediction-task`` data.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/eval/arf-12-hours-prediction-task/valid.py
:language: markdown
:caption: ds_data/eval/arf-12-hours-prediction-task/valid.py
:linenos:
- Create a ``ds_data/eval/arf-12-hours-prediction-task/grade.py`` file, which is used to calculate the score based on the submission file and the **standard answer file**, and output the result in JSON format.
- The following shows a grading script based on the ``arf-12-hours-prediction-task`` data implementation.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/eval/arf-12-hours-prediction-task/grade.py
:language: markdown
:caption: ds_data/eval/arf-12-hours-prediction-task/grade.py
:linenos:
- At this point, you have created a complete dataset. The correct structure of the dataset should look like this.
.. code-block:: text
ds_data
├── arf-12-hours-prediction-task
│ ├── train
│ │ ├── ARF_12h.csv
│ │ └── X.npz
│ ├── test
│ │ ├── ARF_12h.csv
│ │ └── X.npz
│ ├── description.md
│ ├── sample_submission.csv
│ └── sample.py
├── eval
│ └── arf-12-hours-prediction-task
│ ├── grade.py
│ ├── submission_test.csv
│ └── valid.py
└── source_data
└── arf-12-hours-prediction-task
├── ARF_12h.csv
├── prepare.py
└── X.npz
- The above shows the complete dataset creation workflow, some of the files are not required, in practice you can customize the dataset according to your own needs.
- If we don't need the test set scores, then we can choose not to generate **formatted submission files** and **standard answer file** in the prepare code, and we don't need to write **data checking codes** and **Code for calculation of scores**.
- **Data sampling code** can also be created according to the actual need, if you do not provide **data sampling code**, RD-Agent will be handed over to the LLM sampling at runtime.
- In the default sampling method (``create_debug_data``), the default sampling ratio (parameter: ``min_frac``) is 1%, if 1% of the data is less than 5, then 5 data will be sampled (parameter: ``min_num``), you can adjust the sampling ratio by adjusting these two parameters.
- If you have customized data sampling code, you need to set ``DS_SAMPLE_DATA_BY_LLM`` to ``False`` (default is True) in the ``.env`` file before running, so that the program will use the customized sampling code when running, and you can just execute this line of code in the command line:
.. code-block:: sh
dotenv set DS_SAMPLE_DATA_BY_LLM False
- In addition, we provide a data sampling method in `rdagent.scenarios.data_science.debug.data.create_debug_data <https://github.com/microsoft/RD-Agent/blob/main/rdagent/scenarios/data_science/debug/data.py#L605>`_, in this method, the default sampling ratio (parameter: ``min_frac``) is 1%, if 1% of the data is less than 5, then 5 data will be sampled (parameter: ``min_num``), you can use this method by the following two ways.
- You can set ``DS_SAMPLE_DATA_BY_LLM`` to ``False`` in the ``.env`` file so that when the program runs, it will use the sampling code provided by RD-Agent.
.. code-block:: sh
dotenv set DS_SAMPLE_DATA_BY_LLM False
- If you think that the parameters in the receipt sampling method provided by RD-Agent are not suitable, you can customize the parameters in the following command and run it, and set ``DS_SAMPLE_DATA_BY_LLM`` to ``False`` in the ``.env`` so that the program will use the sampling data you provided when running.
.. code-block:: sh
python rdagent/app/data_science/debug.py --dataset_path <dataset path> --competition <competiton_name> --min_frac <sampling ratio> --min_num <minimum number of sampling>
dotenv set DS_SAMPLE_DATA_BY_LLM False
- If you don't need the scores from the test set and leave the data sampling to the LLM, or if you use the sampling method provided by the RD-Agent, you only need to prepare a minimal dataset. The structure of the simplest dataset should be as shown below.
.. code-block:: text
ds_data
├── arf-12-hours-prediction-task
│ ├── train
│ │ ├── ARF_12h.csv
│ │ └── X.npz
│ ├── test
│ │ ├── ARF_12h.csv
│ │ └── X.npz
│ └── description.md
└── source_data
└── arf-12-hours-prediction-task
├── ARF_12h.csv
├── prepare.py
└── X.npz
- We have prepared a dataset based on the above description for your reference. You can download it with the following command.
.. code-block:: sh
wget https://github.com/SunsetWolf/rdagent_resource/releases/download/ds_data/arf-12-hours-prediction-task.zip
⚙️ **Set up Environment for Customized datasets**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: sh
dotenv set DS_SCEN rdagent.scenarios.data_science.scen.DataScienceScen
dotenv set DS_LOCAL_DATA_PATH <your local directory>/ds_data
dotenv set DS_CODER_ON_WHOLE_PIPELINE True
- 📘 More Environment Variables (Optional)
- If you want to see all the available environment variables, you can refer to the configuration file for Data Science scenarios:
.. literalinclude:: ../../rdagent/app/data_science/conf.py
:language: python
:linenos:
- These variables allow you to have finer-grained control in Data Science scenarios.
🚀 **Run the Application**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 🌏 You can directly run the application by using the following command:
.. code-block:: sh
rdagent data_science --competition <Competition ID>
- The following shows the command to run based on the ``arf-12-hours-prediction-task`` data
.. code-block:: sh
rdagent data_science --competition arf-12-hours-prediction-task
- More CLI Parameters for `rdagent data_science` command:
.. automodule:: rdagent.app.data_science.loop
:members:
:no-index:
- 📈 Visualize the R&D Process
- We provide a web UI to visualize the log. You just need to run:
.. code-block:: sh
rdagent ui --port <custom port> --log-dir <your log folder like "log/"> --data_science True
- Then you can input the log path and visualize the R&D process.
- 🧪 Scoring the test results
- Finally, shutdown the program, and get the test set scores with this command.
.. code-block:: sh
dotenv run -- python rdagent/log/mle_summary.py grade <url_to_log>
Here, <url_to_log> refers to the parent directory of the log folder generated during the run.
🕹️ Kaggle Agent
~~~~~~~~~~~~~~~~
📖 Background
^^^^^^^^^^^^^^
In the landscape of data science competitions, Kaggle serves as the ultimate arena where data enthusiasts harness the power of algorithms to tackle real-world challenges.
The Kaggle Agent stands as a pivotal tool, empowering participants to seamlessly integrate cutting-edge models and datasets, transforming raw data into actionable insights.
By utilizing the **Kaggle Agent**, data scientists can craft innovative solutions that not only uncover hidden patterns but also drive significant advancements in predictive accuracy and model robustness.
🧭 Example Guide - Kaggle Dataset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
🛠️ Preparing For The Competition
""""""""""""""""""""""""""""""""""
- 🔨 **Configuring the Kaggle API**
- Register and login on the `Kaggle <https://www.kaggle.com/>`_ website.
- Click on the avatar (usually in the top right corner of the page) -> ``Settings`` -> ``Create New Token``, A file called ``kaggle.json`` will be downloaded.
- Move ``kaggle.json`` to ``~/.config/kaggle/``
- Modify the permissions of the ``kaggle.json`` file.
.. code-block:: sh
chmod 600 ~/.config/kaggle/kaggle.json
- For more information about Kaggle API Settings, refer to the `Kaggle API <https://github.com/Kaggle/kaggle-api>`_.
- 🔩 **Setting the Environment variables at .env file**
- Determine the path where the data will be stored and add it to the ``.env`` file.
.. code-block:: sh
mkdir -p <your local directory>/ds_data
dotenv set KG_LOCAL_DATA_PATH <your local directory>/ds_data
- 📘 More Environment Variables (Optional)
- If you want to see all the available environment variables, you can refer to the configuration file for Data Science scenarios:
.. literalinclude:: ../../rdagent/app/data_science/conf.py
:language: python
:linenos:
- These variables allow you to have finer-grained control in Data Science scenarios.
- 🗳️ **Join the competition**
- If your Kaggle API account has not joined a competition, you will need to join the competition before running the program.
- At the bottom of the competition details page, you can find the ``Join the competition`` button, click on it and select ``I Understand and Accept`` to join the competition.
- In the **Competition List Available** below, you can jump to the competition details page.
📥 Preparing Competition DataDataset && Set up RD-Agent Environment
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- As a subset of data science, kaggle's dataset still follows the data science format. Based on this, the kaggle dataset can be divided into two categories depending on whether or not it is supported by the **MLE-Bench**.
- What is **MLE-Bench**?
- **MLE-Bench** is a comprehensive benchmark designed to evaluate the **machine learning engineering** capabilities of AI systems using real-world scenarios. The dataset includes multiple Kaggle competitions. Since Kaggle does not provide reserved test sets for these competitions, the benchmark includes preparation scripts for splitting publicly available training data into new training and test sets, and scoring scripts for each competition to accurately evaluate submission scores.
- I'm running a competition Is **MLE-Bench** supported?
- You can see all the competitions supported by **MLE-Bench** `here <https://github.com/openai/mle-bench/tree/main/mlebench/competitions>`_.
- Prepare datasets for **MLE-Bench** supported competitions.
- If you agree with the **MLE-Bench** standard, then you don't need to prepare the dataset, you just need to configure your ``.env`` file to automate the download of the dataset.
- Configure environment variables, add ``DS_IF_USING_MLE_DATA`` to environment variables, and set it to ``True``.
.. code-block:: sh
dotenv set DS_IF_USING_MLE_DATA True
- Configure environment variables, add ``DS_SAMPLE_DATA_BY_LLM`` to environment variables, and set it to ``True``.
.. code-block:: sh
dotenv set DS_SAMPLE_DATA_BY_LLM True
- Configure environment variables, add ``DS_SCEN`` to environment variables, and set it to ``rdagent.scenarios.data_science.scen.KaggleScen``.
.. code-block:: sh
dotenv set DS_SCEN rdagent.scenarios.data_science.scen.KaggleScen
- At this point, you are ready to start running your competition, which will automatically download the data, and the LLM will automatically extract the minimum dataset.
- After running the program the structure of the ds_data folder should look like this (Using the ``tabular-playground-series-dec-2021`` contest as an example).
.. code-block:: text
ds_data
├── tabular-playground-series-dec-2021
│ ├── description.md
│ ├── sample_submission.csv
│ ├── test.csv
│ └── train.csv
└── zip_files
└── tabular-playground-series-dec-2021
└── tabular-playground-series-dec-2021.zip
- The ``ds_data/zip_files`` folder contains a zip file of the raw competition data downloaded from kaggle website.
- At runtime, RD-Agent will automatically build the Docker image specified at `rdagent/scenarios/kaggle/docker/mle_bench_docker/Dockerfile <https://github.com/microsoft/RD-Agent/blob/main/rdagent/scenarios/kaggle/docker/mle_bench_docker/Dockerfile>`_. This image is responsible for downloading the required datasets and grading files for MLE-Bench.
Note: The first run may take longer than subsequent runs as the Docker image and data are being downloaded and set up for the first time.
- Prepare datasets for competitions that are not supported by **MLE-Bench**.
- As a subset of data science, we can follow the format and steps of data science dataset to prepare kaggle dataset. Below we will describe the workflow for preparing a kaggle dataset using the competition ``playground-series-s4e9`` as an example.
- Create a ``ds_data/source_data/playground-series-s4e9`` folder, which will be used to store your raw dataset.
- The raw files for the competition ``playground-series-s4e9`` have two files: ``train.csv``, ``test.csv``, ``sample_submission.csv``, and there are two ways to get the raw data:
- You can find the raw data required for the competition on the `official kaggle website <https://www.kaggle.com/competitions/playground-series-s4e9/data>`_.
- Or you can use the command line to download the raw data for the competition, the download command is as follows.
.. code-block:: sh
kaggle competitions download -c playground-series-s4e9
- Create a ``ds_data/source_data/playground-series-s4e9/prepare.py`` file that splits your raw data into **training data**, **test data**, **formatted submission file**, and **standard answer file**. (You will need to write a script based on your raw data.)
- The following shows the preprocessing code for the raw data of ``playground-series-s4e9``.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/source_data/playground-series-s4e9/prepare.py
:language: python
:caption: ds_data/source_data/playground-series-s4e9/prepare.py
:linenos:
- At the end of program execution, the ``ds_data`` folder structure will look like this:
.. code-block:: text
ds_data
├── playground-series-s4e9
│ ├── train.csv
│ ├── test.csv
│ └── sample_submission.csv
├── eval
│ └── playground-series-s4e9
│ └── submission_test.csv
└── source_data
└── playground-series-s4e9
├── prepare.py
├── sample_submission.csv
├── test.csv
└── train.csv
- Create a ``ds_data/playground-series-s4e9/description.md`` file to describe your competition, dataset description, and other information. We can find the `competition description information <https://www.kaggle.com/competitions/playground-series-s4e9/overview>`_ and the `dataset description information <https://www.kaggle.com/competitions/playground-series-s4e9/data>`_ from the Kaggle website.
- The following shows the description file for ``playground-series-s4e9``
.. literalinclude:: ../../rdagent/scenarios/data_science/example/playground-series-s4e9/description.md
:language: markdown
:caption: ds_data/playground-series-s4e9/description.md
:linenos:
- Create a ``ds_data/eval/playground-series-s4e9/valid.py`` file, which is used to check the validity of the submission files to ensure that their formatting is consistent with the reference file.
- The following shows a script that checks the validity of a submission based on the ``playground-series-s4e9`` data.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/eval/playground-series-s4e9/valid.py
:language: markdown
:caption: ds_data/eval/playground-series-s4e9/valid.py
:linenos:
- Create a ``ds_data/eval/playground-series-s4e9/grade.py`` file, which is used to calculate the score based on the submission file and the **standard answer file**, and output the result in JSON format.
- The following shows a grading script based on the ``playground-series-s4e9`` data implementation.
.. literalinclude:: ../../rdagent/scenarios/data_science/example/eval/playground-series-s4e9/grade.py
:language: markdown
:caption: ds_data/eval/playground-series-s4e9/grade.py
:linenos:
- In this example we don't create a ``ds_data/eval/playground-series-s4e9/sample.py``, we use the sample method provided by RD-Agent by default.
- At this point, you have created a complete dataset. The correct structure of the dataset should look like this.
.. code-block:: text
ds_data
├── playground-series-s4e9
│ ├── train.csv
│ ├── test.csv
│ ├── description.md
│ └── sample_submission.csv
├── eval
│ └── playground-series-s4e9
│ ├── grade.py
│ ├── submission_test.csv
│ └── valid.py
└── source_data
└── playground-series-s4e9
├── prepare.py
├── sample_submission.csv
├── test.csv
└── train.csv
- We have prepared a dataset based on the above description for your reference. You can download it with the following command.
.. code-block:: sh
wget https://github.com/SunsetWolf/rdagent_resource/releases/download/ds_data/playground-series-s4e9.zip
- Next, we need to configure the environment for the ``playground-series-s4e9`` contest. You can do this by executing the following command at the command line.
.. code-block:: sh
dotenv set DS_IF_USING_MLE_DATA False
dotenv set DS_SAMPLE_DATA_BY_LLM False
dotenv set DS_SCEN rdagent.scenarios.data_science.scen.KaggleScen
🚀 **Run the Application**
""""""""""""""""""""""""""""""""""""
- 🌏 You can directly run the application by using the following command:
.. code-block:: sh
rdagent data_science --competition <Competition ID>
- The following shows the command to run based on the ``playground-series-s4e9`` data
.. code-block:: sh
rdagent data_science --competition playground-series-s4e9
- More CLI Parameters for `rdagent data_science` command:
.. automodule:: rdagent.app.data_science.loop
:members:
:no-index:
- 📈 Visualize the R&D Process
- We provide a web UI to visualize the log. You just need to run:
.. code-block:: sh
rdagent ui --port <custom port> --log-dir <your log folder like "log/"> --data_science True
- Then you can input the log path and visualize the R&D process.
- 🧪 Scoring the test results
- Finally, shutdown the program, and get the test set scores with this command.
.. code-block:: sh
dotenv run -- python rdagent/log/mle_summary.py grade <url_to_log>
- If you have configured the full output in ``ds_data/eval/playground-series-s4e9/grade.py``, or if you are running a competition that receives **MLE-Bench** support, you can also summarize the scores by running the following command.
.. code-block:: sh
rdagent grade_summary --log-folder=<url_to_log>
Here, <url_to_log> refers to the parent directory of the log folder generated during the run.
+26
View File
@@ -0,0 +1,26 @@
.. _finetune_agent:
================================
FT-Agent for LLM Fine-Tuning
================================
FT-Agent is the RD-Agent scenario for autonomous LLM fine-tuning, introduced in
the ICML 2026 paper `FT-Dojo: Towards Autonomous LLM Fine-Tuning with Language
Agents <https://arxiv.org/abs/2603.01712>`_.
The scenario automates benchmark-driven data processing, LLaMA-Factory training
configuration, fail-fast validation, OpenCompass evaluation, and feedback-based
iteration.
The full user guide is maintained in the repository:
`rdagent/app/finetune/llm/README.md <https://github.com/microsoft/RD-Agent/blob/main/rdagent/app/finetune/llm/README.md>`_
Minimal command after configuring the required ``FT_*`` settings:
.. code-block:: sh
rdagent llm_finetune --base-model Qwen/Qwen2.5-7B-Instruct
Please read the full guide before running this scenario. A first run can download
large dataset/model assets and consume LLM API calls and GPU hours.
Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+150
View File
@@ -0,0 +1,150 @@
.. _model_agent_fin:
=======================
Finance Model Agent
=======================
**🤖 Automated Quantitative Trading & Iterative Model Evolution**
------------------------------------------------------------------------------------------
📖 Background
~~~~~~~~~~~~~~
In the realm of quantitative finance, both factor discovery and model development play crucial roles in driving performance.
While much attention is often given to the discovery of new financial factors, the **models** that leverage these factors are equally important.
The effectiveness of a quantitative strategy depends not only on the factors used but also on how well these factors are integrated into robust, predictive models.
However, the process of developing and optimizing these models can be labor-intensive and complex, requiring continuous refinement and adaptation to ever-changing market conditions.
And this is where the **Finance Model Agent** steps in.
🎥 `Demo <https://rdagent.azurewebsites.net/model_loop>`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. raw:: html
<div style="display: flex; justify-content: center; align-items: center;">
<video width="600" controls>
<source src="https://rdagent.azurewebsites.net/media/d85e8cab1da1cd3501d69ce837452f53a971a24911eae7bfa9237137.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
🌟 Introduction
~~~~~~~~~~~~~~~~
In this scenario, our automated system proposes hypothesis, constructs model, implements code, conducts back-testing, and utilizes feedback in a continuous, iterative process.
The goal is to automatically optimize performance metrics within the Qlib library, ultimately discovering the most efficient code through autonomous research and development.
Here's an enhanced outline of the steps:
**Step 1 : Hypothesis Generation 🔍**
- Generate and propose initial hypotheses based on previous experiment analysis and domain expertise, with thorough reasoning and financial justification.
**Step 2 : Model Creation ✨**
- Transform the hypothesis into a task.
- Develop, define, and implement a quantitative model, including its name, description, and formulation.
**Step 3 : Model Implementation 👨‍💻**
- Implement the model code based on the detailed description.
- Evolve the model iteratively as a developer would, ensuring accuracy and efficiency.
**Step 4 : Backtesting with Qlib 📉**
- Conduct backtesting using the newly developed model and 20 factors extracted from Alpha158 in Qlib.
- Evaluate the model's effectiveness and performance.
+----------------+------------+------------------------+----------------------------------------------------+
| Dataset | Model | Factors | Data Split |
+================+============+========================+====================================================+
| CSI300 | RDAgent-dev| 20 factors (Alpha158) | +-----------+--------------------------+ |
| | | | | Train | 2008-01-01 to 2014-12-31 | |
| | | | +-----------+--------------------------+ |
| | | | | Valid | 2015-01-01 to 2016-12-31 | |
| | | | +-----------+--------------------------+ |
| | | | | Test | 2017-01-01 to 2020-08-01 | |
| | | | +-----------+--------------------------+ |
+----------------+------------+------------------------+----------------------------------------------------+
**Step 5 : Feedback Analysis 🔍**
- Analyze backtest results to assess performance.
- Incorporate feedback to refine hypotheses and improve the model.
**Step 6 :Hypothesis Refinement ♻️**
- Refine hypotheses based on feedback from backtesting.
- Repeat the process to continuously improve the model.
⚡ Quick Start
~~~~~~~~~~~~~~~~~
Please refer to the installation part in :doc:`../installation_and_configuration` to prepare your system dependency.
You can try our demo by running the following command:
- 🐍 Create a Conda Environment
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
.. code-block:: sh
conda create -n rdagent python=3.10
- Activate the environment:
.. code-block:: sh
conda activate rdagent
- 📦 Install the RDAgent
- You can install the RDAgent package from PyPI:
.. code-block:: sh
pip install rdagent
- 🚀 Run the Application
- You can directly run the application by using the following command:
.. code-block:: sh
rdagent fin_model
🛠️ Usage of modules
~~~~~~~~~~~~~~~~~~~~~
.. _Env Config:
- **Env Config**
The following environment variables can be set in the `.env` file to customize the application's behavior:
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.ModelBasePropSetting
:settings-show-field-summary: False
:exclude-members: Config
- **Qlib Config**
- The `config.yaml` file located in the `model_template` folder contains the relevant configurations for running the developed model in Qlib. The default settings include key information such as:
- **market**: Specifies the market, which is set to `csi300`.
- **fields_group**: Defines the fields group, with the value `feature`.
- **col_list**: A list of columns used, including various indicators such as `RESI5`, `WVMA5`, `RSQR5`, and others.
- **start_time**: The start date for the data, set to `2008-01-01`.
- **end_time**: The end date for the data, set to `2020-08-01`.
- **fit_start_time**: The start date for fitting the model, set to `2008-01-01`.
- **fit_end_time**: The end date for fitting the model, set to `2014-12-31`.
- The default hyperparameters used in the configuration are as follows:
- **n_epochs**: The number of epochs, set to `100`.
- **lr**: The learning rate, set to `1e-3`.
- **early_stop**: The early stopping criterion, set to `10`.
- **batch_size**: The batch size, set to `2000`.
- **metric**: The evaluation metric, set to `loss`.
- **loss**: The loss function, set to `mse`.
- **n_jobs**: The number of parallel jobs, set to `20`.
+99
View File
@@ -0,0 +1,99 @@
.. _model_copilot_general:
======================
General Model Copilot
======================
**🤖 Automated Model Research & Development Co-Pilot**
--------------------------------------------------------
📖 Background
~~~~~~~~~~~~~~
In the fast-paced field of artificial intelligence, the number of academic papers published each year is skyrocketing.
These papers introduce new models, techniques, and approaches that can significantly advance the state of the art.
However, reproducing and implementing these models can be a daunting task, requiring substantial time and expertise.
Researchers often face challenges in extracting the essential details from these papers and converting them into functional code.
And this is where the **General Model Copilot** steps in.
🎥 `Demo <https://rdagent.azurewebsites.net/report_model>`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. raw:: html
<div style="display: flex; justify-content: center; align-items: center;">
<video width="600" controls>
<source src="https://rdagent.azurewebsites.net/media/b35f904765b05099b0fcddbebe041a04f4d7bde239657e5fc24bf0cc.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
🌟 Introduction
~~~~~~~~~~~~~~~~
In this scenario, our automated system proposes hypotheses, constructs models, implements code, performs back-testing, and uses feedback to iterate continuously. The system aims to automatically optimize performance metrics from the Qlib library, finding the best code through autonomous research and development.
Model R&D CoPilot Scenario
~~~~~~~~~~~~~~~~~~~~~~~~~~
**Overview**
This demo automates the extraction and iterative development of models from academic papers, ensuring functionality and correctness. This scenario automates the development of PyTorch models by reading academic papers or other sources. It supports various data types, including tabular, time-series, and graph data. The primary workflow involves two main components: the Reader and the Coder.
**Workflow Components**
1. **Reader**
- Parses and extracts relevant model information from academic papers or sources, including architectures, parameters, and implementation details.
- Uses Large Language Models to convert content into a structured format for the Coder.
2. **Evolving Coder**
- Translates structured information from the Reader into executable PyTorch code.
- Utilizes an evolving coding mechanism to ensure correct tensor shapes, verified with sample input tensors.
- Iteratively refines the code to align with source material specifications.
**Supported Data Types**
- **Tabular Data:** Structured data with rows and columns, such as spreadsheets or databases.
- **Time-Series Data:** Sequential data points indexed in time order, useful for forecasting and temporal pattern recognition.
- **Graph Data:** Data structured as nodes and edges, suitable for network analysis and relational tasks.
⚡ Quick Start
~~~~~~~~~~~~~~~~~
Please refer to the installation part in :doc:`../installation_and_configuration` to prepare your system dependency.
You can try our demo by running the following command:
- 🐍 Create a Conda Environment
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
.. code-block:: sh
conda create -n rdagent python=3.10
- Activate the environment:
.. code-block:: sh
conda activate rdagent
- 📦 Install the RDAgent
- You can install the RDAgent package from PyPI:
.. code-block:: sh
pip install rdagent
- 🚀 Run the Application
- Prepare relevant files (in pdf format) by uploading papers to the directory below and copy the path as report_file_path.
.. code-block:: sh
rdagent/scenarios/general_model
- Run the following command in your terminal within the same virtual environment:
.. code-block:: sh
rdagent general_model --report-file-path=<path_to_pdf_file>
+113
View File
@@ -0,0 +1,113 @@
.. _quant_agent_fin:
=====================
Finance Quant Agent
=====================
**🥇The First Data-Centric Quant Multi-Agent Framework RD-Agent(Q)**
---------------------------------------------------------------------
R&D-Agent for Quantitative Finance, in short **RD-Agent(Q)**, is the first data-centric, multi-agent framework designed to automate the full-stack research and development of quantitative strategies via coordinated factor-model co-optimization.
You can learn more details about **RD-Agent(Q)** through the `paper <https://arxiv.org/abs/2505.15155>`_.
⚡ Quick Start
~~~~~~~~~~~~~~~~~
Before you start, please make sure you have installed RD-Agent and configured the environment for RD-Agent correctly. If you want to know how to install and configure the RD-Agent, please refer to the `documentation <../installation_and_configuration.html>`_.
Then, you can run the framework by running the following command:
- 🐍 Create a Conda Environment
- Create a new conda environment with Python (3.10 and 3.11 are well tested in our CI):
.. code-block:: sh
conda create -n rdagent python=3.10
- Activate the environment:
.. code-block:: sh
conda activate rdagent
- 📦 Install the RDAgent
- You can install the RDAgent package from PyPI:
.. code-block:: sh
pip install rdagent
- 🚀 Run the Application
- You can directly run the application by using the following command:
.. code-block:: sh
rdagent fin_quant
🛠️ Usage of modules
~~~~~~~~~~~~~~~~~~~~~
.. _Env Config:
- **Env Config**
The following environment variables can be set in the `.env` file to customize the application's behavior:
.. autopydantic_settings:: rdagent.app.qlib_rd_loop.conf.QuantBasePropSetting
:settings-show-field-summary: False
:exclude-members: Config
.. autopydantic_settings:: rdagent.components.coder.factor_coder.config.FactorCoSTEERSettings
:settings-show-field-summary: False
:members: coder_use_cache, data_folder, data_folder_debug, file_based_execution_timeout, select_method, max_loop, knowledge_base_path, new_knowledge_base_path
:exclude-members: Config, fail_task_trial_limit, v1_query_former_trace_limit, v1_query_similar_success_limit, v2_query_component_limit, v2_query_error_limit, v2_query_former_trace_limit, v2_error_summary, v2_knowledge_sampler
:no-index:
- **Qlib Configuration**
- The `.yaml` files in both the `model_template` and `factor_template` directories contain some configurations for running the corresponding models or factors within the Qlib framework. Below is an overview of their contents and roles:
- **General Settings**:
- **provider_uri**: Specifies the local Qlib data path, set to `~/.qlib/qlib_data/cn_data`.
- **market**: Configured to `csi300`, representing the CSI 300 index constituents.
- **benchmark**: Set to `SH000300`, used for backtesting evaluation.
- **Data Handling**:
- **start_time** and **end_time**: Define the full data range, from `2008-01-01` to `2022-08-01`.
- **fit_start_time**: The start date for fitting the model, set to `2008-01-01`.
- **fit_end_time**: The end date for fitting the model, set to `2014-12-31`.
- **features and labels**: Generated via a nested data loader combining `Alpha158DL` (for engineered features such as `RESI5`, `WVMA5`, `RSQR5`, `KLEN`, etc.) and a `StaticDataLoader` that loads precomputed factor files (`combined_factors_df.parquet`).
- **normalization**: The pipeline includes `RobustZScoreNorm` (with clipping) and `Fillna` for inference, and `DropnaLabel` with `CSZScoreNorm` for training.
- **Training Configuration**:
- **Model**: Uses `GeneralPTNN`, a PyTorch-based neural network model.
- **Dataset Splits**:
- **train**: `2008-01-01` to `2014-12-31`
- **valid**: `2015-01-01` to `2016-12-31`
- **test**: `2017-01-01` to `2020-08-01`
- **Default Hyperparameters** (can be overridden by command-line arguments):
- **n_epochs**: `100`
- **lr**: `2e-4`
- **early_stop**: `10`
- **batch_size**: `256`
- **weight_decay**: `0.0`
- **metric**: `loss`
- **loss**: `mse`
- **n_jobs**: `20`
- **GPU**: `0` (uses GPU 0 if available)
- **Backtesting and Evaluation**:
- **strategy**: `TopkDropoutStrategy`, which selects the top 50 stocks and randomly drops 5 to introduce exploration.
- **backtest period**: `2017-01-01` to `2020-08-01`
- **initial capital**: `100,000,000`
- **cost configuration**: Includes open/close costs, minimum transaction costs, and slippage control.
- **Recording and Analysis**:
- **SignalRecord**: Logs predicted signals.
- **SigAnaRecord**: Performs signal analysis without long-short separation.
- **PortAnaRecord**: Conducts portfolio analysis using the configured strategy and backtest settings.
+49
View File
@@ -0,0 +1,49 @@
==============
User Interface
==============
Introduction
============
RD-Agent will generate some logs during the R&D process. These logs are very useful for debugging and understanding the R&D process. However, just viewing the terminal log is not intuitive enough. RD-Agent provides a web app as UI to visualize the R&D process. You can easily view the R&D process and understand the R&D process better.
A Quick Demo
============
Start Web App
-------------
In `RD-Agent/` folder, run:
.. code-block:: bash
rdagent ui --port <port> --log-dir <log_dir like "log/"> [--debug]
This will start a web app on `http://localhost:<port>`.
**NOTE**: The log_dir parameter is not required. You can manually enter the log_path in the web app. If you set the log_dir parameter, you can easily select a different log_path in the web app.
--debug is optional, it will show a "Single Step Run" button in sidebar and saved objects info in the web app.
Use Web App
-----------
1. Open the sidebar.
.. TODO: update these
2. Select the scenario you want to show. There are some pre-defined scenarios:
- Qlib Model
- Qlib Factor
- Data Mining
- Model from Paper
- Kaggle
3. Click the `Config⚙️` button and input the log path (if you set the log_dir parameter, you can select a log_path in the dropdown list).
4. Click the buttons below Config⚙️ to show the scenario execution process. Buttons are:
- All Loops: Show complete scenario execution process.
- Next Loop: Show one success **R&D Loop**.
- One Evolving: Show one **evolving** step of **development** part.
- refresh logs: clear shown logs.