def run_example():
    indexes = ['000016.zicn', '000300.zicn', '000905.zicn']

    # futures to trade
    ihs = ['ih.ccfx']
    ifs = ['if.ccfx']
    ics = ['ic.ccfx']

    futures = ihs + ifs + ics

    universe = indexes + futures
    startDate = dt.datetime(2015, 5, 1)
    endDate = dt.datetime(2017, 2, 13)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   initialCapital=100000,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   portfolioType=PortfolioType.CashManageable,
                   freq=0,
                   saveFile=True,
                   plot=True,
                   benchmark='000905.zicn',
                   logLevel='info')
def run_example():
    csvDir = "data"
    universe = ['aapl', 'msft', 'ibm']
    initialCapital = 1000000.0

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   initialCapital=initialCapital,
                   symbolList=universe,
                   dataSource=DataSource.CSV,
                   csvDir=csvDir,
                   saveFile=False,
                   plot=True)
Beispiel #3
0
def run_example():
    universe = ['aapl.us', 'msft.us', 'ibm.us']
    initialCapital = 100000.0
    startDate = dt.datetime(1990, 1, 1)
    endDate = dt.datetime(2015, 9, 15)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   initialCapital=initialCapital,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.YAHOO,
                   saveFile=False)
Beispiel #4
0
def run_example():
    universe = ['000300.zicn']
    startDate = dt.datetime(2012, 1, 1)
    endDate = dt.datetime(2016, 1, 12)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   strategyParameters=(36, 78, 27, 42),
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=5,
                   logLevel='critical',
                   plot=True)
Beispiel #5
0
def run_example():
    universe = set_universe('000300.zicn')[:10]
    startDate = dt.datetime(2007, 1, 1)
    endDate = dt.datetime(2015, 10, 1)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   freq=0,
                   benchmark='000300.zicn',
                   logLevel='info',
                   saveFile=True,
                   plot=True)
Beispiel #6
0
def run_example():
    universe = ['000300.zicn']
    startDate = dt.datetime(2012, 1, 1)
    endDate = dt.datetime(2016, 1, 12)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   strategyParameters=(36, 78, 27, 42),
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=5,
                   logLevel='critical',
                   plot=True)
def run_example():
    universe = ['000300.zicn']
    startDate = dt.datetime(2005, 1, 1)
    endDate = dt.datetime(2015, 11, 1)

    strategyRunner(userStrategy=MonitoringIndexStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=0,
                   benchmark='000300.zicn',
                   logLevel="info",
                   saveFile=True,
                   plot=True)
Beispiel #8
0
def run_example():
    universe = set_universe('000300.zicn', refDate='2015-01-01')[:200]
    startDate = dt.datetime(2015, 1, 1)
    endDate = dt.datetime(2017, 1, 1)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   benchmark='000300.zicn',
                   dataSource=DataSource.WIND,
                   logLevel='info',
                   saveFile=True,
                   plot=True,
                   freq='D')
Beispiel #9
0
def run_example():
    stocks = set_universe('000300.zicn')
    futures = ['if15%02d.ccfx' % i for i in range(1, 13)]

    universes = stocks + futures

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   symbolList=universes,
                   startDate=dt.datetime(2015, 1, 1),
                   endDate=dt.datetime(2015, 12, 5),
                   logLevel='info',
                   saveFile=False,
                   plot=True,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000300.zicn')
Beispiel #10
0
def run_example():
    universe = ['000300.zicn']
    startDate = dt.datetime(2003, 12, 1)
    endDate = dt.datetime(2015, 11, 1)

    strategyRunner(userStrategy=MonitoringIndexStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=0,
                   benchmark='000300.zicn',
                   logLevel="info",
                   saveFile=True,
                   plot=True)
def run_example():
    stocks = set_universe('000300.zicn')
    futures = ['if15%02d.cffex' % i for i in range(1, 13)]

    universes = stocks + futures

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   symbolList=universes,
                   startDate=dt.datetime(2015, 1, 1),
                   endDate=dt.datetime(2015, 12, 5),
                   logLevel='info',
                   saveFile=False,
                   plot=False,
                   dataSource=DataSource.DataYes,
                   benchmark='000300.zicn',)
