Ejemplo n.º 1
0
def addStrategy(request):
    strdao = StrategyInfoDao()
    oStrategyInfo = StrategyInfo(request)
    StrategyInfoDict = oStrategyInfo.getStrategyInfoDict()
    strategy_id = request.REQUEST.get('strategy_id', '')
    if not isStrategyExisted(strategy_id):
        strdao.addStrategy(StrategyInfoDict)
    else:
        strdao.updateStrategy(strategy_id, StrategyInfoDict)
    return strategy_id
Ejemplo n.º 2
0
def addStrategy(request):
    strdao = StrategyInfoDao()
    oStrategyInfo = StrategyInfo(request)
    StrategyInfoDict = oStrategyInfo.getStrategyInfoDict()
    strategy_id = request.REQUEST.get('strategy_id','')
    if not isStrategyExisted(strategy_id):
        strdao.addStrategy(StrategyInfoDict)
    else:
        strdao.updateStrategy(strategy_id, StrategyInfoDict)
    return strategy_id
Ejemplo n.º 3
0
def addStrategy(request):
    strdao = StrategyInfoDao()
    oStrategyInfo = StrategyInfo(request)
    StrategyInfoDict = oStrategyInfo.getStrategyInfoDict()

    strategy_id = request.REQUEST.get('strategy_id', '')
    if not isStrategyExisted(strategy_id):
        strdao.addStrategy(StrategyInfoDict)
    else:
        strdao.updateStrategy(strategy_id, StrategyInfoDict)
    print "--==Running the strategy==--"
    ticker = request.REQUEST.get('ticker', '')
    account_id = request.REQUEST.get('account_id', '')
    algo_fname = request.REQUEST.get('filename', '')
    args = request.REQUEST.get('args', '')
    task = runAlgo.delay(ticker, account_id, algo_fname, args)
    add_task(strategy_id, task.id)
    print 'Task is running'

    return strategy_id