Exemple #1
0
 def parse(self, args: list) -> dict:
     data = {'type': 'acronym', 'keyword': 'all'}
     for a in range(len(args)):
         if is_keyword(args[a]):
             n, v = parse_variable(args[a])
             data[n] = v
         elif a == 0:
             data['type'] = args[a]
         else:
             data['keyword'] = args[a]
     return data
 def parse(self, args: list) -> dict:
     data = {'title': 'stock', 'acronym': args[0], 'shares': 1, 'price': -1}
     for a in range(1, len(args)):
         if is_keyword(args[a]):
             n, v = parse_variable(args[a])
             data[n] = v
         elif a == 1:
             data['shares'] = int(args[a])
         else:
             data['price'] = float(args[a])
     return data
 def parse(self, args: list) -> dict:
     data = {
         'title': 'transaction',
         'id': int(args[0]),
         'shares': -1,
         'price': -1.0,
         'date': dt.datetime.now().strftime(date_format)
     }
     for a in range(2, len(args)):
         if is_keyword(args[a]):
             n, v = parse_variable(args[a])
             data[n] = v
         elif a == 1:
             data['shares'] = int(args[a])
         elif a == 2:
             data['price'] = float(args[a])
         else:
             data['date'] = dt.datetime.strptime(args[a], date_format)
     return data
 def parse(self, args: list) -> dict:
     data = {
         'title': 'monitor',
         'acronym': args[0],
         'ask_price': -1.0,
         'bid_price': -1.0,
         'ask_size': -1,
         'bid_size': -1
     }
     for a in range(1, len(args)):
         if is_keyword(args[a]):
             n, v = parse_variable(args[a])
             data[n] = v
         elif a == 1:
             data['ask_price'] = float(args[a])
         elif a == 2:
             data['bid_price'] = float(args[a])
         elif a == 3:
             data['ask_size'] = int(args[a])
         else:
             data['bid_size'] = int(args[a])
     return data