Skip to content

Commit

Permalink
Constants now persist
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedamen committed Apr 15, 2021
1 parent f3dcd7a commit b715096
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ In finmarketpy/examples you will find several examples, including some simple tr

# finmarketpy log

* 15 Apr 2021
* Constant overrides now persist
* 13 Apr 2021
* Replaced loc with iloc in TechIndicator to remove Pandas deprecated functionality
* 08 Apr 2021
Expand Down
8 changes: 8 additions & 0 deletions finmarketpy/util/marketconstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class MarketConstants(object):

fx_options_tol = 1e-8

override_fields = {}

# Overwrite field variables with those listed in MarketCred or we can pass through an override_fields dictionary
def __init__(self, override_fields={}):
try:
Expand All @@ -145,6 +147,12 @@ def __init__(self, override_fields={}):
except:
pass

# Store overrided fields
if override_fields == {}:
override_fields = MarketConstants.override_fields
else:
MarketConstants.override_fields = override_fields

for k in override_fields.keys():
if '__' not in k:
setattr(MarketConstants, k, override_fields[k])

0 comments on commit b715096

Please sign in to comment.