How to use groups method in storybook-root

Best JavaScript code snippet using storybook-root

factor_store.py

Source:factor_store.py Github

copy

Full Screen

1#! /usr/bin/env python2# -*- coding: utf-8 -*-3"""4@version: 0.15@author: li6@file: factor_store.py7@time: 2019/11/11 11:20 上午8"""9from PyFin.api import *10from alphamind.api import *11# uqer因子 经过CSQuantiles处理12basic_factor_store = {13 'AccountsPayablesTDays': CSQuantiles(LAST('AccountsPayablesTDays'), groups='sw1'),14 'AccountsPayablesTRate': CSQuantiles(LAST('AccountsPayablesTRate'), groups='sw1'),15 'AdminiExpenseRate': CSQuantiles(LAST('AdminiExpenseRate'), groups='sw1'),16 'ARTDays': CSQuantiles(LAST('ARTDays'), groups='sw1'),17 'ARTRate': CSQuantiles(LAST('ARTRate'), groups='sw1'),18 'ASSI': CSQuantiles(LAST('ASSI'), groups='sw1'),19 'BLEV': CSQuantiles(LAST('BLEV'), groups='sw1'),20 'BondsPayableToAsset': CSQuantiles(LAST('BondsPayableToAsset'), groups='sw1'),21 'CashRateOfSales': CSQuantiles(LAST('CashRateOfSales'), groups='sw1'),22 'CashToCurrentLiability': CSQuantiles(LAST('CashToCurrentLiability'), groups='sw1'),23 'CMRA': CSQuantiles(LAST('CMRA'), groups='sw1'),24 'CTOP': CSQuantiles(LAST('CTOP'), groups='sw1'),25 'CTP5': CSQuantiles(LAST('CTP5'), groups='sw1'),26 'CurrentAssetsRatio': CSQuantiles(LAST('CurrentAssetsRatio'), groups='sw1'),27 'CurrentAssetsTRate': CSQuantiles(LAST('CurrentAssetsTRate'), groups='sw1'),28 'CurrentRatio': CSQuantiles(LAST('CurrentRatio'), groups='sw1'),29 'DAVOL10': CSQuantiles(LAST('DAVOL10'), groups='sw1'),30 'DAVOL20': CSQuantiles(LAST('DAVOL20'), groups='sw1'),31 'DAVOL5': CSQuantiles(LAST('DAVOL5'), groups='sw1'),32 'DDNBT': CSQuantiles(LAST('DDNBT'), groups='sw1'),33 'DDNCR': CSQuantiles(LAST('DDNCR'), groups='sw1'),34 'DDNSR': CSQuantiles(LAST('DDNSR'), groups='sw1'),35 'DebtEquityRatio': CSQuantiles(LAST('DebtEquityRatio'), groups='sw1'),36 'DebtsAssetRatio': CSQuantiles(LAST('DebtsAssetRatio'), groups='sw1'),37 'DHILO': CSQuantiles(LAST('DHILO'), groups='sw1'),38 'DilutedEPS': CSQuantiles(LAST('DilutedEPS'), groups='sw1'),39 'DVRAT': CSQuantiles(LAST('DVRAT'), groups='sw1'),40 'EBITToTOR': CSQuantiles(LAST('EBITToTOR'), groups='sw1'),41 'EGRO': CSQuantiles(LAST('EGRO'), groups='sw1'),42 'EMA10': CSQuantiles(LAST('EMA10'), groups='sw1'),43 'EMA120': CSQuantiles(LAST('EMA120'), groups='sw1'),44 'EMA20': CSQuantiles(LAST('EMA20'), groups='sw1'),45 'EMA5': CSQuantiles(LAST('EMA5'), groups='sw1'),46 'EMA60': CSQuantiles(LAST('EMA60'), groups='sw1'),47 'EPS': CSQuantiles(LAST('EPS'), groups='sw1'),48 'EquityFixedAssetRatio': CSQuantiles(LAST('EquityFixedAssetRatio'), groups='sw1'),49 'EquityToAsset': CSQuantiles(LAST('EquityToAsset'), groups='sw1'),50 'EquityTRate': CSQuantiles(LAST('EquityTRate'), groups='sw1'),51 'ETOP': CSQuantiles(LAST('ETOP'), groups='sw1'),52 'ETP5': CSQuantiles(LAST('ETP5'), groups='sw1'),53 'FinancialExpenseRate': CSQuantiles(LAST('FinancialExpenseRate'), groups='sw1'),54 'FinancingCashGrowRate': CSQuantiles(LAST('FinancingCashGrowRate'), groups='sw1'),55 'FixAssetRatio': CSQuantiles(LAST('FixAssetRatio'), groups='sw1'),56 'FixedAssetsTRate': CSQuantiles(LAST('FixedAssetsTRate'), groups='sw1'),57 'GrossIncomeRatio': CSQuantiles(LAST('GrossIncomeRatio'), groups='sw1'),58 'HBETA': CSQuantiles(LAST('HBETA'), groups='sw1'),59 'HSIGMA': CSQuantiles(LAST('HBETA'), groups='sw1'),60 'IntangibleAssetRatio': CSQuantiles(LAST('IntangibleAssetRatio'), groups='sw1'),61 'InventoryTDays': CSQuantiles(LAST('InventoryTDays'), groups='sw1'),62 'InventoryTRate': CSQuantiles(LAST('InventoryTRate'), groups='sw1'),63 'InvestCashGrowRate': CSQuantiles(LAST('InvestCashGrowRate'), groups='sw1'),64 'LCAP': CSQuantiles(LAST('LCAP'), groups='sw1'),65 'LFLO': CSQuantiles(LAST('LFLO'), groups='sw1'),66 'LongDebtToAsset': CSQuantiles(LAST('LongDebtToAsset'), groups='sw1'),67 'LongDebtToWorkingCapital': CSQuantiles(LAST('LongDebtToWorkingCapital'), groups='sw1'),68 'LongTermDebtToAsset': CSQuantiles(LAST('LongTermDebtToAsset'), groups='sw1'),69 'MA10': CSQuantiles(LAST('MA10'), groups='sw1'),70 'MA120': CSQuantiles(LAST('MA120'), groups='sw1'),71 'MA20': CSQuantiles(LAST('MA20'), groups='sw1'),72 'MA5': CSQuantiles(LAST('MA5'), groups='sw1'),73 'MA60': CSQuantiles(LAST('MA60'), groups='sw1'),74 'MAWVAD': CSQuantiles(LAST('MAWVAD'), groups='sw1'),75 'MFI': CSQuantiles(LAST('MFI'), groups='sw1'),76 'MLEV': CSQuantiles(LAST('MLEV'), groups='sw1'),77 'NetAssetGrowRate': CSQuantiles(LAST('NetAssetGrowRate'), groups='sw1'),78 'NetProfitGrowRate': CSQuantiles(LAST('NetProfitGrowRate'), groups='sw1'),79 'NetProfitRatio': CSQuantiles(LAST('NetProfitRatio'), groups='sw1'),80 'NOCFToOperatingNI': CSQuantiles(LAST('NetProfitRatio'), groups='sw1'),81 'NonCurrentAssetsRatio': CSQuantiles(LAST('NonCurrentAssetsRatio'), groups='sw1'),82 'NPParentCompanyGrowRate': CSQuantiles(LAST('NPParentCompanyGrowRate'), groups='sw1'),83 'NPToTOR': CSQuantiles(LAST('NPToTOR'), groups='sw1'),84 'OperatingExpenseRate': CSQuantiles(LAST('OperatingExpenseRate'), groups='sw1'),85 'OperatingProfitGrowRate': CSQuantiles(LAST('OperatingProfitGrowRate'), groups='sw1'),86 'OperatingProfitRatio': CSQuantiles(LAST('OperatingProfitRatio'), groups='sw1'),87 'OperatingProfitToTOR': CSQuantiles(LAST('OperatingProfitToTOR'), groups='sw1'),88 'OperatingRevenueGrowRate': CSQuantiles(LAST('OperatingRevenueGrowRate'), groups='sw1'),89 'OperCashGrowRate': CSQuantiles(LAST('OperCashGrowRate'), groups='sw1'),90 'OperCashInToCurrentLiability': CSQuantiles(LAST('OperCashInToCurrentLiability'), groups='sw1'),91 'PB': CSQuantiles(LAST('PB'), groups='sw1'),92 'PCF': CSQuantiles(LAST('PCF'), groups='sw1'),93 'PE': CSQuantiles(LAST('PE'), groups='sw1'),94 'PS': CSQuantiles(LAST('PS'), groups='sw1'),95 'PSY': CSQuantiles(LAST('PSY'), groups='sw1'),96 'QuickRatio': CSQuantiles(LAST('QuickRatio'), groups='sw1'),97 'REVS10': CSQuantiles(LAST('REVS10'), groups='sw1'),98 'REVS20': CSQuantiles(LAST('REVS20'), groups='sw1'),99 'REVS5': CSQuantiles(LAST('REVS5'), groups='sw1'),100 'ROA': CSQuantiles(LAST('REVS5'), groups='sw1'),101 'ROA5': CSQuantiles(LAST('ROA5'), groups='sw1'),102 'ROE': CSQuantiles(LAST('ROE'), groups='sw1'),103 'ROE5': CSQuantiles(LAST('ROE5'), groups='sw1'),104 'RSI': CSQuantiles(LAST('RSI'), groups='sw1'),105 'RSTR12': CSQuantiles(LAST('RSTR12'), groups='sw1'),106 'RSTR24': CSQuantiles(LAST('RSTR24'), groups='sw1'),107 'SalesCostRatio': CSQuantiles(LAST('SalesCostRatio'), groups='sw1'),108 'SaleServiceCashToOR': CSQuantiles(LAST('SaleServiceCashToOR'), groups='sw1'),109 'SUE': CSQuantiles(LAST('SUE'), groups='sw1'),110 'TaxRatio': CSQuantiles(LAST('TaxRatio'), groups='sw1'),111 'TOBT': CSQuantiles(LAST('TOBT'), groups='sw1'),112 'TotalAssetGrowRate': CSQuantiles(LAST('TotalAssetGrowRate'), groups='sw1'),113 'TotalAssetsTRate': CSQuantiles(LAST('TotalAssetsTRate'), groups='sw1'),114 'TotalProfitCostRatio': CSQuantiles(LAST('TotalProfitCostRatio'), groups='sw1'),115 'TotalProfitGrowRate': CSQuantiles(LAST('TotalProfitGrowRate'), groups='sw1'),116 'VOL10': CSQuantiles(LAST('VOL10'), groups='sw1'),117 'VOL120': CSQuantiles(LAST('VOL120'), groups='sw1'),118 'VOL20': CSQuantiles(LAST('VOL20'), groups='sw1'),119 'VOL240': CSQuantiles(LAST('VOL240'), groups='sw1'),120 'VOL5': CSQuantiles(LAST('VOL5'), groups='sw1'),121 'VOL60': CSQuantiles(LAST('VOL60'), groups='sw1'),122 'WVAD': CSQuantiles(LAST('WVAD'), groups='sw1'),123 'REC': CSQuantiles(LAST('REC'), groups='sw1'),124 'DAREC': CSQuantiles(LAST('DAREC'), groups='sw1'),125 'GREC': CSQuantiles(LAST('GREC'), groups='sw1'),126 'FY12P': CSQuantiles(LAST('FY12P'), groups='sw1'),127 'DAREV': CSQuantiles(LAST('DAREV'), groups='sw1'),128 'GREV': CSQuantiles(LAST('GREV'), groups='sw1'),129 'SFY12P': CSQuantiles(LAST('SFY12P'), groups='sw1'),130 'DASREV': CSQuantiles(LAST('DASREV'), groups='sw1'),131 'GSREV': CSQuantiles(LAST('GSREV'), groups='sw1'),132 'FEARNG': CSQuantiles(LAST('FEARNG'), groups='sw1'),133 'FSALESG': CSQuantiles(LAST('FSALESG'), groups='sw1'),134 'TA2EV': CSQuantiles(LAST('TA2EV'), groups='sw1'),135 'CFO2EV': CSQuantiles(LAST('CFO2EV'), groups='sw1'),136 'ACCA': CSQuantiles(LAST('ACCA'), groups='sw1'),137 'DEGM': CSQuantiles(LAST('DEGM'), groups='sw1'),138 'SUOI': CSQuantiles(LAST('SUOI'), groups='sw1'),139 'EARNMOM': CSQuantiles(LAST('EARNMOM'), groups='sw1'),140 'FiftyTwoWeekHigh': CSQuantiles(LAST('FiftyTwoWeekHigh'), groups='sw1'),141 'Volatility': CSQuantiles(LAST('Volatility'), groups='sw1'),142 'Skewness': CSQuantiles(LAST('Skewness'), groups='sw1'),143 'ILLIQUIDITY': CSQuantiles(LAST('ILLIQUIDITY'), groups='sw1'),144 'BackwardADJ': CSQuantiles(LAST('BackwardADJ'), groups='sw1'),145 'MACD': CSQuantiles(LAST('MACD'), groups='sw1'),146 'ADTM': CSQuantiles(LAST('ADTM'), groups='sw1'),147 'ATR14': CSQuantiles(LAST('ATR14'), groups='sw1'),148 'ATR6': CSQuantiles(LAST('ATR6'), groups='sw1'),149 'BIAS10': CSQuantiles(LAST('BIAS10'), groups='sw1'),150 'BIAS20': CSQuantiles(LAST('BIAS20'), groups='sw1'),151 'BIAS5': CSQuantiles(LAST('BIAS5'), groups='sw1'),152 'BIAS60': CSQuantiles(LAST('BIAS60'), groups='sw1'),153 'BollDown': CSQuantiles(LAST('BollDown'), groups='sw1'),154 'BollUp': CSQuantiles(LAST('BollUp'), groups='sw1'),155 'CCI10': CSQuantiles(LAST('CCI10'), groups='sw1'),156 'CCI20': CSQuantiles(LAST('CCI20'), groups='sw1'),157 'CCI5': CSQuantiles(LAST('CCI5'), groups='sw1'),158 'CCI88': CSQuantiles(LAST('CCI88'), groups='sw1'),159 'KDJ_K': CSQuantiles(LAST('KDJ_K'), groups='sw1'),160 'KDJ_D': CSQuantiles(LAST('KDJ_D'), groups='sw1'),161 'KDJ_J': CSQuantiles(LAST('KDJ_J'), groups='sw1'),162 'ROC6': CSQuantiles(LAST('ROC6'), groups='sw1'),163 'ROC20': CSQuantiles(LAST('ROC20'), groups='sw1'),164 'SBM': CSQuantiles(LAST('SBM'), groups='sw1'),165 'STM': CSQuantiles(LAST('STM'), groups='sw1'),166 'UpRVI': CSQuantiles(LAST('UpRVI'), groups='sw1'),167 'DownRVI': CSQuantiles(LAST('DownRVI'), groups='sw1'),168 'RVI': CSQuantiles(LAST('RVI'), groups='sw1'),169 'SRMI': CSQuantiles(LAST('SRMI'), groups='sw1'),170 'ChandeSD': CSQuantiles(LAST('ChandeSD'), groups='sw1'),171 'ChandeSU': CSQuantiles(LAST('ChandeSU'), groups='sw1'),172 'CMO': CSQuantiles(LAST('CMO'), groups='sw1'),173 'DBCD': CSQuantiles(LAST('DBCD'), groups='sw1'),174 'ARC': CSQuantiles(LAST('ARC'), groups='sw1'),175 'OBV': CSQuantiles(LAST('OBV'), groups='sw1'),176 'OBV6': CSQuantiles(LAST('OBV6'), groups='sw1'),177 'OBV20': CSQuantiles(LAST('OBV20'), groups='sw1'),178 'TVMA20': CSQuantiles(LAST('TVMA20'), groups='sw1'),179 'TVMA6': CSQuantiles(LAST('TVMA6'), groups='sw1'),180 'TVSTD20': CSQuantiles(LAST('TVSTD20'), groups='sw1'),181 'TVSTD6': CSQuantiles(LAST('TVSTD6'), groups='sw1'),182 'VDEA': CSQuantiles(LAST('VDEA'), groups='sw1'),183 'VDIFF': CSQuantiles(LAST('VDIFF'), groups='sw1'),184 'VEMA10': CSQuantiles(LAST('VEMA10'), groups='sw1'),185 'VEMA12': CSQuantiles(LAST('VEMA12'), groups='sw1'),186 'VEMA26': CSQuantiles(LAST('VEMA26'), groups='sw1'),187 'VEMA5': CSQuantiles(LAST('VEMA5'), groups='sw1'),188 'VMACD': CSQuantiles(LAST('VMACD'), groups='sw1'),189 'VR': CSQuantiles(LAST('VR'), groups='sw1'),190 'VROC12': CSQuantiles(LAST('VROC12'), groups='sw1'),191 'VROC6': CSQuantiles(LAST('VROC6'), groups='sw1'),192 'VSTD10': CSQuantiles(LAST('VSTD10'), groups='sw1'),193 'VSTD20': CSQuantiles(LAST('VSTD20'), groups='sw1'),194 'KlingerOscillator': CSQuantiles(LAST('KlingerOscillator'), groups='sw1'),195 'MoneyFlow20': CSQuantiles(LAST('MoneyFlow20'), groups='sw1'),196 'AD': CSQuantiles(LAST('AD'), groups='sw1'),197 'AD20': CSQuantiles(LAST('AD20'), groups='sw1'),198 'AD6': CSQuantiles(LAST('AD6'), groups='sw1'),199 'CoppockCurve': CSQuantiles(LAST('CoppockCurve'), groups='sw1'),200 'ASI': CSQuantiles(LAST('ASI'), groups='sw1'),201 'ChaikinOscillator': CSQuantiles(LAST('ChaikinOscillator'), groups='sw1'),202 'ChaikinVolatility': CSQuantiles(LAST('ChaikinVolatility'), groups='sw1'),203 'EMV14': CSQuantiles(LAST('EMV14'), groups='sw1'),204 'EMV6': CSQuantiles(LAST('EMV6'), groups='sw1'),205 'plusDI': CSQuantiles(LAST('plusDI'), groups='sw1'),206 'minusDI': CSQuantiles(LAST('minusDI'), groups='sw1'),207 'ADX': CSQuantiles(LAST('ADX'), groups='sw1'),208 'ADXR': CSQuantiles(LAST('ADXR'), groups='sw1'),209 'Aroon': CSQuantiles(LAST('Aroon'), groups='sw1'),210 'AroonDown': CSQuantiles(LAST('AroonDown'), groups='sw1'),211 'AroonUp': CSQuantiles(LAST('AroonUp'), groups='sw1'),212 'DEA': CSQuantiles(LAST('DEA'), groups='sw1'),213 'DIFF': CSQuantiles(LAST('DIFF'), groups='sw1'),214 'DDI': CSQuantiles(LAST('DDI'), groups='sw1'),215 'DIZ': CSQuantiles(LAST('DIZ'), groups='sw1'),216 'DIF': CSQuantiles(LAST('DIF'), groups='sw1'),217 'MTM': CSQuantiles(LAST('MTM'), groups='sw1'),218 'MTMMA': CSQuantiles(LAST('MTMMA'), groups='sw1'),219 'PVT': CSQuantiles(LAST('PVT'), groups='sw1'),220 'PVT6': CSQuantiles(LAST('PVT6'), groups='sw1'),221 'PVT12': CSQuantiles(LAST('PVT12'), groups='sw1'),222 'TRIX5': CSQuantiles(LAST('TRIX5'), groups='sw1'),223 'TRIX10': CSQuantiles(LAST('TRIX10'), groups='sw1'),224 'UOS': CSQuantiles(LAST('UOS'), groups='sw1'),225 'MA10RegressCoeff12': CSQuantiles(LAST('MA10RegressCoeff12'), groups='sw1'),226 'MA10RegressCoeff6': CSQuantiles(LAST('MA10RegressCoeff6'), groups='sw1'),227 'PLRC6': CSQuantiles(LAST('PLRC6'), groups='sw1'),228 'PLRC12': CSQuantiles(LAST('PLRC12'), groups='sw1'),229 'SwingIndex': CSQuantiles(LAST('SwingIndex'), groups='sw1'),230 'Ulcer10': CSQuantiles(LAST('Ulcer10'), groups='sw1'),231 'Ulcer5': CSQuantiles(LAST('Ulcer5'), groups='sw1'),232 'Hurst': CSQuantiles(LAST('Hurst'), groups='sw1'),233 'ACD6': CSQuantiles(LAST('ACD6'), groups='sw1'),234 'ACD20': CSQuantiles(LAST('ACD20'), groups='sw1'),235 'EMA12': CSQuantiles(LAST('EMA12'), groups='sw1'),236 'EMA26': CSQuantiles(LAST('EMA26'), groups='sw1'),237 'APBMA': CSQuantiles(LAST('APBMA'), groups='sw1'),238 'BBI': CSQuantiles(LAST('APBMA'), groups='sw1'),239 'BBIC': CSQuantiles(LAST('BBIC'), groups='sw1'),240 'TEMA10': CSQuantiles(LAST('TEMA10'), groups='sw1'),241 'TEMA5': CSQuantiles(LAST('TEMA5'), groups='sw1'),242 'MA10Close': CSQuantiles(LAST('MA10Close'), groups='sw1'),243 'AR': CSQuantiles(LAST('AR'), groups='sw1'),244 'BR': CSQuantiles(LAST('BR'), groups='sw1'),245 'ARBR': CSQuantiles(LAST('ARBR'), groups='sw1'),246 'CR20': CSQuantiles(LAST('CR20'), groups='sw1'),247 'MassIndex': CSQuantiles(LAST('MassIndex'), groups='sw1'),248 'BearPower': CSQuantiles(LAST('BearPower'), groups='sw1'),249 'BullPower': CSQuantiles(LAST('BullPower'), groups='sw1'),250 'Elder': CSQuantiles(LAST('Elder'), groups='sw1'),251 'NVI': CSQuantiles(LAST('NVI'), groups='sw1'),252 'PVI': CSQuantiles(LAST('PVI'), groups='sw1'),253 'RC12': CSQuantiles(LAST('RC12'), groups='sw1'),254 'RC24': CSQuantiles(LAST('RC24'), groups='sw1'),255 'JDQS20': CSQuantiles(LAST('JDQS20'), groups='sw1'),256 'Variance20': CSQuantiles(LAST('Variance20'), groups='sw1'),257 'Variance60': CSQuantiles(LAST('Variance60'), groups='sw1'),258 'Variance120': CSQuantiles(LAST('Variance120'), groups='sw1'),259 'Kurtosis20': CSQuantiles(LAST('Kurtosis20'), groups='sw1'),260 'Kurtosis60': CSQuantiles(LAST('Kurtosis60'), groups='sw1'),261 'Kurtosis120': CSQuantiles(LAST('Kurtosis120'), groups='sw1'),262 'Alpha20': CSQuantiles(LAST('Alpha20'), groups='sw1'),263 'Alpha60': CSQuantiles(LAST('Alpha60'), groups='sw1'),264 'Alpha120': CSQuantiles(LAST('Alpha120'), groups='sw1'),265 'Beta20': CSQuantiles(LAST('Beta20'), groups='sw1'),266 'Beta60': CSQuantiles(LAST('Beta60'), groups='sw1'),267 'Beta120': CSQuantiles(LAST('Beta60'), groups='sw1'),268 'SharpeRatio20': CSQuantiles(LAST('SharpeRatio20'), groups='sw1'),269 'SharpeRatio60': CSQuantiles(LAST('SharpeRatio60'), groups='sw1'),270 'SharpeRatio120': CSQuantiles(LAST('SharpeRatio120'), groups='sw1'),271 'TreynorRatio20': CSQuantiles(LAST('TreynorRatio20'), groups='sw1'),272 'TreynorRatio60': CSQuantiles(LAST('TreynorRatio60'), groups='sw1'),273 'TreynorRatio120': CSQuantiles(LAST('TreynorRatio120'), groups='sw1'),274 'InformationRatio20': CSQuantiles(LAST('InformationRatio20'), groups='sw1'),275 'InformationRatio60': CSQuantiles(LAST('InformationRatio60'), groups='sw1'),276 'InformationRatio120': CSQuantiles(LAST('InformationRatio120'), groups='sw1'),277 'GainVariance20': CSQuantiles(LAST('GainVariance20'), groups='sw1'),278 'GainVariance60': CSQuantiles(LAST('GainVariance60'), groups='sw1'),279 'GainVariance120': CSQuantiles(LAST('GainVariance120'), groups='sw1'),280 'LossVariance20': CSQuantiles(LAST('LossVariance20'), groups='sw1'),281 'LossVariance60': CSQuantiles(LAST('LossVariance60'), groups='sw1'),282 'LossVariance120': CSQuantiles(LAST('LossVariance120'), groups='sw1'),283 'GainLossVarianceRatio20': CSQuantiles(LAST('GainLossVarianceRatio20'), groups='sw1'),284 'GainLossVarianceRatio60': CSQuantiles(LAST('GainLossVarianceRatio60'), groups='sw1'),285 'GainLossVarianceRatio120': CSQuantiles(LAST('GainLossVarianceRatio120'), groups='sw1'),286 'RealizedVolatility': CSQuantiles(LAST('RealizedVolatility'), groups='sw1'),287 'REVS60': CSQuantiles(LAST('REVS60'), groups='sw1'),288 'REVS120': CSQuantiles(LAST('REVS120'), groups='sw1'),289 'REVS250': CSQuantiles(LAST('REVS250'), groups='sw1'),290 'REVS750': CSQuantiles(LAST('REVS750'), groups='sw1'),291 'REVS5m20': CSQuantiles(LAST('REVS5m20'), groups='sw1'),292 'REVS5m60': CSQuantiles(LAST('REVS5m60'), groups='sw1'),293 'REVS5Indu1': CSQuantiles(LAST('REVS5Indu1'), groups='sw1'),294 'REVS20Indu1': CSQuantiles(LAST('REVS20Indu1'), groups='sw1'),295 'Volumn1M': CSQuantiles(LAST('Volumn1M'), groups='sw1'),296 'Volumn3M': CSQuantiles(LAST('Volumn3M'), groups='sw1'),297 'Price1M': CSQuantiles(LAST('Price1M'), groups='sw1'),298 'Price3M': CSQuantiles(LAST('Price3M'), groups='sw1'),299 'Price1Y': CSQuantiles(LAST('Price1Y'), groups='sw1'),300 'Rank1M': CSQuantiles(LAST('Rank1M'), groups='sw1'),301 'CashDividendCover': CSQuantiles(LAST('CashDividendCover'), groups='sw1'),302 'DividendCover': CSQuantiles(LAST('DividendCover'), groups='sw1'),303 'DividendPaidRatio': CSQuantiles(LAST('DividendPaidRatio'), groups='sw1'),304 'RetainedEarningRatio': CSQuantiles(LAST('RetainedEarningRatio'), groups='sw1'),305 'CashEquivalentPS': CSQuantiles(LAST('CashEquivalentPS'), groups='sw1'),306 'DividendPS': CSQuantiles(LAST('DividendPS'), groups='sw1'),307 'EPSTTM': CSQuantiles(LAST('EPSTTM'), groups='sw1'),308 'NetAssetPS': CSQuantiles(LAST('NetAssetPS'), groups='sw1'),309 'TORPS': CSQuantiles(LAST('TORPS'), groups='sw1'),310 'TORPSLatest': CSQuantiles(LAST('TORPSLatest'), groups='sw1'),311 'OperatingRevenuePS': CSQuantiles(LAST('OperatingRevenuePS'), groups='sw1'),312 'OperatingRevenuePSLatest': CSQuantiles(LAST('OperatingRevenuePSLatest'), groups='sw1'),313 'OperatingProfitPS': CSQuantiles(LAST('OperatingProfitPS'), groups='sw1'),314 'OperatingProfitPSLatest': CSQuantiles(LAST('OperatingProfitPSLatest'), groups='sw1'),315 'CapitalSurplusFundPS': CSQuantiles(LAST('CapitalSurplusFundPS'), groups='sw1'),316 'SurplusReserveFundPS': CSQuantiles(LAST('SurplusReserveFundPS'), groups='sw1'),317 'UndividedProfitPS': CSQuantiles(LAST('UndividedProfitPS'), groups='sw1'),318 'RetainedEarningsPS': CSQuantiles(LAST('RetainedEarningsPS'), groups='sw1'),319 'OperCashFlowPS': CSQuantiles(LAST('OperCashFlowPS'), groups='sw1'),320 'CashFlowPS': CSQuantiles(LAST('CashFlowPS'), groups='sw1'),321 'NetNonOIToTP': CSQuantiles(LAST('NetNonOIToTP'), groups='sw1'),322 'NetNonOIToTPLatest': CSQuantiles(LAST('NetNonOIToTPLatest'), groups='sw1'),323 'PeriodCostsRate': CSQuantiles(LAST('PeriodCostsRate'), groups='sw1'),324 'InterestCover': CSQuantiles(LAST('InterestCover'), groups='sw1'),325 'NetProfitGrowRate3Y': CSQuantiles(LAST('NetProfitGrowRate3Y'), groups='sw1'),326 'NetProfitGrowRate5Y': CSQuantiles(LAST('NetProfitGrowRate5Y'), groups='sw1'),327 'OperatingRevenueGrowRate3Y': CSQuantiles(LAST('OperatingRevenueGrowRate3Y'), groups='sw1'),328 'OperatingRevenueGrowRate5Y': CSQuantiles(LAST('OperatingRevenueGrowRate5Y'), groups='sw1'),329 'NetCashFlowGrowRate': CSQuantiles(LAST('NetCashFlowGrowRate'), groups='sw1'),330 'NetProfitCashCover': CSQuantiles(LAST('NetProfitCashCover'), groups='sw1'),331 'OperCashInToAsset': CSQuantiles(LAST('OperCashInToAsset'), groups='sw1'),332 'CashConversionCycle': CSQuantiles(LAST('CashConversionCycle'), groups='sw1'),333 'OperatingCycle': CSQuantiles(LAST('OperatingCycle'), groups='sw1'),334 'PEG3Y': CSQuantiles(LAST('PEG3Y'), groups='sw1'),335 'PEG5Y': CSQuantiles(LAST('PEG5Y'), groups='sw1'),336 'PEIndu': CSQuantiles(LAST('PEIndu'), groups='sw1'),337 'PBIndu': CSQuantiles(LAST('PBIndu'), groups='sw1'),338 'PSIndu': CSQuantiles(LAST('PSIndu'), groups='sw1'),339 'PCFIndu': CSQuantiles(LAST('PCFIndu'), groups='sw1'),340 'PEHist20': CSQuantiles(LAST('PEHist20'), groups='sw1'),341 'PEHist60': CSQuantiles(LAST('PEHist60'), groups='sw1'),342 'PEHist120': CSQuantiles(LAST('PEHist120'), groups='sw1'),343 'PEHist250': CSQuantiles(LAST('PEHist250'), groups='sw1'),344 'StaticPE': CSQuantiles(LAST('StaticPE'), groups='sw1'),345 'ForwardPE': CSQuantiles(LAST('ForwardPE'), groups='sw1'),346 'EnterpriseFCFPS': CSQuantiles(LAST('EnterpriseFCFPS'), groups='sw1'),347 'ShareholderFCFPS': CSQuantiles(LAST('ShareholderFCFPS'), groups='sw1'),348 'ROEDiluted': CSQuantiles(LAST('ROEDiluted'), groups='sw1'),349 'ROEAvg': CSQuantiles(LAST('ROEAvg'), groups='sw1'),350 'ROEWeighted': CSQuantiles(LAST('ROEWeighted'), groups='sw1'),351 'ROECut': CSQuantiles(LAST('ROECut'), groups='sw1'),352 'ROECutWeighted': CSQuantiles(LAST('ROECutWeighted'), groups='sw1'),353 'ROIC': CSQuantiles(LAST('ROIC'), groups='sw1'),354 'ROAEBIT': CSQuantiles(LAST('ROAEBIT'), groups='sw1'),355 'ROAEBITTTM': CSQuantiles(LAST('ROAEBITTTM'), groups='sw1'),356 'OperatingNIToTP': CSQuantiles(LAST('OperatingNIToTP'), groups='sw1'),357 'OperatingNIToTPLatest': CSQuantiles(LAST('OperatingNIToTPLatest'), groups='sw1'),358 'InvestRAssociatesToTP': CSQuantiles(LAST('InvestRAssociatesToTP'), groups='sw1'),359 'InvestRAssociatesToTPLatest': CSQuantiles(LAST('InvestRAssociatesToTPLatest'), groups='sw1'),360 'NPCutToNP': CSQuantiles(LAST('NPCutToNP'), groups='sw1'),361 'SuperQuickRatio': CSQuantiles(LAST('SuperQuickRatio'), groups='sw1'),362 'TSEPToInterestBearDebt': CSQuantiles(LAST('TSEPToInterestBearDebt'), groups='sw1'),363 'DebtTangibleEquityRatio': CSQuantiles(LAST('DebtTangibleEquityRatio'), groups='sw1'),364 'TangibleAToInteBearDebt': CSQuantiles(LAST('TangibleAToInteBearDebt'), groups='sw1'),365 'TangibleAToNetDebt': CSQuantiles(LAST('TangibleAToNetDebt'), groups='sw1'),366 'NOCFToTLiability': CSQuantiles(LAST('NOCFToTLiability'), groups='sw1'),367 'NOCFToInterestBearDebt': CSQuantiles(LAST('NOCFToInterestBearDebt'), groups='sw1'),368 'NOCFToNetDebt': CSQuantiles(LAST('NOCFToNetDebt'), groups='sw1'),369 'TSEPToTotalCapital': CSQuantiles(LAST('TSEPToTotalCapital'), groups='sw1'),370 'InteBearDebtToTotalCapital': CSQuantiles(LAST('InteBearDebtToTotalCapital'), groups='sw1'),371 'NPParentCompanyCutYOY': CSQuantiles(LAST('NPParentCompanyCutYOY'), groups='sw1'),372 'SalesServiceCashToORLatest': CSQuantiles(LAST('SalesServiceCashToORLatest'), groups='sw1'),373 'CashRateOfSalesLatest': CSQuantiles(LAST('CashRateOfSalesLatest'), groups='sw1'),374 'NOCFToOperatingNILatest': CSQuantiles(LAST('NOCFToOperatingNILatest'), groups='sw1'),375 'TotalAssets': CSQuantiles(LAST('TotalAssets'), groups='sw1'),376 'MktValue': CSQuantiles(LAST('MktValue'), groups='sw1'),377 'NegMktValue': CSQuantiles(LAST('NegMktValue'), groups='sw1'),378 'TEAP': CSQuantiles(LAST('TEAP'), groups='sw1'),379 'NIAP': CSQuantiles(LAST('NIAP'), groups='sw1'),380 'TotalFixedAssets': CSQuantiles(LAST('TotalFixedAssets'), groups='sw1'),381 'IntFreeCL': CSQuantiles(LAST('IntFreeCL'), groups='sw1'),382 'IntFreeNCL': CSQuantiles(LAST('IntFreeNCL'), groups='sw1'),383 'IntCL': CSQuantiles(LAST('IntCL'), groups='sw1'),384 'IntDebt': CSQuantiles(LAST('IntDebt'), groups='sw1'),385 'NetDebt': CSQuantiles(LAST('NetDebt'), groups='sw1'),386 'NetTangibleAssets': CSQuantiles(LAST('NetTangibleAssets'), groups='sw1'),387 'WorkingCapital': CSQuantiles(LAST('WorkingCapital'), groups='sw1'),388 'NetWorkingCapital': CSQuantiles(LAST('WorkingCapital'), groups='sw1'),389 'TotalPaidinCapital': CSQuantiles(LAST('TotalPaidinCapital'), groups='sw1'),390 'RetainedEarnings': CSQuantiles(LAST('RetainedEarnings'), groups='sw1'),391 'OperateNetIncome': CSQuantiles(LAST('OperateNetIncome'), groups='sw1'),392 'ValueChgProfit': CSQuantiles(LAST('ValueChgProfit'), groups='sw1'),393 'NetIntExpense': CSQuantiles(LAST('NetIntExpense'), groups='sw1'),394 'EBIT': CSQuantiles(LAST('EBIT'), groups='sw1'),395 'EBITDA': CSQuantiles(LAST('EBITDA'), groups='sw1'),396 'EBIAT': CSQuantiles(LAST('EBIAT'), groups='sw1'),397 'NRProfitLoss': CSQuantiles(LAST('NRProfitLoss'), groups='sw1'),398 'NIAPCut': CSQuantiles(LAST('NIAPCut'), groups='sw1'),399 'FCFF': CSQuantiles(LAST('FCFF'), groups='sw1'),400 'FCFE': CSQuantiles(LAST('FCFE'), groups='sw1'),401 'DA': CSQuantiles(LAST('DA'), groups='sw1'),402 'TRevenueTTM': CSQuantiles(LAST('TRevenueTTM'), groups='sw1'),403 'TCostTTM': CSQuantiles(LAST('TCostTTM'), groups='sw1'),404 'RevenueTTM': CSQuantiles(LAST('RevenueTTM'), groups='sw1'),405 'CostTTM': CSQuantiles(LAST('CostTTM'), groups='sw1'),406 'GrossProfitTTM': CSQuantiles(LAST('GrossProfitTTM'), groups='sw1'),407 'SalesExpenseTTM': CSQuantiles(LAST('SalesExpenseTTM'), groups='sw1'),408 'AdminExpenseTTM': CSQuantiles(LAST('AdminExpenseTTM'), groups='sw1'),409 'FinanExpenseTTM': CSQuantiles(LAST('FinanExpenseTTM'), groups='sw1'),410 'AssetImpairLossTTM': CSQuantiles(LAST('AssetImpairLossTTM'), groups='sw1'),411 'NPFromOperatingTTM': CSQuantiles(LAST('NPFromOperatingTTM'), groups='sw1'),412 'NPFromValueChgTTM': CSQuantiles(LAST('NPFromValueChgTTM'), groups='sw1'),413 'OperateProfitTTM': CSQuantiles(LAST('OperateProfitTTM'), groups='sw1'),414 'NonOperatingNPTTM': CSQuantiles(LAST('NonOperatingNPTTM'), groups='sw1'),415 'TProfitTTM': CSQuantiles(LAST('TProfitTTM'), groups='sw1'),416 'NetProfitTTM': CSQuantiles(LAST('NetProfitTTM'), groups='sw1'),417 'NetProfitAPTTM': CSQuantiles(LAST('NetProfitAPTTM'), groups='sw1'),418 'SaleServiceRenderCashTTM': CSQuantiles(LAST('SaleServiceRenderCashTTM'), groups='sw1'),419 'NetOperateCFTTM': CSQuantiles(LAST('NetOperateCFTTM'), groups='sw1'),420 'NetInvestCFTTM': CSQuantiles(LAST('NetInvestCFTTM'), groups='sw1'),421 'NetFinanceCFTTM': CSQuantiles(LAST('NetFinanceCFTTM'), groups='sw1'),422 'GrossProfit': CSQuantiles(LAST('GrossProfit'), groups='sw1'),423 'Beta252': CSQuantiles(LAST('Beta252'), groups='sw1'),424 'RSTR504': CSQuantiles(LAST('RSTR504'), groups='sw1'),425 'EPIBS': CSQuantiles(LAST('EPIBS'), groups='sw1'),426 'CETOP': CSQuantiles(LAST('CETOP'), groups='sw1'),427 'DASTD': CSQuantiles(LAST('DASTD'), groups='sw1'),428 'CmraCNE5': CSQuantiles(LAST('CmraCNE5'), groups='sw1'),429 'HsigmaCNE5': CSQuantiles(LAST('HsigmaCNE5'), groups='sw1'),430 'SGRO': CSQuantiles(LAST('SGRO'), groups='sw1'),431 'EgibsLong': CSQuantiles(LAST('EgibsLong'), groups='sw1'),432 'STOM': CSQuantiles(LAST('STOM'), groups='sw1'),433 'STOQ': CSQuantiles(LAST('STOQ'), groups='sw1'),434 'STOA': CSQuantiles(LAST('STOA'), groups='sw1'),435 'NLSIZE': CSQuantiles(LAST('NLSIZE'), groups='sw1')}436# alpha191 LAST437alpha_factor_store = {438 'alpha_1': LAST('alpha_1'), 'alpha_2': LAST('alpha_2'), 'alpha_3': LAST('alpha_3'),439 'alpha_4': LAST('alpha_4'), 'alpha_5': LAST('alpha_5'), 'alpha_6': LAST('alpha_6'),440 'alpha_7': LAST('alpha_7'), 'alpha_8': LAST('alpha_8'), 'alpha_9': LAST('alpha_9'),441 'alpha_10': LAST('alpha_10'), 'alpha_11': LAST('alpha_11'), 'alpha_12': LAST('alpha_12'),442 'alpha_13': LAST('alpha_13'), 'alpha_14': LAST('alpha_14'), 'alpha_15': LAST('alpha_15'),443 'alpha_16': LAST('alpha_16'), 'alpha_17': LAST('alpha_17'), 'alpha_18': LAST('alpha_18'),444 'alpha_19': LAST('alpha_19'), 'alpha_20': LAST('alpha_20'), 'alpha_21': LAST('alpha_21'),445 'alpha_22': LAST('alpha_22'), 'alpha_23': LAST('alpha_23'), 'alpha_24': LAST('alpha_24'),446 'alpha_25': LAST('alpha_25'), 'alpha_26': LAST('alpha_26'), 'alpha_27': LAST('alpha_27'),447 'alpha_28': LAST('alpha_28'), 'alpha_29': LAST('alpha_29'), 'alpha_30': LAST('alpha_30'),448 'alpha_31': LAST('alpha_31'), 'alpha_32': LAST('alpha_32'), 'alpha_33': LAST('alpha_33'),449 'alpha_34': LAST('alpha_34'), 'alpha_35': LAST('alpha_35'), 'alpha_36': LAST('alpha_36'),450 'alpha_37': LAST('alpha_37'), 'alpha_38': LAST('alpha_38'), 'alpha_39': LAST('alpha_39'),451 'alpha_40': LAST('alpha_40'), 'alpha_41': LAST('alpha_41'), 'alpha_42': LAST('alpha_42'),452 'alpha_43': LAST('alpha_43'), 'alpha_44': LAST('alpha_44'), 'alpha_45': LAST('alpha_45'),453 'alpha_46': LAST('alpha_46'), 'alpha_47': LAST('alpha_47'), 'alpha_48': LAST('alpha_48'),454 'alpha_49': LAST('alpha_49'), 'alpha_50': LAST('alpha_50'), 'alpha_51': LAST('alpha_51'),455 'alpha_52': LAST('alpha_52'), 'alpha_53': LAST('alpha_53'), 'alpha_54': LAST('alpha_54'),456 'alpha_55': LAST('alpha_55'), 'alpha_56': LAST('alpha_56'), 'alpha_57': LAST('alpha_57'),457 'alpha_58': LAST('alpha_58'), 'alpha_59': LAST('alpha_59'), 'alpha_60': LAST('alpha_60'),458 'alpha_61': LAST('alpha_61'), 'alpha_62': LAST('alpha_62'), 'alpha_63': LAST('alpha_63'),459 'alpha_64': LAST('alpha_64'), 'alpha_65': LAST('alpha_65'), 'alpha_66': LAST('alpha_66'),460 'alpha_67': LAST('alpha_67'), 'alpha_68': LAST('alpha_68'), 'alpha_69': LAST('alpha_69'),461 'alpha_70': LAST('alpha_70'), 'alpha_71': LAST('alpha_71'), 'alpha_72': LAST('alpha_72'),462 'alpha_73': LAST('alpha_73'), 'alpha_74': LAST('alpha_74'), 'alpha_75': LAST('alpha_75'),463 'alpha_76': LAST('alpha_76'), 'alpha_77': LAST('alpha_77'), 'alpha_78': LAST('alpha_78'),464 'alpha_79': LAST('alpha_79'), 'alpha_80': LAST('alpha_80'), 'alpha_81': LAST('alpha_81'),465 'alpha_82': LAST('alpha_82'), 'alpha_83': LAST('alpha_83'), 'alpha_84': LAST('alpha_84'),466 'alpha_85': LAST('alpha_85'), 'alpha_86': LAST('alpha_86'), 'alpha_87': LAST('alpha_87'),467 'alpha_88': LAST('alpha_88'), 'alpha_89': LAST('alpha_89'), 'alpha_90': LAST('alpha_90'),468 'alpha_91': LAST('alpha_91'), 'alpha_92': LAST('alpha_92'), 'alpha_93': LAST('alpha_93'),469 'alpha_94': LAST('alpha_94'), 'alpha_95': LAST('alpha_95'), 'alpha_96': LAST('alpha_96'),470 'alpha_97': LAST('alpha_97'), 'alpha_98': LAST('alpha_98'), 'alpha_99': LAST('alpha_99'),471 'alpha_100': LAST('alpha_100'), 'alpha_101': LAST('alpha_101'), 'alpha_102': LAST('alpha_102'),472 'alpha_103': LAST('alpha_103'), 'alpha_104': LAST('alpha_104'), 'alpha_105': LAST('alpha_105'),473 'alpha_106': LAST('alpha_106'), 'alpha_107': LAST('alpha_107'), 'alpha_108': LAST('alpha_108'),474 'alpha_109': LAST('alpha_109'), 'alpha_110': LAST('alpha_110'), 'alpha_111': LAST('alpha_111'),475 'alpha_112': LAST('alpha_113'), 'alpha_113': LAST('alpha_113'), 'alpha_114': LAST('alpha_114'),476 'alpha_115': LAST('alpha_116'), 'alpha_116': LAST('alpha_116'), 'alpha_117': LAST('alpha_117'),477 'alpha_118': LAST('alpha_118'), 'alpha_119': LAST('alpha_119'), 'alpha_120': LAST('alpha_120'),478 'alpha_121': LAST('alpha_121'), 'alpha_122': LAST('alpha_122'), 'alpha_123': LAST('alpha_123'),479 'alpha_124': LAST('alpha_124'), 'alpha_125': LAST('alpha_125'), 'alpha_126': LAST('alpha_126'),480 'alpha_127': LAST('alpha_127'), 'alpha_128': LAST('alpha_128'), 'alpha_129': LAST('alpha_129'),481 'alpha_130': LAST('alpha_130'), 'alpha_131': LAST('alpha_131'), 'alpha_132': LAST('alpha_132'),482 'alpha_133': LAST('alpha_133'), 'alpha_134': LAST('alpha_134'), 'alpha_135': LAST('alpha_135'),483 'alpha_136': LAST('alpha_136'), 'alpha_137': LAST('alpha_137'), 'alpha_138': LAST('alpha_138'),484 'alpha_139': LAST('alpha_139'), 'alpha_140': LAST('alpha_140'), 'alpha_141': LAST('alpha_141'),485 'alpha_142': LAST('alpha_142'), 'alpha_143': LAST('alpha_143'), 'alpha_144': LAST('alpha_144'),486 'alpha_145': LAST('alpha_145'), 'alpha_146': LAST('alpha_146'), 'alpha_147': LAST('alpha_147'),487 'alpha_148': LAST('alpha_148'), 'alpha_149': LAST('alpha_149'), 'alpha_150': LAST('alpha_150'),488 'alpha_151': LAST('alpha_151'), 'alpha_152': LAST('alpha_152'), 'alpha_153': LAST('alpha_153'),489 'alpha_154': LAST('alpha_154'), 'alpha_155': LAST('alpha_155'), 'alpha_156': LAST('alpha_156'),490 'alpha_157': LAST('alpha_157'), 'alpha_158': LAST('alpha_158'), 'alpha_159': LAST('alpha_159'),491 'alpha_160': LAST('alpha_160'), 'alpha_161': LAST('alpha_161'), 'alpha_162': LAST('alpha_162'),492 'alpha_163': LAST('alpha_163'), 'alpha_164': LAST('alpha_164'), 'alpha_165': LAST('alpha_165'),493 'alpha_166': LAST('alpha_166'), 'alpha_167': LAST('alpha_167'), 'alpha_168': LAST('alpha_168'),494 'alpha_169': LAST('alpha_169'), 'alpha_170': LAST('alpha_170'), 'alpha_171': LAST('alpha_171'),495 'alpha_172': LAST('alpha_172'), 'alpha_173': LAST('alpha_173'), 'alpha_174': LAST('alpha_174'),496 'alpha_175': LAST('alpha_175'), 'alpha_176': LAST('alpha_176'), 'alpha_177': LAST('alpha_177'),497 'alpha_178': LAST('alpha_178'), 'alpha_179': LAST('alpha_179'), 'alpha_180': LAST('alpha_180'),498 'alpha_181': LAST('alpha_181'), 'alpha_182': LAST('alpha_182'), 'alpha_183': LAST('alpha_183'),499 'alpha_184': LAST('alpha_184'), 'alpha_185': LAST('alpha_185'), 'alpha_186': LAST('alpha_186'),500 'alpha_187': LAST('alpha_187'), 'alpha_188': LAST('alpha_188'), 'alpha_189': LAST('alpha_189'),501 'alpha_190': LAST('alpha_190'), 'alpha_191': LAST('alpha_191')502}503# uqer因子 LAST504basic_factor_last_store = {505 'AccountsPayablesTDays': LAST('AccountsPayablesTDays'),506 'AccountsPayablesTRate': LAST('AccountsPayablesTRate'),507 'AdminiExpenseRate': LAST('AdminiExpenseRate'),508 'ARTDays': LAST('ARTDays'),509 'ARTRate': LAST('ARTRate'),510 'ASSI': LAST('ASSI'),511 'BLEV': LAST('BLEV'),512 'BondsPayableToAsset': LAST('BondsPayableToAsset'),513 'CashRateOfSales': LAST('CashRateOfSales'),514 'CashToCurrentLiability': LAST('CashToCurrentLiability'),515 'CMRA': LAST('CMRA'),516 'CTOP': LAST('CTOP'),517 'CTP5': LAST('CTP5'),518 'CurrentAssetsRatio': LAST('CurrentAssetsRatio'),519 'CurrentAssetsTRate': LAST('CurrentAssetsTRate'),520 'CurrentRatio': LAST('CurrentRatio'),521 'DAVOL10': LAST('DAVOL10'),522 'DAVOL20': LAST('DAVOL20'),523 'DAVOL5': LAST('DAVOL5'),524 'DDNBT': LAST('DDNBT'),525 'DDNCR': LAST('DDNCR'),526 'DDNSR': LAST('DDNSR'),527 'DebtEquityRatio': LAST('DebtEquityRatio'),528 'DebtsAssetRatio': LAST('DebtsAssetRatio'),529 'DHILO': LAST('DHILO'),530 'DilutedEPS': LAST('DilutedEPS'),531 'DVRAT': LAST('DVRAT'),532 'EBITToTOR': LAST('EBITToTOR'),533 'EGRO': LAST('EGRO'),534 'EMA10': LAST('EMA10'),535 'EMA120': LAST('EMA120'),536 'EMA20': LAST('EMA20'),537 'EMA5': LAST('EMA5'),538 'EMA60': LAST('EMA60'),539 'EPS': LAST('EPS'),540 'EquityFixedAssetRatio': LAST('EquityFixedAssetRatio'),541 'EquityToAsset': LAST('EquityToAsset'),542 'EquityTRate': LAST('EquityTRate'),543 'ETOP': LAST('ETOP'),544 'ETP5': LAST('ETP5'),545 'FinancialExpenseRate': LAST('FinancialExpenseRate'),546 'FinancingCashGrowRate': LAST('FinancingCashGrowRate'),547 'FixAssetRatio': LAST('FixAssetRatio'),548 'FixedAssetsTRate': LAST('FixedAssetsTRate'),549 'GrossIncomeRatio': LAST('GrossIncomeRatio'),550 'HBETA': LAST('HBETA'),551 'HSIGMA': LAST('HBETA'),552 'IntangibleAssetRatio': LAST('IntangibleAssetRatio'),553 'InventoryTDays': LAST('InventoryTDays'),554 'InventoryTRate': LAST('InventoryTRate'),555 'InvestCashGrowRate': LAST('InvestCashGrowRate'),556 'LCAP': LAST('LCAP'),557 'LFLO': LAST('LFLO'),558 'LongDebtToAsset': LAST('LongDebtToAsset'),559 'LongDebtToWorkingCapital': LAST('LongDebtToWorkingCapital'),560 'LongTermDebtToAsset': LAST('LongTermDebtToAsset'),561 'MA10': LAST('MA10'),562 'MA120': LAST('MA120'),563 'MA20': LAST('MA20'),564 'MA5': LAST('MA5'),565 'MA60': LAST('MA60'),566 'MAWVAD': LAST('MAWVAD'),567 'MFI': LAST('MFI'),568 'MLEV': LAST('MLEV'),569 'NetAssetGrowRate': LAST('NetAssetGrowRate'),570 'NetProfitGrowRate': LAST('NetProfitGrowRate'),571 'NetProfitRatio': LAST('NetProfitRatio'),572 'NOCFToOperatingNI': LAST('NetProfitRatio'),573 'NonCurrentAssetsRatio': LAST('NonCurrentAssetsRatio'),574 'NPParentCompanyGrowRate': LAST('NPParentCompanyGrowRate'),575 'NPToTOR': LAST('NPToTOR'),576 'OperatingExpenseRate': LAST('OperatingExpenseRate'),577 'OperatingProfitGrowRate': LAST('OperatingProfitGrowRate'),578 'OperatingProfitRatio': LAST('OperatingProfitRatio'),579 'OperatingProfitToTOR': LAST('OperatingProfitToTOR'),580 'OperatingRevenueGrowRate': LAST('OperatingRevenueGrowRate'),581 'OperCashGrowRate': LAST('OperCashGrowRate'),582 'OperCashInToCurrentLiability': LAST('OperCashInToCurrentLiability'),583 'PB': LAST('PB'),584 'PCF': LAST('PCF'),585 'PE': LAST('PE'),586 'PS': LAST('PS'),587 'PSY': LAST('PSY'),588 'QuickRatio': LAST('QuickRatio'),589 'REVS10': LAST('REVS10'),590 'REVS20': LAST('REVS20'),591 'REVS5': LAST('REVS5'),592 'ROA': LAST('REVS5'),593 'ROA5': LAST('ROA5'),594 'ROE': LAST('ROE'),595 'ROE5': LAST('ROE5'),596 'RSI': LAST('RSI'),597 'RSTR12': LAST('RSTR12'),598 'RSTR24': LAST('RSTR24'),599 'SalesCostRatio': LAST('SalesCostRatio'),600 'SaleServiceCashToOR': LAST('SaleServiceCashToOR'),601 'SUE': LAST('SUE'),602 'TaxRatio': LAST('TaxRatio'),603 'TOBT': LAST('TOBT'),604 'TotalAssetGrowRate': LAST('TotalAssetGrowRate'),605 'TotalAssetsTRate': LAST('TotalAssetsTRate'),606 'TotalProfitCostRatio': LAST('TotalProfitCostRatio'),607 'TotalProfitGrowRate': LAST('TotalProfitGrowRate'),608 'VOL10': LAST('VOL10'),609 'VOL120': LAST('VOL120'),610 'VOL20': LAST('VOL20'),611 'VOL240': LAST('VOL240'),612 'VOL5': LAST('VOL5'),613 'VOL60': LAST('VOL60'),614 'WVAD': LAST('WVAD'),615 'REC': LAST('REC'),616 'DAREC': LAST('DAREC'),617 'GREC': LAST('GREC'),618 'FY12P': LAST('FY12P'),619 'DAREV': LAST('DAREV'),620 'GREV': LAST('GREV'),621 'SFY12P': LAST('SFY12P'),622 'DASREV': LAST('DASREV'),623 'GSREV': LAST('GSREV'),624 'FEARNG': LAST('FEARNG'),625 'FSALESG': LAST('FSALESG'),626 'TA2EV': LAST('TA2EV'),627 'CFO2EV': LAST('CFO2EV'),628 'ACCA': LAST('ACCA'),629 'DEGM': LAST('DEGM'),630 'SUOI': LAST('SUOI'),631 'EARNMOM': LAST('EARNMOM'),632 'FiftyTwoWeekHigh': LAST('FiftyTwoWeekHigh'),633 'Volatility': LAST('Volatility'),634 'Skewness': LAST('Skewness'),635 'ILLIQUIDITY': LAST('ILLIQUIDITY'),636 'BackwardADJ': LAST('BackwardADJ'),637 'MACD': LAST('MACD'),638 'ADTM': LAST('ADTM'),639 'ATR14': LAST('ATR14'),640 'ATR6': LAST('ATR6'),641 'BIAS10': LAST('BIAS10'),642 'BIAS20': LAST('BIAS20'),643 'BIAS5': LAST('BIAS5'),644 'BIAS60': LAST('BIAS60'),645 'BollDown': LAST('BollDown'),646 'BollUp': LAST('BollUp'),647 'CCI10': LAST('CCI10'),648 'CCI20': LAST('CCI20'),649 'CCI5': LAST('CCI5'),650 'CCI88': LAST('CCI88'),651 'KDJ_K': LAST('KDJ_K'),652 'KDJ_D': LAST('KDJ_D'),653 'KDJ_J': LAST('KDJ_J'),654 'ROC6': LAST('ROC6'),655 'ROC20': LAST('ROC20'),656 'SBM': LAST('SBM'),657 'STM': LAST('STM'),658 'UpRVI': LAST('UpRVI'),659 'DownRVI': LAST('DownRVI'),660 'RVI': LAST('RVI'),661 'SRMI': LAST('SRMI'),662 'ChandeSD': LAST('ChandeSD'),663 'ChandeSU': LAST('ChandeSU'),664 'CMO': LAST('CMO'),665 'DBCD': LAST('DBCD'),666 'ARC': LAST('ARC'),667 'OBV': LAST('OBV'),668 'OBV6': LAST('OBV6'),669 'OBV20': LAST('OBV20'),670 'TVMA20': LAST('TVMA20'),671 'TVMA6': LAST('TVMA6'),672 'TVSTD20': LAST('TVSTD20'),673 'TVSTD6': LAST('TVSTD6'),674 'VDEA': LAST('VDEA'),675 'VDIFF': LAST('VDIFF'),676 'VEMA10': LAST('VEMA10'),677 'VEMA12': LAST('VEMA12'),678 'VEMA26': LAST('VEMA26'),679 'VEMA5': LAST('VEMA5'),680 'VMACD': LAST('VMACD'),681 'VR': LAST('VR'),682 'VROC12': LAST('VROC12'),683 'VROC6': LAST('VROC6'),684 'VSTD10': LAST('VSTD10'),685 'VSTD20': LAST('VSTD20'),686 'KlingerOscillator': LAST('KlingerOscillator'),687 'MoneyFlow20': LAST('MoneyFlow20'),688 'AD': LAST('AD'),689 'AD20': LAST('AD20'),690 'AD6': LAST('AD6'),691 'CoppockCurve': LAST('CoppockCurve'),692 'ASI': LAST('ASI'),693 'ChaikinOscillator': LAST('ChaikinOscillator'),694 'ChaikinVolatility': LAST('ChaikinVolatility'),695 'EMV14': LAST('EMV14'),696 'EMV6': LAST('EMV6'),697 'plusDI': LAST('plusDI'),698 'minusDI': LAST('minusDI'),699 'ADX': LAST('ADX'),700 'ADXR': LAST('ADXR'),701 'Aroon': LAST('Aroon'),702 'AroonDown': LAST('AroonDown'),703 'AroonUp': LAST('AroonUp'),704 'DEA': LAST('DEA'),705 'DIFF': LAST('DIFF'),706 'DDI': LAST('DDI'),707 'DIZ': LAST('DIZ'),708 'DIF': LAST('DIF'),709 'MTM': LAST('MTM'),710 'MTMMA': LAST('MTMMA'),711 'PVT': LAST('PVT'),712 'PVT6': LAST('PVT6'),713 'PVT12': LAST('PVT12'),714 'TRIX5': LAST('TRIX5'),715 'TRIX10': LAST('TRIX10'),716 'UOS': LAST('UOS'),717 'MA10RegressCoeff12': LAST('MA10RegressCoeff12'),718 'MA10RegressCoeff6': LAST('MA10RegressCoeff6'),719 'PLRC6': LAST('PLRC6'),720 'PLRC12': LAST('PLRC12'),721 'SwingIndex': LAST('SwingIndex'),722 'Ulcer10': LAST('Ulcer10'),723 'Ulcer5': LAST('Ulcer5'),724 'Hurst': LAST('Hurst'),725 'ACD6': LAST('ACD6'),726 'ACD20': LAST('ACD20'),727 'EMA12': LAST('EMA12'),728 'EMA26': LAST('EMA26'),729 'APBMA': LAST('APBMA'),730 'BBI': LAST('APBMA'),731 'BBIC': LAST('BBIC'),732 'TEMA10': LAST('TEMA10'),733 'TEMA5': LAST('TEMA5'),734 'MA10Close': LAST('MA10Close'),735 'AR': LAST('AR'),736 'BR': LAST('BR'),737 'ARBR': LAST('ARBR'),738 'CR20': LAST('CR20'),739 'MassIndex': LAST('MassIndex'),740 'BearPower': LAST('BearPower'),741 'BullPower': LAST('BullPower'),742 'Elder': LAST('Elder'),743 'NVI': LAST('NVI'),744 'PVI': LAST('PVI'),745 'RC12': LAST('RC12'),746 'RC24': LAST('RC24'),747 'JDQS20': LAST('JDQS20'),748 'Variance20': LAST('Variance20'),749 'Variance60': LAST('Variance60'),750 'Variance120': LAST('Variance120'),751 'Kurtosis20': LAST('Kurtosis20'),752 'Kurtosis60': LAST('Kurtosis60'),753 'Kurtosis120': LAST('Kurtosis120'),754 'Alpha20': LAST('Alpha20'),755 'Alpha60': LAST('Alpha60'),756 'Alpha120': LAST('Alpha120'),757 'Beta20': LAST('Beta20'),758 'Beta60': LAST('Beta60'),759 'Beta120': LAST('Beta60'),760 'SharpeRatio20': LAST('SharpeRatio20'),761 'SharpeRatio60': LAST('SharpeRatio60'),762 'SharpeRatio120': LAST('SharpeRatio120'),763 'TreynorRatio20': LAST('TreynorRatio20'),764 'TreynorRatio60': LAST('TreynorRatio60'),765 'TreynorRatio120': LAST('TreynorRatio120'),766 'InformationRatio20': LAST('InformationRatio20'),767 'InformationRatio60': LAST('InformationRatio60'),768 'InformationRatio120': LAST('InformationRatio120'),769 'GainVariance20': LAST('GainVariance20'),770 'GainVariance60': LAST('GainVariance60'),771 'GainVariance120': LAST('GainVariance120'),772 'LossVariance20': LAST('LossVariance20'),773 'LossVariance60': LAST('LossVariance60'),774 'LossVariance120': LAST('LossVariance120'),775 'GainLossVarianceRatio20': LAST('GainLossVarianceRatio20'),776 'GainLossVarianceRatio60': LAST('GainLossVarianceRatio60'),777 'GainLossVarianceRatio120': LAST('GainLossVarianceRatio120'),778 'RealizedVolatility': LAST('RealizedVolatility'),779 'REVS60': LAST('REVS60'),780 'REVS120': LAST('REVS120'),781 'REVS250': LAST('REVS250'),782 'REVS750': LAST('REVS750'),783 'REVS5m20': LAST('REVS5m20'),784 'REVS5m60': LAST('REVS5m60'),785 'REVS5Indu1': LAST('REVS5Indu1'),786 'REVS20Indu1': LAST('REVS20Indu1'),787 'Volumn1M': LAST('Volumn1M'),788 'Volumn3M': LAST('Volumn3M'),789 'Price1M': LAST('Price1M'),790 'Price3M': LAST('Price3M'),791 'Price1Y': LAST('Price1Y'),792 'Rank1M': LAST('Rank1M'),793 'CashDividendCover': LAST('CashDividendCover'),794 'DividendCover': LAST('DividendCover'),795 'DividendPaidRatio': LAST('DividendPaidRatio'),796 'RetainedEarningRatio': LAST('RetainedEarningRatio'),797 'CashEquivalentPS': LAST('CashEquivalentPS'),798 'DividendPS': LAST('DividendPS'),799 'EPSTTM': LAST('EPSTTM'),800 'NetAssetPS': LAST('NetAssetPS'),801 'TORPS': LAST('TORPS'),802 'TORPSLatest': LAST('TORPSLatest'),803 'OperatingRevenuePS': LAST('OperatingRevenuePS'),804 'OperatingRevenuePSLatest': LAST('OperatingRevenuePSLatest'),805 'OperatingProfitPS': LAST('OperatingProfitPS'),806 'OperatingProfitPSLatest': LAST('OperatingProfitPSLatest'),807 'CapitalSurplusFundPS': LAST('CapitalSurplusFundPS'),808 'SurplusReserveFundPS': LAST('SurplusReserveFundPS'),809 'UndividedProfitPS': LAST('UndividedProfitPS'),810 'RetainedEarningsPS': LAST('RetainedEarningsPS'),811 'OperCashFlowPS': LAST('OperCashFlowPS'),812 'CashFlowPS': LAST('CashFlowPS'),813 'NetNonOIToTP': LAST('NetNonOIToTP'),814 'NetNonOIToTPLatest': LAST('NetNonOIToTPLatest'),815 'PeriodCostsRate': LAST('PeriodCostsRate'),816 'InterestCover': LAST('InterestCover'),817 'NetProfitGrowRate3Y': LAST('NetProfitGrowRate3Y'),818 'NetProfitGrowRate5Y': LAST('NetProfitGrowRate5Y'),819 'OperatingRevenueGrowRate3Y': LAST('OperatingRevenueGrowRate3Y'),820 'OperatingRevenueGrowRate5Y': LAST('OperatingRevenueGrowRate5Y'),821 'NetCashFlowGrowRate': LAST('NetCashFlowGrowRate'),822 'NetProfitCashCover': LAST('NetProfitCashCover'),823 'OperCashInToAsset': LAST('OperCashInToAsset'),824 'CashConversionCycle': LAST('CashConversionCycle'),825 'OperatingCycle': LAST('OperatingCycle'),826 'PEG3Y': LAST('PEG3Y'),827 'PEG5Y': LAST('PEG5Y'),828 'PEIndu': LAST('PEIndu'),829 'PBIndu': LAST('PBIndu'),830 'PSIndu': LAST('PSIndu'),831 'PCFIndu': LAST('PCFIndu'),832 'PEHist20': LAST('PEHist20'),833 'PEHist60': LAST('PEHist60'),834 'PEHist120': LAST('PEHist120'),835 'PEHist250': LAST('PEHist250'),836 'StaticPE': LAST('StaticPE'),837 'ForwardPE': LAST('ForwardPE'),838 'EnterpriseFCFPS': LAST('EnterpriseFCFPS'),839 'ShareholderFCFPS': LAST('ShareholderFCFPS'),840 'ROEDiluted': LAST('ROEDiluted'),841 'ROEAvg': LAST('ROEAvg'),842 'ROEWeighted': LAST('ROEWeighted'),843 'ROECut': LAST('ROECut'),844 'ROECutWeighted': LAST('ROECutWeighted'),845 'ROIC': LAST('ROIC'),846 'ROAEBIT': LAST('ROAEBIT'),847 'ROAEBITTTM': LAST('ROAEBITTTM'),848 'OperatingNIToTP': LAST('OperatingNIToTP'),849 'OperatingNIToTPLatest': LAST('OperatingNIToTPLatest'),850 'InvestRAssociatesToTP': LAST('InvestRAssociatesToTP'),851 'InvestRAssociatesToTPLatest': LAST('InvestRAssociatesToTPLatest'),852 'NPCutToNP': LAST('NPCutToNP'),853 'SuperQuickRatio': LAST('SuperQuickRatio'),854 'TSEPToInterestBearDebt': LAST('TSEPToInterestBearDebt'),855 'DebtTangibleEquityRatio': LAST('DebtTangibleEquityRatio'),856 'TangibleAToInteBearDebt': LAST('TangibleAToInteBearDebt'),857 'TangibleAToNetDebt': LAST('TangibleAToNetDebt'),858 'NOCFToTLiability': LAST('NOCFToTLiability'),859 'NOCFToInterestBearDebt': LAST('NOCFToInterestBearDebt'),860 'NOCFToNetDebt': LAST('NOCFToNetDebt'),861 'TSEPToTotalCapital': LAST('TSEPToTotalCapital'),862 'InteBearDebtToTotalCapital': LAST('InteBearDebtToTotalCapital'),863 'NPParentCompanyCutYOY': LAST('NPParentCompanyCutYOY'),864 'SalesServiceCashToORLatest': LAST('SalesServiceCashToORLatest'),865 'CashRateOfSalesLatest': LAST('CashRateOfSalesLatest'),866 'NOCFToOperatingNILatest': LAST('NOCFToOperatingNILatest'),867 'TotalAssets': LAST('TotalAssets'),868 'MktValue': LAST('MktValue'),869 'NegMktValue': LAST('NegMktValue'),870 'TEAP': LAST('TEAP'),871 'NIAP': LAST('NIAP'),872 'TotalFixedAssets': LAST('TotalFixedAssets'),873 'IntFreeCL': LAST('IntFreeCL'),874 'IntFreeNCL': LAST('IntFreeNCL'),875 'IntCL': LAST('IntCL'),876 'IntDebt': LAST('IntDebt'),877 'NetDebt': LAST('NetDebt'),878 'NetTangibleAssets': LAST('NetTangibleAssets'),879 'WorkingCapital': LAST('WorkingCapital'),880 'NetWorkingCapital': LAST('WorkingCapital'),881 'TotalPaidinCapital': LAST('TotalPaidinCapital'),882 'RetainedEarnings': LAST('RetainedEarnings'),883 'OperateNetIncome': LAST('OperateNetIncome'),884 'ValueChgProfit': LAST('ValueChgProfit'),885 'NetIntExpense': LAST('NetIntExpense'),886 'EBIT': LAST('EBIT'),887 'EBITDA': LAST('EBITDA'),888 'EBIAT': LAST('EBIAT'),889 'NRProfitLoss': LAST('NRProfitLoss'),890 'NIAPCut': LAST('NIAPCut'),891 'FCFF': LAST('FCFF'),892 'FCFE': LAST('FCFE'),893 'DA': LAST('DA'),894 'TRevenueTTM': LAST('TRevenueTTM'),895 'TCostTTM': LAST('TCostTTM'),896 'RevenueTTM': LAST('RevenueTTM'),897 'CostTTM': LAST('CostTTM'),898 'GrossProfitTTM': LAST('GrossProfitTTM'),899 'SalesExpenseTTM': LAST('SalesExpenseTTM'),900 'AdminExpenseTTM': LAST('AdminExpenseTTM'),901 'FinanExpenseTTM': LAST('FinanExpenseTTM'),902 'AssetImpairLossTTM': LAST('AssetImpairLossTTM'),903 'NPFromOperatingTTM': LAST('NPFromOperatingTTM'),904 'NPFromValueChgTTM': LAST('NPFromValueChgTTM'),905 'OperateProfitTTM': LAST('OperateProfitTTM'),906 'NonOperatingNPTTM': LAST('NonOperatingNPTTM'),907 'TProfitTTM': LAST('TProfitTTM'),908 'NetProfitTTM': LAST('NetProfitTTM'),909 'NetProfitAPTTM': LAST('NetProfitAPTTM'),910 'SaleServiceRenderCashTTM': LAST('SaleServiceRenderCashTTM'),911 'NetOperateCFTTM': LAST('NetOperateCFTTM'),912 'NetInvestCFTTM': LAST('NetInvestCFTTM'),913 'NetFinanceCFTTM': LAST('NetFinanceCFTTM'),914 'GrossProfit': LAST('GrossProfit'),915 'Beta252': LAST('Beta252'),916 'RSTR504': LAST('RSTR504'),917 'EPIBS': LAST('EPIBS'),918 'CETOP': LAST('CETOP'),919 'DASTD': LAST('DASTD'),920 'CmraCNE5': LAST('CmraCNE5'),921 'HsigmaCNE5': LAST('HsigmaCNE5'),922 'SGRO': LAST('SGRO'),923 'EgibsLong': LAST('EgibsLong'),924 'STOM': LAST('STOM'),925 'STOQ': LAST('STOQ'),926 'STOA': LAST('STOA'),...