def run_example():
    csvDir = "data"
    universe = ["aapl.us", "msft.us", "ibm.us"]
    initialCapital = 1000000.0

    strategyRunner(
        userStrategy=MovingAverageCrossStrategy,
        initialCapital=initialCapital,
        symbolList=universe,
        dataSource=DataSource.CSV,
        csvDir=csvDir,
        saveFile=False,
        logLevel="info",
        plot=True,
    )
def run_example():
    universe = ['if1701.ccfx']

    startDate = dt.datetime(2016, 10, 7)
    endDate = dt.datetime(2016, 12, 4)

    strategyRunner(userStrategy=IndexMomentumStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000001.zicn',
                   freq=5,
                   logLevel='info',
                   plot=True,
                   saveFile=False)
def run_example():
    universe = ['if1701.ccfx']

    startDate = dt.datetime(2016, 10, 7)
    endDate = dt.datetime(2016, 12, 4)

    strategyRunner(userStrategy=IndexMomentumStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000001.zicn',
                   freq=5,
                   logLevel='info',
                   plot=True,
                   saveFile=False)
Beispiel #15
0
def run_example():
    universe = ['if.ccfx']

    startDate = dt.datetime(2013, 12, 1)
    endDate = dt.datetime(2016, 4, 25)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   strategyParameters=(39, 78, 27, 42),
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000300.zicn',
                   freq=5,
                   logLevel='info',
                   plot=True,
                   saveFile=False)
def run_example():
    universe = ['ru.xsge']

    startDate = dt.datetime(2016, 7, 1)
    endDate = dt.datetime(2016, 8, 31)

    strategyRunner(userStrategy=HighFrequencyRU,
                   symbolList=universe,
                   initialCapital=50000.,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=5,
                   saveFile=True,
                   plot=True,
                   portfolioType=PortfolioType.CashManageable,
                   logLevel='info')
Beispiel #17
0
def run_example():
    universe = ['600000.xshg', '000300.zicn']
    initialCapital = 1e5
    startDate = dt.datetime(2014, 12, 1)
    endDate = dt.datetime(2015, 11, 1)

    strategyRunner(userStrategy=MonitoringIndexStrategy,
                   initialCapital=initialCapital,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=0,
                   benchmark='000300.zicn',
                   logLevel="warning",
                   saveFile=True,
                   plot=True)
def run_example():
    universe = ['tf.cffex']

    startDate = dt.datetime(2013, 12, 1)
    endDate = dt.datetime(2016, 4, 25)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   strategyParameters=(39, 78, 27, 42),
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000300.zicn',
                   freq=5,
                   logLevel='info',
                   plot=True,
                   saveFile=False)
def run_example():
    stocks = set_universe("000300.zicn")
    futures = ["if15%02d.ccfx" % i for i in range(1, 13)]

    universes = stocks + futures

    strategyRunner(
        userStrategy=MovingAverageCrossStrategy,
        symbolList=universes,
        startDate=dt.datetime(2015, 1, 1),
        endDate=dt.datetime(2015, 12, 5),
        logLevel="info",
        saveFile=False,
        plot=True,
        dataSource=DataSource.DXDataCenter,
        benchmark="000300.zicn",
    )
def run_example():
    universe = ['ru.xsge']

    startDate = dt.datetime(2016, 7, 1)
    endDate = dt.datetime(2016, 8, 31)

    strategyRunner(userStrategy=HighFrequencyRU,
                   symbolList=universe,
                   initialCapital=50000.,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=5,
                   saveFile=True,
                   plot=True,
                   portfolioType=PortfolioType.CashManageable,
                   logLevel='info')
Beispiel #21
0
def run_example():
    universe = secIDs
    startDate = dt.datetime(2015, 12, 1)
    endDate = dt.datetime(2016, 9, 22)
    initialCapital = 200000.

    strategyRunner(userStrategy=GridTradingStrategy,
                   initialCapital=initialCapital,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   portfolioType=PortfolioType.CashManageable,
                   freq=0,
                   benchmark=secIDs[0],
                   logLevel="info",
                   saveFile=False,
                   plot=False)
def run_example():
    universe = secIDs
    startDate = dt.datetime(2015, 12, 1)
    endDate = dt.datetime(2016, 9, 22)
    initialCapital = 200000.

    strategyRunner(userStrategy=GridTradingStrategy,
                   initialCapital=initialCapital,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   portfolioType=PortfolioType.CashManageable,
                   freq=0,
                   benchmark=secIDs[0],
                   logLevel="info",
                   saveFile=False,
                   plot=True)
