Esempio n. 1
0
 def wrapper(self, **kwargs):
     orders, filters = func(self, **kwargs), {
         k if k != 'symbol' else 'instrument': v if k != 'symbol' else
         self.client.get(stock(v))['results'][0]['url']
         for k, v in kwargs.items() if k in ['symbol', 'type', 'state']
     }
     results = [
         list(filter(lambda x: x[k] == v, orders))
         for k, v in filters.items()
     ][0]
     if kwargs.get('ids'):
         return [o['id'] for o in results]
     return results
Esempio n. 2
0
 def wrapper(self, *args, **kwargs):
     s = self.client.get(stock(self.symbol))['results'][0]
     self.price = float(self.client.get(s['quote'])['last_trade_price'])
     return func(self, *args, **kwargs)
Esempio n. 3
0
 def __init__(self, symbol, populate=True):
     self.symbol, self.client = symbol.upper(), Client()
     self.stock_id = self.client.get(stock(self.symbol))['results'][0]['id']
     self.options = self.build_chain() if populate else None