Full Screen

Full Screen

run.py

Source:run.py Github

copy

Full Screen

1#! /usr/bin/env python2# -*- coding: utf-8 -*-3"""4@version: ??5@author: li6@file: run.py7@time: 2019-08-05 19:558"""9import time10import sys11sys.path.append('../')12sys.path.append('../../')13sys.path.append('../../../')14import pandas as pd15from PyFin.api import *16from alphamind.api import *17from src.conf.models import *18import numpy as np19from alphamind.execution.naiveexecutor import NaiveExecutor20from datetime import timedelta21from m1_xgb import *22from src.conf.configuration import lgb_conf23import xgboost as xgb24import gc25from flask import Flask, request26app = Flask(__name__)27def create_scenario(train_data, features, label, ref_dates, freq, regress_conf, weight_gap, return_data, risk_total,28 benchmark_total, industry_total, bounds, constraint_risk, total_risk_names, GPUs=True):29 executor = NaiveExecutor()30 trade_dates = []31 transact_cost = 0.00332 previous_pos = pd.DataFrame()33 tune_record = pd.DataFrame()34 current_pos = pd.DataFrame()35 rets = []36 net_rets = []37 turn_overs = []38 leverags = []39 ics = []40 # take ref_dates[i] as an example41 for i, ref_date in enumerate(ref_dates):42 alpha_logger.info('{0} is start'.format(ref_date))43 # machine learning bst_model44 # Filter Training data45 # train data46 trade_date_pre = ref_date - timedelta(days=1)47 trade_date_pre_80 = ref_date - timedelta(days=80)48 # train = train_data[(train_data.trade_date <= trade_date_pre) & (trade_date_pre_80 <= train_data.trade_date)].dropna()49 train = train_data[train_data.trade_date <= trade_date_pre].dropna()50 if len(train) <= 0:51 continue52 x_train = train[features]53 y_train = train[label]54 alpha_logger.info('len_x_train: {0}, len_y_train: {1}'.format(len(x_train.values), len(y_train.values)))55 alpha_logger.info('X_train.shape={0}, X_test.shape = {1}'.format(np.shape(x_train), np.shape(y_train)))56 tic = time.time()57 # training58 xgb_model = XGBooster(regress_conf)59 if GPUs:60 xgb_model.set_params(tree_method='gpu_hist', n_gpus=-1, max_depth=5)61 else:62 xgb_model.set_params(max_depth=5)63 print(xgb_model.get_params)64 best_score, best_round, best_model = xgb_model.fit(x_train, y_train)65 alpha_logger.info('Training time cost {}s'.format(time.time() - tic))66 alpha_logger.info('best_score = {}, best_round = {}'.format(best_score, best_round))67 # Test data68 total_data_test_excess = train_data[train_data.trade_date == ref_date]69 alpha_logger.info('{0} total_data_test_excess: {1}'.format(ref_date, len(total_data_test_excess)))70 if len(total_data_test_excess) <= 0:71 alpha_logger.info('{0} HAS NO DATA!!!'.format(ref_date))72 continue73 industry_matrix = industry_total[industry_total.trade_date == ref_date]74 benchmark_w = benchmark_total[benchmark_total.trade_date == ref_date]75 risk_matrix = risk_total[risk_total.trade_date == ref_date]76 total_data = pd.merge(industry_matrix, benchmark_w, on=['code'], how='left').fillna(0.)77 total_data = pd.merge(total_data, risk_matrix, on=['code'])78 alpha_logger.info('{0} len_of_total_data: {1}'.format(ref_date, len(total_data)))79 total_data_test_excess = pd.merge(total_data, total_data_test_excess, on=['code'])80 alpha_logger.info('{0} len_of_total_data_test_excess: {1}'.format(ref_date, len(total_data_test_excess)))81 codes = total_data_test_excess.code.values.tolist()82 alpha_logger.info('{0} full re-balance: {1}'.format(ref_date, len(codes)))83 dx_returns = return_data[return_data.trade_date == ref_date][['code', 'dx']]84 benchmark_w = total_data_test_excess.weight.values85 alpha_logger.info('shape_of_benchmark_w: {}'.format(np.shape(benchmark_w)))86 is_in_benchmark = (benchmark_w > 0.).astype(float).reshape((-1, 1))87 total_risk_exp = np.concatenate([total_data_test_excess[constraint_risk].values.astype(float),88 is_in_benchmark,89 np.ones_like(is_in_benchmark)],90 axis=1)91 alpha_logger.info('shape_of_total_risk_exp_pre: {}'.format(np.shape(total_risk_exp)))92 total_risk_exp = pd.DataFrame(total_risk_exp, columns=total_risk_names)93 alpha_logger.info('shape_of_total_risk_exp: {}'.format(np.shape(total_risk_exp)))94 constraints = LinearConstraints(bounds, total_risk_exp, benchmark_w)95 alpha_logger.info('constraints: {0} in {1}'.format(np.shape(constraints.risk_targets()), ref_date))96 lbound = np.maximum(0., benchmark_w - weight_gap)97 ubound = weight_gap + benchmark_w98 alpha_logger.info('lbound: {0} in {1}'.format(np.shape(lbound), ref_date))99 alpha_logger.info('ubound: {0} in {1}'.format(np.shape(ubound), ref_date))100 # alpha_logger.info('lbound: \n{}'.format(lbound))101 # alpha_logger.info('ubound: \n{}'.format(ubound))102 # predict103 x_pred = total_data_test_excess[features]104 dpred = xgb.DMatrix(x_pred.values)105 predict_xgboost = best_model.predict(dpred)106 a = np.shape(predict_xgboost)107 predict_xgboost = np.reshape(predict_xgboost, (a[0], -1)).astype(np.float64)108 alpha_logger.info('shape_of_predict_xgboost: {}'.format(np.shape(predict_xgboost)))109 # alpha_logger.info('predict_xgboost: {}'.format(predict_xgboost))110 del xgb_model111 del best_model112 gc.collect()113 # backtest114 try:115 target_pos, _ = er_portfolio_analysis(predict_xgboost,116 total_data_test_excess['industry'].values,117 None,118 constraints,119 False,120 benchmark_w,121 method='risk_neutral',122 lbound=lbound,123 ubound=ubound)124 except:125 import pdb126 pdb.set_trace()127 alpha_logger.info('target_pos: {}'.format(target_pos))128 alpha_logger.info('target_pos_shape: {}'.format(np.shape(target_pos)))129 alpha_logger.info('len_codes:{}'.format(np.shape(codes)))130 target_pos['code'] = codes131 result = pd.merge(target_pos, dx_returns, on=['code'])132 result['trade_date'] = ref_date133 tune_record = tune_record.append(result)134 alpha_logger.info('len_result: {}'.format(len(result)))135 # excess_return = np.exp(result.dx.values) - 1. - index_return.loc[ref_date, 'dx']136 excess_return = np.exp(result.dx.values) - 1.137 ret = result.weight.values @ excess_return138 trade_dates.append(ref_date)139 rets.append(np.log(1. + ret))140 alpha_logger.info('len_rets: {}, len_trade_dates: {}'.format(len(rets), len(trade_dates)))141 turn_over_org, current_pos = executor.execute(target_pos=target_pos)142 turn_over = turn_over_org / sum(target_pos.weight.values)143 executor.set_current(current_pos)144 net_rets.append(np.log(1. + ret - transact_cost * turn_over))145 alpha_logger.info('len_net_rets: {}, len_trade_dates: {}'.format(len(net_rets), len(trade_dates)))146 alpha_logger.info('{} is finished'.format(ref_date))147 # ret_df = pd.DataFrame({'xgb_regress': rets}, index=trade_dates)148 ret_df = pd.DataFrame({'xgb_regress': rets, 'net_xgb_regress': net_rets}, index=trade_dates)149 ret_df.loc[advanceDateByCalendar('china.sse', ref_dates[-1], freq).strftime('%Y-%m-%d')] = 0.150 ret_df = ret_df.shift(1)151 ret_df.iloc[0] = 0.152 return ret_df, tune_record153@app.route('/')154def index():155 return '<h1>hello Test<h1>'156@app.route('/backtest', methods=['POST'])157def backtest():158 data_source = 'postgresql+psycopg2://alpha:alpha@180.166.26.82:8889/alpha'159 engine = SqlEngine(data_source)160 start_date = request.form['start_date']161 end_date = request.form['end_date']162 freq = request.form['freq']163 max_round = request.form['max_round']164 GPUs = request.form['GPUs']165 if start_date is None or start_date == '':166 start_date = '2019-01-01'167 if end_date is None or end_date == '':168 end_date = '2019-08-01'169 if freq is None or freq == '':170 freq = '2b'171 if max_round is None or max_round == '':172 max_round = 10173 # xgb_configuration174 lgb_conf.xgb_config_r()175 lgb_conf.cv_folds = None176 lgb_conf.early_stop_round = 10177 lgb_conf.max_round = int(max_round)178 ref_dates = makeSchedule(start_date, end_date, freq, 'china.sse')179 universe = Universe('zz500')180 benchmark_code = 905181 horizon = map_freq(freq)182 industry_name = 'sw'183 industry_level = 1184 basic_factor_store = {185 'f0': CSQuantiles(LAST('AccountsPayablesTDays'), groups='sw1'),186 'f1': CSQuantiles(LAST('AccountsPayablesTRate'), groups='sw1'),187 'f2': CSQuantiles(LAST('AdminiExpenseRate'), groups='sw1'),188 'f3': CSQuantiles(LAST('ARTDays'), groups='sw1'),189 'f4': CSQuantiles(LAST('ARTRate'), groups='sw1'),190 'f5': CSQuantiles(LAST('ASSI'), groups='sw1'),191 'f6': CSQuantiles(LAST('BLEV'), groups='sw1'),192 'f7': CSQuantiles(LAST('BondsPayableToAsset'), groups='sw1'),193 'f8': CSQuantiles(LAST('CashRateOfSales'), groups='sw1'),194 'f9': CSQuantiles(LAST('CashToCurrentLiability'), groups='sw1'),195 'f10': CSQuantiles(LAST('CMRA'), groups='sw1'),196 'f11': CSQuantiles(LAST('CTOP'), groups='sw1'),197 'f12': CSQuantiles(LAST('CTP5'), groups='sw1'),198 'f13': CSQuantiles(LAST('CurrentAssetsRatio'), groups='sw1'),199 'f14': CSQuantiles(LAST('CurrentAssetsTRate'), groups='sw1'),200 'f15': CSQuantiles(LAST('CurrentAssetsTRate'), groups='sw1'),201 'f16': CSQuantiles(LAST('DAVOL10'), groups='sw1'),202 'f17': CSQuantiles(LAST('DAVOL20'), groups='sw1'),203 'f18': CSQuantiles(LAST('DAVOL5'), groups='sw1'),204 'f19': CSQuantiles(LAST('DDNBT'), groups='sw1'),205 'f20': CSQuantiles(LAST('DDNCR'), groups='sw1'),206 'f21': CSQuantiles(LAST('DDNSR'), groups='sw1'),207 'f22': CSQuantiles(LAST('DebtEquityRatio'), groups='sw1'),208 'f23': CSQuantiles(LAST('DebtsAssetRatio'), groups='sw1'),209 'f24': CSQuantiles(LAST('DHILO'), groups='sw1'),210 'f25': CSQuantiles(LAST('DilutedEPS'), groups='sw1'),211 'f26': CSQuantiles(LAST('DVRAT'), groups='sw1'),212 'f27': CSQuantiles(LAST('EBITToTOR'), groups='sw1'),213 'f28': CSQuantiles(LAST('EGRO'), groups='sw1'),214 'f29': CSQuantiles(LAST('EMA10'), groups='sw1'),215 'f30': CSQuantiles(LAST('EMA120'), groups='sw1'),216 'f31': CSQuantiles(LAST('EMA20'), groups='sw1'),217 'f32': CSQuantiles(LAST('EMA5'), groups='sw1'),218 'f33': CSQuantiles(LAST('EMA60'), groups='sw1'),219 'f34': CSQuantiles(LAST('EPS'), groups='sw1'),220 'f35': CSQuantiles(LAST('EquityFixedAssetRatio'), groups='sw1'),221 'f36': CSQuantiles(LAST('EquityToAsset'), groups='sw1'),222 'f37': CSQuantiles(LAST('EquityTRate'), groups='sw1'),223 'f38': CSQuantiles(LAST('ETOP'), groups='sw1'),224 'f39': CSQuantiles(LAST('ETP5'), groups='sw1'),225 'f40': CSQuantiles(LAST('FinancialExpenseRate'), groups='sw1'),226 'f41': CSQuantiles(LAST('FinancingCashGrowRate'), groups='sw1'),227 'f42': CSQuantiles(LAST('FixAssetRatio'), groups='sw1'),228 'f43': CSQuantiles(LAST('FixedAssetsTRate'), groups='sw1'),229 'f44': CSQuantiles(LAST('GrossIncomeRatio'), groups='sw1'),230 'f45': CSQuantiles(LAST('HBETA'), groups='sw1'),231 'f46': CSQuantiles(LAST('HBETA'), groups='sw1'),232 'f47': CSQuantiles(LAST('IntangibleAssetRatio'), groups='sw1'),233 'f48': CSQuantiles(LAST('InventoryTDays'), groups='sw1'),234 'f49': CSQuantiles(LAST('InventoryTRate'), groups='sw1'),235 'f50': CSQuantiles(LAST('InvestCashGrowRate'), groups='sw1'),236 'f51': CSQuantiles(LAST('LCAP'), groups='sw1'),237 'f52': CSQuantiles(LAST('LFLO'), groups='sw1'),238 'f53': CSQuantiles(LAST('LongDebtToAsset'), groups='sw1'),239 'f54': CSQuantiles(LAST('LongDebtToWorkingCapital'), groups='sw1'),240 'f55': CSQuantiles(LAST('LongTermDebtToAsset'), groups='sw1'),241 'f56': CSQuantiles(LAST('MA10'), groups='sw1'),242 'f57': CSQuantiles(LAST('MA120'), groups='sw1'),243 'f58': CSQuantiles(LAST('MA20'), groups='sw1'),244 'f59': CSQuantiles(LAST('MA5'), groups='sw1'),245 'f60': CSQuantiles(LAST('MA60'), groups='sw1'),246 'f61': CSQuantiles(LAST('MAWVAD'), groups='sw1'),247 'f62': CSQuantiles(LAST('MFI'), groups='sw1'),248 'f63': CSQuantiles(LAST('MLEV'), groups='sw1'),249 'f64': CSQuantiles(LAST('NetAssetGrowRate'), groups='sw1'),250 'f65': CSQuantiles(LAST('NetProfitGrowRate'), groups='sw1'),251 'f66': CSQuantiles(LAST('NetProfitRatio'), groups='sw1'),252 'f67': CSQuantiles(LAST('NetProfitRatio'), groups='sw1'),253 'f68': CSQuantiles(LAST('NonCurrentAssetsRatio'), groups='sw1'),254 'f69': CSQuantiles(LAST('NPParentCompanyGrowRate'), groups='sw1'),255 'f70': CSQuantiles(LAST('NPToTOR'), groups='sw1'),256 'f71': CSQuantiles(LAST('OperatingExpenseRate'), groups='sw1'),257 'f72': CSQuantiles(LAST('OperatingProfitGrowRate'), groups='sw1'),258 'f73': CSQuantiles(LAST('OperatingProfitRatio'), groups='sw1'),259 'f74': CSQuantiles(LAST('OperatingProfitToTOR'), groups='sw1'),260 'f75': CSQuantiles(LAST('OperatingRevenueGrowRate'), groups='sw1'),261 'f76': CSQuantiles(LAST('OperCashGrowRate'), groups='sw1'),262 'f77': CSQuantiles(LAST('OperCashInToCurrentLiability'), groups='sw1'),263 'f78': CSQuantiles(LAST('PB'), groups='sw1'),264 'f79': CSQuantiles(LAST('PCF'), groups='sw1'),265 'f80': CSQuantiles(LAST('PE'), groups='sw1'),266 'f81': CSQuantiles(LAST('PS'), groups='sw1'),267 'f82': CSQuantiles(LAST('PSY'), groups='sw1'),268 'f83': CSQuantiles(LAST('QuickRatio'), groups='sw1'),269 'f84': CSQuantiles(LAST('REVS10'), groups='sw1'),270 'f85': CSQuantiles(LAST('REVS20'), groups='sw1'),271 'f86': CSQuantiles(LAST('REVS5'), groups='sw1'),272 'f87': CSQuantiles(LAST('REVS5'), groups='sw1'),273 'f88': CSQuantiles(LAST('ROA5'), groups='sw1'),274 'f89': CSQuantiles(LAST('ROE'), groups='sw1'),275 'f90': CSQuantiles(LAST('ROE5'), groups='sw1'),276 'f91': CSQuantiles(LAST('RSI'), groups='sw1'),277 'f92': CSQuantiles(LAST('RSTR12'), groups='sw1'),278 'f93': CSQuantiles(LAST('RSTR24'), groups='sw1'),279 'f94': CSQuantiles(LAST('SalesCostRatio'), groups='sw1'),280 'f95': CSQuantiles(LAST('SaleServiceCashToOR'), groups='sw1'),281 'f96': CSQuantiles(LAST('SUE'), groups='sw1'),282 'f97': CSQuantiles(LAST('TaxRatio'), groups='sw1'),283 'f98': CSQuantiles(LAST('TOBT'), groups='sw1'),284 'f99': CSQuantiles(LAST('TotalAssetGrowRate'), groups='sw1'),285 'f100': CSQuantiles(LAST('TotalAssetsTRate'), groups='sw1'),286 'f101': CSQuantiles(LAST('TotalProfitCostRatio'), groups='sw1'),287 'f102': CSQuantiles(LAST('TotalProfitGrowRate'), groups='sw1'),288 'f103': CSQuantiles(LAST('VOL10'), groups='sw1'),289 'f104': CSQuantiles(LAST('VOL120'), groups='sw1'),290 'f105': CSQuantiles(LAST('VOL20'), groups='sw1'),291 'f106': CSQuantiles(LAST('VOL240'), groups='sw1'),292 'f107': CSQuantiles(LAST('VOL5'), groups='sw1'),293 'f108': CSQuantiles(LAST('VOL60'), groups='sw1'),294 'f109': CSQuantiles(LAST('WVAD'), groups='sw1'),295 'f110': CSQuantiles(LAST('REC'), groups='sw1'),296 'f111': CSQuantiles(LAST('DAREC'), groups='sw1'),297 'f112': CSQuantiles(LAST('GREC'), groups='sw1'),298 'f113': CSQuantiles(LAST('FY12P'), groups='sw1'),299 'f114': CSQuantiles(LAST('DAREV'), groups='sw1'),300 'f115': CSQuantiles(LAST('GREV'), groups='sw1'),301 'f116': CSQuantiles(LAST('SFY12P'), groups='sw1'),302 'f117': CSQuantiles(LAST('DASREV'), groups='sw1'),303 'f118': CSQuantiles(LAST('GSREV'), groups='sw1'),304 'f119': CSQuantiles(LAST('FEARNG'), groups='sw1'),305 'f120': CSQuantiles(LAST('FSALESG'), groups='sw1'),306 'f121': CSQuantiles(LAST('TA2EV'), groups='sw1'),307 'f122': CSQuantiles(LAST('CFO2EV'), groups='sw1'),308 'f123': CSQuantiles(LAST('ACCA'), groups='sw1'),309 'f124': CSQuantiles(LAST('DEGM'), groups='sw1'),310 'f125': CSQuantiles(LAST('SUOI'), groups='sw1'),311 'f126': CSQuantiles(LAST('EARNMOM'), groups='sw1'),312 'f127': CSQuantiles(LAST('FiftyTwoWeekHigh'), groups='sw1'),313 'f128': CSQuantiles(LAST('Volatility'), groups='sw1'),314 'f129': CSQuantiles(LAST('Skewness'), groups='sw1'),315 'f130': CSQuantiles(LAST('ILLIQUIDITY'), groups='sw1'),316 'f131': CSQuantiles(LAST('BackwardADJ'), groups='sw1'),317 'f132': CSQuantiles(LAST('MACD'), groups='sw1'),318 'f133': CSQuantiles(LAST('ADTM'), groups='sw1'),319 'f134': CSQuantiles(LAST('ATR14'), groups='sw1'),320 'f135': CSQuantiles(LAST('ATR6'), groups='sw1'),321 'f136': CSQuantiles(LAST('BIAS10'), groups='sw1'),322 'f137': CSQuantiles(LAST('BIAS20'), groups='sw1'),323 'f138': CSQuantiles(LAST('BIAS5'), groups='sw1'),324 'f139': CSQuantiles(LAST('BIAS60'), groups='sw1'),325 'f140': CSQuantiles(LAST('BollDown'), groups='sw1'),326 'f141': CSQuantiles(LAST('BollUp'), groups='sw1'),327 'f142': CSQuantiles(LAST('CCI10'), groups='sw1'),328 'f143': CSQuantiles(LAST('CCI20'), groups='sw1'),329 'f144': CSQuantiles(LAST('CCI5'), groups='sw1'),330 'f145': CSQuantiles(LAST('CCI88'), groups='sw1'),331 'f146': CSQuantiles(LAST('KDJ_K'), groups='sw1'),332 'f147': CSQuantiles(LAST('KDJ_D'), groups='sw1'),333 'f148': CSQuantiles(LAST('KDJ_J'), groups='sw1'),334 'f149': CSQuantiles(LAST('ROC6'), groups='sw1'),335 'f150': CSQuantiles(LAST('ROC20'), groups='sw1'),336 'f151': CSQuantiles(LAST('SBM'), groups='sw1'),337 'f152': CSQuantiles(LAST('STM'), groups='sw1'),338 'f153': CSQuantiles(LAST('UpRVI'), groups='sw1'),339 'f154': CSQuantiles(LAST('DownRVI'), groups='sw1'),340 'f155': CSQuantiles(LAST('RVI'), groups='sw1'),341 'f156': CSQuantiles(LAST('SRMI'), groups='sw1'),342 'f157': CSQuantiles(LAST('ChandeSD'), groups='sw1'),343 'f158': CSQuantiles(LAST('ChandeSU'), groups='sw1'),344 'f159': CSQuantiles(LAST('CMO'), groups='sw1'),345 'f160': CSQuantiles(LAST('DBCD'), groups='sw1'),346 'f161': CSQuantiles(LAST('ARC'), groups='sw1'),347 'f162': CSQuantiles(LAST('OBV'), groups='sw1'),348 'f163': CSQuantiles(LAST('OBV6'), groups='sw1'),349 'f164': CSQuantiles(LAST('OBV20'), groups='sw1'),350 'f165': CSQuantiles(LAST('TVMA20'), groups='sw1'),351 'f166': CSQuantiles(LAST('TVMA6'), groups='sw1'),352 'f167': CSQuantiles(LAST('TVSTD20'), groups='sw1'),353 'f168': CSQuantiles(LAST('TVSTD6'), groups='sw1'),354 'f169': CSQuantiles(LAST('VDEA'), groups='sw1'),355 'f170': CSQuantiles(LAST('VDIFF'), groups='sw1'),356 'f171': CSQuantiles(LAST('VEMA10'), groups='sw1'),357 'f172': CSQuantiles(LAST('VEMA12'), groups='sw1'),358 'f173': CSQuantiles(LAST('VEMA26'), groups='sw1'),359 'f174': CSQuantiles(LAST('VEMA5'), groups='sw1'),360 'f175': CSQuantiles(LAST('VMACD'), groups='sw1'),361 'f176': CSQuantiles(LAST('VR'), groups='sw1'),362 'f177': CSQuantiles(LAST('VROC12'), groups='sw1'),363 'f178': CSQuantiles(LAST('VROC6'), groups='sw1'),364 'f179': CSQuantiles(LAST('VSTD10'), groups='sw1'),365 'f180': CSQuantiles(LAST('VSTD20'), groups='sw1'),366 'f181': CSQuantiles(LAST('KlingerOscillator'), groups='sw1'),367 'f182': CSQuantiles(LAST('MoneyFlow20'), groups='sw1'),368 'f183': CSQuantiles(LAST('AD'), groups='sw1'),369 'f184': CSQuantiles(LAST('AD20'), groups='sw1'),370 'f185': CSQuantiles(LAST('AD6'), groups='sw1'),371 'f186': CSQuantiles(LAST('CoppockCurve'), groups='sw1'),372 'f187': CSQuantiles(LAST('ASI'), groups='sw1'),373 'f188': CSQuantiles(LAST('ChaikinOscillator'), groups='sw1'),374 'f189': CSQuantiles(LAST('ChaikinVolatility'), groups='sw1'),375 'f190': CSQuantiles(LAST('EMV14'), groups='sw1'),376 'f191': CSQuantiles(LAST('EMV6'), groups='sw1'),377 'f192': CSQuantiles(LAST('plusDI'), groups='sw1'),378 'f193': CSQuantiles(LAST('minusDI'), groups='sw1'),379 'f194': CSQuantiles(LAST('ADX'), groups='sw1'),380 'f195': CSQuantiles(LAST('ADXR'), groups='sw1'),381 'f196': CSQuantiles(LAST('Aroon'), groups='sw1'),382 'f197': CSQuantiles(LAST('AroonDown'), groups='sw1'),383 'f198': CSQuantiles(LAST('AroonUp'), groups='sw1'),384 'f199': CSQuantiles(LAST('DEA'), groups='sw1'),385 'f200': CSQuantiles(LAST('DIFF'), groups='sw1'),386 'f201': CSQuantiles(LAST('DDI'), groups='sw1'),387 'f202': CSQuantiles(LAST('DIZ'), groups='sw1'),388 'f203': CSQuantiles(LAST('DIF'), groups='sw1'),389 'f204': CSQuantiles(LAST('MTM'), groups='sw1'),390 'f205': CSQuantiles(LAST('MTMMA'), groups='sw1'),391 'f206': CSQuantiles(LAST('PVT'), groups='sw1'),392 'f207': CSQuantiles(LAST('PVT6'), groups='sw1'),393 'f208': CSQuantiles(LAST('PVT12'), groups='sw1'),394 'f209': CSQuantiles(LAST('TRIX5'), groups='sw1'),395 'f210': CSQuantiles(LAST('TRIX10'), groups='sw1'),396 'f211': CSQuantiles(LAST('UOS'), groups='sw1'),397 'f212': CSQuantiles(LAST('MA10RegressCoeff12'), groups='sw1'),398 'f213': CSQuantiles(LAST('MA10RegressCoeff6'), groups='sw1'),399 'f214': CSQuantiles(LAST('PLRC6'), groups='sw1'),400 'f215': CSQuantiles(LAST('PLRC12'), groups='sw1'),401 'f216': CSQuantiles(LAST('SwingIndex'), groups='sw1'),402 'f217': CSQuantiles(LAST('Ulcer10'), groups='sw1'),403 'f218': CSQuantiles(LAST('Ulcer5'), groups='sw1'),404 'f219': CSQuantiles(LAST('Hurst'), groups='sw1'),405 'f220': CSQuantiles(LAST('ACD6'), groups='sw1'),406 'f221': CSQuantiles(LAST('ACD20'), groups='sw1'),407 'f222': CSQuantiles(LAST('EMA12'), groups='sw1'),408 'f223': CSQuantiles(LAST('EMA26'), groups='sw1'),409 'f224': CSQuantiles(LAST('APBMA'), groups='sw1'),410 'f225': CSQuantiles(LAST('APBMA'), groups='sw1'),411 'f226': CSQuantiles(LAST('BBIC'), groups='sw1'),412 'f227': CSQuantiles(LAST('TEMA10'), groups='sw1'),413 'f228': CSQuantiles(LAST('TEMA5'), groups='sw1'),414 'f229': CSQuantiles(LAST('MA10Close'), groups='sw1'),415 'f230': CSQuantiles(LAST('AR'), groups='sw1'),416 'f231': CSQuantiles(LAST('BR'), groups='sw1'),417 'f232': CSQuantiles(LAST('ARBR'), groups='sw1'),418 'f233': CSQuantiles(LAST('CR20'), groups='sw1'),419 'f234': CSQuantiles(LAST('MassIndex'), groups='sw1'),420 'f235': CSQuantiles(LAST('BearPower'), groups='sw1'),421 'f236': CSQuantiles(LAST('BullPower'), groups='sw1'),422 'f237': CSQuantiles(LAST('Elder'), groups='sw1'),423 'f238': CSQuantiles(LAST('NVI'), groups='sw1'),424 'f239': CSQuantiles(LAST('PVI'), groups='sw1'),425 'f240': CSQuantiles(LAST('RC12'), groups='sw1'),426 'f241': CSQuantiles(LAST('RC24'), groups='sw1'),427 'f242': CSQuantiles(LAST('JDQS20'), groups='sw1'),428 'f243': CSQuantiles(LAST('Variance20'), groups='sw1'),429 'f244': CSQuantiles(LAST('Variance60'), groups='sw1'),430 'f245': CSQuantiles(LAST('Variance120'), groups='sw1'),431 'f246': CSQuantiles(LAST('Kurtosis20'), groups='sw1'),432 'f247': CSQuantiles(LAST('Kurtosis60'), groups='sw1'),433 'f248': CSQuantiles(LAST('Kurtosis120'), groups='sw1'),434 'f249': CSQuantiles(LAST('Alpha20'), groups='sw1'),435 'f250': CSQuantiles(LAST('Alpha60'), groups='sw1'),436 'f251': CSQuantiles(LAST('Alpha120'), groups='sw1'),437 'f252': CSQuantiles(LAST('Beta20'), groups='sw1'),438 'f253': CSQuantiles(LAST('Beta60'), groups='sw1'),439 'f254': CSQuantiles(LAST('Beta60'), groups='sw1'),440 'f255': CSQuantiles(LAST('SharpeRatio20'), groups='sw1'),441 'f256': CSQuantiles(LAST('SharpeRatio60'), groups='sw1'),442 'f257': CSQuantiles(LAST('SharpeRatio120'), groups='sw1'),443 'f258': CSQuantiles(LAST('TreynorRatio20'), groups='sw1'),444 'f259': CSQuantiles(LAST('TreynorRatio60'), groups='sw1'),445 'f260': CSQuantiles(LAST('TreynorRatio120'), groups='sw1'),446 'f261': CSQuantiles(LAST('InformationRatio20'), groups='sw1'),447 'f262': CSQuantiles(LAST('InformationRatio60'), groups='sw1'),448 'f263': CSQuantiles(LAST('InformationRatio120'), groups='sw1'),449 'f264': CSQuantiles(LAST('GainVariance20'), groups='sw1'),450 'f265': CSQuantiles(LAST('GainVariance60'), groups='sw1'),451 'f266': CSQuantiles(LAST('GainVariance120'), groups='sw1'),452 'f267': CSQuantiles(LAST('LossVariance20'), groups='sw1'),453 'f268': CSQuantiles(LAST('LossVariance60'), groups='sw1'),454 'f269': CSQuantiles(LAST('LossVariance120'), groups='sw1'),455 'f270': CSQuantiles(LAST('GainLossVarianceRatio20'), groups='sw1'),456 'f271': CSQuantiles(LAST('GainLossVarianceRatio60'), groups='sw1'),457 'f272': CSQuantiles(LAST('GainLossVarianceRatio120'), groups='sw1'),458 'f273': CSQuantiles(LAST('RealizedVolatility'), groups='sw1'),459 'f274': CSQuantiles(LAST('REVS60'), groups='sw1'),460 'f275': CSQuantiles(LAST('REVS120'), groups='sw1'),461 'f276': CSQuantiles(LAST('REVS250'), groups='sw1'),462 'f277': CSQuantiles(LAST('REVS750'), groups='sw1'),463 'f278': CSQuantiles(LAST('REVS5m20'), groups='sw1'),464 'f279': CSQuantiles(LAST('REVS5m60'), groups='sw1'),465 'f280': CSQuantiles(LAST('REVS5Indu1'), groups='sw1'),466 'f281': CSQuantiles(LAST('REVS20Indu1'), groups='sw1'),467 'f282': CSQuantiles(LAST('Volumn1M'), groups='sw1'),468 'f283': CSQuantiles(LAST('Volumn3M'), groups='sw1'),469 'f284': CSQuantiles(LAST('Price1M'), groups='sw1'),470 'f285': CSQuantiles(LAST('Price3M'), groups='sw1'),471 'f286': CSQuantiles(LAST('Price1Y'), groups='sw1'),472 'f287': CSQuantiles(LAST('Rank1M'), groups='sw1'),473 'f288': CSQuantiles(LAST('CashDividendCover'), groups='sw1'),474 'f289': CSQuantiles(LAST('DividendCover'), groups='sw1'),475 'f290': CSQuantiles(LAST('DividendPaidRatio'), groups='sw1'),476 'f291': CSQuantiles(LAST('RetainedEarningRatio'), groups='sw1'),477 'f292': CSQuantiles(LAST('CashEquivalentPS'), groups='sw1'),478 'f293': CSQuantiles(LAST('DividendPS'), groups='sw1'),479 'f294': CSQuantiles(LAST('EPSTTM'), groups='sw1'),480 'f295': CSQuantiles(LAST('NetAssetPS'), groups='sw1'),481 'f296': CSQuantiles(LAST('TORPS'), groups='sw1'),482 'f297': CSQuantiles(LAST('TORPSLatest'), groups='sw1'),483 'f298': CSQuantiles(LAST('OperatingRevenuePS'), groups='sw1'),484 'f299': CSQuantiles(LAST('OperatingRevenuePSLatest'), groups='sw1'),485 'f300': CSQuantiles(LAST('OperatingProfitPS'), groups='sw1'),486 'f301': CSQuantiles(LAST('OperatingProfitPSLatest'), groups='sw1'),487 'f302': CSQuantiles(LAST('CapitalSurplusFundPS'), groups='sw1'),488 'f303': CSQuantiles(LAST('SurplusReserveFundPS'), groups='sw1'),489 'f304': CSQuantiles(LAST('UndividedProfitPS'), groups='sw1'),490 'f305': CSQuantiles(LAST('RetainedEarningsPS'), groups='sw1'),491 'f306': CSQuantiles(LAST('OperCashFlowPS'), groups='sw1'),492 'f307': CSQuantiles(LAST('CashFlowPS'), groups='sw1'),493 'f308': CSQuantiles(LAST('NetNonOIToTP'), groups='sw1'),494 'f309': CSQuantiles(LAST('NetNonOIToTPLatest'), groups='sw1'),495 'f310': CSQuantiles(LAST('PeriodCostsRate'), groups='sw1'),496 'f311': CSQuantiles(LAST('InterestCover'), groups='sw1'),497 'f312': CSQuantiles(LAST('NetProfitGrowRate3Y'), groups='sw1'),498 'f313': CSQuantiles(LAST('NetProfitGrowRate5Y'), groups='sw1'),499 'f314': CSQuantiles(LAST('OperatingRevenueGrowRate3Y'), groups='sw1'),500 'f315': CSQuantiles(LAST('OperatingRevenueGrowRate5Y'), groups='sw1'),501 'f316': CSQuantiles(LAST('NetCashFlowGrowRate'), groups='sw1'),502 'f317': CSQuantiles(LAST('NetProfitCashCover'), groups='sw1'),503 'f318': CSQuantiles(LAST('OperCashInToAsset'), groups='sw1'),504 'f319': CSQuantiles(LAST('CashConversionCycle'), groups='sw1'),505 'f320': CSQuantiles(LAST('OperatingCycle'), groups='sw1'),506 'f321': CSQuantiles(LAST('PEG3Y'), groups='sw1'),507 'f322': CSQuantiles(LAST('PEG5Y'), groups='sw1'),508 'f323': CSQuantiles(LAST('PEIndu'), groups='sw1'),509 'f324': CSQuantiles(LAST('PBIndu'), groups='sw1'),510 'f325': CSQuantiles(LAST('PSIndu'), groups='sw1'),511 'f326': CSQuantiles(LAST('PCFIndu'), groups='sw1'),512 'f327': CSQuantiles(LAST('PEHist20'), groups='sw1'),513 'f328': CSQuantiles(LAST('PEHist60'), groups='sw1'),514 'f329': CSQuantiles(LAST('PEHist120'), groups='sw1'),515 'f330': CSQuantiles(LAST('PEHist250'), groups='sw1'),516 'f331': CSQuantiles(LAST('StaticPE'), groups='sw1'),517 'f332': CSQuantiles(LAST('ForwardPE'), groups='sw1'),518 'f333': CSQuantiles(LAST('EnterpriseFCFPS'), groups='sw1'),519 'f334': CSQuantiles(LAST('ShareholderFCFPS'), groups='sw1'),520 'f335': CSQuantiles(LAST('ROEDiluted'), groups='sw1'),521 'f336': CSQuantiles(LAST('ROEAvg'), groups='sw1'),522 'f337': CSQuantiles(LAST('ROEWeighted'), groups='sw1'),523 'f338': CSQuantiles(LAST('ROECut'), groups='sw1'),524 'f339': CSQuantiles(LAST('ROECutWeighted'), groups='sw1'),525 'f340': CSQuantiles(LAST('ROIC'), groups='sw1'),526 'f341': CSQuantiles(LAST('ROAEBIT'), groups='sw1'),527 'f342': CSQuantiles(LAST('ROAEBITTTM'), groups='sw1'),528 'f343': CSQuantiles(LAST('OperatingNIToTP'), groups='sw1'),529 'f344': CSQuantiles(LAST('OperatingNIToTPLatest'), groups='sw1'),530 'f345': CSQuantiles(LAST('InvestRAssociatesToTP'), groups='sw1'),531 'f346': CSQuantiles(LAST('InvestRAssociatesToTPLatest'), groups='sw1'),532 'f347': CSQuantiles(LAST('NPCutToNP'), groups='sw1'),533 'f348': CSQuantiles(LAST('SuperQuickRatio'), groups='sw1'),534 'f349': CSQuantiles(LAST('TSEPToInterestBearDebt'), groups='sw1'),535 'f350': CSQuantiles(LAST('DebtTangibleEquityRatio'), groups='sw1'),536 'f351': CSQuantiles(LAST('TangibleAToInteBearDebt'), groups='sw1'),537 'f352': CSQuantiles(LAST('TangibleAToNetDebt'), groups='sw1'),538 'f353': CSQuantiles(LAST('NOCFToTLiability'), groups='sw1'),539 'f354': CSQuantiles(LAST('NOCFToInterestBearDebt'), groups='sw1'),540 'f355': CSQuantiles(LAST('NOCFToNetDebt'), groups='sw1'),541 'f356': CSQuantiles(LAST('TSEPToTotalCapital'), groups='sw1'),542 'f357': CSQuantiles(LAST('InteBearDebtToTotalCapital'), groups='sw1'),543 'f358': CSQuantiles(LAST('NPParentCompanyCutYOY'), groups='sw1'),544 'f359': CSQuantiles(LAST('SalesServiceCashToORLatest'), groups='sw1'),545 'f360': CSQuantiles(LAST('CashRateOfSalesLatest'), groups='sw1'),546 'f361': CSQuantiles(LAST('NOCFToOperatingNILatest'), groups='sw1'),547 'f362': CSQuantiles(LAST('TotalAssets'), groups='sw1'),548 'f363': CSQuantiles(LAST('MktValue'), groups='sw1'),549 'f364': CSQuantiles(LAST('NegMktValue'), groups='sw1'),550 'f365': CSQuantiles(LAST('TEAP'), groups='sw1'),551 'f366': CSQuantiles(LAST('NIAP'), groups='sw1'),552 'f367': CSQuantiles(LAST('TotalFixedAssets'), groups='sw1'),553 'f368': CSQuantiles(LAST('IntFreeCL'), groups='sw1'),554 'f369': CSQuantiles(LAST('IntFreeNCL'), groups='sw1'),555 'f370': CSQuantiles(LAST('IntCL'), groups='sw1'),556 'f371': CSQuantiles(LAST('IntDebt'), groups='sw1'),557 'f372': CSQuantiles(LAST('NetDebt'), groups='sw1'),558 'f373': CSQuantiles(LAST('NetTangibleAssets'), groups='sw1'),559 'f374': CSQuantiles(LAST('WorkingCapital'), groups='sw1'),560 'f375': CSQuantiles(LAST('WorkingCapital'), groups='sw1'),561 'f376': CSQuantiles(LAST('TotalPaidinCapital'), groups='sw1'),562 'f377': CSQuantiles(LAST('RetainedEarnings'), groups='sw1'),563 'f378': CSQuantiles(LAST('OperateNetIncome'), groups='sw1'),564 'f379': CSQuantiles(LAST('ValueChgProfit'), groups='sw1'),565 'f380': CSQuantiles(LAST('NetIntExpense'), groups='sw1'),566 'f381': CSQuantiles(LAST('EBIT'), groups='sw1'),567 'f382': CSQuantiles(LAST('EBITDA'), groups='sw1'),568 'f383': CSQuantiles(LAST('EBIAT'), groups='sw1'),569 'f384': CSQuantiles(LAST('NRProfitLoss'), groups='sw1'),570 'f385': CSQuantiles(LAST('NIAPCut'), groups='sw1'),571 'f386': CSQuantiles(LAST('FCFF'), groups='sw1'),572 'f387': CSQuantiles(LAST('FCFE'), groups='sw1'),573 'f388': CSQuantiles(LAST('DA'), groups='sw1'),574 'f389': CSQuantiles(LAST('TRevenueTTM'), groups='sw1'),575 'f390': CSQuantiles(LAST('TCostTTM'), groups='sw1'),576 'f391': CSQuantiles(LAST('RevenueTTM'), groups='sw1'),577 'f392': CSQuantiles(LAST('CostTTM'), groups='sw1'),578 'f393': CSQuantiles(LAST('GrossProfitTTM'), groups='sw1'),579 'f394': CSQuantiles(LAST('SalesExpenseTTM'), groups='sw1'),580 'f395': CSQuantiles(LAST('AdminExpenseTTM'), groups='sw1'),581 'f396': CSQuantiles(LAST('FinanExpenseTTM'), groups='sw1'),582 'f397': CSQuantiles(LAST('AssetImpairLossTTM'), groups='sw1'),583 'f398': CSQuantiles(LAST('NPFromOperatingTTM'), groups='sw1'),584 'f399': CSQuantiles(LAST('NPFromValueChgTTM'), groups='sw1'),585 'f400': CSQuantiles(LAST('OperateProfitTTM'), groups='sw1'),586 'f401': CSQuantiles(LAST('NonOperatingNPTTM'), groups='sw1'),587 'f402': CSQuantiles(LAST('TProfitTTM'), groups='sw1'),588 'f403': CSQuantiles(LAST('NetProfitTTM'), groups='sw1'),589 'f404': CSQuantiles(LAST('NetProfitAPTTM'), groups='sw1'),590 'f405': CSQuantiles(LAST('SaleServiceRenderCashTTM'), groups='sw1'),591 'f406': CSQuantiles(LAST('NetOperateCFTTM'), groups='sw1'),592 'f407': CSQuantiles(LAST('NetInvestCFTTM'), groups='sw1'),593 'f408': CSQuantiles(LAST('NetFinanceCFTTM'), groups='sw1'),594 'f409': CSQuantiles(LAST('GrossProfit'), groups='sw1'),595 'f410': CSQuantiles(LAST('Beta252'), groups='sw1'),596 'f411': CSQuantiles(LAST('RSTR504'), groups='sw1'),597 'f412': CSQuantiles(LAST('EPIBS'), groups='sw1'),598 'f413': CSQuantiles(LAST('CETOP'), groups='sw1'),599 'f414': CSQuantiles(LAST('DASTD'), groups='sw1'),600 'f415': CSQuantiles(LAST('CmraCNE5'), groups='sw1'),601 'f416': CSQuantiles(LAST('HsigmaCNE5'), groups='sw1'),602 'f417': CSQuantiles(LAST('HsigmaCNE5'), groups='sw1'),603 'f418': CSQuantiles(LAST('EgibsLong'), groups='sw1'),604 'f419': CSQuantiles(LAST('STOM'), groups='sw1'),605 'f420': CSQuantiles(LAST('STOQ'), groups='sw1'),606 'f421': CSQuantiles(LAST('STOA'), groups='sw1'),607 'f422': CSQuantiles(LAST('NLSIZE'), groups='sw1')}608 features = ['f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15',609 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24', 'f25', 'f26', 'f27', 'f28', 'f29',610 'f30', 'f31', 'f32', 'f33', 'f34', 'f35', 'f36', 'f37', 'f38', 'f39', 'f40', 'f41', 'f42', 'f43',611 'f44', 'f45', 'f46', 'f47', 'f48', 'f49', 'f50', 'f51', 'f52', 'f53', 'f54', 'f55', 'f56', 'f57',612 'f58', 'f59', 'f60', 'f61', 'f62', 'f63', 'f64', 'f65', 'f66', 'f67', 'f68', 'f69', 'f70', 'f71',613 'f72', 'f73', 'f74', 'f75', 'f76', 'f77', 'f78', 'f79', 'f80', 'f81', 'f82', 'f83', 'f84', 'f85',614 'f86', 'f87', 'f88', 'f89', 'f90', 'f91', 'f92', 'f93', 'f94', 'f95', 'f96', 'f97', 'f98', 'f99',615 'f100']616 # features = ['f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', 'f13', 'f14', 'f15',617 # 'f16', 'f17', 'f18', 'f19', 'f20', 'f21', 'f22', 'f23', 'f24', 'f25', 'f26', 'f27', 'f28', 'f29',618 # 'f30', 'f31', 'f32', 'f33', 'f34', 'f35', 'f36', 'f37', 'f38', 'f39', 'f40', 'f41', 'f42', 'f43',619 # 'f44', 'f45', 'f46', 'f47', 'f48', 'f49', 'f50', 'f51', 'f52', 'f53', 'f54', 'f55', 'f56', 'f57',620 # 'f58', 'f59', 'f60', 'f61', 'f62', 'f63', 'f64', 'f65', 'f66', 'f67', 'f68', 'f69', 'f70', 'f71',621 # 'f72', 'f73', 'f74', 'f75', 'f76', 'f77', 'f78', 'f79', 'f80', 'f81', 'f82', 'f83', 'f84', 'f85',622 # 'f86', 'f87', 'f88', 'f89', 'f90', 'f91', 'f92', 'f93', 'f94', 'f95', 'f96', 'f97', 'f98', 'f99',623 # 'f100', 'f101', 'f102', 'f103', 'f104', 'f105', 'f106', 'f107', 'f108', 'f109', 'f110', 'f111', 'f112',624 # 'f113', 'f114', 'f115', 'f116', 'f117', 'f118', 'f119', 'f120', 'f121', 'f122', 'f123', 'f124', 'f125',625 # 'f126', 'f127', 'f128', 'f129', 'f130', 'f131', 'f132', 'f133', 'f134', 'f135', 'f136', 'f137', 'f138',626 # 'f139', 'f140', 'f141', 'f142', 'f143', 'f144', 'f145', 'f146', 'f147', 'f148', 'f149', 'f150', 'f151',627 # 'f152', 'f153', 'f154', 'f155', 'f156', 'f157', 'f158', 'f159', 'f160', 'f161', 'f162', 'f163', 'f164',628 # 'f165', 'f166', 'f167', 'f168', 'f169', 'f170', 'f171', 'f172', 'f173', 'f174', 'f175', 'f176', 'f177',629 # 'f178', 'f179', 'f180', 'f181', 'f182', 'f183', 'f184', 'f185', 'f186', 'f187', 'f188', 'f189', 'f190',630 # 'f191', 'f192', 'f193', 'f194', 'f195', 'f196', 'f197', 'f198', 'f199', 'f200', 'f201', 'f202', 'f203',631 # 'f204', 'f205', 'f206', 'f207', 'f208', 'f209', 'f210', 'f211', 'f212', 'f213', 'f214', 'f215', 'f216',632 # 'f217', 'f218', 'f219', 'f220', 'f221', 'f222', 'f223', 'f224', 'f225', 'f226', 'f227', 'f228', 'f229',633 # 'f230', 'f231', 'f232', 'f233', 'f234', 'f235', 'f236', 'f237', 'f238', 'f239', 'f240', 'f241', 'f242',634 # 'f243', 'f244', 'f245', 'f246', 'f247', 'f248', 'f249', 'f250', 'f251', 'f252', 'f253', 'f254', 'f255',635 # 'f256', 'f257', 'f258', 'f259', 'f260', 'f261', 'f262', 'f263', 'f264', 'f265', 'f266', 'f267', 'f268',636 # 'f269', 'f270', 'f271', 'f272', 'f273', 'f274', 'f275', 'f276', 'f277', 'f278', 'f279', 'f280', 'f281',637 # 'f282', 'f283', 'f284', 'f285', 'f286', 'f287', 'f288', 'f289', 'f290', 'f291', 'f292', 'f293', 'f294',638 # 'f295', 'f296', 'f297', 'f298', 'f299', 'f300', 'f301', 'f302', 'f303', 'f304', 'f305', 'f306', 'f307',639 # 'f308', 'f309', 'f310', 'f311', 'f312', 'f313', 'f314', 'f315', 'f316', 'f317', 'f318', 'f319', 'f320',640 # 'f321', 'f322', 'f323', 'f324', 'f325', 'f326', 'f327', 'f328', 'f329', 'f330', 'f331', 'f332', 'f333',641 # 'f334', 'f335', 'f336', 'f337', 'f338', 'f339', 'f340', 'f341', 'f342', 'f343', 'f344', 'f345', 'f346',642 # 'f347', 'f348', 'f349', 'f350', 'f351', 'f352', 'f353', 'f354', 'f355', 'f356', 'f357', 'f358', 'f359',643 # 'f360', 'f361', 'f362', 'f363', 'f364', 'f365', 'f366', 'f367', 'f368', 'f369', 'f370', 'f371', 'f372',644 # 'f373', 'f374', 'f375', 'f376', 'f377', 'f378', 'f379', 'f380', 'f381', 'f382', 'f383', 'f384', 'f385',645 # 'f386', 'f387', 'f388', 'f389', 'f390', 'f391', 'f392', 'f393', 'f394', 'f395', 'f396', 'f397', 'f398',646 # 'f399', 'f400', 'f401', 'f402', 'f403', 'f404', 'f405', 'f406', 'f407', 'f408', 'f409', 'f410', 'f411',647 # 'f412', 'f413', 'f414', 'f415', 'f416', 'f417', 'f418', 'f419', 'f420', 'f421', 'f422']648 label = ['dx']649 print('>>>>>>>>>>>>>>>>> Backtesting >>>>>>>>>>>>>>>>>')650 print('>>>>>>>>> Loading Factor Data >>>>>>>>>>')651 # 获取因子数据652 # factor_data_org = engine.fetch_factor_range(universe, basic_factor_store,653 # dates=ref_dates, used_factor_tables=[Alpha191])654 factor_data_org = engine.fetch_factor_range(universe, basic_factor_store, dates=ref_dates)655 # 获取行业数据, 风险因子656 industry = engine.fetch_industry_range(universe, dates=ref_dates)657 factor_data = pd.merge(factor_data_org, industry, on=['trade_date', 'code']).fillna(0.)658 risk_total = engine.fetch_risk_model_range(universe, dates=ref_dates)[1]659 # 获取收益率660 return_data = engine.fetch_dx_return_range(universe, dates=ref_dates, horizon=horizon, offset=0,661 benchmark=benchmark_code)662 print('>>>>>>>>> Loading Benchmark >>>>>>>>>>')663 # 获取benchmark664 benchmark_total = engine.fetch_benchmark_range(dates=ref_dates, benchmark=benchmark_code)665 industry_total = engine.fetch_industry_matrix_range(universe, dates=ref_dates, category=industry_name,666 level=industry_level)667 # Constraintes settings668 weight_gap = 1669 industry_names = industry_list(industry_name, industry_level)670 constraint_risk = ['EARNYILD', 'LIQUIDTY', 'GROWTH', 'SIZE', 'BETA', 'MOMENTUM'] + industry_names671 total_risk_names = constraint_risk + ['benchmark', 'total']672 b_type = []673 l_val = []674 u_val = []675 for name in total_risk_names:676 if name == 'benchmark':677 b_type.append(BoundaryType.RELATIVE)678 l_val.append(0.0)679 u_val.append(1.0)680 elif name == 'total':681 b_type.append(BoundaryType.ABSOLUTE)682 l_val.append(.0)683 u_val.append(.0)684 else:685 b_type.append(BoundaryType.ABSOLUTE)686 l_val.append(-1.005)687 u_val.append(1.005)688 bounds = create_box_bounds(total_risk_names, b_type, l_val, u_val) # Constraintes settings689 train_data = pd.merge(factor_data, return_data, on=['trade_date', 'code']).dropna()690 print('>>>>>>>>>>>> Data Load Success >>>>>>>>>>>>')691 ret_df, tune_record = create_scenario(train_data, features, label, ref_dates, freq, lgb_conf, weight_gap,692 return_data, risk_total, benchmark_total, industry_total,693 bounds, constraint_risk, total_risk_names, GPUs)694 result_dic = {'ret_df': ret_df.to_json(), 'tune_record': tune_record.reset_index().to_json()}695 return result_dic696if __name__ == '__main__':...