Beispiel #23
0
def run_example():
    universe = ['000905.zicn']

    startDate = dt.datetime(2013, 1, 1)
    endDate = dt.datetime(2016, 8, 12)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   strategyParameters=(39, 78, 27, 42),
                   initialCapital=50000.,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000905.zicn',
                   freq=5,
                   logLevel='info',
                   portfolioType=PortfolioType.CashManageable,
                   plot=True,
                   saveFile=False)
Beispiel #24
0
def run_example():
    universe = ['000905.zicn'] #set_universe('000300.zicn', refDate='2012-06-01')

    startDate = dt.datetime(2013, 1, 1)
    endDate = dt.datetime(2016, 1, 12)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   strategyParameters=(39, 78, 27, 42),
                   #initialCapital=50000.,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000300.zicn',
                   freq=5,
                   logLevel='info',
                   #portfolioType=PortfolioType.CashManageable,
                   plot=True,
                   saveFile=False)
def run_example():
    universe = ['000905.zicn']
    startDate = dt.datetime(2016, 1, 1)
    endDate = dt.datetime(2016, 9, 5)
    initialCapital = 10000000.
    batches = 10
    pack = 100

    strategyRunner(userStrategy=GridTradingStrategy,
                   initialCapital=initialCapital,
                   strategyParameters=(batches, pack),
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   portfolioType=PortfolioType.CashManageable,
                   freq=5,
                   logLevel="info",
                   saveFile=True,
                   plot=True)
Beispiel #26
0
def run_example():
    universe = ['000905.zicn']
    startDate = dt.datetime(2016, 1, 1)
    endDate = dt.datetime(2016, 9, 5)
    initialCapital = 10000000.
    batches = 10
    pack = 100

    strategyRunner(userStrategy=GridTradingStrategy,
                   initialCapital=initialCapital,
                   strategyParameters=(batches, pack),
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   portfolioType=PortfolioType.CashManageable,
                   freq=5,
                   logLevel="info",
                   saveFile=True,
                   plot=True)
def run_example():
    universe = set_universe('000300.zicn')
    startDate = dt.datetime(2012, 1, 1)
    endDate = dt.datetime(2015, 10, 1)

    return strategyRunner(userStrategy=MovingAverageCrossStrategy,
                          symbolList=universe,
                          startDate=startDate,
                          endDate=endDate,
                          dataSource=DataSource.DXDataCenter,
                          benchmark='000300.zicn',
                          saveFile=False,
                          logLevel='critical',
                          plot=False)
Beispiel #28
0
def run_example():
    universe = set_universe('000300.zicn')
    startDate = dt.datetime(2012, 1, 1)
    endDate = dt.datetime(2015, 10, 1)

    return strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   benchmark='000300.zicn',
                   saveFile=True,
                   logLevel='info',
                   plot=True)
def run_example(freq):
    universe = ['000905.zicn']
    startDate = dt.datetime(2016, 1, 8)
    endDate = dt.datetime(2016, 1, 31)

    return strategyRunner(userStrategy=SimpleStrategy,
                          symbolList=universe,
                          startDate=startDate,
                          endDate=endDate,
                          dataSource=DataSource.DXDataCenter,
                          freq=freq,
                          logLevel="warning",
                          saveFile=False,
                          plot=False)
Beispiel #30
0
def run_example():
    indexes = ['000016.zicn', '000300.zicn', '000905.zicn']

    # futures to trade
    ihs = ['ih.cffex']
    ifs = ['if.cffex']
    ics = ['ic.cffex']

    futures = ihs + ifs + ics

    universe = indexes + futures
    startDate = dt.datetime(2015, 5, 1)
    endDate = dt.datetime(2016, 4, 25)

    strategyRunner(userStrategy=MovingAverageCrossStrategy,
                   symbolList=universe,
                   startDate=startDate,
                   endDate=endDate,
                   dataSource=DataSource.DXDataCenter,
                   freq=0,
                   saveFile=True,
                   plot=True,
                   benchmark='000300.zicn',
                   logLevel='info')
Beispiel #31
0
def run_example():
    index_code = '000905.zicn'
    universe = set_universe(index_code, refDate='2015-01-01') + [index_code]
    startDate = dt.datetime(2015, 1, 1)
    endDate = dt.datetime(2016, 4, 25)
    initialCapital = 10000000.

    return strategyRunner(userStrategy=CatchMomentumStrategy,
                          strategyParameters=(index_code, ),
                          initialCapital=initialCapital,
                          symbolList=universe,
                          startDate=startDate,
                          endDate=endDate,
                          dataSource=DataSource.DXDataCenter,
                          portfolioType=PortfolioType.CashManageable,
                          freq=5,
                          benchmark=index_code,
                          logLevel="info",
                          saveFile=True,
                          plot=True)
def run_example():
    index_code = '000905.zicn'
    universe = set_universe(index_code, refDate='2015-01-01') + [index_code]
    startDate = dt.datetime(2015, 1, 1)
    endDate = dt.datetime(2016, 2, 29)
    initialCapital = 10000000.

    return strategyRunner(userStrategy=CatchMomentumStrategy,
                          strategyParameters=(index_code,),
                          initialCapital=initialCapital,
                          symbolList=universe,
                          startDate=startDate,
                          endDate=endDate,
                          dataSource=DataSource.DXDataCenter,
                          portfolioType=PortfolioType.CashManageable,
                          freq=5,
                          benchmark=index_code,
                          logLevel="info",
                          saveFile=True,
                          plot=True)
Beispiel #33
0
# -*- coding: utf-8 -*-
u"""
Created on 2015-12-08

@author: cheng.li
"""

import datetime as dt
from AlgoTrading.api import Strategy
from AlgoTrading.api import strategyRunner
from AlgoTrading.api import DataSource


class UserStrategy(Strategy):
    def handle_data(self):

        for s in self.tradableAssets:
            self.order(s, 1, 100)


res = strategyRunner(userStrategy=UserStrategy,
                     symbolList=['600000.xshg', 'if.ccfx'],
                     startDate=dt.datetime(2015, 1, 1),
                     endDate=dt.datetime(2016, 9, 19),
                     benchmark='000300.zicn',
                     dataSource=DataSource.DataYes,
                     freq=5,
                     plot=True)
Beispiel #34
0
# -*- coding: utf-8 -*-
u"""
Created on 2015-12-08

@author: cheng.li
"""

import datetime as dt
from AlgoTrading.api import Strategy
from AlgoTrading.api import strategyRunner


class UserStrategy(Strategy):
    def handle_data(self):

        for s in self.tradableAssets:
            self.order(s, 1, 100)


res = strategyRunner(userStrategy=UserStrategy,
                     symbolList=['600000.xshg'],
                     startDate=dt.datetime(2015, 10, 1),
                     endDate=dt.datetime(2015, 11, 19),
                     benchmark='000300.zicn',
                     freq=5,
                     plot=False)
# -*- coding: utf-8 -*-
u"""
Created on 2015-12-08

@author: cheng.li
"""

import datetime as dt
from AlgoTrading.api import Strategy
from AlgoTrading.api import strategyRunner
from AlgoTrading.api import DataSource


class UserStrategy(Strategy):

    def handle_data(self):

        for s in self.tradableAssets:
            self.order(s, 1, 100)

res = strategyRunner(userStrategy=UserStrategy,
                     symbolList=['600000.xshg', 'if.ccfx'],
                     startDate=dt.datetime(2015, 1, 1),
                     endDate=dt.datetime(2016, 9, 19),
                     benchmark='000300.zicn',
                     dataSource=DataSource.DataYes,
                     freq=5,
                     plot=True)
Beispiel #36
0
# -*- coding: utf-8 -*-
u"""
Created on 2015-12-08

@author: cheng.li
"""

import datetime as dt
from AlgoTrading.api import Strategy
from AlgoTrading.api import strategyRunner


class UserStrategy(Strategy):

    def handle_data(self):

        for s in self.tradableAssets:
            self.order(s, 1, 100)

res = strategyRunner(userStrategy=UserStrategy,
                     symbolList=['600000.xshg'],
                     startDate=dt.datetime(2015, 10, 1),
                     endDate=dt.datetime(2015, 11, 19),
                     benchmark='000300.zicn',
                     freq=5,
                     plot=False)