Skip to content

Instantly share code, notes, and snippets.

@nkabir
Created December 5, 2011 16:10
Show Gist options
  • Select an option

  • Save nkabir/1434106 to your computer and use it in GitHub Desktop.

Select an option

Save nkabir/1434106 to your computer and use it in GitHub Desktop.
alexhawat hw3
class Market(object):
'''
classdocs
'''
### THIS IS NOT NEEDED
#counter is a "Class Variable" for the number of created instances of Currency
counter = 0
def __init__(self, ref_date):
'''
Constructor
'''
self.market_observables = {}
self.reference_date=ref_date
## YOU ALSO NEED A REFERENCE CURRENCY
def set_market_observable(self, observable):
## I RECOMMEND EXPANDING THIS INTERFACE TO TAKE (self, observable_id, observable)
## Otherwise, you effectively require all observables to implement an "id"
## This is a preference--and you may very well require all Observables to implement
## a common method but be aware of this requirement.
## Also, don't capitalize ID--sshould be 'obs_id'
self.market_observables[observable.obs_ID] = observable
def get_market_observable(self, observable_id):
return self.market_observables.get(observable_id)
def make(ref_date):
return Market(ref_date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment