Skip to content

Commit

Permalink
magic method of instrument
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Dec 17, 2018
1 parent ebf7377 commit 0126c4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rqalpha/model/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def __init__(self, dic):
if np.isnan(self.contract_multiplier):
raise RuntimeError("Contract multiplier of {} is not supposed to be nan".format(self.order_book_id))

def __getattr__(self, item):
try:
return super(Instrument, self).__getattribute__("_ins_dict")[item]
except KeyError:
raise AttributeError(item)

@property
def order_book_id(self):
"""
Expand Down

0 comments on commit 0126c4b

Please sign in to comment.