Skip to content

Commit 53fbcdf

Browse files
committed
New alpha + minor tweaks of prompt
1 parent 97d4bc7 commit 53fbcdf

6 files changed

Lines changed: 31 additions & 9 deletions

File tree

brain/agent.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ def prompt(
3131
3232
Steps:
3333
1. Think about the alphas you created so far and the PROS and CONS
34-
2. If there is some good alpha, try to improve it first
35-
2. Reason about possible improvements
36-
3. Check the list of available operators and data fields
37-
5. Always try uncommon data fields first before using close, volumn, open, close, etc.
38-
4. Propose the alpha and run the alpha simulation.
34+
2. If there is some good alpha (passing tests and seft-correlation < 0.5), try to improve it first
35+
3. Reason about possible improvements
36+
4 From time to time try to create a new alpha from scratch
37+
5. Check the list of available operators and data fields
38+
6. Always try uncommon data fields first before using close, volumn, open, close, etc.
39+
7. Propose the alpha and run the alpha simulation.
3940
4041
- Use more of ts_corr(x, y, d), ts_regression(y, x, d, lag=0, rettype=0)
4142
- Try applying different functions and changing parameter values.

brain/agent_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
DEFAULT_CONFIG = {
44
"region": "USA",
55
"universe": "TOP3000",
6-
"neutralization": "MARKET",
6+
"neutralization": "INDUSTRY",
7+
"decay": 8,
78
"delay": 1,
89
}
910

brain/alphas/alpha_22.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Code
2+
code = """
3+
a = ts_corr(ts_zscore(high + ts_delta(open, 10), 30), ts_zscore(low + ts_delta(open, 10), 30), 100);
4+
trade_when(abs(ts_zscore(volume, 100)) < 0.5, a, -1)
5+
"""
6+
7+
# Simulation Settings
8+
config = {
9+
"region": "USA",
10+
"universe": "TOP3000",
11+
"decay": 5,
12+
"delay": 1,
13+
"truncation": 0.01,
14+
"neutralization": "INDUSTRY",
15+
"pasteurization": "ON",
16+
"nan_handling": "OFF",
17+
"unit_handling": "VERIFY",
18+
}

brain/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def get_self_corr(self, alpha_id: str):
184184

185185
return self_corr_df
186186

187-
def check_self_corr_test(self, alpha_id: str, threshold: float = 0.7):
187+
def check_self_corr_test(self, alpha_id: str, threshold: float = 0.6):
188188
"""Check if alpha's self_corr test passed and saves result to dataframe"""
189189
self_corr_df = self.get_self_corr(alpha_id)
190190
if self_corr_df.empty:

brain/search_algorithm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ def main():
150150

151151
# Start a new alpha simulation
152152
if alpha is not None and alpha.alpha_id is not None and alpha.fitness < -0.5:
153-
alpha_config = {**alpha_config, "regular": f"-{alpha.regular}"}
153+
split = alpha.regular.split(";")
154+
regular = f'{";".join(split[:-1])}{";" if len(split) > 1 else ""}-({split[-1]})'
155+
alpha_config = {**alpha_config, "regular": regular}
154156
response = BrainAPI.start_simulation(alpha_config)
155157
else:
156158
response, alpha_config = create_alpha_simulation(alphas_dict, alphas_categories)

brain/tools/datafields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def filter_datafields(data: pd.DataFrame) -> pd.DataFrame:
2020
return (
2121
data[(data["coverage"] > 0.5) & (data["alphaCount"] > 100)]
2222
.sort_values(by="alphaCount", ascending=False)
23-
.iloc[:1000]
23+
.iloc[:2000]
2424
)
2525

2626

0 commit comments

Comments
 (0)