Пример #1
0
def getHistoricalSplit(tickerName):
    tempData = sql.executeReturn('SELECT * FROM ' + tickerName)
    data = []

    for i in tempData:
        data.append([i[0], float(i[7])])

    return data
Пример #2
0
def getAllTables():
    allTables = sql.executeReturn("SELECT name FROM sqlite_master WHERE type = 'table';")
    tables = []
    
    for i in allTables:
        print(i)
        
    for i in allTables:
        tables.append(i[0])
    
    return tables
Пример #3
0
def getHistoricalPrices(tickerName):
    tempData = sql.executeReturn('SELECT * FROM ' + tickerName)

    data = []

    for i in tempData:
        temp = []
        for j in i:
            temp.append(j)
        data.append(temp)

    return data
Пример #4
0
def updateHistoricalPrice(tickerName):
    tableName = tickerName
    
    tempData = sql.executeReturn('SELECT * FROM ' + tableName)
    sqlData = []
    for i in tempData:
        temp = []
        for j in i:
            temp.append(j)
        sqlData.append(temp)
        
    newData = Download.updateHistoricalPrice(tickerName, sqlData) #@Unresolved
    
#     for i in newData:
#         print(i)
    insertMechanism(tickerName, newData)
Пример #5
0
def insertMechanism(tickerName, data):
    sql.execute('DROP TABLE IF EXISTS ' + tickerName, None)
    sql.execute('CREATE TABLE ' + tickerName + '(CC0 TEXT, CC1 TEXT, CC2 TEXT, CC3 TEXT, CC4 TEXT, CC5 TEXT, CC6 TEXT, CC7 TEXT)', None)
    
    totalText = ''
    for i in data:
        totalText += '('
        for j in i:
            totalText += "'" + str(j) + "',"
        totalText = totalText[0:len(totalText) -1 ]
        totalText += '),'
#             tempArray.append(j)
#         totalText += valuesText + ','
    
    totalText = totalText[0:len(totalText)-1]
    sql.execute('INSERT INTO ' + tickerName + ' VALUES ' + totalText , None)
Пример #6
0
def vacuum():
    sql.execute("VACUUM", None)
Пример #7
0
def removeTicker(tickerName):
    sql.execute('DROP TABLE IF EXISTS ' + tickerName, None)
Пример #8
0
def getAll():
    allTables = sql.executeReturn(
        "SELECT name FROM sqlite_master WHERE type = 'table';")
    return allTables