Skip to content

Commit

Permalink
Release 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
open-risk committed Feb 21, 2022
1 parent 2ce4ef5 commit 764045f
Show file tree
Hide file tree
Showing 41 changed files with 3,372 additions and 651 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ ChangeLog

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

v0.2.0 (21-02-2022)
-------------------
* Installation:
* PyPI release update

v0.1.2 (26-03-2019)
-------------------

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Key Information
* License: Apache 2.0
* Mathematical Documentation: [Open Risk Manual](https://www.openriskmanual.org/wiki/Correlation_Matrix)
* Development website: [Github](https://github.com/open-risk/correlationMatrix)
* General Discussions: [Gitter](https://gitter.im/open-risk/Lobby)
* Package Specific Chat: [Gitter](https://gitter.im/open-risk/correlationMatrix)
* General Discussions: [Open Risk Commons](https://www.openriskcommons.org/c/open-source/correlationmatrix/26)


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

The examples directory contains a large sample of examples illustrating the current functionality
The examples directory contains examples illustrating the current functionality


Display correlation matrix
Expand Down
30 changes: 0 additions & 30 deletions TODO.rst

This file was deleted.

4 changes: 2 additions & 2 deletions correlationMatrix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

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

__version__ = '0.1'
__version__ = '0.2'

package_name = 'correlationMatrix'
module_path = os.path.dirname(__file__)
Expand Down
12 changes: 7 additions & 5 deletions correlationMatrix/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

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

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

matrix = self.matrix
# checking squareness of matrix
if matrix.shape[0] != matrix.shape[1]:
if len(matrix.shape) != 2:
validation_messages.append(("Matrix Non Square: ", matrix.shape))
elif matrix.shape[0] != matrix.shape[1]:
validation_messages.append(("Matrix Dimensions Differ: ", matrix.shape))
else:
matrix_size = matrix.shape[0]
Expand All @@ -278,7 +280,7 @@ def validate(self, accuracy=1e-3):
for j in range(matrix_size):
if matrix[i, j] != matrix[j, i]:
validation_messages.append(("Symmetry violating value: ", (i, j, matrix[i, j])))
# checking positive semi-definitess (non-negative eigenvalues)
# checking positive semi-definiteness (non-negative eigenvalues)
Eigenvalues, Decomposition = eigh(matrix)
if not np.all(Eigenvalues > - EIGENVALUE_TOLERANCE):
validation_messages.append(("Matrix is not positive semi-definite"))
Expand Down
2 changes: 1 addition & 1 deletion correlationMatrix/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

# (c) 2019 Open Risk, all rights reserved
# (c) 2019-2022 Open Risk, all rights reserved
#
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
Expand Down
6 changes: 3 additions & 3 deletions correlationMatrix/utils/converters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# encoding: utf-8
# encoding: utf-8

# (c) 2017-2019 Open Risk (https://www.openriskmanagement.com)
#
Expand Down Expand Up @@ -49,10 +49,10 @@ def matrix_print(A, format_type='Standard', accuracy=2):
"""
for s_in in range(A.shape[0]):
for s_out in range(A.shape[1]):
if format_type is 'Standard':
if format_type == 'Standard':
format_string = "{0:." + str(accuracy) + "f}"
print(format_string.format(A[s_in, s_out]) + ' ', end='')
elif format_type is 'Percent':
elif format_type == 'Percent':
print("{0:.2f}%".format(100 * A[s_in, s_out]) + ' ', end='')
print('')
print('')
2 changes: 1 addition & 1 deletion correlationMatrix/utils/dataset_generators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

# (c) 2019 Open Risk, all rights reserved
# (c) 2019-2022 Open Risk, all rights reserved
#
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
Expand Down
2 changes: 1 addition & 1 deletion correlationMatrix/utils/fetch_equity_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

# (c) 2019 Open Risk, all rights reserved
# (c) 2019-2022 Open Risk, all rights reserved
#
# correlationMatrix is licensed under the Apache 2.0 license a copy of which is included
# in the source distribution of correlationMatrix. This is notwithstanding any licenses of
Expand Down
40 changes: 19 additions & 21 deletions correlationMatrix/utils/preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

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

'''
"""
module correlationMatrix.utils - helper classes and functions
'''
"""

import numpy as np
import pandas as pd


def csv_files_to_frame(list, directory, filename):
"""
Given a list of symbols with timeseries data
- iterate through a directory for *.csv files
""" Given a list of symbols with timeseries data
- iterate through a directory for csv files
- load and merge file data into a single dataframe
"""
Expand All @@ -45,24 +45,22 @@ def csv_files_to_frame(list, directory, filename):


def json_file_to_frame(input_filename, output_filename):
"""
Given a file name with json data in the format
{
"Entity1" : [Values],
"Entity2" : [Values],
...
"EntityN" : [Values]
}
Convert the data to a pandas dataframe for further processing
""" Given a file name with json data in the format
.. code:: python
{
"Entity1" : [Values],
"Entity2" : [Values],
...
"EntityN" : [Values]
}
Convert the data to a pandas dataframe for further processing
"""

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

return entity_data
Expand Down
2 changes: 1 addition & 1 deletion datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

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

0 comments on commit 764045f

Please sign in to comment.