def __init__(self):
     df = pd.read_csv('d:/ru_data.csv',
                      header=0,
                      index_col=0,
                      parse_dates=True)
     self.signals = df.resample('5min').sum().dropna()
     self.date_index = self.signals.index
     self.close = CLOSE()
Пример #2
0
    def __init__(self):

        self.closes = CLOSE()
        self.preCloses = CLOSE().shift(1)
        self.openes = OPEN()
        self.lowes = LOW()
        self.highes = HIGH()

        # 计算指数的备用指标
        self.closeDLastClose = self.closes / self.preCloses - 1.
        self.closeDOpen = self.closes / self.openes - 1.
        self.closeDLow = self.closes / self.lowes - 1.
        self.highDClose = 1. - self.highes / self.closes

        # 定义指数的权重
        self.indexWeights = pd.Series(
            [1., -2., 1.], index=['000016.zicn', '000300.zicn', '000905.zicn'])
Пример #3
0
 def __init__(self, batches, pack):
     self.var = VARIANCE(120, 'close')
     self.max = MAX(120, 'high')
     self.min = MIN(120, 'low')
     self.close = CLOSE()
     self.batches = batches
     self.interval = {}
     self.bought_grid = {}
     self.bought_price = {}
     self.bought_amount = {}
     self.sold_grid = {}
     self.sold_price = {}
     self.sold_amount = {}
     self.count = 0
     self.pack = pack
    def __init__(self):

        self.closes = CLOSE()
        self.mul = LAST('multiplier')
        self.preMul = LAST('multiplier').shift(1)
        self.preCloses = CLOSE().shift(1)
        self.openes = OPEN()
        self.lowes = LOW()
        self.highes = HIGH()

        # 计算指数的备用指标
        self.closeDLastClose = self.closes / self.preCloses - 1.
        self.closeDOpen = self.closes / self.openes - 1.
        self.closeDLow = self.closes / self.lowes - 1.
        self.highDClose = 1. - self.highes / self.closes

        self.ih_amount = 28
        self.if_amount = 42
        self.ic_amount = 12

        # 定义指数的权重
        names = ['000016.zicn', '000300.zicn', '000905.zicn']
        self.indexWeights = SeriesValues(np.array([1., -2., 1.]),
                                         index=dict(zip(names, range(len(names)))))
Пример #5
0
 def __init__(self, window_up, multi_up, window_down, multi_down, **kwargs):
     self._window_up = int(window_up)
     self._multi_up = multi_up
     self._window_down = int(window_down)
     self._multi_down = multi_down
     self._open = OPEN()
     self._close = CLOSE()
     self._high = HIGH()
     self._low = LOW()
     self._price_daily = defaultdict(lambda: defaultdict(list))
     self._thrust = defaultdict(lambda: defaultdict(list))
     self._day_count = 0
     self._update_date = None
     self._save_thrust = kwargs.get('save_thrust', True)
     self._del_rule = kwargs.get('del_rule', {'nth': 3, 'day_of_week': 6})
     self._main_contract = None
Пример #6
0
    def __init__(self):
        self.window = 10
        self.ma = MA(self.window, 'close')
        self.std = SQRT(VARIANCE(10, RETURNSimple('close')))
        self.close = CLOSE()
        self.pack = {'ta.xzce': 1,
                     'zc.xzce': 1,
                     'y.xdce': 1,
                     'ru.xsge': 1,
                     'a.xdce': 1,
                     'j.xdce': 1,
                     'jm.xdce': 1,
                     'ic.ccfx': 1,
                     'if.ccfx': 1,
                     'ih.ccfx': 1}
        self.upper_direction = -1
        self.lower_direction = 1

        self.position_book = {}
        self.order_queue = {}
Пример #7
0
    def __init__(self):
        self.window = 20
        self.ma = MA(self.window, 'close')
        self.var = SQRT(VARIANCE(20, RETURNSimple('close')))
        self.close = CLOSE()
        self.pack = {
            'ta.xzce': 1,
            'y.xdce': 1,
            'ru.xsge': 1,
            'a.xdce': 1,
            'ic.ccfx': 1,
            'if.ccfx': 1,
            'ih.ccfx': 1
        }
        self.upper_direction = -1
        self.lower_direction = 1
        self.step = 0.005
        self.profit_threshold = 0.005

        self.position_book = {}
        self.order_queue = {}
Пример #8
0
 def __init__(self):
     self.preMax = MMAX(10, 'close').shift(1)
     self.preMin = MMIN(10, 'close').shift(1)
     self.maxOI = MMAX(10, 'openInterest')
     self.current = CLOSE()
     self.count = 0
Пример #9
0
 def __init__(self):
     self.preMax = MAX(10, 'close').shift(1)
     self.preMin = MIN(10, 'close').shift(1)
     self.current = CLOSE()
     self.count = 0
Пример #10
0
 def __init__(self):
     self.count = 0
     self.close = CLOSE()