Esempio n. 1
0
def genTickerlist(stockSelection):
    dbInt = DatabaseInteraction('backtest_real')

    tickerLimit = 200
    #tickerListTotal = np.loadtxt('data/tickerOverview.txt', delimiter=',', skiprows=0, usecols=(0,), unpack=False,dtype = 'str')
    tickerListTotal = dbInt.getTickerList(stockSelection)

    tickerListAssembly = []
    a = int(len(tickerListTotal) / tickerLimit) + 1
    for i in range(a):
        tickerListAssembly.append(
            tickerListTotal[i * tickerLimit:i * tickerLimit + tickerLimit])

    return tickerListAssembly
Esempio n. 2
0
#!/usr/bin/python
from DatabaseInteraction import DatabaseInteraction
import time

dbObject = DatabaseInteraction('backtest_real')
[columnNames, queryResult] = dbObject.getAllTableEntries("strategy")
for item in columnNames:
    print item[0]

for item in queryResult:
    print item
print '------------------------'
dbObject.getTableNames()

#dbObject.addMethod("fundamentalist","geen argumenten jongeuh")
#dbObject.addStock("apple","BLUB","Nasdaq")
#dbObject.addStock("oak","OAKK","EuroNext")
tickerList = dbObject.getAllTickers()
print str(tickerList)
stockInfo = dbObject.getStockInfo("OAK")
print str(stockInfo)

dbObject.addPidToSimulation(1, 3)

#test om stocks in de server te steken

startTime = time.time()
for i in range(200, 700):
    ticker = "h" + str(i)
    #dbObject.addStock(ticker,ticker,"brolmarkt")
#!/usr/bin/python
from DatabaseInteraction import DatabaseInteraction

print 'Test entries will be added to database'

dbObject = DatabaseInteraction('backtest_real')


# users
dbObject.addUser("nero","$2a$12$/MugNnVIjdLd1TnshSyK2eXp.jM3lGM1GipTdFNTuwTHvFimPgCbu")
dbObject.addUser("michiel","$2a$12$/MugNnVIjdLd1TnshSyK2eXp.jM3lGM1GipTdFNTuwTHvFimPgCbu")
dbObject.addUser("baerto","$2a$12$/MugNnVIjdLd1TnshSyK2eXp.jM3lGM1GipTdFNTuwTHvFimPgCbu")

# stocks
dbObject.addStock("apple","AAPL","Nasdaq")
dbObject.addStock("oak","OAK","Euronext")

# stockCategory
dbObject.addStockToCategory("OAK","locatie","lieven zijn bureau")
dbObject.addStockToCategory("AAPL","locatie","amerika")

# methods
dbObject.addMethod("fundamentalist","geen argumenten jongeuh")
dbObject.addMethod("indexvolger","geef als string de index mee die je wil volgen")

# strategies

dbObject.addStrategy("fundamentAgressief","fundamentalist","")
dbObject.addStrategy("bel20volger","indexvolger","bel20")

# add data sources
#!/usr/bin/python
from DatabaseInteraction import DatabaseInteraction
import time

startTime = time.time()

print 'Test entries will be added to database'

dbInt = DatabaseInteraction('backtest_real')

# users
# TODO pass ipv hashing meegeven
# password = fromzerotoone
dbInt.addUser("nero",
              "$2a$12$/MugNnVIjdLd1TnshSyK2eXp.jM3lGM1GipTdFNTuwTHvFimPgCbu")
dbInt.addUser("michiel",
              "$2a$12$/MugNnVIjdLd1TnshSyK2eXp.jM3lGM1GipTdFNTuwTHvFimPgCbu")
dbInt.addUser("baerto",
              "$2a$12$/MugNnVIjdLd1TnshSyK2eXp.jM3lGM1GipTdFNTuwTHvFimPgCbu")

# stocks
numIgnored = 0
stockList = []
z = open('tickers.txt', 'r')
for line in z.readlines():
    line = line.replace("\n", "")
    line = line.replace("\"", "")
    line = line.replace("'", "")
    cols = line.split('\t')

    if len(cols) == 3:  # aandeel heeft zowel naam,ticker als markt
Esempio n. 5
0
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
# navigeer een naar boven
os.chdir('../')
sys.path.insert(0, 'SQL')
from DatabaseInteraction import DatabaseInteraction

# navigeer naar map waar data staat en moet geupdate worden
os.chdir('data/wikiData/')

# start timer
startTime = time.time()

# get list of wikipedia articles to check
dbInt = DatabaseInteraction("backtest_real")
[columnNames, queryResult] = dbInt.executeQuery(
    "SELECT STK.ticker, STC.value FROM stockCategory STC JOIN stock STK ON STC.stock = STK.id  WHERE criterium='wikipedia'"
)

# generate lists of tickers and lists of wikipedia articles
tickerList = []
articleList = []
for row in queryResult:
    tickerList.append(row[0])
    articleList.append(row[1])

# number of http requests to do in a batch
chunkSize = 50.

# website root
Esempio n. 6
0
#!/usr/bin/python
from DatabaseInteraction import DatabaseInteraction

dbObject = DatabaseInteraction('backtest_real', 'webapp')
result = dbObject.getTickerList('{market=ASX,location=thuis}')
for ticker in result:
    print ticker

dbObject.editStockCategory("AUB.AX", "wikipedia", "apple")
from DatabaseInteraction import DatabaseInteraction

dbInt = DatabaseInteraction('backtest_real')
dbInt.addMethod("methodTA1","MACD, Aroon, OBV and RSI combined")
dbInt.addStrategy("Technical Analysis 1","methodTA1",[6,3])