Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 9ff770d

Browse files
author
Ehsan Totoni
committed
minor intraday example rand
1 parent 71b7e63 commit 9ff770d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

examples/intraday_mean_rand.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
@hpat.jit
1212
def intraday_mean_revert():
1313
nsyms = 1000
14-
max_num_days = 8000
15-
all_res = np.zeros(max_num_days)
14+
max_num_days = 80000
15+
all_res = 0.0
1616

1717
t1 = time.time()
1818
for i in prange(nsyms):
19+
#np.random.seed(0)
1920
s_open = 20 * np.random.randn(max_num_days)
2021
s_low = 18 * np.random.randn(max_num_days)
2122
s_close = 19 * np.random.randn(max_num_days)
@@ -44,9 +45,9 @@ def intraday_mean_revert():
4445
#create a strategy return series by using the daily stock returns where the trade criteria above are met
4546
df['Rets'] = df['Pct Change'][df['BUY'] == True]
4647

47-
all_res += df['Rets'].fillna(0)
48+
all_res += df['Rets'].mean()
4849

49-
print(all_res.mean())
50+
print(all_res)
5051
print("execution time:", time.time()-t1)
5152

5253
intraday_mean_revert()

0 commit comments

Comments
 (0)