Skip to content
Derek Hu edited this page Jan 16, 2015 · 6 revisions
Welcome to the trading wiki!
    json = {
        'backtest': {
            'start_date': "2013-01-01",     # (range: 2000-01-01 -- 2014-12-01)
            'end_date': "2014-01-01",
            'initial_balance': 1000000,
            'frequency': 12,  # (the more frequent, the longer backtest will take, upper limit == 252)
            'num_holdings': 2,  # (must be >= 1)
            }, 
        'algorithm': {
            'name' : 'Test',
            'block' : {
                'sma': {
                    'buy': [{
                        'period1': 15, 
                        'period2': 10,
                        'range': (0.2,10),
                        'appetite': 5
                        },{
                        'period1': 2, 
                        'period2': 50,
                        'range': (0.8,10),
                        'appetite': 50
                        }],
                    'sell' : []
                },
                'volatility' : {
                    'buy' : [],
                    'sell' : [{
                        'behavior': 'sell', # or sell
                        'period': 15,
                        'appetite': 100,
                        'range': (0.1,0.2),
                        }] 
                },
                'covariance': {
                    'buy' :[{
                        'benchmark': 'ACE',
                        'period': 15,
                        'appetite': 200,
                        'range': (0.1,0.2,), (if null, upper bound == 1000000000, lower bound = -1000000)
                    }],
                    'sell' : []
                },
                'thresholds': {
                    'buy' :[{
                        'price' : (50,150), #(range)
                        # 'sector' : {'include': ['Healthcare']},
                        # 'industry': {'exclude': ['Asset Management']}
                        }],
                    'sell' : []
                },
                'diversity': { 
                    'buy' : [],
                    'sell' : [{
                        'num_sector': 2, #(upper bound for number of sector/industry you allow in portfolio)
                        'num_industry': 1
                        }]
                },
                'event': {  #(example: If GOOG 600 > close > 650 --> Buy)
                    'buy' :[{
                        'stock': 'GOOG', #(must be valid stock symbols)
                        'attribute': 'close', #(choices : open,high,low,close,volume)
                        'range': (600,650,),
                        'appetite': 300
                        }],
                    'sell' : []
                }
            }
        }
    }
  • Start celery worker

celery --app=graph_trader.celery:app worker --loglevel=INFO

Clone this wiki locally