Full Screen

Full Screen

student-groups.component.spec.ts

Source:student-groups.component.spec.ts Github

copy

Full Screen

1import { async, ComponentFixture, TestBed } from '@angular/core/testing';2import { StudentGroupsComponent } from './student-groups.component';3import {GroupService} from "app/services/group/group.service";4import {UserService} from "app/services/user/user.service";5import {RouterTestingModule} from "@angular/router/testing";6import {FormsModule} from "@angular/forms";7import {Http, HttpModule} from "@angular/http";8import {AuthConfig, AuthHttp} from "angular2-jwt";9import {User} from "app/user";10import {Group} from "app/group";11import {GroupListComponent} from "app/components/core/group/group-list/group-list.component";12import {Observable} from "rxjs/Observable";13import {Subject} from "rxjs/Subject";14import {AuthService} from "../../../../../services/auth/auth.service";15import {UtilModule} from "../../../../util/util.module";16class AuthServiceMock {17 getUserAsObservable() {18 let user = new User(1, {19 first_name: 'Jan',20 last_name: 'Kowalski',21 role: 'STUDENT'22 });23 let sub = new Subject<User>();24 sub.next(user);25 return sub.asObservable();26 }27 public getAuthenticatedUser(): Promise<User> {28 let user = new User(1, {29 first_name: 'Jan',30 last_name: 'Kowalski',31 role: 'STUDENT'32 });33 return new Promise(r => r(user))34 }35}36class UserServiceMock {37 getAuthenticatedUserObject() {38 let user = new User(1, {39 'role': 'SUPERVISOR'40 })41 return new Promise((resolve) => resolve(user));42 }43 getAuthenticatedUser(): Observable<User> {44 let user = new User(1, {45 attributes: {46 role: 'SUPERVISOR'47 }48 });49 let sub = new Subject<User>();50 sub.next(user);51 return sub.asObservable();52 }53}54class GroupServiceMock {55 getGroups() {56 let source = {"data":[{"id":"1","type":"groups","links":{"self":"http://localhost:3000/groups/1"},"attributes":{"name":"Grupa 0","description":"Grupa testowa","user-count":2},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/1/relationships/users","related":"http://localhost:3000/groups/1/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/1/relationships/teachers","related":"http://localhost:3000/groups/1/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/1/relationships/courses","related":"http://localhost:3000/groups/1/courses"}}}},{"id":"2","type":"groups","links":{"self":"http://localhost:3000/groups/2"},"attributes":{"name":"SP3 GR 3","description":"Lębork, klasa 5-6 ","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/2/relationships/users","related":"http://localhost:3000/groups/2/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/2/relationships/teachers","related":"http://localhost:3000/groups/2/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/2/relationships/courses","related":"http://localhost:3000/groups/2/courses"}}}},{"id":"3","type":"groups","links":{"self":"http://localhost:3000/groups/3"},"attributes":{"name":"Rokity gr 1","description":"Rokity, klasa 2-3","user-count":7},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/3/relationships/users","related":"http://localhost:3000/groups/3/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/3/relationships/teachers","related":"http://localhost:3000/groups/3/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/3/relationships/courses","related":"http://localhost:3000/groups/3/courses"}}}},{"id":"4","type":"groups","links":{"self":"http://localhost:3000/groups/4"},"attributes":{"name":"Nożyno gr 1","description":"Nożyno, klasa 4-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/4/relationships/users","related":"http://localhost:3000/groups/4/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/4/relationships/teachers","related":"http://localhost:3000/groups/4/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/4/relationships/courses","related":"http://localhost:3000/groups/4/courses"}}}},{"id":"10","type":"groups","links":{"self":"http://localhost:3000/groups/10"},"attributes":{"name":"Nożyno gr 2","description":"Nożyno, gimnazjum","user-count":10},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/10/relationships/users","related":"http://localhost:3000/groups/10/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/10/relationships/teachers","related":"http://localhost:3000/groups/10/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/10/relationships/courses","related":"http://localhost:3000/groups/10/courses"}}}},{"id":"11","type":"groups","links":{"self":"http://localhost:3000/groups/11"},"attributes":{"name":"Czarna Dąbrówka gr 3","description":"Czarna Dąbrówka, klasa 4-6, gr 3","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/11/relationships/users","related":"http://localhost:3000/groups/11/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/11/relationships/teachers","related":"http://localhost:3000/groups/11/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/11/relationships/courses","related":"http://localhost:3000/groups/11/courses"}}}},{"id":"12","type":"groups","links":{"self":"http://localhost:3000/groups/12"},"attributes":{"name":"Czarna Dąbrówka gr 2","description":"Czarna Dąbrówka, klasa 4-6, gr 2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/12/relationships/users","related":"http://localhost:3000/groups/12/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/12/relationships/teachers","related":"http://localhost:3000/groups/12/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/12/relationships/courses","related":"http://localhost:3000/groups/12/courses"}}}},{"id":"13","type":"groups","links":{"self":"http://localhost:3000/groups/13"},"attributes":{"name":"Czarna Dąbrówka gr 1","description":"Czarna Dąbrówka, klasa 2-3, gr 1","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/13/relationships/users","related":"http://localhost:3000/groups/13/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/13/relationships/teachers","related":"http://localhost:3000/groups/13/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/13/relationships/courses","related":"http://localhost:3000/groups/13/courses"}}}},{"id":"14","type":"groups","links":{"self":"http://localhost:3000/groups/14"},"attributes":{"name":"Czarna Dąbrówka gr 4","description":"Czarna Dąbrówka, gimnazjum, gr 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/14/relationships/users","related":"http://localhost:3000/groups/14/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/14/relationships/teachers","related":"http://localhost:3000/groups/14/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/14/relationships/courses","related":"http://localhost:3000/groups/14/courses"}}}},{"id":"15","type":"groups","links":{"self":"http://localhost:3000/groups/15"},"attributes":{"name":"Czarna Dąbrówka gr 5","description":"Czarna Dąbrówka, gimnazjum, gr 5","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/15/relationships/users","related":"http://localhost:3000/groups/15/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/15/relationships/teachers","related":"http://localhost:3000/groups/15/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/15/relationships/courses","related":"http://localhost:3000/groups/15/courses"}}}},{"id":"16","type":"groups","links":{"self":"http://localhost:3000/groups/16"},"attributes":{"name":"Czarna Dąbrówka gr 6","description":"Czarna Dąbrówka, gimnazjum, gr 6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/16/relationships/users","related":"http://localhost:3000/groups/16/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/16/relationships/teachers","related":"http://localhost:3000/groups/16/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/16/relationships/courses","related":"http://localhost:3000/groups/16/courses"}}}},{"id":"17","type":"groups","links":{"self":"http://localhost:3000/groups/17"},"attributes":{"name":"GIM 1 GR 2","description":"Lębork, Gimnazjum 1, gr 2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/17/relationships/users","related":"http://localhost:3000/groups/17/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/17/relationships/teachers","related":"http://localhost:3000/groups/17/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/17/relationships/courses","related":"http://localhost:3000/groups/17/courses"}}}},{"id":"18","type":"groups","links":{"self":"http://localhost:3000/groups/18"},"attributes":{"name":"GIM 2 GR 2","description":"Lębork, Gimnazjum 2, gr 2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/18/relationships/users","related":"http://localhost:3000/groups/18/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/18/relationships/teachers","related":"http://localhost:3000/groups/18/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/18/relationships/courses","related":"http://localhost:3000/groups/18/courses"}}}},{"id":"19","type":"groups","links":{"self":"http://localhost:3000/groups/19"},"attributes":{"name":"GIM 2 GR 3","description":"Lębork, Gimnazjum 2, gr 3","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/19/relationships/users","related":"http://localhost:3000/groups/19/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/19/relationships/teachers","related":"http://localhost:3000/groups/19/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/19/relationships/courses","related":"http://localhost:3000/groups/19/courses"}}}},{"id":"21","type":"groups","links":{"self":"http://localhost:3000/groups/21"},"attributes":{"name":"GIM 2 GR 4","description":"Lębork, Gimnazjum 2, gr 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/21/relationships/users","related":"http://localhost:3000/groups/21/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/21/relationships/teachers","related":"http://localhost:3000/groups/21/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/21/relationships/courses","related":"http://localhost:3000/groups/21/courses"}}}},{"id":"22","type":"groups","links":{"self":"http://localhost:3000/groups/22"},"attributes":{"name":"JASIEŃ","description":"JASIEŃ, klasa 5-6","user-count":7},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/22/relationships/users","related":"http://localhost:3000/groups/22/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/22/relationships/teachers","related":"http://localhost:3000/groups/22/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/22/relationships/courses","related":"http://localhost:3000/groups/22/courses"}}}},{"id":"23","type":"groups","links":{"self":"http://localhost:3000/groups/23"},"attributes":{"name":"GIM 1","description":"Lębork, Gimnazjum nr 1","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/23/relationships/users","related":"http://localhost:3000/groups/23/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/23/relationships/teachers","related":"http://localhost:3000/groups/23/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/23/relationships/courses","related":"http://localhost:3000/groups/23/courses"}}}},{"id":"24","type":"groups","links":{"self":"http://localhost:3000/groups/24"},"attributes":{"name":"Magda","description":"Magda, kl II","user-count":1},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/24/relationships/users","related":"http://localhost:3000/groups/24/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/24/relationships/teachers","related":"http://localhost:3000/groups/24/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/24/relationships/courses","related":"http://localhost:3000/groups/24/courses"}}}},{"id":"25","type":"groups","links":{"self":"http://localhost:3000/groups/25"},"attributes":{"name":"Rokity gr 2","description":"Rokity, klasa 4-6","user-count":7},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/25/relationships/users","related":"http://localhost:3000/groups/25/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/25/relationships/teachers","related":"http://localhost:3000/groups/25/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/25/relationships/courses","related":"http://localhost:3000/groups/25/courses"}}}},{"id":"26","type":"groups","links":{"self":"http://localhost:3000/groups/26"},"attributes":{"name":"Rokity gr 3","description":"Rokity, gimnazjum","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/26/relationships/users","related":"http://localhost:3000/groups/26/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/26/relationships/teachers","related":"http://localhost:3000/groups/26/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/26/relationships/courses","related":"http://localhost:3000/groups/26/courses"}}}},{"id":"27","type":"groups","links":{"self":"http://localhost:3000/groups/27"},"attributes":{"name":"Rokity gr 4","description":"Rokity, gimnazjum","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/27/relationships/users","related":"http://localhost:3000/groups/27/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/27/relationships/teachers","related":"http://localhost:3000/groups/27/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/27/relationships/courses","related":"http://localhost:3000/groups/27/courses"}}}},{"id":"28","type":"groups","links":{"self":"http://localhost:3000/groups/28"},"attributes":{"name":"Rokity gr 5","description":"Rokity, gimnazjum","user-count":7},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/28/relationships/users","related":"http://localhost:3000/groups/28/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/28/relationships/teachers","related":"http://localhost:3000/groups/28/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/28/relationships/courses","related":"http://localhost:3000/groups/28/courses"}}}},{"id":"29","type":"groups","links":{"self":"http://localhost:3000/groups/29"},"attributes":{"name":"SP 3 GR 5","description":"Lębork, Szkoła Podstawowa nr 5, klasa 4-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/29/relationships/users","related":"http://localhost:3000/groups/29/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/29/relationships/teachers","related":"http://localhost:3000/groups/29/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/29/relationships/courses","related":"http://localhost:3000/groups/29/courses"}}}},{"id":"30","type":"groups","links":{"self":"http://localhost:3000/groups/30"},"attributes":{"name":"SP4 GR 6","description":"Lębork, Szkoła Podstawowa 4, klasa 4-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/30/relationships/users","related":"http://localhost:3000/groups/30/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/30/relationships/teachers","related":"http://localhost:3000/groups/30/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/30/relationships/courses","related":"http://localhost:3000/groups/30/courses"}}}},{"id":"31","type":"groups","links":{"self":"http://localhost:3000/groups/31"},"attributes":{"name":"SP4 GR 7","description":"Lębork, Szkoła Podstawowa 4, klasa 4-6","user-count":9},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/31/relationships/users","related":"http://localhost:3000/groups/31/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/31/relationships/teachers","related":"http://localhost:3000/groups/31/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/31/relationships/courses","related":"http://localhost:3000/groups/31/courses"}}}},{"id":"32","type":"groups","links":{"self":"http://localhost:3000/groups/32"},"attributes":{"name":"SP 5 GR 1","description":"Lębork, Szkoła Podstawowa nr 5, klasa 2,3 oraz 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/32/relationships/users","related":"http://localhost:3000/groups/32/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/32/relationships/teachers","related":"http://localhost:3000/groups/32/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/32/relationships/courses","related":"http://localhost:3000/groups/32/courses"}}}},{"id":"33","type":"groups","links":{"self":"http://localhost:3000/groups/33"},"attributes":{"name":"SP 5 GR 2","description":"Lębork, Szkoła Podstawowa nr 5, klasa 4-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/33/relationships/users","related":"http://localhost:3000/groups/33/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/33/relationships/teachers","related":"http://localhost:3000/groups/33/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/33/relationships/courses","related":"http://localhost:3000/groups/33/courses"}}}},{"id":"34","type":"groups","links":{"self":"http://localhost:3000/groups/34"},"attributes":{"name":"SP 3 GR 2","description":"Lębork, Szkoła Podstawowa nr 3, klasa 3-4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/34/relationships/users","related":"http://localhost:3000/groups/34/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/34/relationships/teachers","related":"http://localhost:3000/groups/34/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/34/relationships/courses","related":"http://localhost:3000/groups/34/courses"}}}},{"id":"35","type":"groups","links":{"self":"http://localhost:3000/groups/35"},"attributes":{"name":"SP4 GR 1","description":"Lębork, Szkoła Podstawowa nr 4, klasa 1-2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/35/relationships/users","related":"http://localhost:3000/groups/35/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/35/relationships/teachers","related":"http://localhost:3000/groups/35/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/35/relationships/courses","related":"http://localhost:3000/groups/35/courses"}}}},{"id":"36","type":"groups","links":{"self":"http://localhost:3000/groups/36"},"attributes":{"name":"GIM 3 GR 2","description":"Lębork, Gimnazjum nr 3, gr 2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/36/relationships/users","related":"http://localhost:3000/groups/36/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/36/relationships/teachers","related":"http://localhost:3000/groups/36/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/36/relationships/courses","related":"http://localhost:3000/groups/36/courses"}}}},{"id":"37","type":"groups","links":{"self":"http://localhost:3000/groups/37"},"attributes":{"name":"GIM 3 GR 1","description":"Lębork, Gimnazjum nr 3, gr 1","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/37/relationships/users","related":"http://localhost:3000/groups/37/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/37/relationships/teachers","related":"http://localhost:3000/groups/37/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/37/relationships/courses","related":"http://localhost:3000/groups/37/courses"}}}},{"id":"38","type":"groups","links":{"self":"http://localhost:3000/groups/38"},"attributes":{"name":"SP 4 GR 3","description":"Lębork, Szkoła Podstawowa nr 4, kl. 6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/38/relationships/users","related":"http://localhost:3000/groups/38/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/38/relationships/teachers","related":"http://localhost:3000/groups/38/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/38/relationships/courses","related":"http://localhost:3000/groups/38/courses"}}}},{"id":"39","type":"groups","links":{"self":"http://localhost:3000/groups/39"},"attributes":{"name":"ZS 3 GR 5","description":"Lębork, szkoła podstawowa, klasa 6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/39/relationships/users","related":"http://localhost:3000/groups/39/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/39/relationships/teachers","related":"http://localhost:3000/groups/39/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/39/relationships/courses","related":"http://localhost:3000/groups/39/courses"}}}},{"id":"40","type":"groups","links":{"self":"http://localhost:3000/groups/40"},"attributes":{"name":"GIM 3 GR 3","description":"Lębork, Gimnazjum nr 3, gr 3","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/40/relationships/users","related":"http://localhost:3000/groups/40/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/40/relationships/teachers","related":"http://localhost:3000/groups/40/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/40/relationships/courses","related":"http://localhost:3000/groups/40/courses"}}}},{"id":"41","type":"groups","links":{"self":"http://localhost:3000/groups/41"},"attributes":{"name":"SP 4 GR 2","description":"Lębork, Szkoła Podstawowa nr 4, gr 2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/41/relationships/users","related":"http://localhost:3000/groups/41/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/41/relationships/teachers","related":"http://localhost:3000/groups/41/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/41/relationships/courses","related":"http://localhost:3000/groups/41/courses"}}}},{"id":"42","type":"groups","links":{"self":"http://localhost:3000/groups/42"},"attributes":{"name":"SP 4 GR 4","description":"Lębork, Szkoła Podstawowa nr 4, gr 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/42/relationships/users","related":"http://localhost:3000/groups/42/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/42/relationships/teachers","related":"http://localhost:3000/groups/42/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/42/relationships/courses","related":"http://localhost:3000/groups/42/courses"}}}},{"id":"43","type":"groups","links":{"self":"http://localhost:3000/groups/43"},"attributes":{"name":"SP 8 GR 3","description":"Lębork, Szkoła Podstawowa nr 8, gr 3","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/43/relationships/users","related":"http://localhost:3000/groups/43/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/43/relationships/teachers","related":"http://localhost:3000/groups/43/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/43/relationships/courses","related":"http://localhost:3000/groups/43/courses"}}}},{"id":"44","type":"groups","links":{"self":"http://localhost:3000/groups/44"},"attributes":{"name":" SP 8 GR 5","description":"Lębork, Szkoła Podstawowa nr 8, gr 5","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/44/relationships/users","related":"http://localhost:3000/groups/44/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/44/relationships/teachers","related":"http://localhost:3000/groups/44/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/44/relationships/courses","related":"http://localhost:3000/groups/44/courses"}}}},{"id":"45","type":"groups","links":{"self":"http://localhost:3000/groups/45"},"attributes":{"name":"SP 8 GR 1","description":"Lębork, Szkoła Podstawowa nr 8, klasa 1-2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/45/relationships/users","related":"http://localhost:3000/groups/45/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/45/relationships/teachers","related":"http://localhost:3000/groups/45/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/45/relationships/courses","related":"http://localhost:3000/groups/45/courses"}}}},{"id":"46","type":"groups","links":{"self":"http://localhost:3000/groups/46"},"attributes":{"name":"SP 8 GR 2","description":"Lębork, Szkoła Podstawowa nr 8, klasa 3-4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/46/relationships/users","related":"http://localhost:3000/groups/46/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/46/relationships/teachers","related":"http://localhost:3000/groups/46/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/46/relationships/courses","related":"http://localhost:3000/groups/46/courses"}}}},{"id":"47","type":"groups","links":{"self":"http://localhost:3000/groups/47"},"attributes":{"name":"SP 8 GR 4","description":"Lębork, Szkoła Podstawowa nr 8, klasa 4-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/47/relationships/users","related":"http://localhost:3000/groups/47/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/47/relationships/teachers","related":"http://localhost:3000/groups/47/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/47/relationships/courses","related":"http://localhost:3000/groups/47/courses"}}}},{"id":"48","type":"groups","links":{"self":"http://localhost:3000/groups/48"},"attributes":{"name":"SP 8 GR 6","description":"Lębork, Szkoła Podstawowa nr 8, klasa 6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/48/relationships/users","related":"http://localhost:3000/groups/48/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/48/relationships/teachers","related":"http://localhost:3000/groups/48/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/48/relationships/courses","related":"http://localhost:3000/groups/48/courses"}}}},{"id":"49","type":"groups","links":{"self":"http://localhost:3000/groups/49"},"attributes":{"name":"SP3 GR 1","description":"Lębork, Szkoła Podstawowa nr 3, klasa 2","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/49/relationships/users","related":"http://localhost:3000/groups/49/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/49/relationships/teachers","related":"http://localhost:3000/groups/49/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/49/relationships/courses","related":"http://localhost:3000/groups/49/courses"}}}},{"id":"50","type":"groups","links":{"self":"http://localhost:3000/groups/50"},"attributes":{"name":"SP3 GR 4","description":"Lębork, Szkoła Podstawowa nr 3, klasa 5-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/50/relationships/users","related":"http://localhost:3000/groups/50/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/50/relationships/teachers","related":"http://localhost:3000/groups/50/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/50/relationships/courses","related":"http://localhost:3000/groups/50/courses"}}}},{"id":"51","type":"groups","links":{"self":"http://localhost:3000/groups/51"},"attributes":{"name":"GIM 2 GR 1","description":"Lębork, Gimnazjum nr 2, gr 1","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/51/relationships/users","related":"http://localhost:3000/groups/51/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/51/relationships/teachers","related":"http://localhost:3000/groups/51/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/51/relationships/courses","related":"http://localhost:3000/groups/51/courses"}}}},{"id":"52","type":"groups","links":{"self":"http://localhost:3000/groups/52"},"attributes":{"name":"GIM 3 GR 5B","description":"Lębork, Gimnazjum nr 3, klasa 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/52/relationships/users","related":"http://localhost:3000/groups/52/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/52/relationships/teachers","related":"http://localhost:3000/groups/52/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/52/relationships/courses","related":"http://localhost:3000/groups/52/courses"}}}},{"id":"53","type":"groups","links":{"self":"http://localhost:3000/groups/53"},"attributes":{"name":"LEŚNICE GR 1","description":"Leśnice, szkoła podstawowa, klasa 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/53/relationships/users","related":"http://localhost:3000/groups/53/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/53/relationships/teachers","related":"http://localhost:3000/groups/53/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/53/relationships/courses","related":"http://localhost:3000/groups/53/courses"}}}},{"id":"54","type":"groups","links":{"self":"http://localhost:3000/groups/54"},"attributes":{"name":"NWL GR 1","description":"Nowa Wieś Lęborska, szkoła podstawowa, klasa 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/54/relationships/users","related":"http://localhost:3000/groups/54/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/54/relationships/teachers","related":"http://localhost:3000/groups/54/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/54/relationships/courses","related":"http://localhost:3000/groups/54/courses"}}}},{"id":"55","type":"groups","links":{"self":"http://localhost:3000/groups/55"},"attributes":{"name":"NWL GR 2","description":"Nowa Wieś Lęborska, szkoła podstawowa, klasa 6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/55/relationships/users","related":"http://localhost:3000/groups/55/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/55/relationships/teachers","related":"http://localhost:3000/groups/55/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/55/relationships/courses","related":"http://localhost:3000/groups/55/courses"}}}},{"id":"56","type":"groups","links":{"self":"http://localhost:3000/groups/56"},"attributes":{"name":"NWL GR 3","description":"Nowa Wieś Lęborska, szkoła podstawowa, klasa 6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/56/relationships/users","related":"http://localhost:3000/groups/56/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/56/relationships/teachers","related":"http://localhost:3000/groups/56/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/56/relationships/courses","related":"http://localhost:3000/groups/56/courses"}}}},{"id":"57","type":"groups","links":{"self":"http://localhost:3000/groups/57"},"attributes":{"name":"NWL GR 4","description":"Nowa Wieś Lęborska, gimnazjum","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/57/relationships/users","related":"http://localhost:3000/groups/57/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/57/relationships/teachers","related":"http://localhost:3000/groups/57/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/57/relationships/courses","related":"http://localhost:3000/groups/57/courses"}}}},{"id":"58","type":"groups","links":{"self":"http://localhost:3000/groups/58"},"attributes":{"name":"NWL GR 5","description":"Nowa Wieś Lęborska, gimnazjum","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/58/relationships/users","related":"http://localhost:3000/groups/58/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/58/relationships/teachers","related":"http://localhost:3000/groups/58/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/58/relationships/courses","related":"http://localhost:3000/groups/58/courses"}}}},{"id":"59","type":"groups","links":{"self":"http://localhost:3000/groups/59"},"attributes":{"name":"NWL GR 6","description":"Nowa Wieś Lęborska, gimnazjum","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/59/relationships/users","related":"http://localhost:3000/groups/59/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/59/relationships/teachers","related":"http://localhost:3000/groups/59/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/59/relationships/courses","related":"http://localhost:3000/groups/59/courses"}}}},{"id":"60","type":"groups","links":{"self":"http://localhost:3000/groups/60"},"attributes":{"name":"REDKOWICE GR 1","description":"Redkowice, szkoła podstawowa, klasa 1-3","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/60/relationships/users","related":"http://localhost:3000/groups/60/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/60/relationships/teachers","related":"http://localhost:3000/groups/60/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/60/relationships/courses","related":"http://localhost:3000/groups/60/courses"}}}},{"id":"61","type":"groups","links":{"self":"http://localhost:3000/groups/61"},"attributes":{"name":"REDKOWICE GR 2","description":"Redkowice, szkoła podstawowa, klasa 4","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/61/relationships/users","related":"http://localhost:3000/groups/61/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/61/relationships/teachers","related":"http://localhost:3000/groups/61/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/61/relationships/courses","related":"http://localhost:3000/groups/61/courses"}}}},{"id":"62","type":"groups","links":{"self":"http://localhost:3000/groups/62"},"attributes":{"name":"REDKOWICE GR 3","description":"Redkowice, szkoła podstawowa, klasa 4-6","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/62/relationships/users","related":"http://localhost:3000/groups/62/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/62/relationships/teachers","related":"http://localhost:3000/groups/62/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/62/relationships/courses","related":"http://localhost:3000/groups/62/courses"}}}},{"id":"63","type":"groups","links":{"self":"http://localhost:3000/groups/63"},"attributes":{"name":"REDKOWICE GR 4","description":"Redkowice, szkoła podstawowa, klasa 1-3","user-count":8},"relationships":{"users":{"links":{"self":"http://localhost:3000/groups/63/relationships/users","related":"http://localhost:3000/groups/63/users"}},"teachers":{"links":{"self":"http://localhost:3000/groups/63/relationships/teachers","related":"http://localhost:3000/groups/63/teachers"}},"courses":{"links":{"self":"http://localhost:3000/groups/63/relationships/courses","related":"http://localhost:3000/groups/63/courses"}}}}]};57 let groups = source.data.map((item) => {58 return new Group(+item.id, item.attributes);59 });60 return new Promise((resolve) => resolve(groups));61 }62}63describe('StudentGroupsComponent', () => {64 let component: StudentGroupsComponent;65 let fixture: ComponentFixture<StudentGroupsComponent>;66 beforeEach(async(() => {67 TestBed.configureTestingModule({68 imports: [ RouterTestingModule, FormsModule, HttpModule, UtilModule ],69 declarations: [ StudentGroupsComponent, GroupListComponent ],70 providers: [71 {provide: GroupService, useClass: GroupServiceMock},72 {provide: AuthService, useClass: AuthServiceMock},73 {provide: UserService, useClass: UserServiceMock},74 {75 provide: AuthHttp,76 useFactory: (http) => {77 return new AuthHttp(new AuthConfig(), http);78 },79 deps: [Http]80 }81 ]82 })83 .compileComponents();84 fixture = TestBed.createComponent(StudentGroupsComponent);85 component = fixture.componentInstance;86 fixture.detectChanges();87 }))88 it('should create', () => {89 expect(component).toBeTruthy();90 });...

Full Screen

Full Screen

test.py

Source:test.py Github

copy

Full Screen

...39def test_objects():40 db = bob.db.cbsr_nir_vis_2.Database()41 p = "view2_1"42 #Checking groups43 assert len(db.groups(protocol=p)) == 344 #cheking files45 assert len(db.objects(protocol=p))== 8750+6481+656646 assert len(db.objects(protocol=p, groups="world"))== 875047 # Checking the modalities48 assert len(db.objects(protocol=p, groups="world", modality=["VIS"])) == 248049 assert len(db.objects(protocol=p, groups="world", modality=["NIR"])) == 627050 51 assert len(db.objects(protocol=p, groups="dev"))== 648152 assert len(db.objects(protocol=p, groups="eval"))== 656653 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 35854 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 612355 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 35856 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 620857 p = "view2_2"58 #Checking groups59 assert len(db.groups(protocol=p)) == 360 #cheking files 61 assert len(db.objects(protocol=p))== 8750+6481+659062 assert len(db.objects(protocol=p, groups="world"))== 875063 assert len(db.objects(protocol=p, groups="world", modality=["VIS"])) == 248064 assert len(db.objects(protocol=p, groups="world", modality=["NIR"])) == 627065 66 assert len(db.objects(protocol=p, groups="dev"))== 648167 assert len(db.objects(protocol=p, groups="eval"))== 659068 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 35869 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 612370 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 35871 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 623272 p = "view2_3"73 #Checking groups74 assert len(db.groups(protocol=p)) == 375 #cheking files 76 assert len(db.objects(protocol=p))== 8750+6481+656877 assert len(db.objects(protocol=p, groups="world"))== 875078 assert len(db.objects(protocol=p, groups="dev"))== 648179 assert len(db.objects(protocol=p, groups="eval"))== 656880 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 35881 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 612382 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 35883 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 621084 p = "view2_4"85 #Checking groups86 assert len(db.groups(protocol=p)) == 387 #cheking files 88 assert len(db.objects(protocol=p))== 8750+6481+641389 assert len(db.objects(protocol=p, groups="world"))== 875090 assert len(db.objects(protocol=p, groups="dev"))== 648191 assert len(db.objects(protocol=p, groups="eval"))== 641392 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 35893 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 612394 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 35895 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 605596 p = "view2_5"97 #Checking groups98 assert len(db.groups(protocol=p)) == 399 #cheking files 100 assert len(db.objects(protocol=p))== 8750+6481+6562101 assert len(db.objects(protocol=p, groups="world"))== 8750102 assert len(db.objects(protocol=p, groups="dev"))== 6481103 assert len(db.objects(protocol=p, groups="eval"))== 6562104 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 358105 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 6123106 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 358107 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 6204108 p = "view2_6"109 #Checking groups110 assert len(db.groups(protocol=p)) == 3111 #cheking files 112 assert len(db.objects(protocol=p))== 8750+6481+6549113 assert len(db.objects(protocol=p, groups="world"))== 8750114 assert len(db.objects(protocol=p, groups="dev"))== 6481115 assert len(db.objects(protocol=p, groups="eval"))== 6549116 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 358117 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 6123118 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 358119 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 6191120 121 p = "view2_7"122 #Checking groups123 assert len(db.groups(protocol=p)) == 3124 #cheking files 125 assert len(db.objects(protocol=p))== 8750+6481+6605126 assert len(db.objects(protocol=p, groups="world"))== 8750127 assert len(db.objects(protocol=p, groups="dev"))== 6481128 assert len(db.objects(protocol=p, groups="eval"))== 6605129 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 358130 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 6123131 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 358132 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 6247133 p = "view2_8"134 #Checking groups135 assert len(db.groups(protocol=p)) == 3136 #cheking files 137 assert len(db.objects(protocol=p))== 8750+6481+6580138 assert len(db.objects(protocol=p, groups="world"))== 8750139 assert len(db.objects(protocol=p, groups="dev"))== 6481140 assert len(db.objects(protocol=p, groups="eval"))== 6580141 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 358142 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 6123143 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 358144 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 6222145 p = "view2_9"146 #Checking groups147 assert len(db.groups(protocol=p)) == 3148 #cheking files 149 assert len(db.objects(protocol=p))== 8750+6481+6520150 assert len(db.objects(protocol=p, groups="world"))== 8750151 assert len(db.objects(protocol=p, groups="dev"))== 6481152 assert len(db.objects(protocol=p, groups="eval"))== 6520153 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 358154 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 6123155 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 358156 assert len(db.objects(protocol=p, groups="eval", purposes="probe"))== 6162157 #db = bob.db.cbsr_nir_vis_2.Database()158 p = "view2_10"159 #Checking groups160 assert len(db.groups(protocol=p)) == 3161 #cheking files 162 assert len(db.objects(protocol=p))== 8750+6481+6603163 assert len(db.objects(protocol=p, groups="world"))== 8750164 assert len(db.objects(protocol=p, groups="dev"))== 6481165 assert len(db.objects(protocol=p, groups="eval"))== 6603166 assert len(db.objects(protocol=p, groups="dev", purposes="enroll"))== 358167 assert len(db.objects(protocol=p, groups="dev", purposes="probe"))== 6123168 assert len(db.objects(protocol=p, groups="eval", purposes="enroll"))== 358...

Full Screen

Full Screen

groups.js

Source:groups.js Github

copy

Full Screen

1// (C) Copyright 2015 Martin Dougiamas2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14angular.module('mm.core')15/**16 * Service to handle groups.17 *18 * @module mm.core.groups19 * @ngdoc service20 * @name $mmGroups21 */22.factory('$mmGroups', function($log, $q, $mmSite, $mmSitesManager) {23 $log = $log.getInstance('$mmGroups');24 var self = {};25 // Group mode constants.26 self.NOGROUPS = 0;27 self.SEPARATEGROUPS = 1;28 self.VISIBLEGROUPS = 2;29 /**30 * Get the groups allowed in an activity.31 *32 * @module mm.core.groups33 * @ngdoc method34 * @name $mmGroups#getActivityAllowedGroups35 * @param {Number} cmid Course module ID.36 * @param {Number} [userid] User ID. If not defined, use current user.37 * @param {String} [siteId] Site ID. If not defined, current site.38 * @return {Promise} Promise resolved when the groups are retrieved.39 */40 self.getActivityAllowedGroups = function(cmid, userid, siteId) {41 userid = userid || $mmSite.getUserId();42 siteId = siteId || $mmSite.getId();43 return $mmSitesManager.getSite(siteId).then(function(site) {44 var params = {45 cmid: cmid,46 userid: userid47 },48 preSets = {49 cacheKey: getActivityAllowedGroupsCacheKey(cmid, userid)50 };51 return site.read('core_group_get_activity_allowed_groups', params, preSets).then(function(response) {52 if (!response || !response.groups) {53 return $q.reject();54 }55 return response.groups;56 });57 });58 };59 /**60 * Get cache key for group mode WS calls.61 *62 * @param {Number} cmid Course module ID.63 * @return {String} Cache key.64 */65 function getActivityAllowedGroupsCacheKey(cmid, userid) {66 return 'mmGroups:allowedgroups:' + cmid + ':' + userid;67 }68 /**69 * Get the group mode of an activity.70 *71 * @module mm.core.groups72 * @ngdoc method73 * @name $mmGroups#getActivityGroupMode74 * @param {Number} cmid Course module ID.75 * @param {String} [siteId] Site ID. If not defined, current site.76 * @return {Promise} Promise resolved when the group mode is retrieved.77 */78 self.getActivityGroupMode = function(cmid, siteId) {79 siteId = siteId || $mmSite.getId();80 return $mmSitesManager.getSite(siteId).then(function(site) {81 var params = {82 cmid: cmid83 },84 preSets = {85 cacheKey: getActivityGroupModeCacheKey(cmid)86 };87 return site.read('core_group_get_activity_groupmode', params, preSets).then(function(response) {88 if (!response || typeof response.groupmode == 'undefined') {89 return $q.reject();90 }91 return response.groupmode;92 });93 });94 };95 /**96 * Get cache key for group mode WS calls.97 *98 * @param {Number} cmid Course module ID.99 * @return {String} Cache key.100 */101 function getActivityGroupModeCacheKey(cmid) {102 return 'mmGroups:groupmode:' + cmid;103 }104 /**105 * Get user groups in courses.106 *107 * @module mm.core.groups108 * @ngdoc method109 * @name $mmGroups#getUserGroups110 * @param {Object[]|Number[]} courses List of courses or course ids to get the groups from.111 * @param {Boolean} [refresh] True when we should not get the value from the cache.112 * @param {String} [siteid] Site to get the groups from. If not defined, use current site.113 * @param {Number} [userid] ID of the user. If not defined, use the userid related to siteid.114 * @return {Promise} Promise to be resolved when the groups are retrieved.115 */116 self.getUserGroups = function(courses, refresh, siteid, userid) {117 var promises = [],118 groups = [],119 deferred = $q.defer();120 angular.forEach(courses, function(course) {121 var courseid;122 if (typeof course == 'object') { // Param is array of courses.123 courseid = course.id;124 } else { // Param is array of courseids.125 courseid = course;126 }127 var promise = self.getUserGroupsInCourse(courseid, refresh, siteid, userid).then(function(coursegroups) {128 groups = groups.concat(coursegroups);129 });130 promises.push(promise);131 });132 $q.all(promises).finally(function() {133 // Use finally because we don't want to block the load of events if a request fails.134 deferred.resolve(groups);135 });136 return deferred.promise;137 };138 /**139 * Get user groups in a course.140 *141 * @module mm.core.groups142 * @ngdoc method143 * @name $mmGroups#getUserGroupsInCourse144 * @param {Number} courseid ID of the course.145 * @param {Boolean} [refresh] True when we should not get the value from the cache.146 * @param {String} [siteid] Site to get the groups from. If not defined, use current site.147 * @param {Number} [userid] ID of the user. If not defined, use ID related to siteid.148 * @return {Promise} Promise to be resolved when the groups are retrieved.149 */150 self.getUserGroupsInCourse = function(courseid, refresh, siteid, userid) {151 siteid = siteid || $mmSite.getId();152 return $mmSitesManager.getSite(siteid).then(function(site) {153 var presets = {},154 data = {155 userid: userid || site.getUserId(),156 courseid: courseid157 };158 if (refresh) {159 presets.getFromCache = false;160 }161 return site.read('core_group_get_course_user_groups', data, presets).then(function(response) {162 if (response && response.groups) {163 return response.groups;164 } else {165 return $q.reject();166 }167 });168 });169 };170 /**171 * Invalidates activity allowed groups.172 *173 * @module mm.core.groups174 * @ngdoc method175 * @name $mmGroups#invalidateActivityAllowedGroups176 * @param {Number} cmid Course module ID.177 * @param {Number} [userid] User ID. If not defined, use current user.178 * @return {Promise} Promise resolved when the data is invalidated.179 */180 self.invalidateActivityAllowedGroups = function(cmid, userid) {181 userid = userid || $mmSite.getUserId();182 return $mmSite.invalidateWsCacheForKey(getActivityAllowedGroupsCacheKey(cmid, userid));183 };184 /**185 * Invalidates activity group mode.186 *187 * @module mm.core.groups188 * @ngdoc method189 * @name $mmGroups#invalidateActivityGroupMode190 * @param {Number} cmid Course module ID.191 * @return {Promise} Promise resolved when the data is invalidated.192 */193 self.invalidateActivityGroupMode = function(cmid) {194 return $mmSite.invalidateWsCacheForKey(getActivityGroupModeCacheKey(cmid));195 };196 return self;...

Full Screen

Full Screen

collisionmanager.js

Source:collisionmanager.js Github

copy

Full Screen

1function CollisionManager(game){2 3 this.game = game;4 this.groups = {5 players: []6 , layers: []7 , drops: []8 , bullets: []9 , enemy_bullets: []10 , baddies: []11 , mines: []12 , teeth: []13 , turrets: []14 };15}16CollisionManager.prototype.addObjectToGroup = function(obj, group){17 18 var arr = this.groups[group];19 arr.push(obj);20};21CollisionManager.prototype.removeObjectFromGroup = function(obj, group){22 var arr = this.groups[group];23 if(arr.indexOf(obj) >= 0){24 arr.splice(arr.indexOf(obj), 1);25 }26};27CollisionManager.prototype.purge = function(){28 for(var i in this.groups){29 var arr = this.groups[i];30 arr = [];31 }32}33CollisionManager.prototype.update = function(){34 //PLAYER VS LAYER35 for( var i = 0; i < this.groups.players.length; i++ ){36 var player = this.groups.players[i];37 for( var k = 0; k < this.groups.layers.length; k++ ){38 var layer = this.groups.layers[k];39 this.game.physics.collide(player, layer);40 }41 }42 //PLAYER VS TURRETS43 for( var i = 0; i < this.groups.players.length; i++ ){44 var player = this.groups.players[i];45 for( var k = 0; k < this.groups.turrets.length; k++ ){46 var turret = this.groups.turrets[k];47 this.game.physics.collide(player, turret);48 }49 }50 //PLAYER VS TEETH51 for( var i = 0; i < this.groups.players.length; i++ ){52 var player = this.groups.players[i];53 for( var k = 0; k < this.groups.teeth.length; k++ ){54 var tooth = this.groups.teeth[k];55 this.game.physics.collide(player, tooth);56 }57 }58 //PLAYER VS BADDIES59 for( var i = 0; i < this.groups.players.length; i++ ){60 var player = this.groups.players[i];61 for( var k = 0; k < this.groups.baddies.length; k++ ){62 var baddie = this.groups.baddies[k];63 this.game.physics.collide(player, baddie, function(){64 if(baddie.name=="mint"){65 player._damage(10);66 baddie.die();67 }68 else if(baddie.name=="corn"){69 player._damage(20);70 baddie.die();71 }72 });73 }74 }75 //BULLET VS LAYER76 for( var i = 0; i < this.groups.bullets.length; i++ ){77 var bullet = this.groups.bullets[i];78 for( var k = 0; k < this.groups.layers.length; k++ ){79 var layer = this.groups.layers[k];80 if(bullet.alive){81 this.game.physics.collide(bullet, layer, function(){ bullet.die(); });82 }83 }84 }85 //BULLETS (player) VS TEETH86 for( var i = 0; i < this.groups.bullets.length; i++){87 var bullet = this.groups.bullets[i];88 for( var k = 0; k < this.groups.teeth.length; k++ ){89 var tooth = this.groups.teeth[k];90 this.game.physics.overlap(bullet, tooth, function(){ bullet.die(); });91 }92 }93 //BULLET VS BADDIES94 for( var i = 0; i < this.groups.bullets.length; i++ ){95 var bullet = this.groups.bullets[i];96 for( var k = 0; k < this.groups.baddies.length; k++ ){97 var baddie = this.groups.baddies[k];98 this.game.physics.overlap(bullet, baddie, function(){99 baddie._damage(bullet._parent.attackDamage, bullet._parent);100 bullet.die();101 if(bullet._parent.name=="player"){102 WaveManager.enemyHits++;103 }104 }); 105 }106 }107 //BADDIES VS LAYER108 for( var i = 0; i < this.groups.baddies.length; i++ ){109 var baddie = this.groups.baddies[i];110 for( var k = 0; k < this.groups.layers.length; k++ ){111 var layer = this.groups.layers[k];112 this.game.physics.collide(baddie, layer);113 }114 }115 //BADDIES VS TEETH116 for( var i = 0; i < this.groups.teeth.length; i++ ){117 var tooth = this.groups.teeth[i];118 for( var k = 0; k < this.groups.baddies.length; k++ ){119 var baddie = this.groups.baddies[k];120 this.game.physics.collide(tooth, baddie, function(){121 if(baddie.name == "mint"){122 tooth.damage(20);123 baddie.die();124 }125 else if(baddie.name == "corn"){126 tooth.damage(30);127 baddie.die();128 }129 });130 }131 }132 //BADDIES VS TURRETS133 for( var i = 0; i < this.groups.baddies.length; i++ ){134 var baddie = this.groups.baddies[i];135 for( var k = 0; k < this.groups.turrets.length; k++ ){136 var turret = this.groups.turrets[k];137 this.game.physics.collide(baddie, turret, function(){138 if(baddie.name == "mint"){139 turret.damage(10);140 baddie.die();141 }142 else if(baddie.name == "corn"){143 turret.damage(20);144 baddie.die();145 }146 });147 }148 }149 //ENEMY BULLETS VS LAYER150 for( var i = 0; i < this.groups.enemy_bullets.length; i++ ){151 var bullet = this.groups.enemy_bullets[i];152 for( var k = 0; k < this.groups.layers.length; k++ ){153 var layer = this.groups.layers[k];154 this.game.physics.collide(bullet, layer, function(){ bullet.die(); });155 }156 }157 //ENEMY BULLETS VS TEETH158 for( var i = 0; i < this.groups.enemy_bullets.length; i++){159 var bullet = this.groups.enemy_bullets[i];160 for( var k = 0; k < this.groups.teeth.length; k++ ){161 var tooth = this.groups.teeth[k];162 this.game.physics.collide(bullet, tooth, function(){ bullet.die(); tooth.damage(10) });163 }164 }165 //ENEMY BULLETS VS TURRETS166 for( var i = 0; i < this.groups.enemy_bullets.length; i++ ){167 var bullet = this.groups.enemy_bullets[i];168 for( var k = 0; k < this.groups.turrets.length; k++ ){169 var turret = this.groups.turrets[k];170 this.game.physics.collide(bullet, turret, function(){ bullet.die(); turret.damage(5); });171 }172 }173 //ENEMY BULLETS VS PLAYER174 for( var i = 0; i < this.groups.enemy_bullets.length; i++ ){175 var bullet = this.groups.enemy_bullets[i];176 for( var k = 0; k < this.groups.players.length; k++ ){177 var player = this.groups.players[k];178 this.game.physics.collide(bullet, player, function(){ bullet.die(); player._damage(5); });179 }180 }...

Full Screen

Full Screen

createFrameGroups.test.ts

Source:createFrameGroups.test.ts Github

copy

Full Screen

1import createFlareErrorFrame from './__helpers__/createFlareErrorFrame';2import createFrameGroups from '../selectors/createFrameGroups';3describe('createFrameGroups', () => {4 let state = {5 frames: [6 createFlareErrorFrame({ relative_file: 'a.php' }),7 createFlareErrorFrame({ relative_file: 'a.php' }),8 createFlareErrorFrame({ relative_file: 'b.php' }),9 ],10 expanded: [3, 2, 1],11 selected: 3,12 };13 let frameGroups = createFrameGroups(state);14 test('it creates list items', () => {15 expect(frameGroups).toHaveLength(2);16 expect(frameGroups[0].type).toBe('application');17 expect(frameGroups[0].relative_file).toBe('a.php');18 expect(frameGroups[0].frames).toHaveLength(2);19 expect(frameGroups[1].type).toBe('application');20 expect(frameGroups[1].relative_file).toBe('b.php');21 expect(frameGroups[1].frames).toHaveLength(1);22 });23 test('it adds frame numbers', () => {24 expect(frameGroups[0].frames[0].frame_number).toBe(3);25 expect(frameGroups[0].frames[1].frame_number).toBe(2);26 expect(frameGroups[1].frames[0].frame_number).toBe(1);27 });28 test('it expands frame groups', () => {29 expect(frameGroups[0].expanded).toBe(true);30 expect(frameGroups[1].expanded).toBe(true);31 });32 test('it selects frames', () => {33 expect(frameGroups[0].frames[0].selected).toBe(true);34 expect(frameGroups[0].frames[1].selected).toBe(false);35 expect(frameGroups[1].frames[0].selected).toBe(false);36 });37 test('it collapses successive vendor frames', () => {38 state = {39 frames: [40 createFlareErrorFrame({ relative_file: 'a.php' }),41 createFlareErrorFrame({ relative_file: 'vendor/b.php' }),42 createFlareErrorFrame({ relative_file: 'vendor/c.php' }),43 createFlareErrorFrame({ relative_file: 'd.php' }),44 ],45 expanded: [4, 1],46 selected: 4,47 };48 frameGroups = createFrameGroups(state);49 expect(frameGroups).toHaveLength(3);50 expect(frameGroups[0].type).toBe('application');51 expect(frameGroups[0].relative_file).toBe('a.php');52 expect(frameGroups[0].frames).toHaveLength(1);53 expect(frameGroups[0].expanded).toBe(true);54 expect(frameGroups[1].type).toBe('vendor');55 expect(frameGroups[1].relative_file).toBe('vendor/b.php');56 expect(frameGroups[1].frames).toHaveLength(2);57 expect(frameGroups[1].expanded).toBe(false);58 expect(frameGroups[2].type).toBe('application');59 expect(frameGroups[2].relative_file).toBe('d.php');60 expect(frameGroups[2].frames).toHaveLength(1);61 expect(frameGroups[2].expanded).toBe(true);62 });63 test('it collapses successive vendor frames', () => {64 state = {65 frames: [66 createFlareErrorFrame({ relative_file: 'a.php' }),67 createFlareErrorFrame({ relative_file: 'unknown' }),68 createFlareErrorFrame({ relative_file: 'unknown' }),69 createFlareErrorFrame({ relative_file: 'd.php' }),70 ],71 expanded: [4, 1],72 selected: 4,73 };74 frameGroups = createFrameGroups(state);75 expect(frameGroups).toHaveLength(3);76 expect(frameGroups[0].type).toBe('application');77 expect(frameGroups[0].relative_file).toBe('a.php');78 expect(frameGroups[0].frames).toHaveLength(1);79 expect(frameGroups[0].expanded).toBe(true);80 expect(frameGroups[1].type).toBe('unknown');81 expect(frameGroups[1].relative_file).toBe('unknown');82 expect(frameGroups[1].frames).toHaveLength(2);83 expect(frameGroups[1].expanded).toBe(false);84 expect(frameGroups[2].type).toBe('application');85 expect(frameGroups[2].relative_file).toBe('d.php');86 expect(frameGroups[2].frames).toHaveLength(1);87 expect(frameGroups[2].expanded).toBe(true);88 });...

Full Screen

Full Screen

user-groups.js

Source:user-groups.js Github

copy

Full Screen

1// Action Types2export const actionTypes = {3 GET_USER_GROUPS: "GET_USER_GROUPS",4 GET_USER_GROUPS_SUCCESS: "GET_USER_GROUPS_SUCCESS",5 GET_USER_GROUPS_FAILED: "GET_USER_GROUPS_FAILED",6 GET_SINGLE_USER_GROUP: "GET_SINGLE_USER_GROUP",7 GET_SINGLE_USER_GROUP_SUCCESS: "GET_SINGLE_USER_GROUP_SUCCESS",8 GET_SINGLE_USER_GROUP_FAILED: "GET_SINGLE_USER_GROUP_FAILED",9 GET_ALL_USER_GROUPS: "GET_ALL_USER_GROUPS",10 GET_ALL_USER_GROUPS_SUCCESS: "GET_ALL_USER_GROUPS_SUCCESS",11 GET_ALL_USER_GROUPS_FAILED: "GET_ALL_USER_GROUPS_FAILED",12 CREATE_USER_GROUPS: "CREATE_USER_GROUPS",13 CREATE_USER_GROUPS_SUCCESS: "CREATE_USER_GROUPS_SUCCESS",14 CREATE_USER_GROUPS_FAILED: "CREATE_USER_GROUPS_FAILED",15 UPDATE_USER_GROUPS: "UPDATE_USER_GROUPS",16 UPDATE_USER_GROUPS_SUCCESS: "UPDATE_USER_GROUPS_SUCCESS",17 UPDATE_USER_GROUPS_FAILED: "UPDATE_USER_GROUPS_FAILED"18};19// Reducer20const initialState = {21 data: null,22 selected: {},23 data_all: [],24 meta: null,25 isLoading: false,26 errors: null,27 actionType: { id: null, type: null }28};29export const actionCreators = {30 createUserGroup: body => ({31 type: actionTypes.CREATE_USER_GROUPS,32 body33 }),34 getSingleUserGroup: id => ({35 type: actionTypes.GET_SINGLE_USER_GROUP,36 id37 }),38 getUserGroupsRequest: filters => ({39 type: actionTypes.GET_USER_GROUPS,40 filters41 }),42 getAllUserGroupsRequest: () => ({ type: actionTypes.GET_ALL_USER_GROUPS }),43 updateUserGroup: (id, body) => ({44 type: actionTypes.UPDATE_USER_GROUPS,45 id,46 body47 })48};49export default (state = initialState, action) => {50 switch (action.type) {51 case actionTypes.GET_SINGLE_USER_GROUP:52 case actionTypes.GET_USER_GROUPS:53 case actionTypes.GET_ALL_USER_GROUPS:54 case actionTypes.CREATE_USER_GROUPS:55 case actionTypes.UPDATE_USER_GROUPS:56 return Object.assign({}, state, { isLoading: true, errors: null });57 case actionTypes.GET_SINGLE_USER_GROUP_SUCCESS:58 return Object.assign({}, state, {59 isLoading: false,60 selected: action.payload.data61 });62 case actionTypes.CREATE_USER_GROUPS_SUCCESS:63 return Object.assign({}, state, {64 isLoading: false,65 actionType: {66 id: action.payload.data.id,67 type: actionTypes.CREATE_USER_GROUPS_SUCCESS68 }69 });70 case actionTypes.UPDATE_USER_GROUPS_SUCCESS:71 return Object.assign({}, state, {72 isLoading: false,73 actionType: {74 id: action.payload.data.id,75 type: actionTypes.UPDATE_USER_GROUPS_SUCCESS76 }77 });78 case actionTypes.GET_USER_GROUPS_SUCCESS:79 return Object.assign({}, state, {80 isLoading: false,81 errors: null,82 data: action.payload.data,83 meta: {84 current: action.payload.meta.current_page,85 total: action.payload.meta.total,86 pageSize: action.payload.meta.per_page87 },88 actionType: {89 id: null,90 type: actionTypes.GET_USER_GROUPS_SUCCESS91 }92 });93 case actionTypes.GET_ALL_USER_GROUPS_SUCCESS:94 return Object.assign({}, state, {95 isLoading: false,96 errors: null,97 data_all: action.payload.data98 });99 case actionTypes.GET_SINGLE_USER_GROUP_FAILED:100 case actionTypes.GET_ALL_USER_GROUPS_FAILED:101 case actionTypes.GET_USER_GROUPS_FAILED:102 case actionTypes.CREATE_USER_GROUPS_FAILED:103 case actionTypes.UPDATE_USER_GROUPS_FAILED:104 return Object.assign({}, state, {105 isLoading: false,106 errors: action.errors107 });108 default:109 return state;110 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf } from '@storybook/react';3import { withInfo } from '@storybook/addon-info';4import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';5import Button from './Button';6storiesOf('Button', module)7 .addDecorator(withKnobs)8 .add('with text', () => (9 <Button disabled={boolean('Disabled', false)}>10 {text('Label', 'Hello Storybook')}11 .add('with some emoji', () => (12 <Button disabled={boolean('Disabled', false)}>13 .add(14 withInfo(`15 `)(() => (16 <Button disabled={boolean('Disabled', false)}>17 .add(18 withInfo({19 })(() => (20 <Button disabled={boolean('Disabled', false)}>21 );22import { configure } from '@storybook/react';23configure(require.context('../src', true, /\.stories\.js$/), module);24import { configure, addDecorator } from '@storybook/react';25import { withInfo } from '@storybook/addon-info';26import { withKnobs } from '@storybook/addon-knobs';27const req = require.context('../src', true, /\.stories\.js$/);28function loadStories() {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from '@storybook/react';2import { withInfo } from '@storybook/addon-info';3import { withKnobs } from '@storybook/addon-knobs';4import { withReadme } from 'storybook-readme';5import { withViewport } from '@storybook/addon-viewport';6import readme from './readme.md';7import { Button } from '../src';8storiesOf('Button', module)9 .addDecorator(withInfo)10 .addDecorator(withKnobs)11 .addDecorator(withReadme(readme))12 .addDecorator(withViewport('iphone6'))13 .add('Default', () => <Button>Default</Button>)14 .add('Primary', () => <Button type="primary">Primary</Button>)15 .add('Danger', () => <Button type="danger">Danger</Button>);16import { configure } from '@storybook/react';17import { setOptions } from '@storybook/addon-options';18import { setDefaults } from 'storybook-addon-jsx';19import { setDefaults as setViewportDefaults } from '@storybook/addon-viewport';20setOptions({

Full Screen

Using AI Code Generation

copy

Full Screen

1var storybook = require('storybook-root');2storybook.groups('group1', 'group2', 'group3');3var storybook = require('storybook-root');4storybook.groups('group1', 'group2', 'group3');5var storybook = require('storybook-root');6storybook.groups('group1', 'group2', 'group3');7var storybook = require('storybook-root');8storybook.groups('group1', 'group2', 'group3');9var storybook = require('storybook-root');10storybook.groups('group1', 'group2', 'group3');11var storybook = require('storybook-root');12storybook.groups('group1', 'group2', 'group3');13var storybook = require('storybook-root');14storybook.groups('group1', 'group2', 'group3');15var storybook = require('storybook-root');16storybook.groups('group1', 'group2', 'group3');17var storybook = require('storybook-root');18storybook.groups('group1', 'group2', 'group3');19var storybook = require('storybook-root');20storybook.groups('group1', 'group2', 'group3');21var storybook = require('storybook-root');22storybook.groups('group1', 'group2', 'group3');23var storybook = require('storybook-root');24storybook.groups('group1', 'group2', 'group3');25var storybook = require('storybook

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf, action } from '@kadira/storybook';3import { withKnobs, text } from '@kadira/storybook-addon-knobs';4import { withInfo } from '@kadira/storybook-addon-info';5import { withNotes } from '@kadira/storybook-addon-notes';6import { withReadme } from 'storybook-readme';7import { withTests } from '@kadira/storybook-addon-knobs';8import { withOptions } from '@kadira/storybook-addon-options';9import { withLinks } from '@kadira/storybook-addon-links';10import { withViewport } from '@kadira/storybook-addon-viewport';11import { withBackgrounds } from '@kadira/storybook-addon-backgrounds';12import { withState } from '@kadira/storybook-addon-state';13import { withPropsTable } from 'storybook-addon-react-docgen';14import { withConsole } from '@kadira/storybook-addon-console';15import { withOptions } from '@kadira/storybook-addon-options';16import { withViewport } from '@kadira/storybook-addon-viewport';17storiesOf('Button', module)18 .addDecorator(withKnobs)19 .addDecorator(withInfo)20 .addDecorator(withNotes)21 .addDecorator(withReadme)22 .addDecorator(withTests)23 .addDecorator(withOptions)24 .addDecorator(withLinks)25 .addDecorator(withViewport)26 .addDecorator(withBackgrounds)27 .addDecorator(withState)28 .addDecorator(withPropsTable)29 .addDecorator(withConsole)30 .addDecorator(withOptions)31 .addDecorator(withViewport)32 .add('with text', () => (33 <button>{text('Label', 'Hello Button')}</button>34 ));35groups: {36 'Button': {37 'with text': {38 knobs: {

Full Screen

Using AI Code Generation

copy

Full Screen

1import {storiesOf, action} from 'storybook-root';2storiesOf('test', module).add('test', () => <div>test</div>);3import {configure} from 'storybook-root';4configure(() => {5 require('../test.js');6}, module);7const path = require('path');8module.exports = {9 resolve: {10 alias: {11 'storybook-root': path.join(__dirname, '../node_modules/@storybook/react'),12 },13 },14};15{16 "dependencies": {17 }18}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { groups } = require('storybook-root');2const { storiesOf } = require('storybook-root');3const { group } = require('storybook-root');4const { story } = require('storybook-root');5groups('Test', () => {6 storiesOf('Test', module)7 .add('Test', () => {8 return `<div>Test</div>`;9 });10});11group('Test', () => {12 story('Test', () => {13 return `<div>Test</div>`;14 });15});16group('Test', () => {17 story('Test', () => {18 return `<div>Test</div>`;19 });20});21story('Test', () => {22 return `<div>Test</div>`;23});24groups('Test', () => {25 storiesOf('Test', module)26 .add('Test', () => {27 return `<div>Test</div>`;28 });29});30storiesOf('Test', module)31 .add('Test', () => {32 return `<div>Test</div>`;33 });34.add('Test', () => {35 return `<div>Test</div>`;36});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { groups } = require('storybook-root')2const stories = groups('stories/**/*.js')3console.log(stories)4const { stories } = require('storybook-root')5const stories = stories('stories/**/*.js')6console.log(stories)7const { stories } = require('storybook-root')8const stories = stories('stories/**/*.js')9console.log(stories)10const { stories } = require('storybook-root')11const stories = stories('stories/**/*.js')12console.log(stories)13const { stories } = require('storybook-root')14const stories = stories('stories/**/*.js')15console.log(stories)16const { stories } = require('storybook-root')17const stories = stories('stories/**/*.js')18console.log(stories)19const { stories } = require('storybook-root')20const stories = stories('stories/**/*.js')21console.log(stories)22const { stories } = require('storybook-root')23const stories = stories('stories/**/*.js')24console.log(stories)25const { stories } = require('storybook-root')26const stories = stories('stories/**/*.js')27console.log(stories)28const { stories } = require('storybook-root')29const stories = stories('stories/**/*.js')30console.log(stories)31const { stories } = require('storybook-root')32const stories = stories('stories/**/*.js')33console.log(stories)34const { stories } = require('storybook-root')35const stories = stories('stories/**/*.js')36console.log(stories)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful