def __init__(self): Connection.__init__(self) self.url = '' self.type_name = '' self.symbols = [] self.pattern = Template('(?<!\w)(' '${fullNameLower}|' '${fullNameTitle}|' '${symbolLower}|' '${symbolUpper}|' ')(?!\w)')
def __init__(self, title, date, description, url, metadata={}): Connection.__init__(self) url_parts = urlparse(url) self.id = 0 self.title = title self.date = date self.url = url self.source = url_parts.netloc self.metadata = metadata self.description = description # self.scrape_meta_tags(['description']) self.syntax_tree = {} # self.construct_syntax_tree() self.set()
def __init__(self): SymbolType.__init__(self) Connection.__init__(self) self.get(self.symbol_type_id)
def __init__(self): Connection.__init__(self) exchanges = self.get_exchanges() for exchange in exchanges: source = self.request_source(exchange[2]) symbol_exchange_rates = json.loads(source) for sym in symbol_exchange_rates: # TODO: Load correct endpoint field names by exchange args = { 'tablename': 'symbol', 'conditional': 'AND', 'where_stmt': [{ 'key': 'symbol', 'value': sym['symbol'], 'operator': '=' }, { 'key': 'symbol_type_id', 'value': exchange[1], 'operator': '=' }] } exists = Connection.exists(self, args) # Add symbol to table if it does not exist. if (not exists): Connection.set(self, query_params={ 'tablename': 'symbol', 'fields': { 'symbol_type_id': exchange[1], 'symbol': sym['symbol'], 'name': sym['id'], 'meta': '', 'full_name': sym['name'] } }) # Get our symbol id # TODO: We need to grab this symbol id from an object cache. # See https://trello.com/c/nivVoxpF symbol_id = Connection.get(self, query_params={ 'tablename': 'symbol', 'where_stmt': [{ 'key': 'symbol', 'value': sym['symbol'], 'operator': '=' }, { 'key': 'symbol_type_id', 'value': exchange[1], 'operator': '=' }], 'fields': ['symbol_id'] }) # Insert most recent exchange rate. if (sym['last_updated']): Connection.set( self, query_params={ 'tablename': 'symbol_exchange_rate_lookup', 'fields': { 'exchange_id': exchange[0], 'symbol_id': symbol_id[0][0], 'rate': sym['price_usd'], 'date': Connection.convert_timestamp_to_datetime( self, sym['last_updated']) } })
def __init__(self): Connection.__init__(self) self.feeds = []