Skip to content

Commit 764045f

Browse files
committed
Release 0.2.0
1 parent 2ce4ef5 commit 764045f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3372
-651
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ ChangeLog
33

44
PLEASE NOTE THAT THE API IS STILL UNSTABLE AS MORE USE CASES / FEATURES ARE ADDED REGULARLY
55

6+
v0.2.0 (21-02-2022)
7+
-------------------
8+
* Installation:
9+
* PyPI release update
10+
611
v0.1.2 (26-03-2019)
712
-------------------
813

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Key Information
2121
* License: Apache 2.0
2222
* Mathematical Documentation: [Open Risk Manual](https://www.openriskmanual.org/wiki/Correlation_Matrix)
2323
* Development website: [Github](https://github.com/open-risk/correlationMatrix)
24-
* General Discussions: [Gitter](https://gitter.im/open-risk/Lobby)
25-
* Package Specific Chat: [Gitter](https://gitter.im/open-risk/correlationMatrix)
24+
* General Discussions: [Open Risk Commons](https://www.openriskcommons.org/c/open-source/correlationmatrix/26)
25+
2626

2727
**NB: correlationMatrix is still in active development. If you encounter issues please raise them in our
2828
github repository**
@@ -31,7 +31,7 @@ github repository**
3131
Examples
3232
========
3333

34-
The examples directory contains a large sample of examples illustrating the current functionality
34+
The examples directory contains examples illustrating the current functionality
3535

3636

3737
Display correlation matrix

TODO.rst

Lines changed: 0 additions & 30 deletions
This file was deleted.

correlationMatrix/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22

3-
# (c) 2019 Open Risk (https://www.openriskmanagement.com)
3+
# (c) 2019-2022 Open Risk (https://www.openriskmanagement.com)
44
#
55
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
66
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
@@ -20,7 +20,7 @@
2020
from .model import *
2121
from .utils import *
2222

23-
__version__ = '0.1'
23+
__version__ = '0.2'
2424

2525
package_name = 'correlationMatrix'
2626
module_path = os.path.dirname(__file__)

correlationMatrix/model.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22

3-
# (c) 2019 Open Risk (https://www.openriskmanagement.com)
3+
# (c) 2019-2022 Open Risk (https://www.openriskmanagement.com)
44
#
55
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
66
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
@@ -14,8 +14,8 @@
1414

1515
""" This module provides the key correlation matrix classes
1616
17-
* correlationMatrix_ implements the functionality of single period correlation matrix
18-
* TODO correlationMatrixSet_ provides a container for a multiperiod correlation matrix collection
17+
* correlationMatrix implements the functionality of single period correlation matrix
18+
* TODO correlationMatrixSet provides a container for a multiperiod correlation matrix collection
1919
* TODO PairwiseCorrelation implements functionality for pairwise data analysis of timeseries
2020
* EmpiricalCorrelationMatrix implements the functionality of a continuously observed correlation matrix
2121
@@ -260,7 +260,9 @@ def validate(self, accuracy=1e-3):
260260

261261
matrix = self.matrix
262262
# checking squareness of matrix
263-
if matrix.shape[0] != matrix.shape[1]:
263+
if len(matrix.shape) != 2:
264+
validation_messages.append(("Matrix Non Square: ", matrix.shape))
265+
elif matrix.shape[0] != matrix.shape[1]:
264266
validation_messages.append(("Matrix Dimensions Differ: ", matrix.shape))
265267
else:
266268
matrix_size = matrix.shape[0]
@@ -278,7 +280,7 @@ def validate(self, accuracy=1e-3):
278280
for j in range(matrix_size):
279281
if matrix[i, j] != matrix[j, i]:
280282
validation_messages.append(("Symmetry violating value: ", (i, j, matrix[i, j])))
281-
# checking positive semi-definitess (non-negative eigenvalues)
283+
# checking positive semi-definiteness (non-negative eigenvalues)
282284
Eigenvalues, Decomposition = eigh(matrix)
283285
if not np.all(Eigenvalues > - EIGENVALUE_TOLERANCE):
284286
validation_messages.append(("Matrix is not positive semi-definite"))

correlationMatrix/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22

3-
# (c) 2019 Open Risk, all rights reserved
3+
# (c) 2019-2022 Open Risk, all rights reserved
44
#
55
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
66
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of

correlationMatrix/utils/converters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# encoding: utf-8
1+
# encoding: utf-8
22

33
# (c) 2017-2019 Open Risk (https://www.openriskmanagement.com)
44
#
@@ -49,10 +49,10 @@ def matrix_print(A, format_type='Standard', accuracy=2):
4949
"""
5050
for s_in in range(A.shape[0]):
5151
for s_out in range(A.shape[1]):
52-
if format_type is 'Standard':
52+
if format_type == 'Standard':
5353
format_string = "{0:." + str(accuracy) + "f}"
5454
print(format_string.format(A[s_in, s_out]) + ' ', end='')
55-
elif format_type is 'Percent':
55+
elif format_type == 'Percent':
5656
print("{0:.2f}%".format(100 * A[s_in, s_out]) + ' ', end='')
5757
print('')
5858
print('')

correlationMatrix/utils/dataset_generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22

3-
# (c) 2019 Open Risk, all rights reserved
3+
# (c) 2019-2022 Open Risk, all rights reserved
44
#
55
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
66
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of

correlationMatrix/utils/fetch_equity_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22

3-
# (c) 2019 Open Risk, all rights reserved
3+
# (c) 2019-2022 Open Risk, all rights reserved
44
#
55
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
66
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of

correlationMatrix/utils/preprocessing.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# encoding: utf-8
22

3-
# (c) 2019 Open Risk, all rights reserved
3+
# (c) 2019-2022 Open Risk, all rights reserved
44
#
55
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
66
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
@@ -12,19 +12,19 @@
1212
# either express or implied. See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
'''
15+
"""
1616
module correlationMatrix.utils - helper classes and functions
1717
18-
'''
18+
"""
1919

2020
import numpy as np
2121
import pandas as pd
2222

2323

2424
def csv_files_to_frame(list, directory, filename):
25-
"""
26-
Given a list of symbols with timeseries data
27-
- iterate through a directory for *.csv files
25+
""" Given a list of symbols with timeseries data
26+
27+
- iterate through a directory for csv files
2828
- load and merge file data into a single dataframe
2929
3030
"""
@@ -45,24 +45,22 @@ def csv_files_to_frame(list, directory, filename):
4545

4646

4747
def json_file_to_frame(input_filename, output_filename):
48-
"""
49-
Given a file name with json data in the format
50-
{
51-
"Entity1" : [Values],
52-
"Entity2" : [Values],
53-
...
54-
"EntityN" : [Values]
55-
}
56-
Convert the data to a pandas dataframe for further processing
48+
""" Given a file name with json data in the format
49+
50+
.. code:: python
51+
52+
{
53+
"Entity1" : [Values],
54+
"Entity2" : [Values],
55+
...
56+
"EntityN" : [Values]
57+
}
58+
59+
Convert the data to a pandas dataframe for further processing
5760
5861
"""
5962

60-
entity_data = pd.read_json(input_filename)
61-
# select_data = entity_data.drop(columns=['High', 'Low', 'Open', 'Close', 'Volume'])
62-
# index_data = select_data.set_index('Date')
63-
# rename_data = index_data.rename(columns={"Adj Close": entry_name})
64-
# df = pd.concat([df, rename_data], axis=1, sort=False)
65-
#
63+
entity_data = pd.read_json(open(input_filename, mode='r'))
6664
entity_data.to_csv(output_filename, index=False)
6765

6866
return entity_data

0 commit comments

Comments
 (0)