Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
62f5ccf7
Commit
62f5ccf7
authored
May 09, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try disable jit to make coveralls work
parent
5e369db0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
61 deletions
+6
-61
.travis.yml
.travis.yml
+6
-5
standardize.py
alphamind/data/standardize.py
+0
-10
winsorize.py
alphamind/data/winsorize.py
+0
-12
linearbuilder.py
alphamind/portfolio/linearbuilder.py
+0
-14
percentbuilder.py
alphamind/portfolio/percentbuilder.py
+0
-1
rankbuilder.py
alphamind/portfolio/rankbuilder.py
+0
-11
simplesettle.py
alphamind/settlement/simplesettle.py
+0
-8
No files found.
.travis.yml
View file @
62f5ccf7
...
...
@@ -42,9 +42,10 @@ install:
-
pip install simpleutils
-
pip install coveralls
script
:
-
python setup.py build_ext --inplace
-
coverage run alphamind/tests/test_suite.py
-
coverage report
-
coverage html
-
export NUMBA_DISABLE_JIT=1
-
python setup.py build_ext --line_trace --inplace
-
coverage run --rcfile=./.coveragerc alphamind/tests/test_suite.py
-
coverage report --rcfile=./.coveragerc -i
-
coverage html --rcfile=./.coveragerc -i
after_success
:
coveralls
-
coveralls
alphamind/data/standardize.py
View file @
62f5ccf7
...
...
@@ -22,13 +22,3 @@ def standardize(x: np.ndarray, groups: np.ndarray=None, ddof=1) -> np.ndarray:
return
(
x
-
mean_values
)
/
std_values
else
:
return
(
x
-
simple_mean
(
x
,
axis
=
0
))
/
simple_std
(
x
,
axis
=
0
)
if
__name__
==
'__main__'
:
import
pandas
as
pd
df
=
pd
.
read_csv
(
'd:/test_data.csv'
,
index_col
=
0
)
x
=
df
.
values
groups
=
df
.
index
.
values
.
astype
(
int
)
standardize
(
x
,
groups
)
alphamind/data/winsorize.py
View file @
62f5ccf7
...
...
@@ -63,15 +63,3 @@ def winsorize_normal(x: np.ndarray, num_stds: int = 3, groups: np.ndarray = None
mean_values
=
simple_mean
(
x
,
axis
=
0
)
res
=
mask_values_1d
(
x
,
mean_values
,
std_values
,
num_stds
)
return
res
if
__name__
==
'__main__'
:
x
=
np
.
random
.
randn
(
3000
,
10
)
groups
=
np
.
random
.
randint
(
0
,
20
,
size
=
3000
)
import
datetime
as
dt
start
=
dt
.
datetime
.
now
()
for
_
in
range
(
3000
):
winsorize_normal
(
x
,
2
,
groups
)
print
(
dt
.
datetime
.
now
()
-
start
)
alphamind/portfolio/linearbuilder.py
View file @
62f5ccf7
...
...
@@ -43,17 +43,3 @@ def linear_build(er: np.ndarray,
prob
=
cvxpy
.
Problem
(
objective
,
constraints
)
prob
.
solve
(
solver
=
solver
)
return
prob
.
status
,
prob
.
value
,
np
.
array
(
w
.
value
)
.
flatten
()
if
__name__
==
'__main__'
:
er
=
np
.
arange
(
300
)
bm
=
np
.
ones
(
300
)
*
0.00333333333
risk_exposure
=
np
.
random
.
randn
(
300
,
10
)
s
,
v
,
x
=
linear_build
(
er
,
0.
,
0.01
,
risk_exposure
,
bm
,
(
-
0.01
*
np
.
ones
(
10
),
0.01
*
np
.
ones
(
10
)))
print
(
s
)
print
(
x
.
sum
())
print
(
x
.
min
(),
','
,
x
.
max
())
print
((
x
-
bm
)
@
risk_exposure
)
alphamind/portfolio/percentbuilder.py
View file @
62f5ccf7
...
...
@@ -46,4 +46,3 @@ def percent_build(er: np.ndarray, percent: float, groups: np.ndarray=None) -> np
use_rank
=
int
(
percent
*
len
(
neg_er
))
set_value
(
weights
,
ordering
[:
use_rank
],
1.
)
return
weights
alphamind/portfolio/rankbuilder.py
View file @
62f5ccf7
...
...
@@ -42,14 +42,3 @@ def rank_build(er: np.ndarray, use_rank: int, groups: np.ndarray=None) -> np.nda
ordering
=
neg_er
.
argsort
(
axis
=
0
)
set_value
(
weights
,
ordering
[:
use_rank
],
1.
)
return
weights
if
__name__
==
'__main__'
:
n_sample
=
6
n_groups
=
3
x
=
np
.
random
.
randn
(
n_sample
)
groups
=
np
.
array
([
1
,
1
,
2
,
1
,
0
,
2
])
print
(
groups
)
print
(
groupby
(
groups
))
print
(
rank_build
(
x
,
1
,
groups
))
\ No newline at end of file
alphamind/settlement/simplesettle.py
View file @
62f5ccf7
...
...
@@ -24,11 +24,3 @@ def simple_settle(weights: np.ndarray, ret_series: np.ndarray, groups: np.ndarra
if
ret_mat
.
ndim
==
1
:
ret_mat
=
ret_mat
.
reshape
((
-
1
,
1
))
return
simple_sum
(
ret_mat
,
axis
=
0
)
if
__name__
==
'__main__'
:
from
alphamind.aggregate
import
group_mapping_test
s
=
np
.
random
.
randint
(
2
,
5
,
size
=
6
)
print
(
s
)
print
(
group_mapping_test
(
s
))
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment