def __init__(self): super().__init__('range_rb') self.addMarketRegister(RegisterInstrument('rb')) self.ask_ema: EMA = EMA(60, _use_key='askprice') self.bid_ema: EMA = EMA(60, _use_key='bidprice') self.last_status: int = SignalType.EMPTY self.empty_time: datetime = None self.addPickleKey('last_status')
def __init__(self): super().__init__('ma_rb') self.addMarketRegister(RegisterInstrument('rb')) self.ema: EMA = EMA(20) self.last_status: int = SignalType.EMPTY self.empty_time: datetime = None self.addPickleKey('ema', 'last_status')
def settlement(self, _settlement_event: SettlementEvent): self.ema = EMA(20) self.last_status: int = SignalType.EMPTY self.empty_time: datetime = None
from ParadoxTrading.Fetch.ChineseFutures import FetchDominantIndex from ParadoxTrading.Indicator import Plunge, EMA from ParadoxTrading.Chart import Wizard fetcher = FetchDominantIndex() rb = fetcher.fetchDayData('20100101', '20170101', 'rb') fast_ema = EMA(50).addMany(rb).getAllData() slow_ema = EMA(100).addMany(rb).getAllData() plunge = Plunge().addMany(rb).getAllData() wizard = Wizard() main_view = wizard.addView('main', _adaptive=True, _view_stretch=3) main_view.addLine('price', rb.index(), rb['closeprice']) main_view.addLine('fast_ema', fast_ema.index(), fast_ema['ema']) main_view.addLine('slow_ema', slow_ema.index(), slow_ema['ema']) sub_view = wizard.addView('sub') sub_view.addLine('plunge', plunge.index(), plunge['plunge']) wizard.show()