repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
quantopian/zipline
zipline/pipeline/loaders/earnings_estimates.py
SplitAdjustedEstimatesLoader.retrieve_split_adjustment_data_for_sid
def retrieve_split_adjustment_data_for_sid(self, dates, sid, split_adjusted_asof_idx): """ dates : pd.DatetimeIndex The calendar dates. sid : int The sid for which we want to retrieve adjustments. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. Returns ------- pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. """ adjustments = self._split_adjustments.get_adjustments_for_sid( 'splits', sid ) sorted(adjustments, key=lambda adj: adj[0]) # Get rid of any adjustments that happen outside of our date index. adjustments = list(filter(lambda x: dates[0] <= x[0] <= dates[-1], adjustments)) adjustment_values = np.array([adj[1] for adj in adjustments]) timestamps = pd.DatetimeIndex([adj[0] for adj in adjustments]) # We need the first date on which we would have known about each # adjustment. date_indexes = dates.searchsorted(timestamps) pre_adjustment_idxs = np.where( date_indexes <= split_adjusted_asof_idx )[0] last_adjustment_split_asof_idx = -1 if len(pre_adjustment_idxs): last_adjustment_split_asof_idx = pre_adjustment_idxs.max() pre_adjustments = ( adjustment_values[:last_adjustment_split_asof_idx + 1], date_indexes[:last_adjustment_split_asof_idx + 1] ) post_adjustments = ( adjustment_values[last_adjustment_split_asof_idx + 1:], date_indexes[last_adjustment_split_asof_idx + 1:], timestamps[last_adjustment_split_asof_idx + 1:] ) return pre_adjustments, post_adjustments
python
def retrieve_split_adjustment_data_for_sid(self, dates, sid, split_adjusted_asof_idx): """ dates : pd.DatetimeIndex The calendar dates. sid : int The sid for which we want to retrieve adjustments. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. Returns ------- pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. """ adjustments = self._split_adjustments.get_adjustments_for_sid( 'splits', sid ) sorted(adjustments, key=lambda adj: adj[0]) # Get rid of any adjustments that happen outside of our date index. adjustments = list(filter(lambda x: dates[0] <= x[0] <= dates[-1], adjustments)) adjustment_values = np.array([adj[1] for adj in adjustments]) timestamps = pd.DatetimeIndex([adj[0] for adj in adjustments]) # We need the first date on which we would have known about each # adjustment. date_indexes = dates.searchsorted(timestamps) pre_adjustment_idxs = np.where( date_indexes <= split_adjusted_asof_idx )[0] last_adjustment_split_asof_idx = -1 if len(pre_adjustment_idxs): last_adjustment_split_asof_idx = pre_adjustment_idxs.max() pre_adjustments = ( adjustment_values[:last_adjustment_split_asof_idx + 1], date_indexes[:last_adjustment_split_asof_idx + 1] ) post_adjustments = ( adjustment_values[last_adjustment_split_asof_idx + 1:], date_indexes[last_adjustment_split_asof_idx + 1:], timestamps[last_adjustment_split_asof_idx + 1:] ) return pre_adjustments, post_adjustments
[ "def", "retrieve_split_adjustment_data_for_sid", "(", "self", ",", "dates", ",", "sid", ",", "split_adjusted_asof_idx", ")", ":", "adjustments", "=", "self", ".", "_split_adjustments", ".", "get_adjustments_for_sid", "(", "'splits'", ",", "sid", ")", "sorted", "(", "adjustments", ",", "key", "=", "lambda", "adj", ":", "adj", "[", "0", "]", ")", "# Get rid of any adjustments that happen outside of our date index.", "adjustments", "=", "list", "(", "filter", "(", "lambda", "x", ":", "dates", "[", "0", "]", "<=", "x", "[", "0", "]", "<=", "dates", "[", "-", "1", "]", ",", "adjustments", ")", ")", "adjustment_values", "=", "np", ".", "array", "(", "[", "adj", "[", "1", "]", "for", "adj", "in", "adjustments", "]", ")", "timestamps", "=", "pd", ".", "DatetimeIndex", "(", "[", "adj", "[", "0", "]", "for", "adj", "in", "adjustments", "]", ")", "# We need the first date on which we would have known about each", "# adjustment.", "date_indexes", "=", "dates", ".", "searchsorted", "(", "timestamps", ")", "pre_adjustment_idxs", "=", "np", ".", "where", "(", "date_indexes", "<=", "split_adjusted_asof_idx", ")", "[", "0", "]", "last_adjustment_split_asof_idx", "=", "-", "1", "if", "len", "(", "pre_adjustment_idxs", ")", ":", "last_adjustment_split_asof_idx", "=", "pre_adjustment_idxs", ".", "max", "(", ")", "pre_adjustments", "=", "(", "adjustment_values", "[", ":", "last_adjustment_split_asof_idx", "+", "1", "]", ",", "date_indexes", "[", ":", "last_adjustment_split_asof_idx", "+", "1", "]", ")", "post_adjustments", "=", "(", "adjustment_values", "[", "last_adjustment_split_asof_idx", "+", "1", ":", "]", ",", "date_indexes", "[", "last_adjustment_split_asof_idx", "+", "1", ":", "]", ",", "timestamps", "[", "last_adjustment_split_asof_idx", "+", "1", ":", "]", ")", "return", "pre_adjustments", ",", "post_adjustments" ]
dates : pd.DatetimeIndex The calendar dates. sid : int The sid for which we want to retrieve adjustments. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. Returns ------- pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date.
[ "dates", ":", "pd", ".", "DatetimeIndex", "The", "calendar", "dates", ".", "sid", ":", "int", "The", "sid", "for", "which", "we", "want", "to", "retrieve", "adjustments", ".", "split_adjusted_asof_idx", ":", "int", "The", "index", "in", "dates", "as", "-", "of", "which", "the", "data", "is", "split", "adjusted", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/earnings_estimates.py#L1217-L1265
train
Retrieves the split adjustments for a specific sid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsE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wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1010 + 0o51) + '\x33' + chr(1242 - 1187), 57857 - 57849), ehT0Px3KOsy9('\060' + chr(1545 - 1434) + '\x31' + chr(52) + chr(0b110000), 4740 - 4732), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(55) + '\x32', 37064 - 37056), ehT0Px3KOsy9(chr(1590 - 1542) + chr(0b1101111) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\062' + '\063', 64998 - 64990), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1906 - 1855) + chr(1156 - 1101) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(0b11000 + 0o36) + chr(0b10101 + 0o37), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(11793 - 11682) + '\062' + chr(0b1000 + 0o52) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(762 - 712) + chr(1786 - 1736), 20675 - 20667), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(2155 - 2107) + chr(53), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(1831 - 1777) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + chr(0b0 + 0o67) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(176 - 121) + chr(1407 - 1355), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\063', 27327 - 27319), ehT0Px3KOsy9(chr(48) + chr(0b1101100 + 0o3) + chr(1761 - 1712) + '\x36' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(0b101 + 0o54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b110110) + chr(52), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11010 + 0o27) + '\x37' + chr(1414 - 1365), 0b1000), ehT0Px3KOsy9(chr(2224 - 2176) + '\157' + chr(1597 - 1547) + chr(0b0 + 0o63) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1727 - 1672) + chr(0b110000), 50688 - 50680), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(48) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1011110 + 0o21) + '\062' + chr(1267 - 1212) + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(0b10 + 0o155) + '\x31' + chr(2070 - 2015) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11000 + 0o33) + chr(0b11100 + 0o26) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7697 - 7586) + '\x36' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + '\062' + chr(55) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(4958 - 4847) + chr(0b110010) + chr(0b110000) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10285 - 10174) + '\x33' + '\066' + chr(0b110110), 63146 - 63138), ehT0Px3KOsy9(chr(1551 - 1503) + chr(111) + '\062' + chr(0b101000 + 0o10) + chr(0b100 + 0o55), 26036 - 26028), ehT0Px3KOsy9(chr(345 - 297) + chr(10993 - 10882) + chr(51) + chr(0b110010) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1000 + 0o51) + chr(0b100001 + 0o26) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b1011 + 0o52) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + chr(0b110101) + chr(1349 - 1299), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2461 - 2407) + chr(0b101010 + 0o11), 26988 - 26980), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(52), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\x33' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + chr(374 - 325) + chr(0b110010) + chr(2066 - 2014), 20637 - 20629), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11001 + 0o31) + '\x33' + chr(0b110111), 4139 - 4131), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + '\062' + chr(0b110111) + chr(0b10110 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1037 - 987) + chr(0b10011 + 0o35), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(2806 - 2695) + chr(0b110101) + chr(0b11000 + 0o30), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1'), '\144' + chr(0b111011 + 0o52) + chr(99) + chr(0b10111 + 0o130) + chr(100) + '\x65')('\x75' + chr(0b1110100) + chr(1602 - 1500) + chr(45) + chr(752 - 696)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def qaHDEBIzy1qh(oVre8I6UXc3b, SLiSZu5nk7Kn, Cli4Sf5HnGOS, WUf1MtNLz687): KdhBARPBiGt5 = oVre8I6UXc3b._split_adjustments.get_adjustments_for_sid(xafqLlk3kkUe(SXOLrMavuUCe(b"\xac\x10\x96m'\x8a"), chr(7825 - 7725) + chr(101) + chr(99) + '\157' + '\x64' + chr(0b1100101))(chr(0b1110101) + '\164' + chr(0b10011 + 0o123) + chr(45) + chr(0b100110 + 0o22)), Cli4Sf5HnGOS) vUlqIvNSaRMa(KdhBARPBiGt5, key=lambda zY4j_kVEljQN: zY4j_kVEljQN[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11 + 0o55), ord("\x08"))]) KdhBARPBiGt5 = YyaZ4tpXu4lf(hi1V0ySZcNds(lambda OeWW0F1dBPRQ: SLiSZu5nk7Kn[ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b110000), 8)] <= OeWW0F1dBPRQ[ehT0Px3KOsy9('\060' + chr(111) + '\060', 8)] <= SLiSZu5nk7Kn[-ehT0Px3KOsy9(chr(0b110000) + chr(3700 - 3589) + chr(785 - 736), 8)], KdhBARPBiGt5)) U8Mdr3Vt55XH = WqUC3KWvYVup.B0ePDhpqxN5n([zY4j_kVEljQN[ehT0Px3KOsy9('\060' + '\157' + '\061', 8)] for zY4j_kVEljQN in KdhBARPBiGt5]) OzgEdIwHVXe3 = dubtF9GfzOdC.DatetimeIndex([zY4j_kVEljQN[ehT0Px3KOsy9(chr(48) + '\x6f' + '\060', 8)] for zY4j_kVEljQN in KdhBARPBiGt5]) PK4fNLfAvmRm = SLiSZu5nk7Kn.searchsorted(OzgEdIwHVXe3) X0UsRDoFRHj4 = WqUC3KWvYVup.dRFAC59yQBm_(PK4fNLfAvmRm <= WUf1MtNLz687)[ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10000 + 0o40), 8)] ZkMJYvtmpSH3 = -ehT0Px3KOsy9(chr(0b110000) + chr(0b1011100 + 0o23) + chr(0b100110 + 0o13), 8) if c2A0yzQpDQB3(X0UsRDoFRHj4): ZkMJYvtmpSH3 = X0UsRDoFRHj4.tsdjvlgh9gDP() whAC8aWCqLnl = (U8Mdr3Vt55XH[:ZkMJYvtmpSH3 + ehT0Px3KOsy9('\060' + '\157' + '\x31', 8)], PK4fNLfAvmRm[:ZkMJYvtmpSH3 + ehT0Px3KOsy9('\x30' + chr(0b110100 + 0o73) + chr(215 - 166), 8)]) zRLeKgIcnLNY = (U8Mdr3Vt55XH[ZkMJYvtmpSH3 + ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2231 - 2182), 8):], PK4fNLfAvmRm[ZkMJYvtmpSH3 + ehT0Px3KOsy9(chr(0b110000) + chr(12005 - 11894) + chr(0b11 + 0o56), 8):], OzgEdIwHVXe3[ZkMJYvtmpSH3 + ehT0Px3KOsy9(chr(48) + chr(0b111100 + 0o63) + chr(1655 - 1606), 8):]) return (whAC8aWCqLnl, zRLeKgIcnLNY)
quantopian/zipline
zipline/pipeline/loaders/earnings_estimates.py
SplitAdjustedEstimatesLoader.merge_split_adjustments_with_overwrites
def merge_split_adjustments_with_overwrites( self, pre, post, overwrites, requested_split_adjusted_columns ): """ Merge split adjustments with the dict containing overwrites. Parameters ---------- pre : dict[str -> dict[int -> list]] The adjustments that occur before the split-adjusted-asof-date. post : dict[str -> dict[int -> list]] The adjustments that occur after the split-adjusted-asof-date. overwrites : dict[str -> dict[int -> list]] The overwrites across all time. Adjustments will be merged into this dictionary. requested_split_adjusted_columns : list of str List of names of split adjusted columns that are being requested. """ for column_name in requested_split_adjusted_columns: # We can do a merge here because the timestamps in 'pre' and # 'post' are guaranteed to not overlap. if pre: # Either empty or contains all columns. for ts in pre[column_name]: add_new_adjustments( overwrites, pre[column_name][ts], column_name, ts ) if post: # Either empty or contains all columns. for ts in post[column_name]: add_new_adjustments( overwrites, post[column_name][ts], column_name, ts )
python
def merge_split_adjustments_with_overwrites( self, pre, post, overwrites, requested_split_adjusted_columns ): """ Merge split adjustments with the dict containing overwrites. Parameters ---------- pre : dict[str -> dict[int -> list]] The adjustments that occur before the split-adjusted-asof-date. post : dict[str -> dict[int -> list]] The adjustments that occur after the split-adjusted-asof-date. overwrites : dict[str -> dict[int -> list]] The overwrites across all time. Adjustments will be merged into this dictionary. requested_split_adjusted_columns : list of str List of names of split adjusted columns that are being requested. """ for column_name in requested_split_adjusted_columns: # We can do a merge here because the timestamps in 'pre' and # 'post' are guaranteed to not overlap. if pre: # Either empty or contains all columns. for ts in pre[column_name]: add_new_adjustments( overwrites, pre[column_name][ts], column_name, ts ) if post: # Either empty or contains all columns. for ts in post[column_name]: add_new_adjustments( overwrites, post[column_name][ts], column_name, ts )
[ "def", "merge_split_adjustments_with_overwrites", "(", "self", ",", "pre", ",", "post", ",", "overwrites", ",", "requested_split_adjusted_columns", ")", ":", "for", "column_name", "in", "requested_split_adjusted_columns", ":", "# We can do a merge here because the timestamps in 'pre' and", "# 'post' are guaranteed to not overlap.", "if", "pre", ":", "# Either empty or contains all columns.", "for", "ts", "in", "pre", "[", "column_name", "]", ":", "add_new_adjustments", "(", "overwrites", ",", "pre", "[", "column_name", "]", "[", "ts", "]", ",", "column_name", ",", "ts", ")", "if", "post", ":", "# Either empty or contains all columns.", "for", "ts", "in", "post", "[", "column_name", "]", ":", "add_new_adjustments", "(", "overwrites", ",", "post", "[", "column_name", "]", "[", "ts", "]", ",", "column_name", ",", "ts", ")" ]
Merge split adjustments with the dict containing overwrites. Parameters ---------- pre : dict[str -> dict[int -> list]] The adjustments that occur before the split-adjusted-asof-date. post : dict[str -> dict[int -> list]] The adjustments that occur after the split-adjusted-asof-date. overwrites : dict[str -> dict[int -> list]] The overwrites across all time. Adjustments will be merged into this dictionary. requested_split_adjusted_columns : list of str List of names of split adjusted columns that are being requested.
[ "Merge", "split", "adjustments", "with", "the", "dict", "containing", "overwrites", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/earnings_estimates.py#L1294-L1336
train
Merge split adjustments with overwrites.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQ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Y,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1451 - 1403) + '\x6f' + chr(51) + chr(0b110110) + chr(1145 - 1095), ord("\x08")), ehT0Px3KOsy9(chr(1995 - 1947) + '\x6f' + '\062' + chr(0b11000 + 0o37) + chr(0b1001 + 0o51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100001 + 0o20) + chr(321 - 271) + chr(0b110110), 28510 - 28502), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11110 + 0o23) + '\x31' + chr(0b1011 + 0o46), 32263 - 32255), ehT0Px3KOsy9(chr(2191 - 2143) + '\x6f' + chr(0b110001) + chr(1384 - 1336), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(49) + chr(54) + chr(0b1001 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(51) + '\x34' + chr(830 - 779), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10111 + 0o32) + chr(52) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(191 - 139), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(51) + '\x37', 14407 - 14399), ehT0Px3KOsy9(chr(1129 - 1081) + '\x6f' + chr(50) + chr(0b110110) + chr(2552 - 2500), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + chr(1692 - 1641) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\060' + chr(0b110110 + 0o1), 0b1000), ehT0Px3KOsy9(chr(219 - 171) + chr(111) + chr(0b101001 + 0o10) + chr(0b11000 + 0o31), 55139 - 55131), ehT0Px3KOsy9(chr(1089 - 1041) + chr(0b10101 + 0o132) + chr(0b110 + 0o54) + '\x33' + chr(0b100100 + 0o23), 56314 - 56306), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(1953 - 1901) + chr(54), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\x33' + '\061', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(55) + chr(48), 3595 - 3587), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(0b10110 + 0o33), 0b1000), ehT0Px3KOsy9('\x30' + chr(1706 - 1595) + chr(0b110010) + chr(55) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\x34' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b11111 + 0o26) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + chr(0b10100 + 0o36) + chr(0b110111) + chr(1011 - 959), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(0b11101 + 0o23), 56475 - 56467), ehT0Px3KOsy9(chr(48) + '\157' + chr(2289 - 2239) + '\x35' + chr(0b1111 + 0o44), 33746 - 33738), ehT0Px3KOsy9(chr(48) + chr(0b100000 + 0o117) + chr(0b100 + 0o57) + chr(0b110100) + chr(2034 - 1981), 31318 - 31310), ehT0Px3KOsy9('\060' + chr(6449 - 6338) + chr(0b110001) + chr(0b10010 + 0o36) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + '\061' + '\x33' + chr(0b110010), 25282 - 25274), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(10539 - 10428) + chr(261 - 211) + '\065' + chr(0b100110 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(396 - 348) + chr(0b11001 + 0o126) + chr(0b110011) + '\062' + chr(55), 0o10), ehT0Px3KOsy9(chr(1981 - 1933) + chr(0b111011 + 0o64) + '\x31' + chr(48) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(0b0 + 0o64) + chr(1594 - 1541), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1111 + 0o46) + '\065', 1851 - 1843), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(50) + chr(48), 0b1000), ehT0Px3KOsy9(chr(433 - 385) + chr(0b1101111) + '\x31' + chr(50) + chr(2226 - 2173), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(0b100110 + 0o17), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x36' + chr(0b110011), 3410 - 3402), ehT0Px3KOsy9(chr(2192 - 2144) + chr(0b1101111) + chr(0b110011) + '\061' + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + chr(0b110001) + chr(574 - 523) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100110 + 0o17) + '\x30', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + chr(53) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xdc'), '\x64' + chr(0b110001 + 0o64) + '\x63' + chr(111) + '\x64' + chr(0b1001010 + 0o33))(chr(0b1110101) + '\164' + chr(6127 - 6025) + chr(0b101100 + 0o1) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def kp_y02rsEWbv(oVre8I6UXc3b, R10qpuKN2Xpr, h3AXonO0BtP6, zMZvj8Nrus8P, ttOl5JLvANIp): for iDnl4Uy9SMO2 in ttOl5JLvANIp: if R10qpuKN2Xpr: for vRr8KUuV1pxu in R10qpuKN2Xpr[iDnl4Uy9SMO2]: HiTf0i0_tInu(zMZvj8Nrus8P, R10qpuKN2Xpr[iDnl4Uy9SMO2][vRr8KUuV1pxu], iDnl4Uy9SMO2, vRr8KUuV1pxu) if h3AXonO0BtP6: for vRr8KUuV1pxu in h3AXonO0BtP6[iDnl4Uy9SMO2]: HiTf0i0_tInu(zMZvj8Nrus8P, h3AXonO0BtP6[iDnl4Uy9SMO2][vRr8KUuV1pxu], iDnl4Uy9SMO2, vRr8KUuV1pxu)
quantopian/zipline
zipline/pipeline/loaders/earnings_estimates.py
PreviousSplitAdjustedEarningsEstimatesLoader.collect_split_adjustments
def collect_split_adjustments(self, adjustments_for_sid, requested_qtr_data, dates, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns): """ Collect split adjustments for previous quarters and apply them to the given dictionary of splits for the given sid. Since overwrites just replace all estimates before the new quarter with NaN, we don't need to worry about re-applying split adjustments. Parameters ---------- adjustments_for_sid : dict[str -> dict[int -> list]] The dictionary of adjustments to which splits need to be added. Initially it contains only overwrites. requested_qtr_data : pd.DataFrame The requested quarter data for each calendar date per sid. dates : pd.DatetimeIndex The calendar dates for which estimates data is requested. sid : int The sid for which adjustments need to be collected. sid_idx : int The index of `sid` in the adjusted array. sid_estimates : pd.DataFrame The raw estimates data for the given sid. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. requested_split_adjusted_columns : list of str List of requested split adjusted column names. """ (pre_adjustments_dict, post_adjustments_dict) = self._collect_adjustments( requested_qtr_data, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns ) self.merge_split_adjustments_with_overwrites( pre_adjustments_dict, post_adjustments_dict, adjustments_for_sid, requested_split_adjusted_columns )
python
def collect_split_adjustments(self, adjustments_for_sid, requested_qtr_data, dates, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns): """ Collect split adjustments for previous quarters and apply them to the given dictionary of splits for the given sid. Since overwrites just replace all estimates before the new quarter with NaN, we don't need to worry about re-applying split adjustments. Parameters ---------- adjustments_for_sid : dict[str -> dict[int -> list]] The dictionary of adjustments to which splits need to be added. Initially it contains only overwrites. requested_qtr_data : pd.DataFrame The requested quarter data for each calendar date per sid. dates : pd.DatetimeIndex The calendar dates for which estimates data is requested. sid : int The sid for which adjustments need to be collected. sid_idx : int The index of `sid` in the adjusted array. sid_estimates : pd.DataFrame The raw estimates data for the given sid. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. requested_split_adjusted_columns : list of str List of requested split adjusted column names. """ (pre_adjustments_dict, post_adjustments_dict) = self._collect_adjustments( requested_qtr_data, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns ) self.merge_split_adjustments_with_overwrites( pre_adjustments_dict, post_adjustments_dict, adjustments_for_sid, requested_split_adjusted_columns )
[ "def", "collect_split_adjustments", "(", "self", ",", "adjustments_for_sid", ",", "requested_qtr_data", ",", "dates", ",", "sid", ",", "sid_idx", ",", "sid_estimates", ",", "split_adjusted_asof_idx", ",", "pre_adjustments", ",", "post_adjustments", ",", "requested_split_adjusted_columns", ")", ":", "(", "pre_adjustments_dict", ",", "post_adjustments_dict", ")", "=", "self", ".", "_collect_adjustments", "(", "requested_qtr_data", ",", "sid", ",", "sid_idx", ",", "sid_estimates", ",", "split_adjusted_asof_idx", ",", "pre_adjustments", ",", "post_adjustments", ",", "requested_split_adjusted_columns", ")", "self", ".", "merge_split_adjustments_with_overwrites", "(", "pre_adjustments_dict", ",", "post_adjustments_dict", ",", "adjustments_for_sid", ",", "requested_split_adjusted_columns", ")" ]
Collect split adjustments for previous quarters and apply them to the given dictionary of splits for the given sid. Since overwrites just replace all estimates before the new quarter with NaN, we don't need to worry about re-applying split adjustments. Parameters ---------- adjustments_for_sid : dict[str -> dict[int -> list]] The dictionary of adjustments to which splits need to be added. Initially it contains only overwrites. requested_qtr_data : pd.DataFrame The requested quarter data for each calendar date per sid. dates : pd.DatetimeIndex The calendar dates for which estimates data is requested. sid : int The sid for which adjustments need to be collected. sid_idx : int The index of `sid` in the adjusted array. sid_estimates : pd.DataFrame The raw estimates data for the given sid. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. requested_split_adjusted_columns : list of str List of requested split adjusted column names.
[ "Collect", "split", "adjustments", "for", "previous", "quarters", "and", "apply", "them", "to", "the", "given", "dictionary", "of", "splits", "for", "the", "given", "sid", ".", "Since", "overwrites", "just", "replace", "all", "estimates", "before", "the", "new", "quarter", "with", "NaN", "we", "don", "t", "need", "to", "worry", "about", "re", "-", "applying", "split", "adjustments", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/earnings_estimates.py#L1342-L1401
train
Collect split adjustments for previous quarters and apply them to the given dictionary of splits.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,s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,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\x6f' + '\x35' + chr(0b110011), 56455 - 56447), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(1339 - 1286) + chr(0b10001 + 0o42), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1010000 + 0o37) + chr(0b101010 + 0o11) + '\060' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + chr(0b110110) + chr(1078 - 1029), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\157' + chr(53), 56538 - 56530), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010010 + 0o35) + chr(0b110001) + '\x35' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + chr(1114 - 1064) + chr(0b101110 + 0o7) + '\060', 0b1000), ehT0Px3KOsy9(chr(1803 - 1755) + '\x6f' + chr(642 - 593) + chr(2191 - 2139) + chr(0b110101 + 0o2), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10000 + 0o42) + chr(1490 - 1439), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(534 - 482) + chr(0b11 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(840 - 792) + chr(7371 - 7260) + '\061' + chr(140 - 89) + chr(0b1001 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(1452 - 1404) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + '\x33' + '\060', 16734 - 16726), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + '\x35' + '\x36', 0o10), ehT0Px3KOsy9(chr(1520 - 1472) + '\x6f' + chr(1624 - 1571) + '\062', 6721 - 6713), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\x34' + '\062', 6287 - 6279), ehT0Px3KOsy9('\060' + chr(111) + chr(1960 - 1911) + '\064' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(8352 - 8241) + chr(0b1100 + 0o45) + chr(50) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11481 - 11370) + chr(799 - 748) + '\x36' + chr(1884 - 1834), 42188 - 42180), ehT0Px3KOsy9(chr(2259 - 2211) + '\x6f' + chr(0b110001 + 0o0) + '\x37' + chr(0b110 + 0o55), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(50) + chr(0b110010 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(0b1101111) + chr(0b110011) + chr(0b10101 + 0o41) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(0b110101) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x31' + '\066', 0o10), ehT0Px3KOsy9('\x30' + chr(11071 - 10960) + chr(739 - 689) + '\060' + '\060', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(0b1110 + 0o43) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b110000) + chr(52), 36102 - 36094), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110101), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\x36' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(869 - 818) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1110 + 0o141) + '\062' + chr(0b11001 + 0o27), 0b1000), ehT0Px3KOsy9('\060' + chr(3079 - 2968) + chr(540 - 491) + chr(2599 - 2547) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(186 - 136) + chr(51) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + chr(49) + chr(0b110010) + chr(0b1111 + 0o44), 8), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + chr(53) + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001010 + 0o45) + chr(0b110001) + '\060' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\060' + chr(1756 - 1703), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(53) + '\061', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(845 - 792) + chr(584 - 536), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x05'), chr(100) + chr(0b1100101) + chr(7489 - 7390) + chr(0b1101111) + chr(0b1100100) + chr(0b111010 + 0o53))(chr(3647 - 3530) + chr(0b1 + 0o163) + chr(102) + '\x2d' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def NAeZ4L0YySh6(oVre8I6UXc3b, nNp_I8VGPLcI, NHVd95Fi8_DG, SLiSZu5nk7Kn, Cli4Sf5HnGOS, UMjNgIPKJpqW, zpkTotLFZZEV, WUf1MtNLz687, whAC8aWCqLnl, zRLeKgIcnLNY, ttOl5JLvANIp): (V6R4AWOM5EiI, Uz7raO7rDI4K) = oVre8I6UXc3b._collect_adjustments(NHVd95Fi8_DG, Cli4Sf5HnGOS, UMjNgIPKJpqW, zpkTotLFZZEV, WUf1MtNLz687, whAC8aWCqLnl, zRLeKgIcnLNY, ttOl5JLvANIp) xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"F\x0e\xb6\x96`^\x1a\xd8\x0bz\x97\x04'fr[Y\x96\x0b6\x9c\x0f\xa1\xaa\x9d\xa7\xf4a\xdbj\xc3\xffb\x13\xe8:[&\xb6"), chr(2500 - 2400) + chr(0b1100101) + '\143' + '\x6f' + chr(0b1100100) + chr(3330 - 3229))('\x75' + '\164' + chr(102) + chr(0b11010 + 0o23) + chr(56)))(V6R4AWOM5EiI, Uz7raO7rDI4K, nNp_I8VGPLcI, ttOl5JLvANIp)
quantopian/zipline
zipline/pipeline/loaders/earnings_estimates.py
NextSplitAdjustedEarningsEstimatesLoader.collect_split_adjustments
def collect_split_adjustments(self, adjustments_for_sid, requested_qtr_data, dates, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns): """ Collect split adjustments for future quarters. Re-apply adjustments that would be overwritten by overwrites. Merge split adjustments with overwrites into the given dictionary of splits for the given sid. Parameters ---------- adjustments_for_sid : dict[str -> dict[int -> list]] The dictionary of adjustments to which splits need to be added. Initially it contains only overwrites. requested_qtr_data : pd.DataFrame The requested quarter data for each calendar date per sid. dates : pd.DatetimeIndex The calendar dates for which estimates data is requested. sid : int The sid for which adjustments need to be collected. sid_idx : int The index of `sid` in the adjusted array. sid_estimates : pd.DataFrame The raw estimates data for the given sid. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. requested_split_adjusted_columns : list of str List of requested split adjusted column names. """ (pre_adjustments_dict, post_adjustments_dict) = self._collect_adjustments( requested_qtr_data, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns, ) for column_name in requested_split_adjusted_columns: for overwrite_ts in adjustments_for_sid[column_name]: # We need to cumulatively re-apply all adjustments up to the # split-adjusted-asof-date. We might not have any # pre-adjustments, so we should check for that. if overwrite_ts <= split_adjusted_asof_idx \ and pre_adjustments_dict: for split_ts in pre_adjustments_dict[column_name]: # The split has to have occurred during the span of # the overwrite. if split_ts < overwrite_ts: # Create new adjustments here so that we can # re-apply all applicable adjustments to ONLY # the dates being overwritten. adjustments_for_sid[ column_name ][overwrite_ts].extend([ Float64Multiply( 0, overwrite_ts - 1, sid_idx, sid_idx, adjustment.value ) for adjustment in pre_adjustments_dict[ column_name ][split_ts] ]) # After the split-adjusted-asof-date, we need to re-apply all # adjustments that occur after that date and within the # bounds of the overwrite. They need to be applied starting # from the first date and until an end date. The end date is # the date of the newest information we get about # `requested_quarter` that is >= `split_ts`, or if there is no # new knowledge before `overwrite_ts`, then it is the date # before `overwrite_ts`. else: # Overwrites happen at the first index of a new quarter, # so determine here which quarter that is. requested_quarter = requested_qtr_data[ SHIFTED_NORMALIZED_QTRS, sid ].iloc[overwrite_ts] for adjustment_value, date_index, timestamp in zip( *post_adjustments ): if split_adjusted_asof_idx < date_index < overwrite_ts: # Assume the entire overwrite contains stale data upper_bound = overwrite_ts - 1 end_idx = self.determine_end_idx_for_adjustment( timestamp, dates, upper_bound, requested_quarter, sid_estimates ) adjustments_for_sid[ column_name ][overwrite_ts].append( Float64Multiply( 0, end_idx, sid_idx, sid_idx, adjustment_value ) ) self.merge_split_adjustments_with_overwrites( pre_adjustments_dict, post_adjustments_dict, adjustments_for_sid, requested_split_adjusted_columns )
python
def collect_split_adjustments(self, adjustments_for_sid, requested_qtr_data, dates, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns): """ Collect split adjustments for future quarters. Re-apply adjustments that would be overwritten by overwrites. Merge split adjustments with overwrites into the given dictionary of splits for the given sid. Parameters ---------- adjustments_for_sid : dict[str -> dict[int -> list]] The dictionary of adjustments to which splits need to be added. Initially it contains only overwrites. requested_qtr_data : pd.DataFrame The requested quarter data for each calendar date per sid. dates : pd.DatetimeIndex The calendar dates for which estimates data is requested. sid : int The sid for which adjustments need to be collected. sid_idx : int The index of `sid` in the adjusted array. sid_estimates : pd.DataFrame The raw estimates data for the given sid. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. requested_split_adjusted_columns : list of str List of requested split adjusted column names. """ (pre_adjustments_dict, post_adjustments_dict) = self._collect_adjustments( requested_qtr_data, sid, sid_idx, sid_estimates, split_adjusted_asof_idx, pre_adjustments, post_adjustments, requested_split_adjusted_columns, ) for column_name in requested_split_adjusted_columns: for overwrite_ts in adjustments_for_sid[column_name]: # We need to cumulatively re-apply all adjustments up to the # split-adjusted-asof-date. We might not have any # pre-adjustments, so we should check for that. if overwrite_ts <= split_adjusted_asof_idx \ and pre_adjustments_dict: for split_ts in pre_adjustments_dict[column_name]: # The split has to have occurred during the span of # the overwrite. if split_ts < overwrite_ts: # Create new adjustments here so that we can # re-apply all applicable adjustments to ONLY # the dates being overwritten. adjustments_for_sid[ column_name ][overwrite_ts].extend([ Float64Multiply( 0, overwrite_ts - 1, sid_idx, sid_idx, adjustment.value ) for adjustment in pre_adjustments_dict[ column_name ][split_ts] ]) # After the split-adjusted-asof-date, we need to re-apply all # adjustments that occur after that date and within the # bounds of the overwrite. They need to be applied starting # from the first date and until an end date. The end date is # the date of the newest information we get about # `requested_quarter` that is >= `split_ts`, or if there is no # new knowledge before `overwrite_ts`, then it is the date # before `overwrite_ts`. else: # Overwrites happen at the first index of a new quarter, # so determine here which quarter that is. requested_quarter = requested_qtr_data[ SHIFTED_NORMALIZED_QTRS, sid ].iloc[overwrite_ts] for adjustment_value, date_index, timestamp in zip( *post_adjustments ): if split_adjusted_asof_idx < date_index < overwrite_ts: # Assume the entire overwrite contains stale data upper_bound = overwrite_ts - 1 end_idx = self.determine_end_idx_for_adjustment( timestamp, dates, upper_bound, requested_quarter, sid_estimates ) adjustments_for_sid[ column_name ][overwrite_ts].append( Float64Multiply( 0, end_idx, sid_idx, sid_idx, adjustment_value ) ) self.merge_split_adjustments_with_overwrites( pre_adjustments_dict, post_adjustments_dict, adjustments_for_sid, requested_split_adjusted_columns )
[ "def", "collect_split_adjustments", "(", "self", ",", "adjustments_for_sid", ",", "requested_qtr_data", ",", "dates", ",", "sid", ",", "sid_idx", ",", "sid_estimates", ",", "split_adjusted_asof_idx", ",", "pre_adjustments", ",", "post_adjustments", ",", "requested_split_adjusted_columns", ")", ":", "(", "pre_adjustments_dict", ",", "post_adjustments_dict", ")", "=", "self", ".", "_collect_adjustments", "(", "requested_qtr_data", ",", "sid", ",", "sid_idx", ",", "sid_estimates", ",", "split_adjusted_asof_idx", ",", "pre_adjustments", ",", "post_adjustments", ",", "requested_split_adjusted_columns", ",", ")", "for", "column_name", "in", "requested_split_adjusted_columns", ":", "for", "overwrite_ts", "in", "adjustments_for_sid", "[", "column_name", "]", ":", "# We need to cumulatively re-apply all adjustments up to the", "# split-adjusted-asof-date. We might not have any", "# pre-adjustments, so we should check for that.", "if", "overwrite_ts", "<=", "split_adjusted_asof_idx", "and", "pre_adjustments_dict", ":", "for", "split_ts", "in", "pre_adjustments_dict", "[", "column_name", "]", ":", "# The split has to have occurred during the span of", "# the overwrite.", "if", "split_ts", "<", "overwrite_ts", ":", "# Create new adjustments here so that we can", "# re-apply all applicable adjustments to ONLY", "# the dates being overwritten.", "adjustments_for_sid", "[", "column_name", "]", "[", "overwrite_ts", "]", ".", "extend", "(", "[", "Float64Multiply", "(", "0", ",", "overwrite_ts", "-", "1", ",", "sid_idx", ",", "sid_idx", ",", "adjustment", ".", "value", ")", "for", "adjustment", "in", "pre_adjustments_dict", "[", "column_name", "]", "[", "split_ts", "]", "]", ")", "# After the split-adjusted-asof-date, we need to re-apply all", "# adjustments that occur after that date and within the", "# bounds of the overwrite. They need to be applied starting", "# from the first date and until an end date. The end date is", "# the date of the newest information we get about", "# `requested_quarter` that is >= `split_ts`, or if there is no", "# new knowledge before `overwrite_ts`, then it is the date", "# before `overwrite_ts`.", "else", ":", "# Overwrites happen at the first index of a new quarter,", "# so determine here which quarter that is.", "requested_quarter", "=", "requested_qtr_data", "[", "SHIFTED_NORMALIZED_QTRS", ",", "sid", "]", ".", "iloc", "[", "overwrite_ts", "]", "for", "adjustment_value", ",", "date_index", ",", "timestamp", "in", "zip", "(", "*", "post_adjustments", ")", ":", "if", "split_adjusted_asof_idx", "<", "date_index", "<", "overwrite_ts", ":", "# Assume the entire overwrite contains stale data", "upper_bound", "=", "overwrite_ts", "-", "1", "end_idx", "=", "self", ".", "determine_end_idx_for_adjustment", "(", "timestamp", ",", "dates", ",", "upper_bound", ",", "requested_quarter", ",", "sid_estimates", ")", "adjustments_for_sid", "[", "column_name", "]", "[", "overwrite_ts", "]", ".", "append", "(", "Float64Multiply", "(", "0", ",", "end_idx", ",", "sid_idx", ",", "sid_idx", ",", "adjustment_value", ")", ")", "self", ".", "merge_split_adjustments_with_overwrites", "(", "pre_adjustments_dict", ",", "post_adjustments_dict", ",", "adjustments_for_sid", ",", "requested_split_adjusted_columns", ")" ]
Collect split adjustments for future quarters. Re-apply adjustments that would be overwritten by overwrites. Merge split adjustments with overwrites into the given dictionary of splits for the given sid. Parameters ---------- adjustments_for_sid : dict[str -> dict[int -> list]] The dictionary of adjustments to which splits need to be added. Initially it contains only overwrites. requested_qtr_data : pd.DataFrame The requested quarter data for each calendar date per sid. dates : pd.DatetimeIndex The calendar dates for which estimates data is requested. sid : int The sid for which adjustments need to be collected. sid_idx : int The index of `sid` in the adjusted array. sid_estimates : pd.DataFrame The raw estimates data for the given sid. split_adjusted_asof_idx : int The index in `dates` as-of which the data is split adjusted. pre_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values and indexes in `dates` for adjustments that happened before the split-asof-date. post_adjustments : tuple(list(float), list(int), pd.DatetimeIndex) The adjustment values, indexes in `dates`, and timestamps for adjustments that happened after the split-asof-date. requested_split_adjusted_columns : list of str List of requested split adjusted column names.
[ "Collect", "split", "adjustments", "for", "future", "quarters", ".", "Re", "-", "apply", "adjustments", "that", "would", "be", "overwritten", "by", "overwrites", ".", "Merge", "split", "adjustments", "with", "overwrites", "into", "the", "given", "dictionary", "of", "splits", "for", "the", "given", "sid", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/earnings_estimates.py#L1407-L1534
train
Collect split adjustments for future quarters.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4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Q,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(10701 - 10590) + '\x31' + '\065' + '\064', 18463 - 18455), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1231 - 1180) + chr(0b110100) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111 + 0o0) + '\061' + '\060' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + '\062' + chr(0b110100) + chr(2336 - 2282), 44719 - 44711), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + '\062' + '\x32' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\065' + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(12058 - 11947) + '\x33' + chr(0b110010) + chr(1262 - 1209), 18539 - 18531), ehT0Px3KOsy9('\x30' + chr(0b1000 + 0o147) + chr(0b101011 + 0o7) + chr(0b110 + 0o53) + chr(1770 - 1721), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011011 + 0o24) + chr(51) + chr(0b1011 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001 + 0o146) + '\x34' + chr(48), 17618 - 17610), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b110111) + chr(0b101000 + 0o16), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011001 + 0o26) + chr(0b111 + 0o53) + chr(48) + chr(152 - 104), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1010011 + 0o34) + chr(0b11101 + 0o24) + chr(212 - 161) + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\065' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1213 - 1162) + chr(53) + chr(1118 - 1066), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1010 + 0o51) + '\x35' + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1772 - 1721) + '\064' + chr(0b110010), 25539 - 25531), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101100 + 0o5) + '\x36' + '\063', 43446 - 43438), ehT0Px3KOsy9('\x30' + chr(10617 - 10506) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1111 + 0o140) + chr(0b110011) + chr(0b110010) + chr(2639 - 2586), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2253 - 2204) + chr(0b10000 + 0o40) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(245 - 194) + chr(0b111 + 0o54) + '\x35', 0o10), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b101110 + 0o101) + chr(0b101 + 0o55) + chr(0b100101 + 0o13) + chr(2018 - 1970), 8), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + chr(49) + '\x36' + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(62 - 14) + chr(0b1001101 + 0o42) + chr(892 - 842) + chr(52) + '\064', 13588 - 13580), ehT0Px3KOsy9(chr(1131 - 1083) + chr(0b1101111) + chr(49) + chr(0b110100) + '\066', 4724 - 4716), ehT0Px3KOsy9('\x30' + chr(6280 - 6169) + chr(0b110011) + '\x36' + chr(48), 0o10), ehT0Px3KOsy9(chr(1693 - 1645) + '\x6f' + chr(55) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(50) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(6916 - 6805) + chr(0b110001) + chr(0b110011) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + '\062' + chr(52) + '\x30', 55269 - 55261), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(1434 - 1380), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1010111 + 0o30) + chr(0b101 + 0o55) + '\065' + '\x31', 42263 - 42255), ehT0Px3KOsy9(chr(48) + '\157' + chr(1218 - 1168) + '\x30', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1732 - 1683) + chr(53) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + chr(0b110001) + chr(150 - 96) + chr(48), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(2035 - 1981) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2677 - 2566) + chr(0b100100 + 0o17) + chr(1176 - 1123) + chr(49), 58773 - 58765), ehT0Px3KOsy9(chr(298 - 250) + chr(111) + chr(54) + '\065', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(5607 - 5496) + '\065' + chr(0b101110 + 0o2), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'B'), '\x64' + chr(7482 - 7381) + chr(99) + '\157' + '\x64' + '\145')(chr(0b1110101) + '\164' + chr(0b1001 + 0o135) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def NAeZ4L0YySh6(oVre8I6UXc3b, nNp_I8VGPLcI, NHVd95Fi8_DG, SLiSZu5nk7Kn, Cli4Sf5HnGOS, UMjNgIPKJpqW, zpkTotLFZZEV, WUf1MtNLz687, whAC8aWCqLnl, zRLeKgIcnLNY, ttOl5JLvANIp): (V6R4AWOM5EiI, Uz7raO7rDI4K) = oVre8I6UXc3b._collect_adjustments(NHVd95Fi8_DG, Cli4Sf5HnGOS, UMjNgIPKJpqW, zpkTotLFZZEV, WUf1MtNLz687, whAC8aWCqLnl, zRLeKgIcnLNY, ttOl5JLvANIp) for iDnl4Uy9SMO2 in ttOl5JLvANIp: for KjL78AsOoqro in nNp_I8VGPLcI[iDnl4Uy9SMO2]: if KjL78AsOoqro <= WUf1MtNLz687 and V6R4AWOM5EiI: for IARuVzss0sNW in V6R4AWOM5EiI[iDnl4Uy9SMO2]: if IARuVzss0sNW < KjL78AsOoqro: xafqLlk3kkUe(nNp_I8VGPLcI[iDnl4Uy9SMO2][KjL78AsOoqro], xafqLlk3kkUe(SXOLrMavuUCe(b'\t\x9e6\xc3\xfa\xca'), chr(0b1100100) + chr(101) + chr(99) + '\157' + '\144' + '\145')(chr(0b1011001 + 0o34) + chr(0b1110100) + chr(102) + chr(664 - 619) + '\070'))([Nff6Sv7WnHos(ehT0Px3KOsy9(chr(48) + '\x6f' + '\x30', ord("\x08")), KjL78AsOoqro - ehT0Px3KOsy9('\060' + chr(111) + chr(49), 0b1000), UMjNgIPKJpqW, UMjNgIPKJpqW, xafqLlk3kkUe(XKIeRpwaVL4K, xafqLlk3kkUe(SXOLrMavuUCe(b'=\x8b/\xc1\xc3\xfb\x97\xb8*v\xfd\xca'), chr(0b10111 + 0o115) + '\145' + '\x63' + chr(0b1101111) + chr(0b10101 + 0o117) + chr(0b11001 + 0o114))(chr(117) + chr(0b1110100) + chr(3828 - 3726) + chr(0b101100 + 0o1) + chr(1819 - 1763)))) for XKIeRpwaVL4K in V6R4AWOM5EiI[iDnl4Uy9SMO2][IARuVzss0sNW]]) else: IaL_kFGxXZrH = NHVd95Fi8_DG[W1xEV1vVWN01, Cli4Sf5HnGOS].j91vOdIHACRC[KjL78AsOoqro] for (fk36oD90gpjw, TjcF76xb5Cd0, SgRbwnqVfFz7) in pZ0NK2y6HRbn(*zRLeKgIcnLNY): if WUf1MtNLz687 < TjcF76xb5Cd0 < KjL78AsOoqro: xn0BuD7VQYrb = KjL78AsOoqro - ehT0Px3KOsy9(chr(48) + chr(0b1110 + 0o141) + chr(0b1111 + 0o42), 8) p6zNIQAtD3F5 = oVre8I6UXc3b.determine_end_idx_for_adjustment(SgRbwnqVfFz7, SLiSZu5nk7Kn, xn0BuD7VQYrb, IaL_kFGxXZrH, zpkTotLFZZEV) xafqLlk3kkUe(nNp_I8VGPLcI[iDnl4Uy9SMO2][KjL78AsOoqro], xafqLlk3kkUe(SXOLrMavuUCe(b'\r\x962\xc3\xfa\xca'), '\144' + '\145' + '\143' + '\157' + chr(0b110111 + 0o55) + '\145')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(Nff6Sv7WnHos(ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(987 - 876) + chr(1133 - 1085), 8), p6zNIQAtD3F5, UMjNgIPKJpqW, UMjNgIPKJpqW, fk36oD90gpjw)) xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\x830\xc1\xf1\xf1\xa6\xf9uI\xca\xdf<M\x86\x9d\x91\x07k\xb0*\xa9\xf3+\xd3\x0f\x84S\x8e\x7f(\xc5d\xdeb\x00\x04\x12\x9a'), chr(0b1100100) + chr(3177 - 3076) + '\143' + '\x6f' + chr(1630 - 1530) + '\x65')('\165' + '\164' + chr(0b111101 + 0o51) + chr(589 - 544) + chr(0b111000)))(V6R4AWOM5EiI, Uz7raO7rDI4K, nNp_I8VGPLcI, ttOl5JLvANIp)
quantopian/zipline
zipline/pipeline/factors/basic.py
_ExponentialWeightedFactor.from_span
def from_span(cls, inputs, window_length, span, **kwargs): """ Convenience constructor for passing `decay_rate` in terms of `span`. Forwards `decay_rate` as `1 - (2.0 / (1 + span))`. This provides the behavior equivalent to passing `span` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=(1 - (2.0 / (1 + 15.0))), # ) my_ewma = EWMA.from_span( inputs=[EquityPricing.close], window_length=30, span=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`. """ if span <= 1: raise ValueError( "`span` must be a positive number. %s was passed." % span ) decay_rate = (1.0 - (2.0 / (1.0 + span))) assert 0.0 < decay_rate <= 1.0 return cls( inputs=inputs, window_length=window_length, decay_rate=decay_rate, **kwargs )
python
def from_span(cls, inputs, window_length, span, **kwargs): """ Convenience constructor for passing `decay_rate` in terms of `span`. Forwards `decay_rate` as `1 - (2.0 / (1 + span))`. This provides the behavior equivalent to passing `span` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=(1 - (2.0 / (1 + 15.0))), # ) my_ewma = EWMA.from_span( inputs=[EquityPricing.close], window_length=30, span=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`. """ if span <= 1: raise ValueError( "`span` must be a positive number. %s was passed." % span ) decay_rate = (1.0 - (2.0 / (1.0 + span))) assert 0.0 < decay_rate <= 1.0 return cls( inputs=inputs, window_length=window_length, decay_rate=decay_rate, **kwargs )
[ "def", "from_span", "(", "cls", ",", "inputs", ",", "window_length", ",", "span", ",", "*", "*", "kwargs", ")", ":", "if", "span", "<=", "1", ":", "raise", "ValueError", "(", "\"`span` must be a positive number. %s was passed.\"", "%", "span", ")", "decay_rate", "=", "(", "1.0", "-", "(", "2.0", "/", "(", "1.0", "+", "span", ")", ")", ")", "assert", "0.0", "<", "decay_rate", "<=", "1.0", "return", "cls", "(", "inputs", "=", "inputs", ",", "window_length", "=", "window_length", ",", "decay_rate", "=", "decay_rate", ",", "*", "*", "kwargs", ")" ]
Convenience constructor for passing `decay_rate` in terms of `span`. Forwards `decay_rate` as `1 - (2.0 / (1 + span))`. This provides the behavior equivalent to passing `span` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=(1 - (2.0 / (1 + 15.0))), # ) my_ewma = EWMA.from_span( inputs=[EquityPricing.close], window_length=30, span=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`.
[ "Convenience", "constructor", "for", "passing", "decay_rate", "in", "terms", "of", "span", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/basic.py#L198-L240
train
Convenience constructor for passing decay_rate in terms of span.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0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ortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(50) + '\x35' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(2113 - 2065) + '\157' + chr(398 - 347) + chr(0b101011 + 0o14), 16006 - 15998), ehT0Px3KOsy9(chr(0b110000) + chr(0b11100 + 0o123) + chr(1679 - 1630) + chr(1729 - 1681) + chr(986 - 935), 0o10), ehT0Px3KOsy9(chr(1408 - 1360) + '\x6f' + chr(50) + chr(0b100110 + 0o12) + '\x37', 9262 - 9254), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\x35' + chr(2568 - 2514), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(51) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(596 - 547) + chr(2363 - 2310), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + '\x34' + '\063', 0o10), ehT0Px3KOsy9(chr(2289 - 2241) + '\x6f' + '\061' + chr(0b101001 + 0o16) + '\061', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\065' + chr(55), 13696 - 13688), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + '\x30' + chr(0b10001 + 0o45), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(0b110011) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(12096 - 11985) + chr(0b101011 + 0o13), 34083 - 34075), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + chr(1554 - 1504) + '\x31' + chr(2401 - 2351), 31963 - 31955), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b101110 + 0o4) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(0b110111) + chr(1326 - 1275), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\061' + '\x37', 18739 - 18731), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\x31' + chr(0b10100 + 0o43), 32993 - 32985), ehT0Px3KOsy9('\x30' + chr(0b110000 + 0o77) + chr(0b10 + 0o60) + '\062' + chr(0b110010 + 0o5), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(50) + '\x30' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110010) + chr(1015 - 960), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(2195 - 2144) + '\x31' + chr(55), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101000 + 0o7) + chr(49) + chr(0b110001) + chr(0b110111), 8), ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + chr(603 - 553) + chr(0b110111) + '\x34', 0b1000), ehT0Px3KOsy9(chr(1004 - 956) + chr(3947 - 3836) + chr(49) + chr(0b110 + 0o60) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(421 - 370) + chr(53) + chr(1618 - 1564), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(0b110100 + 0o2) + chr(0b11000 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + chr(0b1011 + 0o47) + '\x34' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1177 - 1129) + chr(111) + chr(0b10 + 0o60) + chr(51) + chr(0b0 + 0o67), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(54) + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b11110 + 0o22) + chr(0b1010 + 0o53), 26192 - 26184), ehT0Px3KOsy9(chr(227 - 179) + '\x6f' + chr(0b101100 + 0o6) + chr(0b101010 + 0o12) + '\x35', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b110101) + '\x37', 31048 - 31040), ehT0Px3KOsy9(chr(2099 - 2051) + '\x6f' + chr(0b11011 + 0o30) + chr(2002 - 1947) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1332 - 1284) + '\x6f' + chr(49) + chr(0b110000) + chr(1866 - 1815), 8), ehT0Px3KOsy9(chr(48) + chr(0b110011 + 0o74) + chr(0b101011 + 0o6) + chr(48) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(52) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + chr(0b110011) + '\064' + '\x36', 240 - 232)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101 + 0o60) + chr(0b11010 + 0o26), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x81'), chr(5427 - 5327) + chr(0b1100101) + chr(9236 - 9137) + '\x6f' + '\144' + chr(101))(chr(117) + chr(0b1101010 + 0o12) + chr(0b1100110) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def fj4hj09qP7vZ(NSstowUUZlxS, vXoupepMtCXU, uIUHNEHOeEMG, cM7fEShWxtgh, **M8EIoTs2GJXE): if cM7fEShWxtgh <= ehT0Px3KOsy9(chr(0b110000) + chr(0b1001101 + 0o42) + chr(0b0 + 0o61), ord("\x08")): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcfl3\xe6z\x8e{\xa0V\n\x9b\xe6?c\xaa2\xdb\xbf \xe4\xeav\xfe\xb9*\x9c\x1c\x9b\x1a\xc7\xfaA\xeb\x85J\x8cc7\xc1\x95\x8fo"\xf4g\x8b?\xe3'), '\144' + '\145' + '\143' + chr(111) + chr(0b111100 + 0o50) + chr(8168 - 8067))(chr(0b1001001 + 0o54) + '\x74' + chr(9563 - 9461) + '\x2d' + chr(0b111000)) % cM7fEShWxtgh) ysg2zuLaUZLS = 1.0 - 2.0 / (1.0 + cM7fEShWxtgh) assert 0.0 < ysg2zuLaUZLS <= 1.0 return NSstowUUZlxS(inputs=vXoupepMtCXU, window_length=uIUHNEHOeEMG, decay_rate=ysg2zuLaUZLS, **M8EIoTs2GJXE)
quantopian/zipline
zipline/pipeline/factors/basic.py
_ExponentialWeightedFactor.from_halflife
def from_halflife(cls, inputs, window_length, halflife, **kwargs): """ Convenience constructor for passing ``decay_rate`` in terms of half life. Forwards ``decay_rate`` as ``exp(log(.5) / halflife)``. This provides the behavior equivalent to passing `halflife` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=np.exp(np.log(0.5) / 15), # ) my_ewma = EWMA.from_halflife( inputs=[EquityPricing.close], window_length=30, halflife=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`. """ if halflife <= 0: raise ValueError( "`span` must be a positive number. %s was passed." % halflife ) decay_rate = exp(log(.5) / halflife) assert 0.0 < decay_rate <= 1.0 return cls( inputs=inputs, window_length=window_length, decay_rate=decay_rate, **kwargs )
python
def from_halflife(cls, inputs, window_length, halflife, **kwargs): """ Convenience constructor for passing ``decay_rate`` in terms of half life. Forwards ``decay_rate`` as ``exp(log(.5) / halflife)``. This provides the behavior equivalent to passing `halflife` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=np.exp(np.log(0.5) / 15), # ) my_ewma = EWMA.from_halflife( inputs=[EquityPricing.close], window_length=30, halflife=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`. """ if halflife <= 0: raise ValueError( "`span` must be a positive number. %s was passed." % halflife ) decay_rate = exp(log(.5) / halflife) assert 0.0 < decay_rate <= 1.0 return cls( inputs=inputs, window_length=window_length, decay_rate=decay_rate, **kwargs )
[ "def", "from_halflife", "(", "cls", ",", "inputs", ",", "window_length", ",", "halflife", ",", "*", "*", "kwargs", ")", ":", "if", "halflife", "<=", "0", ":", "raise", "ValueError", "(", "\"`span` must be a positive number. %s was passed.\"", "%", "halflife", ")", "decay_rate", "=", "exp", "(", "log", "(", ".5", ")", "/", "halflife", ")", "assert", "0.0", "<", "decay_rate", "<=", "1.0", "return", "cls", "(", "inputs", "=", "inputs", ",", "window_length", "=", "window_length", ",", "decay_rate", "=", "decay_rate", ",", "*", "*", "kwargs", ")" ]
Convenience constructor for passing ``decay_rate`` in terms of half life. Forwards ``decay_rate`` as ``exp(log(.5) / halflife)``. This provides the behavior equivalent to passing `halflife` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=np.exp(np.log(0.5) / 15), # ) my_ewma = EWMA.from_halflife( inputs=[EquityPricing.close], window_length=30, halflife=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`.
[ "Convenience", "constructor", "for", "passing", "decay_rate", "in", "terms", "of", "half", "life", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/basic.py#L244-L286
train
This constructor creates a new instance of the class from the given input and window length and halflife.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o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voPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\062' + chr(0b10010 + 0o43), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100001 + 0o21) + '\065' + chr(49), 0o10), ehT0Px3KOsy9(chr(1727 - 1679) + chr(111) + chr(0b110001) + chr(0b11011 + 0o33) + chr(1874 - 1823), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(4819 - 4708) + '\061' + chr(0b110110) + chr(0b100 + 0o57), 8), ehT0Px3KOsy9(chr(288 - 240) + '\157' + chr(0b110010) + '\067' + chr(49), 10756 - 10748), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\064' + chr(48), 0b1000), ehT0Px3KOsy9(chr(1459 - 1411) + chr(0b1011100 + 0o23) + chr(2119 - 2070) + chr(0b110000) + '\061', 23345 - 23337), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10001 + 0o41) + chr(2014 - 1965) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10001 + 0o40) + '\x37' + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1100 + 0o45) + '\060' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1679 - 1631) + chr(111) + chr(2128 - 2078) + chr(0b110111) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(1761 - 1650) + '\x32' + chr(0b110010) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1954 - 1904) + '\x31' + chr(141 - 93), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110110) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b110100) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\063' + chr(0b110000) + chr(653 - 601), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\064' + chr(173 - 118), 0b1000), ehT0Px3KOsy9(chr(670 - 622) + chr(0b1101111) + chr(210 - 160) + chr(1372 - 1321) + '\063', 15025 - 15017), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(111) + chr(51) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100100 + 0o23) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + '\x32' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(2168 - 2114) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + chr(139 - 90) + '\066' + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(4352 - 4241) + chr(0b110010) + chr(0b10000 + 0o42) + chr(0b100010 + 0o20), 8), ehT0Px3KOsy9('\x30' + chr(0b1100001 + 0o16) + chr(0b110001) + chr(0b1000 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b110011) + chr(0b110110) + chr(0b1100 + 0o53), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11000 + 0o33) + '\x30' + chr(0b110011), 20277 - 20269), ehT0Px3KOsy9(chr(992 - 944) + chr(11469 - 11358) + chr(2993 - 2938) + '\062', 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(111) + chr(0b110010) + chr(1511 - 1463) + chr(2620 - 2567), 39033 - 39025), ehT0Px3KOsy9('\x30' + '\157' + chr(1376 - 1326) + chr(0b1101 + 0o44) + chr(0b1100 + 0o45), 4543 - 4535), ehT0Px3KOsy9(chr(48) + chr(8152 - 8041) + '\x33' + chr(0b110100) + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\066' + chr(51), 60960 - 60952), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(0b1101 + 0o45) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(426 - 378) + chr(0b1101000 + 0o7) + chr(50) + chr(0b101011 + 0o14) + '\064', 0b1000), ehT0Px3KOsy9(chr(1453 - 1405) + chr(0b111 + 0o150) + chr(0b100110 + 0o14) + chr(880 - 826) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + chr(0b110000 + 0o2) + chr(0b110001) + chr(2126 - 2072), 36754 - 36746), ehT0Px3KOsy9(chr(970 - 922) + chr(10393 - 10282) + chr(178 - 129) + '\x31' + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(10181 - 10070) + '\062' + chr(0b110100) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(909 - 861) + chr(111) + chr(992 - 941) + chr(1208 - 1160), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10111 + 0o40) + '\x36', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(372 - 324) + chr(111) + '\x35' + '\x30', 55248 - 55240)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'{'), chr(8840 - 8740) + chr(101) + '\143' + '\x6f' + chr(3741 - 3641) + chr(1782 - 1681))(chr(2946 - 2829) + '\164' + '\146' + chr(1279 - 1234) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def OcZVstDGDOow(NSstowUUZlxS, vXoupepMtCXU, uIUHNEHOeEMG, qvcI3N4kUawJ, **M8EIoTs2GJXE): if qvcI3N4kUawJ <= ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b101101 + 0o102) + chr(48), 54391 - 54383): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'5\xda\x03\x12\xd7\x80a\xe1\x0b1\xcf\xb2\xea\x13\x83\xa5\x07\xebwI~C\x1b\xe4j\xd7\xadO\xe8\xeb\x85A\x7f\x9c\x95\xfdl\xd0yMu\xd9\x12\x00\xca\x85%\xa2'), chr(0b1100100) + '\145' + chr(99) + chr(11040 - 10929) + '\x64' + chr(101))(chr(117) + chr(0b1110100) + chr(0b11001 + 0o115) + '\x2d' + '\x38') % qvcI3N4kUawJ) ysg2zuLaUZLS = quvessij56om(WHAFymdp8Jcy(0.5) / qvcI3N4kUawJ) assert 0.0 < ysg2zuLaUZLS <= 1.0 return NSstowUUZlxS(inputs=vXoupepMtCXU, window_length=uIUHNEHOeEMG, decay_rate=ysg2zuLaUZLS, **M8EIoTs2GJXE)
quantopian/zipline
zipline/pipeline/factors/basic.py
_ExponentialWeightedFactor.from_center_of_mass
def from_center_of_mass(cls, inputs, window_length, center_of_mass, **kwargs): """ Convenience constructor for passing `decay_rate` in terms of center of mass. Forwards `decay_rate` as `1 - (1 / 1 + center_of_mass)`. This provides behavior equivalent to passing `center_of_mass` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=(1 - (1 / 15.0)), # ) my_ewma = EWMA.from_center_of_mass( inputs=[EquityPricing.close], window_length=30, center_of_mass=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`. """ return cls( inputs=inputs, window_length=window_length, decay_rate=(1.0 - (1.0 / (1.0 + center_of_mass))), **kwargs )
python
def from_center_of_mass(cls, inputs, window_length, center_of_mass, **kwargs): """ Convenience constructor for passing `decay_rate` in terms of center of mass. Forwards `decay_rate` as `1 - (1 / 1 + center_of_mass)`. This provides behavior equivalent to passing `center_of_mass` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=(1 - (1 / 15.0)), # ) my_ewma = EWMA.from_center_of_mass( inputs=[EquityPricing.close], window_length=30, center_of_mass=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`. """ return cls( inputs=inputs, window_length=window_length, decay_rate=(1.0 - (1.0 / (1.0 + center_of_mass))), **kwargs )
[ "def", "from_center_of_mass", "(", "cls", ",", "inputs", ",", "window_length", ",", "center_of_mass", ",", "*", "*", "kwargs", ")", ":", "return", "cls", "(", "inputs", "=", "inputs", ",", "window_length", "=", "window_length", ",", "decay_rate", "=", "(", "1.0", "-", "(", "1.0", "/", "(", "1.0", "+", "center_of_mass", ")", ")", ")", ",", "*", "*", "kwargs", ")" ]
Convenience constructor for passing `decay_rate` in terms of center of mass. Forwards `decay_rate` as `1 - (1 / 1 + center_of_mass)`. This provides behavior equivalent to passing `center_of_mass` to pandas.ewma. Examples -------- .. code-block:: python # Equivalent to: # my_ewma = EWMA( # inputs=[EquityPricing.close], # window_length=30, # decay_rate=(1 - (1 / 15.0)), # ) my_ewma = EWMA.from_center_of_mass( inputs=[EquityPricing.close], window_length=30, center_of_mass=15, ) Notes ----- This classmethod is provided by both :class:`ExponentialWeightedMovingAverage` and :class:`ExponentialWeightedMovingStdDev`.
[ "Convenience", "constructor", "for", "passing", "decay_rate", "in", "terms", "of", "center", "of", "mass", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/basic.py#L289-L328
train
This is a convenience constructor for passing decay_rate in terms of center of mass.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_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NKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(0b110110) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1504 - 1456) + chr(7709 - 7598) + chr(0b101001 + 0o10) + chr(0b110110), 44392 - 44384), ehT0Px3KOsy9('\060' + chr(111) + chr(55) + '\064', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + '\061' + chr(0b110 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b110101), 15507 - 15499), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(969 - 918) + chr(2644 - 2589), 0o10), ehT0Px3KOsy9(chr(48) + chr(1984 - 1873) + '\x32' + '\x36' + chr(1451 - 1400), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10110 + 0o35) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(623 - 575) + '\x6f' + '\062' + chr(2431 - 2378) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + '\x37', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(55) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(49) + '\x35', 0b1000), ehT0Px3KOsy9(chr(691 - 643) + chr(0b1101011 + 0o4) + chr(0b1001 + 0o52) + '\x30' + '\066', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\063' + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1001101 + 0o42) + chr(51) + chr(2181 - 2131) + chr(0b101100 + 0o7), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b110111) + chr(315 - 264), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b100 + 0o56), 43583 - 43575), ehT0Px3KOsy9(chr(48) + chr(2495 - 2384) + chr(0b101111 + 0o3) + '\x35' + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1146 - 1095) + '\x33' + chr(865 - 812), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101100 + 0o5) + '\062' + chr(0b101101 + 0o5), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(1344 - 1289) + chr(49), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(721 - 670) + '\x37', 0o10), ehT0Px3KOsy9(chr(1185 - 1137) + chr(0b1011 + 0o144) + chr(50) + chr(0b111 + 0o57), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + '\x30' + chr(0b110110), 8), ehT0Px3KOsy9(chr(2022 - 1974) + chr(0b1010010 + 0o35) + chr(54) + chr(0b101001 + 0o10), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b110010) + chr(51), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b101111 + 0o1), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b110100) + chr(0b101011 + 0o14), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b110010) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2061 - 2012) + chr(49) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(210 - 159) + chr(630 - 581) + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(3110 - 2999) + chr(49) + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9(chr(364 - 316) + chr(12283 - 12172) + '\x31' + chr(55) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(813 - 760) + '\x31', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x34' + chr(853 - 801), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\060' + chr(196 - 142), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11110 + 0o23) + chr(0b110100) + chr(0b1100 + 0o44), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'*'), '\144' + chr(1936 - 1835) + '\x63' + chr(111) + chr(8837 - 8737) + '\145')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(45) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def V2IYFDTTzpSz(NSstowUUZlxS, vXoupepMtCXU, uIUHNEHOeEMG, IDa9UZo7faUe, **M8EIoTs2GJXE): return NSstowUUZlxS(inputs=vXoupepMtCXU, window_length=uIUHNEHOeEMG, decay_rate=1.0 - 1.0 / (1.0 + IDa9UZo7faUe), **M8EIoTs2GJXE)
quantopian/zipline
zipline/utils/math_utils.py
tolerant_equals
def tolerant_equals(a, b, atol=10e-7, rtol=10e-7, equal_nan=False): """Check if a and b are equal with some tolerance. Parameters ---------- a, b : float The floats to check for equality. atol : float, optional The absolute tolerance. rtol : float, optional The relative tolerance. equal_nan : bool, optional Should NaN compare equal? See Also -------- numpy.isclose Notes ----- This function is just a scalar version of numpy.isclose for performance. See the docstring of ``isclose`` for more information about ``atol`` and ``rtol``. """ if equal_nan and isnan(a) and isnan(b): return True return math.fabs(a - b) <= (atol + rtol * math.fabs(b))
python
def tolerant_equals(a, b, atol=10e-7, rtol=10e-7, equal_nan=False): """Check if a and b are equal with some tolerance. Parameters ---------- a, b : float The floats to check for equality. atol : float, optional The absolute tolerance. rtol : float, optional The relative tolerance. equal_nan : bool, optional Should NaN compare equal? See Also -------- numpy.isclose Notes ----- This function is just a scalar version of numpy.isclose for performance. See the docstring of ``isclose`` for more information about ``atol`` and ``rtol``. """ if equal_nan and isnan(a) and isnan(b): return True return math.fabs(a - b) <= (atol + rtol * math.fabs(b))
[ "def", "tolerant_equals", "(", "a", ",", "b", ",", "atol", "=", "10e-7", ",", "rtol", "=", "10e-7", ",", "equal_nan", "=", "False", ")", ":", "if", "equal_nan", "and", "isnan", "(", "a", ")", "and", "isnan", "(", "b", ")", ":", "return", "True", "return", "math", ".", "fabs", "(", "a", "-", "b", ")", "<=", "(", "atol", "+", "rtol", "*", "math", ".", "fabs", "(", "b", ")", ")" ]
Check if a and b are equal with some tolerance. Parameters ---------- a, b : float The floats to check for equality. atol : float, optional The absolute tolerance. rtol : float, optional The relative tolerance. equal_nan : bool, optional Should NaN compare equal? See Also -------- numpy.isclose Notes ----- This function is just a scalar version of numpy.isclose for performance. See the docstring of ``isclose`` for more information about ``atol`` and ``rtol``.
[ "Check", "if", "a", "and", "b", "are", "equal", "with", "some", "tolerance", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/math_utils.py#L21-L47
train
Check if two numbers are equal with some tolerance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM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ebP,QC9iu2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011 + 0o0) + chr(0b110010 + 0o0) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48 - 0) + chr(8662 - 8551) + chr(0b110 + 0o55) + '\x33', 0o10), ehT0Px3KOsy9(chr(1062 - 1014) + chr(111) + chr(51) + chr(0b110011) + chr(52), 0o10), ehT0Px3KOsy9(chr(1624 - 1576) + '\x6f' + '\x32' + '\064' + '\064', 1900 - 1892), ehT0Px3KOsy9('\060' + chr(3632 - 3521) + '\061' + '\x34' + chr(0b10000 + 0o40), 41581 - 41573), ehT0Px3KOsy9(chr(1052 - 1004) + chr(0b1101111) + chr(0b100 + 0o56) + chr(0b101110 + 0o3) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1241 - 1192) + chr(0b11010 + 0o34) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\x6f' + chr(50) + chr(1230 - 1180) + chr(50), 43671 - 43663), ehT0Px3KOsy9('\x30' + chr(111) + chr(1116 - 1066) + '\x33' + chr(0b110000 + 0o0), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10586 - 10475) + '\x33' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + '\x32' + '\061' + chr(0b11110 + 0o23), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(579 - 527) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(191 - 142) + '\064' + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1174 - 1125) + chr(0b110101) + chr(1261 - 1212), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1728 - 1678) + '\062' + '\x32', 8), ehT0Px3KOsy9('\x30' + chr(12171 - 12060) + '\062', 47522 - 47514), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110111) + chr(55), 0b1000), ehT0Px3KOsy9(chr(1352 - 1304) + '\157' + chr(2111 - 2062) + chr(54) + chr(348 - 295), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + chr(0b110011) + chr(0b1110 + 0o46) + chr(50), 17755 - 17747), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(1790 - 1741) + '\x33' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(0b110001) + chr(0b110110) + '\062', 8), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(51) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + '\061' + chr(0b101 + 0o54) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\x6f' + '\062' + chr(55) + '\063', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\x6f' + '\061' + '\063' + '\x31', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(53) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010 + 0o4) + chr(1728 - 1678), 0b1000), ehT0Px3KOsy9(chr(1103 - 1055) + chr(0b1011001 + 0o26) + chr(0b110001) + chr(55) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011011 + 0o24) + '\062' + '\065' + chr(2340 - 2287), 29155 - 29147), ehT0Px3KOsy9(chr(48) + chr(1112 - 1001) + chr(0b11000 + 0o33) + chr(52) + chr(1811 - 1759), 40979 - 40971), ehT0Px3KOsy9(chr(0b110000) + chr(0b101000 + 0o107) + '\063' + '\x35' + chr(0b11111 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\067' + chr(118 - 68), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(2082 - 2031), 47842 - 47834), ehT0Px3KOsy9(chr(1889 - 1841) + chr(111) + '\063' + chr(48) + chr(0b110 + 0o56), 45108 - 45100), ehT0Px3KOsy9(chr(354 - 306) + chr(1305 - 1194) + '\x32' + chr(0b101 + 0o53) + '\060', 0b1000), ehT0Px3KOsy9('\x30' + chr(5551 - 5440) + '\x32' + chr(0b1 + 0o61) + chr(0b101100 + 0o11), 34498 - 34490)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10000 + 0o45) + '\x30', 56494 - 56486)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa'), chr(6324 - 6224) + '\x65' + '\143' + chr(0b1101101 + 0o2) + chr(100) + '\145')(chr(2584 - 2467) + chr(116) + chr(0b10000 + 0o126) + chr(0b1001 + 0o44) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def bQgnA8J45JHq(XPh1qbAgrPgG, wmN3dvez4qzC, v2xGgKdrWD8V=1e-06, wiBOoz4NwoTZ=1e-06, ggNlzmG0rwwX=ehT0Px3KOsy9(chr(1185 - 1137) + chr(0b10010 + 0o135) + chr(0b110000), 0b1000)): if ggNlzmG0rwwX and wN4RVZAxJEhp(XPh1qbAgrPgG) and wN4RVZAxJEhp(wmN3dvez4qzC): return ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(255 - 206), 53666 - 53658) return xafqLlk3kkUe(yhiZVkosCjBm, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2My\xaf'), '\144' + chr(4107 - 4006) + chr(99) + '\157' + chr(0b1100010 + 0o2) + chr(0b1101 + 0o130))(chr(0b1011010 + 0o33) + chr(0b11000 + 0o134) + chr(0b1000011 + 0o43) + '\055' + chr(0b111000)))(XPh1qbAgrPgG - wmN3dvez4qzC) <= v2xGgKdrWD8V + wiBOoz4NwoTZ * xafqLlk3kkUe(yhiZVkosCjBm, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2My\xaf'), chr(0b1100100) + chr(0b1100101) + chr(0b100001 + 0o102) + '\157' + chr(0b1100100) + '\145')(chr(0b1110101 + 0o0) + chr(0b1101010 + 0o12) + chr(0b1100110) + chr(45) + chr(0b111000)))(wmN3dvez4qzC)
quantopian/zipline
zipline/utils/math_utils.py
round_if_near_integer
def round_if_near_integer(a, epsilon=1e-4): """ Round a to the nearest integer if that integer is within an epsilon of a. """ if abs(a - round(a)) <= epsilon: return round(a) else: return a
python
def round_if_near_integer(a, epsilon=1e-4): """ Round a to the nearest integer if that integer is within an epsilon of a. """ if abs(a - round(a)) <= epsilon: return round(a) else: return a
[ "def", "round_if_near_integer", "(", "a", ",", "epsilon", "=", "1e-4", ")", ":", "if", "abs", "(", "a", "-", "round", "(", "a", ")", ")", "<=", "epsilon", ":", "return", "round", "(", "a", ")", "else", ":", "return", "a" ]
Round a to the nearest integer if that integer is within an epsilon of a.
[ "Round", "a", "to", "the", "nearest", "integer", "if", "that", "integer", "is", "within", "an", "epsilon", "of", "a", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/math_utils.py#L72-L80
train
Round a to the nearest integer if that integer is within epsilon.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXj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lk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(0b100000 + 0o25) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b110 + 0o151) + chr(0b110010 + 0o1) + chr(55) + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(0b110001) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2033 - 1984) + chr(0b110110) + chr(0b1111 + 0o50), 48630 - 48622), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + '\065' + chr(684 - 634), 6907 - 6899), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101111) + chr(0b110001) + chr(0b110 + 0o60) + chr(55), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11011 + 0o33) + chr(2446 - 2395), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + chr(2216 - 2165) + chr(0b100111 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000101 + 0o52) + chr(0b110010) + '\066' + '\x32', 54137 - 54129), ehT0Px3KOsy9(chr(620 - 572) + chr(0b11 + 0o154) + chr(0b11100 + 0o25) + chr(683 - 634) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(830 - 781) + '\061' + chr(0b110000 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10100 + 0o133) + chr(0b1100 + 0o45) + '\063' + chr(0b101001 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(1060 - 1012) + chr(111) + chr(0b110001) + '\067' + chr(0b110110), 4430 - 4422), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110001) + '\060', 64718 - 64710), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + '\x31' + chr(1729 - 1676) + chr(0b10110 + 0o36), 5637 - 5629), ehT0Px3KOsy9(chr(556 - 508) + chr(5250 - 5139) + chr(1085 - 1034) + chr(0b110001) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(53) + '\x32', 46155 - 46147), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(0b100011 + 0o17) + '\x31' + chr(50), 0o10), ehT0Px3KOsy9(chr(1061 - 1013) + '\157' + '\063' + chr(0b10000 + 0o47) + chr(0b110110), 32430 - 32422), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(50) + '\063' + chr(2874 - 2820), ord("\x08")), ehT0Px3KOsy9(chr(1541 - 1493) + chr(0b10001 + 0o136) + chr(0b110010) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(252 - 204) + '\x6f' + '\x32' + chr(48) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(49) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(0b111 + 0o150) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1482 - 1434) + '\x6f' + '\x31' + chr(0b1101 + 0o50) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(794 - 742) + chr(0b11001 + 0o27), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1010100 + 0o33) + chr(927 - 877) + chr(0b110101) + chr(52), 29174 - 29166), ehT0Px3KOsy9(chr(1174 - 1126) + '\157' + chr(1473 - 1422) + chr(0b110100) + chr(1193 - 1138), 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(0b11001 + 0o35) + '\065', 33163 - 33155), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + '\x32' + '\x35' + chr(2236 - 2183), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(878 - 828) + chr(0b110110) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\062' + '\062' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b110111) + chr(0b0 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(871 - 821) + '\x32' + chr(0b10100 + 0o37), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2327 - 2216) + '\x32' + '\063' + chr(753 - 699), 8), ehT0Px3KOsy9(chr(1046 - 998) + chr(0b1010 + 0o145) + chr(49) + chr(0b1101 + 0o46) + '\067', 25898 - 25890), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + '\064' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1151 - 1040) + chr(50) + chr(54) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b101101 + 0o3) + chr(48), 1060 - 1052), ehT0Px3KOsy9('\x30' + chr(4621 - 4510) + chr(0b11111 + 0o24) + '\060' + chr(0b110110), 21542 - 21534)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(53) + chr(0b1101 + 0o43), 22123 - 22115)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x86'), '\x64' + chr(0b1100101) + '\143' + chr(1027 - 916) + chr(100) + chr(101))(chr(0b100010 + 0o123) + chr(2914 - 2798) + '\x66' + chr(0b101101) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def LwGRLLuDljm0(XPh1qbAgrPgG, Xtig2zAKpR0T=0.0001): if Lt3jp3Wjtj_1(XPh1qbAgrPgG - jB_HdqgHmVpI(XPh1qbAgrPgG)) <= Xtig2zAKpR0T: return jB_HdqgHmVpI(XPh1qbAgrPgG) else: return XPh1qbAgrPgG
quantopian/zipline
zipline/pipeline/factors/factor.py
coerce_numbers_to_my_dtype
def coerce_numbers_to_my_dtype(f): """ A decorator for methods whose signature is f(self, other) that coerces ``other`` to ``self.dtype``. This is used to make comparison operations between numbers and `Factor` instances work independently of whether the user supplies a float or integer literal. For example, if I write:: my_filter = my_factor > 3 my_factor probably has dtype float64, but 3 is an int, so we want to coerce to float64 before doing the comparison. """ @wraps(f) def method(self, other): if isinstance(other, Number): other = coerce_to_dtype(self.dtype, other) return f(self, other) return method
python
def coerce_numbers_to_my_dtype(f): """ A decorator for methods whose signature is f(self, other) that coerces ``other`` to ``self.dtype``. This is used to make comparison operations between numbers and `Factor` instances work independently of whether the user supplies a float or integer literal. For example, if I write:: my_filter = my_factor > 3 my_factor probably has dtype float64, but 3 is an int, so we want to coerce to float64 before doing the comparison. """ @wraps(f) def method(self, other): if isinstance(other, Number): other = coerce_to_dtype(self.dtype, other) return f(self, other) return method
[ "def", "coerce_numbers_to_my_dtype", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "method", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "Number", ")", ":", "other", "=", "coerce_to_dtype", "(", "self", ".", "dtype", ",", "other", ")", "return", "f", "(", "self", ",", "other", ")", "return", "method" ]
A decorator for methods whose signature is f(self, other) that coerces ``other`` to ``self.dtype``. This is used to make comparison operations between numbers and `Factor` instances work independently of whether the user supplies a float or integer literal. For example, if I write:: my_filter = my_factor > 3 my_factor probably has dtype float64, but 3 is an int, so we want to coerce to float64 before doing the comparison.
[ "A", "decorator", "for", "methods", "whose", "signature", "is", "f", "(", "self", "other", ")", "that", "coerces", "other", "to", "self", ".", "dtype", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L70-L91
train
A decorator for methods that coerces numbers to my dtype.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1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,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(154 - 106) + '\x6f' + chr(1007 - 953) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(324 - 275) + '\063' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(231 - 183) + '\x6f' + chr(2283 - 2233) + chr(54) + chr(0b110011), 13452 - 13444), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(8317 - 8206) + chr(2383 - 2334) + chr(2092 - 2041) + chr(0b101010 + 0o14), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001011 + 0o44) + '\x31' + chr(0b110011) + '\x31', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10000 + 0o43) + chr(0b110010) + chr(1749 - 1700), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(1926 - 1873) + chr(2285 - 2231), 0b1000), ehT0Px3KOsy9(chr(978 - 930) + '\157' + chr(50) + chr(48) + chr(0b110101), 55107 - 55099), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(2436 - 2381) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(0b10111 + 0o32) + chr(0b101001 + 0o11) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(6846 - 6735) + chr(0b11011 + 0o26) + chr(0b110000 + 0o6) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100000 + 0o117) + chr(0b110001) + '\x32' + chr(2297 - 2243), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1011000 + 0o27) + chr(0b110011) + '\x30' + '\065', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(2653 - 2600) + chr(51), 23467 - 23459), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\063' + '\x36', 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b100110 + 0o111) + '\062' + chr(0b110100) + '\x34', 0b1000), ehT0Px3KOsy9('\060' + chr(8827 - 8716) + chr(51) + chr(0b110110) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + '\063' + chr(0b110010) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110 + 0o55) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\060' + '\x35', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(55) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(12207 - 12096) + '\067' + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b11 + 0o56), 63591 - 63583), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b100111 + 0o17), 0o10), ehT0Px3KOsy9(chr(945 - 897) + '\157' + chr(0b110011) + chr(2319 - 2264) + chr(0b100011 + 0o23), 0b1000), ehT0Px3KOsy9('\060' + chr(11393 - 11282) + '\063' + '\061' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(467 - 416) + '\067' + chr(2652 - 2599), 53671 - 53663), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(3070 - 2959) + '\x32' + chr(53) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(117 - 69) + chr(111) + chr(0b101011 + 0o10) + '\061' + '\x35', 0b1000), ehT0Px3KOsy9(chr(1501 - 1453) + '\x6f' + chr(0b10 + 0o61) + chr(0b10111 + 0o37) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001101 + 0o42) + chr(0b11100 + 0o31) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(12252 - 12141) + chr(0b110010) + chr(0b110001 + 0o3) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + chr(0b110001) + '\063', 0o10), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + chr(0b10110 + 0o41) + chr(0b10111 + 0o36), 30833 - 30825), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(148 - 99) + chr(0b110111) + chr(0b1100 + 0o53), 23942 - 23934), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b110011 + 0o0) + chr(0b11111 + 0o30), 7781 - 7773), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(53) + chr(0b110101), 48702 - 48694), ehT0Px3KOsy9('\x30' + chr(5702 - 5591) + chr(0b101010 + 0o10) + '\x35' + chr(671 - 617), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + chr(50) + chr(0b101 + 0o57), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + '\x33' + chr(0b101111 + 0o10) + chr(53), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1001100 + 0o43) + '\x35' + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d'), chr(7379 - 7279) + chr(0b1100101) + chr(3991 - 3892) + '\x6f' + chr(0b11010 + 0o112) + '\x65')(chr(0b1011111 + 0o26) + chr(0b1110100) + chr(3030 - 2928) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def e1iVrWoIZ7rg(EGyt1xfPT1P6): @cUOaMZfY2Ho1(EGyt1xfPT1P6) def CVRCXTcnOnH6(oVre8I6UXc3b, KK0ERS7DqYrY): if PlSM16l2KDPD(KK0ERS7DqYrY, RdGQCEqKm_Wb): KK0ERS7DqYrY = V4P6ACojlUhD(oVre8I6UXc3b.jSV9IKnemH7K, KK0ERS7DqYrY) return EGyt1xfPT1P6(oVre8I6UXc3b, KK0ERS7DqYrY) return CVRCXTcnOnH6
quantopian/zipline
zipline/pipeline/factors/factor.py
binop_return_dtype
def binop_return_dtype(op, left, right): """ Compute the expected return dtype for the given binary operator. Parameters ---------- op : str Operator symbol, (e.g. '+', '-', ...). left : numpy.dtype Dtype of left hand side. right : numpy.dtype Dtype of right hand side. Returns ------- outdtype : numpy.dtype The dtype of the result of `left <op> right`. """ if is_comparison(op): if left != right: raise TypeError( "Don't know how to compute {left} {op} {right}.\n" "Comparisons are only supported between Factors of equal " "dtypes.".format(left=left, op=op, right=right) ) return bool_dtype elif left != float64_dtype or right != float64_dtype: raise TypeError( "Don't know how to compute {left} {op} {right}.\n" "Arithmetic operators are only supported between Factors of " "dtype 'float64'.".format( left=left.name, op=op, right=right.name, ) ) return float64_dtype
python
def binop_return_dtype(op, left, right): """ Compute the expected return dtype for the given binary operator. Parameters ---------- op : str Operator symbol, (e.g. '+', '-', ...). left : numpy.dtype Dtype of left hand side. right : numpy.dtype Dtype of right hand side. Returns ------- outdtype : numpy.dtype The dtype of the result of `left <op> right`. """ if is_comparison(op): if left != right: raise TypeError( "Don't know how to compute {left} {op} {right}.\n" "Comparisons are only supported between Factors of equal " "dtypes.".format(left=left, op=op, right=right) ) return bool_dtype elif left != float64_dtype or right != float64_dtype: raise TypeError( "Don't know how to compute {left} {op} {right}.\n" "Arithmetic operators are only supported between Factors of " "dtype 'float64'.".format( left=left.name, op=op, right=right.name, ) ) return float64_dtype
[ "def", "binop_return_dtype", "(", "op", ",", "left", ",", "right", ")", ":", "if", "is_comparison", "(", "op", ")", ":", "if", "left", "!=", "right", ":", "raise", "TypeError", "(", "\"Don't know how to compute {left} {op} {right}.\\n\"", "\"Comparisons are only supported between Factors of equal \"", "\"dtypes.\"", ".", "format", "(", "left", "=", "left", ",", "op", "=", "op", ",", "right", "=", "right", ")", ")", "return", "bool_dtype", "elif", "left", "!=", "float64_dtype", "or", "right", "!=", "float64_dtype", ":", "raise", "TypeError", "(", "\"Don't know how to compute {left} {op} {right}.\\n\"", "\"Arithmetic operators are only supported between Factors of \"", "\"dtype 'float64'.\"", ".", "format", "(", "left", "=", "left", ".", "name", ",", "op", "=", "op", ",", "right", "=", "right", ".", "name", ",", ")", ")", "return", "float64_dtype" ]
Compute the expected return dtype for the given binary operator. Parameters ---------- op : str Operator symbol, (e.g. '+', '-', ...). left : numpy.dtype Dtype of left hand side. right : numpy.dtype Dtype of right hand side. Returns ------- outdtype : numpy.dtype The dtype of the result of `left <op> right`.
[ "Compute", "the", "expected", "return", "dtype", "for", "the", "given", "binary", "operator", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L101-L138
train
Compute the expected return dtype for the given binary operator.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZz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FWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1236 - 1188) + chr(111) + '\x37' + chr(0b110101), 40764 - 40756), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b110101) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(711 - 657) + chr(0b11001 + 0o33), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(457 - 402) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1000 + 0o55) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x36' + chr(0b110 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(9894 - 9783) + '\x33' + chr(0b110110) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\067' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b110111) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b1010 + 0o50) + chr(0b11011 + 0o34), 43794 - 43786), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(77 - 25) + '\065', 0b1000), ehT0Px3KOsy9(chr(537 - 489) + chr(8460 - 8349) + chr(50) + chr(49) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1267 - 1217) + chr(0b110100) + chr(0b100101 + 0o20), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101110 + 0o4) + '\060' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(122 - 73) + '\x36' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(1609 - 1561) + chr(7579 - 7468) + chr(0b110011) + '\x34' + chr(49), 0b1000), ehT0Px3KOsy9(chr(385 - 337) + '\157' + chr(579 - 530) + '\061' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(1365 - 1317) + '\x6f' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\x31' + chr(49) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(932 - 882) + '\061' + chr(661 - 606), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b101011 + 0o6) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1111 + 0o42) + '\x37' + chr(55), 0b1000), ehT0Px3KOsy9(chr(658 - 610) + '\157' + chr(50) + chr(53) + chr(0b10110 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(134 - 81) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b110101), 18657 - 18649), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b110101) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(54) + '\x33', 65220 - 65212), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2347 - 2296) + chr(49) + '\x36', 56834 - 56826), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b110110) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101100 + 0o3) + '\062' + chr(0b11011 + 0o34) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(12227 - 12116) + chr(0b11010 + 0o31) + '\x33' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(884 - 836) + chr(0b1011010 + 0o25) + '\x33' + chr(51) + chr(0b100 + 0o57), 51858 - 51850), ehT0Px3KOsy9(chr(48) + '\157' + chr(55) + '\066', 8), ehT0Px3KOsy9(chr(48) + chr(0b1000001 + 0o56) + chr(49) + '\066', 53993 - 53985), ehT0Px3KOsy9(chr(48) + chr(6020 - 5909) + '\061' + chr(0b1 + 0o64), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2472 - 2421) + chr(49) + chr(0b101011 + 0o13), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2002 - 1952) + '\065' + chr(0b100010 + 0o17), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x32' + '\067' + chr(0b110101), 57935 - 57927), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(0b110010) + chr(0b110001 + 0o6), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1586 - 1538) + '\157' + '\065' + chr(1762 - 1714), 57043 - 57035)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x13'), chr(0b1000011 + 0o41) + chr(0b11011 + 0o112) + '\x63' + '\x6f' + '\144' + '\145')(chr(13591 - 13474) + '\164' + chr(0b1100110) + chr(0b101101) + chr(536 - 480)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def XreA97FhdMk_(C8dAr6Ujq2Tn, mtX6HPOlWiYu, isOYmsUx1jxa): if UW6a6w49n0IL(C8dAr6Ujq2Tn): if mtX6HPOlWiYu != isOYmsUx1jxa: raise sznFqDbNBHlx(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'y\x87\x9a\x19X\x10\x9aU\x95\xe0\x85\xe2\xca\xf7U\x95!$/z\xe2\xbf\n\xda\x8f-\xd0\xdf\xab\x17\xcc\xa7\xfbEa}\xb3\x89\xc6\xe5T\x8f\x9cJQ\x1e\xfbx\x95\xfa\xd5\xeb\xd7\xe9\x06\x8e wlt\xfd\xaa_\xc1\x84a\xd2\x93\xbd\x04\xc8\xaa\xb4Lzh\xaa\x89\xdf\xf2I\x9f\x91[B\x10\xb7Z\x99\xe3\xca\xf8\xd6\xa0\x1a\x87na=`\xee\xa3_\xca\x9et\xdb\xd6\xbd_'), chr(9311 - 9211) + '\x65' + '\x63' + '\157' + chr(0b1010001 + 0o23) + chr(0b100101 + 0o100))('\x75' + '\164' + '\146' + chr(45) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'k\xdc\x86QdQ\xa2\x08\xaa\xe7\xc0\xe0'), '\144' + chr(0b1110 + 0o127) + '\x63' + chr(111) + chr(0b110111 + 0o55) + '\145')(chr(0b10111 + 0o136) + chr(0b1110100) + chr(0b100000 + 0o106) + chr(45) + chr(0b101110 + 0o12)))(left=mtX6HPOlWiYu, op=C8dAr6Ujq2Tn, right=isOYmsUx1jxa)) return RxCWrR7Zbq1B elif mtX6HPOlWiYu != rZ1BN3UDHnco or isOYmsUx1jxa != rZ1BN3UDHnco: raise sznFqDbNBHlx(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'y\x87\x9a\x19X\x10\x9aU\x95\xe0\x85\xe2\xca\xf7U\x95!$/z\xe2\xbf\n\xda\x8f-\xd0\xdf\xab\x17\xcc\xa7\xfbEa}\xb3\x89\xc6\xe5T\x8f\x9cJQ\x1e\xfbz\x88\xfe\xd1\xe2\xc8\xe5\x01\x88-$#e\xea\xbd\x1e\xda\x85\x7f\xd8\x93\xaf\x03\xdd\xfa\xb4Pbt\xee\xda\xc8\xe7M\x87\x86JIT\xd1Y\x9f\xe3\xd2\xef\xc0\xeeU\xa7/g8z\xfd\xbc_\xc1\x8c-\xcf\xc7\xb7\x01\xdd\xfa\xfcXbb\xaf\xdd\x8b\xa3\x1a\xc6'), '\x64' + chr(0b100010 + 0o103) + chr(99) + '\x6f' + chr(0b1000011 + 0o41) + '\145')(chr(0b1000010 + 0o63) + chr(0b1110100) + chr(0b1100110) + chr(0b10001 + 0o34) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'k\xdc\x86QdQ\xa2\x08\xaa\xe7\xc0\xe0'), chr(9721 - 9621) + chr(5265 - 5164) + chr(99) + chr(0b111011 + 0o64) + chr(100) + '\145')(chr(12223 - 12106) + chr(116) + '\146' + chr(45) + '\x38'))(left=xafqLlk3kkUe(mtX6HPOlWiYu, xafqLlk3kkUe(SXOLrMavuUCe(b'|\xa1\x82t~J\xbd_\xbe\xf1\xc2\xcc'), chr(4907 - 4807) + '\145' + chr(1292 - 1193) + '\157' + '\x64' + chr(0b1100101))(chr(0b10 + 0o163) + chr(3748 - 3632) + chr(102) + chr(0b101101) + '\x38')), op=C8dAr6Ujq2Tn, right=xafqLlk3kkUe(isOYmsUx1jxa, xafqLlk3kkUe(SXOLrMavuUCe(b'|\xa1\x82t~J\xbd_\xbe\xf1\xc2\xcc'), chr(0b111010 + 0o52) + chr(101) + chr(99) + chr(111) + chr(4030 - 3930) + '\145')(chr(12851 - 12734) + chr(0b100111 + 0o115) + '\x66' + chr(1671 - 1626) + '\070')))) return rZ1BN3UDHnco
quantopian/zipline
zipline/pipeline/factors/factor.py
binary_operator
def binary_operator(op): """ Factory function for making binary operator methods on a Factor subclass. Returns a function, "binary_operator" suitable for implementing functions like __add__. """ # When combining a Factor with a NumericalExpression, we use this # attrgetter instance to defer to the commuted implementation of the # NumericalExpression operator. commuted_method_getter = attrgetter(method_name_for_op(op, commute=True)) @with_doc("Binary Operator: '%s'" % op) @with_name(method_name_for_op(op)) @coerce_numbers_to_my_dtype def binary_operator(self, other): # This can't be hoisted up a scope because the types returned by # binop_return_type aren't defined when the top-level function is # invoked in the class body of Factor. return_type = binop_return_type(op) if isinstance(self, NumExprFactor): self_expr, other_expr, new_inputs = self.build_binary_op( op, other, ) return return_type( "({left}) {op} ({right})".format( left=self_expr, op=op, right=other_expr, ), new_inputs, dtype=binop_return_dtype(op, self.dtype, other.dtype), ) elif isinstance(other, NumExprFactor): # NumericalExpression overrides ops to correctly handle merging of # inputs. Look up and call the appropriate reflected operator with # ourself as the input. return commuted_method_getter(other)(self) elif isinstance(other, Term): if self is other: return return_type( "x_0 {op} x_0".format(op=op), (self,), dtype=binop_return_dtype(op, self.dtype, other.dtype), ) return return_type( "x_0 {op} x_1".format(op=op), (self, other), dtype=binop_return_dtype(op, self.dtype, other.dtype), ) elif isinstance(other, Number): return return_type( "x_0 {op} ({constant})".format(op=op, constant=other), binds=(self,), # .dtype access is safe here because coerce_numbers_to_my_dtype # will convert any input numbers to numpy equivalents. dtype=binop_return_dtype(op, self.dtype, other.dtype) ) raise BadBinaryOperator(op, self, other) return binary_operator
python
def binary_operator(op): """ Factory function for making binary operator methods on a Factor subclass. Returns a function, "binary_operator" suitable for implementing functions like __add__. """ # When combining a Factor with a NumericalExpression, we use this # attrgetter instance to defer to the commuted implementation of the # NumericalExpression operator. commuted_method_getter = attrgetter(method_name_for_op(op, commute=True)) @with_doc("Binary Operator: '%s'" % op) @with_name(method_name_for_op(op)) @coerce_numbers_to_my_dtype def binary_operator(self, other): # This can't be hoisted up a scope because the types returned by # binop_return_type aren't defined when the top-level function is # invoked in the class body of Factor. return_type = binop_return_type(op) if isinstance(self, NumExprFactor): self_expr, other_expr, new_inputs = self.build_binary_op( op, other, ) return return_type( "({left}) {op} ({right})".format( left=self_expr, op=op, right=other_expr, ), new_inputs, dtype=binop_return_dtype(op, self.dtype, other.dtype), ) elif isinstance(other, NumExprFactor): # NumericalExpression overrides ops to correctly handle merging of # inputs. Look up and call the appropriate reflected operator with # ourself as the input. return commuted_method_getter(other)(self) elif isinstance(other, Term): if self is other: return return_type( "x_0 {op} x_0".format(op=op), (self,), dtype=binop_return_dtype(op, self.dtype, other.dtype), ) return return_type( "x_0 {op} x_1".format(op=op), (self, other), dtype=binop_return_dtype(op, self.dtype, other.dtype), ) elif isinstance(other, Number): return return_type( "x_0 {op} ({constant})".format(op=op, constant=other), binds=(self,), # .dtype access is safe here because coerce_numbers_to_my_dtype # will convert any input numbers to numpy equivalents. dtype=binop_return_dtype(op, self.dtype, other.dtype) ) raise BadBinaryOperator(op, self, other) return binary_operator
[ "def", "binary_operator", "(", "op", ")", ":", "# When combining a Factor with a NumericalExpression, we use this", "# attrgetter instance to defer to the commuted implementation of the", "# NumericalExpression operator.", "commuted_method_getter", "=", "attrgetter", "(", "method_name_for_op", "(", "op", ",", "commute", "=", "True", ")", ")", "@", "with_doc", "(", "\"Binary Operator: '%s'\"", "%", "op", ")", "@", "with_name", "(", "method_name_for_op", "(", "op", ")", ")", "@", "coerce_numbers_to_my_dtype", "def", "binary_operator", "(", "self", ",", "other", ")", ":", "# This can't be hoisted up a scope because the types returned by", "# binop_return_type aren't defined when the top-level function is", "# invoked in the class body of Factor.", "return_type", "=", "binop_return_type", "(", "op", ")", "if", "isinstance", "(", "self", ",", "NumExprFactor", ")", ":", "self_expr", ",", "other_expr", ",", "new_inputs", "=", "self", ".", "build_binary_op", "(", "op", ",", "other", ",", ")", "return", "return_type", "(", "\"({left}) {op} ({right})\"", ".", "format", "(", "left", "=", "self_expr", ",", "op", "=", "op", ",", "right", "=", "other_expr", ",", ")", ",", "new_inputs", ",", "dtype", "=", "binop_return_dtype", "(", "op", ",", "self", ".", "dtype", ",", "other", ".", "dtype", ")", ",", ")", "elif", "isinstance", "(", "other", ",", "NumExprFactor", ")", ":", "# NumericalExpression overrides ops to correctly handle merging of", "# inputs. Look up and call the appropriate reflected operator with", "# ourself as the input.", "return", "commuted_method_getter", "(", "other", ")", "(", "self", ")", "elif", "isinstance", "(", "other", ",", "Term", ")", ":", "if", "self", "is", "other", ":", "return", "return_type", "(", "\"x_0 {op} x_0\"", ".", "format", "(", "op", "=", "op", ")", ",", "(", "self", ",", ")", ",", "dtype", "=", "binop_return_dtype", "(", "op", ",", "self", ".", "dtype", ",", "other", ".", "dtype", ")", ",", ")", "return", "return_type", "(", "\"x_0 {op} x_1\"", ".", "format", "(", "op", "=", "op", ")", ",", "(", "self", ",", "other", ")", ",", "dtype", "=", "binop_return_dtype", "(", "op", ",", "self", ".", "dtype", ",", "other", ".", "dtype", ")", ",", ")", "elif", "isinstance", "(", "other", ",", "Number", ")", ":", "return", "return_type", "(", "\"x_0 {op} ({constant})\"", ".", "format", "(", "op", "=", "op", ",", "constant", "=", "other", ")", ",", "binds", "=", "(", "self", ",", ")", ",", "# .dtype access is safe here because coerce_numbers_to_my_dtype", "# will convert any input numbers to numpy equivalents.", "dtype", "=", "binop_return_dtype", "(", "op", ",", "self", ".", "dtype", ",", "other", ".", "dtype", ")", ")", "raise", "BadBinaryOperator", "(", "op", ",", "self", ",", "other", ")", "return", "binary_operator" ]
Factory function for making binary operator methods on a Factor subclass. Returns a function, "binary_operator" suitable for implementing functions like __add__.
[ "Factory", "function", "for", "making", "binary", "operator", "methods", "on", "a", "Factor", "subclass", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L141-L201
train
Returns a function that can be used to make a binary operator on a Factor subclass.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,LgE_IO_tHXvM,Kk1hd194VKEC,OZYz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2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1010001 + 0o36) + chr(49) + chr(0b110011) + chr(0b1110 + 0o51), 50851 - 50843), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100000 + 0o21) + chr(2323 - 2268) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(1651 - 1603) + chr(111) + chr(1625 - 1576) + chr(2075 - 2021) + '\062', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(52) + '\061', 56891 - 56883), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x33' + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + '\063' + chr(0b1110 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x36' + chr(0b101100 + 0o12), 38444 - 38436), ehT0Px3KOsy9(chr(0b110000) + chr(10403 - 10292) + chr(1485 - 1434) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(66 - 18) + chr(0b101000 + 0o107) + chr(53) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + chr(1652 - 1603) + chr(49) + chr(0b110101), 16792 - 16784), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(657 - 602) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(55) + chr(0b110000), 35197 - 35189), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062', 0b1000), ehT0Px3KOsy9(chr(1224 - 1176) + chr(0b1101111) + chr(51) + '\065' + '\066', 0o10), ehT0Px3KOsy9(chr(1432 - 1384) + '\x6f' + chr(0b10000 + 0o43) + '\x36' + chr(0b110100 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110111) + '\067', 0o10), ehT0Px3KOsy9(chr(409 - 361) + chr(0b1101111) + '\066' + chr(2557 - 2505), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(0b100001 + 0o22) + chr(0b110100) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1088 - 1037) + chr(962 - 911) + chr(54), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1110 + 0o44) + chr(2630 - 2575) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10011 + 0o44) + chr(143 - 95), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(106 - 56) + '\062' + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + '\063' + chr(0b10001 + 0o44) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(0b110001) + '\x33', 1046 - 1038), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b1 + 0o60) + chr(48), 0b1000), ehT0Px3KOsy9(chr(1176 - 1128) + '\x6f' + '\063' + chr(0b101 + 0o53) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110000 + 0o3) + '\x31' + chr(48), 8), ehT0Px3KOsy9(chr(100 - 52) + chr(0b1011101 + 0o22) + chr(0b110011) + '\x34' + chr(1232 - 1183), 0o10), ehT0Px3KOsy9(chr(48) + chr(3905 - 3794) + chr(0b101010 + 0o10) + chr(48) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000101 + 0o52) + '\061' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(1443 - 1391) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100100 + 0o16) + '\067' + chr(48), 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1368 - 1319) + '\064' + '\064', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1191 - 1141) + '\x33' + '\060', 0o10), ehT0Px3KOsy9(chr(135 - 87) + chr(0b1011000 + 0o27) + chr(0b110101) + chr(1352 - 1304), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2220 - 2169) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(1301 - 1253) + chr(0b1101111) + chr(0b100 + 0o57) + '\x37' + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(12182 - 12071) + chr(0b101001 + 0o11) + chr(51) + chr(2021 - 1972), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + chr(1393 - 1344) + chr(0b110001) + '\062', 50145 - 50137)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(1811 - 1700) + chr(1390 - 1337) + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'q'), '\x64' + '\145' + chr(0b1001100 + 0o27) + chr(0b1101111) + '\x64' + chr(0b1100101))('\165' + chr(0b1110100) + chr(4163 - 4061) + chr(0b101101) + chr(0b11011 + 0o35)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def CUzngcSXFl8v(C8dAr6Ujq2Tn): fxpAmr6Wdbgl = rlJwIST4CBV1(AndnJZGtKuQi(C8dAr6Ujq2Tn, commute=ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + '\x31', 0b1000))) @wi_6JDV4IUWJ(xafqLlk3kkUe(SXOLrMavuUCe(b'\x1d\x15\x1c\x00\xac"\x16R_(\xca\x19v\x81\x84\x05\x14\xc4\xfb\xc8\x1f'), chr(0b1000001 + 0o43) + chr(0b110100 + 0o61) + chr(99) + chr(0b1100110 + 0o11) + '\144' + '\145')(chr(0b11100 + 0o131) + chr(0b1110100) + chr(1253 - 1151) + chr(0b100011 + 0o12) + chr(56)) % C8dAr6Ujq2Tn) @x1LswTf8Ltgr(AndnJZGtKuQi(C8dAr6Ujq2Tn)) @e1iVrWoIZ7rg def CUzngcSXFl8v(oVre8I6UXc3b, KK0ERS7DqYrY): ELL59KGwZKj3 = XJBHWl_yQwhZ(C8dAr6Ujq2Tn) if PlSM16l2KDPD(oVre8I6UXc3b, dAD4kyrvgpBh): (kNhlqnMhYXCB, _zY3sbqLHto9, _kVftqoKhv4s) = oVre8I6UXc3b.build_binary_op(C8dAr6Ujq2Tn, KK0ERS7DqYrY) return ELL59KGwZKj3(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'w\x07\x1e\x04\xb8/K4\x0f6\xd7\x08\x7f\xce\xdeDF\x8a\xb9\xd3L\xe8*'), chr(0b1100100) + chr(0b111110 + 0o47) + chr(0b111110 + 0o45) + chr(111) + '\144' + chr(0b1100101))(chr(117) + chr(0b1011100 + 0o30) + chr(0b1100110 + 0o0) + chr(0b101101) + chr(1833 - 1777)), xafqLlk3kkUe(SXOLrMavuUCe(b'\tH\x00\x0e\x96:e.\x7f=\xdd\x12'), chr(3273 - 3173) + '\x65' + chr(9786 - 9687) + chr(0b1010000 + 0o37) + chr(0b1100100) + chr(0b101010 + 0o73))(chr(272 - 155) + chr(0b1110100) + chr(102) + chr(0b1101 + 0o40) + '\x38'))(left=kNhlqnMhYXCB, op=C8dAr6Ujq2Tn, right=_zY3sbqLHto9), _kVftqoKhv4s, dtype=XreA97FhdMk_(C8dAr6Ujq2Tn, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), chr(100) + '\x65' + chr(0b1100011) + chr(0b110001 + 0o76) + chr(100) + chr(101))(chr(0b1100111 + 0o16) + chr(0b11001 + 0o133) + chr(0b100111 + 0o77) + '\055' + chr(1882 - 1826))), xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), '\144' + chr(1513 - 1412) + '\143' + '\x6f' + chr(100) + chr(0b111000 + 0o55))(chr(0b1001000 + 0o55) + chr(116) + '\x66' + chr(45) + '\070')))) elif PlSM16l2KDPD(KK0ERS7DqYrY, dAD4kyrvgpBh): return fxpAmr6Wdbgl(KK0ERS7DqYrY)(oVre8I6UXc3b) elif PlSM16l2KDPD(KK0ERS7DqYrY, FYcYjPCXGlKG): if oVre8I6UXc3b is KK0ERS7DqYrY: return ELL59KGwZKj3(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"'#BA\xa54F`\x0f5\xe7H"), chr(0b1100100) + '\145' + chr(0b101111 + 0o64) + chr(111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(0b1100111 + 0o15) + chr(0b1001 + 0o135) + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\tH\x00\x0e\x96:e.\x7f=\xdd\x12'), chr(0b1000001 + 0o43) + chr(7408 - 7307) + chr(0b10100 + 0o117) + '\157' + chr(0b1100100) + '\145')('\x75' + chr(0b11010 + 0o132) + '\x66' + chr(0b101101) + chr(0b100100 + 0o24)))(op=C8dAr6Ujq2Tn), (oVre8I6UXc3b,), dtype=XreA97FhdMk_(C8dAr6Ujq2Tn, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), '\x64' + chr(101) + chr(0b10100 + 0o117) + '\x6f' + chr(7945 - 7845) + chr(101))(chr(117) + chr(116) + chr(0b1100110) + '\055' + '\070')), xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), chr(0b1100100) + chr(101) + '\x63' + '\x6f' + chr(0b1100100) + chr(101))(chr(0b1110101) + '\164' + '\x66' + '\055' + '\070')))) return ELL59KGwZKj3(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"'#BA\xa54F`\x0f5\xe7I"), chr(3673 - 3573) + chr(0b11 + 0o142) + chr(0b1001010 + 0o31) + chr(111) + chr(0b1100100) + '\145')(chr(0b111000 + 0o75) + '\x74' + '\146' + '\x2d' + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\tH\x00\x0e\x96:e.\x7f=\xdd\x12'), '\x64' + chr(0b1100101) + chr(0b100011 + 0o100) + chr(111) + chr(1001 - 901) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1001100 + 0o32) + chr(45) + chr(0b111000)))(op=C8dAr6Ujq2Tn), (oVre8I6UXc3b, KK0ERS7DqYrY), dtype=XreA97FhdMk_(C8dAr6Ujq2Tn, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), chr(0b1001010 + 0o32) + chr(0b1100101) + chr(0b1001110 + 0o25) + chr(6267 - 6156) + '\144' + '\x65')(chr(3082 - 2965) + '\x74' + chr(9362 - 9260) + chr(1119 - 1074) + chr(56))), xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), chr(100) + chr(5369 - 5268) + '\143' + '\x6f' + '\144' + '\x65')(chr(0b1100000 + 0o25) + chr(0b100110 + 0o116) + chr(102) + chr(45) + chr(56))))) elif PlSM16l2KDPD(KK0ERS7DqYrY, RdGQCEqKm_Wb): return ELL59KGwZKj3(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"'#BA\xa54F`\x0fe\xc3\x1bm\x80\x85KU\x8d\xaa\xc6\x11"), chr(0b1100100) + chr(0b1100101) + chr(0b100001 + 0o102) + chr(0b11 + 0o154) + '\144' + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b1000000 + 0o46) + chr(45) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\tH\x00\x0e\x96:e.\x7f=\xdd\x12'), chr(0b1011000 + 0o14) + '\145' + chr(99) + chr(0b100111 + 0o110) + chr(100) + '\x65')('\x75' + chr(0b1100011 + 0o21) + chr(3982 - 3880) + '\055' + '\x38'))(op=C8dAr6Ujq2Tn, constant=KK0ERS7DqYrY), binds=(oVre8I6UXc3b,), dtype=XreA97FhdMk_(C8dAr6Ujq2Tn, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), '\x64' + chr(101) + '\143' + chr(0b1101111) + '\x64' + chr(0b11011 + 0o112))(chr(5798 - 5681) + chr(0b101111 + 0o105) + chr(0b1001000 + 0o36) + chr(0b101011 + 0o2) + chr(0b100011 + 0o25))), xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'5/$X\x97\x10XxB\x05\x8f3'), chr(7200 - 7100) + chr(6146 - 6045) + chr(0b1100011) + '\157' + chr(0b110100 + 0o60) + chr(101))('\x75' + chr(116) + chr(0b1010001 + 0o25) + chr(0b11111 + 0o16) + chr(56))))) raise g_OwtHWi2Aiy(C8dAr6Ujq2Tn, oVre8I6UXc3b, KK0ERS7DqYrY) return CUzngcSXFl8v
quantopian/zipline
zipline/pipeline/factors/factor.py
reflected_binary_operator
def reflected_binary_operator(op): """ Factory function for making binary operator methods on a Factor. Returns a function, "reflected_binary_operator" suitable for implementing functions like __radd__. """ assert not is_comparison(op) @with_name(method_name_for_op(op, commute=True)) @coerce_numbers_to_my_dtype def reflected_binary_operator(self, other): if isinstance(self, NumericalExpression): self_expr, other_expr, new_inputs = self.build_binary_op( op, other ) return NumExprFactor( "({left}) {op} ({right})".format( left=other_expr, right=self_expr, op=op, ), new_inputs, dtype=binop_return_dtype(op, other.dtype, self.dtype) ) # Only have to handle the numeric case because in all other valid cases # the corresponding left-binding method will be called. elif isinstance(other, Number): return NumExprFactor( "{constant} {op} x_0".format(op=op, constant=other), binds=(self,), dtype=binop_return_dtype(op, other.dtype, self.dtype), ) raise BadBinaryOperator(op, other, self) return reflected_binary_operator
python
def reflected_binary_operator(op): """ Factory function for making binary operator methods on a Factor. Returns a function, "reflected_binary_operator" suitable for implementing functions like __radd__. """ assert not is_comparison(op) @with_name(method_name_for_op(op, commute=True)) @coerce_numbers_to_my_dtype def reflected_binary_operator(self, other): if isinstance(self, NumericalExpression): self_expr, other_expr, new_inputs = self.build_binary_op( op, other ) return NumExprFactor( "({left}) {op} ({right})".format( left=other_expr, right=self_expr, op=op, ), new_inputs, dtype=binop_return_dtype(op, other.dtype, self.dtype) ) # Only have to handle the numeric case because in all other valid cases # the corresponding left-binding method will be called. elif isinstance(other, Number): return NumExprFactor( "{constant} {op} x_0".format(op=op, constant=other), binds=(self,), dtype=binop_return_dtype(op, other.dtype, self.dtype), ) raise BadBinaryOperator(op, other, self) return reflected_binary_operator
[ "def", "reflected_binary_operator", "(", "op", ")", ":", "assert", "not", "is_comparison", "(", "op", ")", "@", "with_name", "(", "method_name_for_op", "(", "op", ",", "commute", "=", "True", ")", ")", "@", "coerce_numbers_to_my_dtype", "def", "reflected_binary_operator", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "self", ",", "NumericalExpression", ")", ":", "self_expr", ",", "other_expr", ",", "new_inputs", "=", "self", ".", "build_binary_op", "(", "op", ",", "other", ")", "return", "NumExprFactor", "(", "\"({left}) {op} ({right})\"", ".", "format", "(", "left", "=", "other_expr", ",", "right", "=", "self_expr", ",", "op", "=", "op", ",", ")", ",", "new_inputs", ",", "dtype", "=", "binop_return_dtype", "(", "op", ",", "other", ".", "dtype", ",", "self", ".", "dtype", ")", ")", "# Only have to handle the numeric case because in all other valid cases", "# the corresponding left-binding method will be called.", "elif", "isinstance", "(", "other", ",", "Number", ")", ":", "return", "NumExprFactor", "(", "\"{constant} {op} x_0\"", ".", "format", "(", "op", "=", "op", ",", "constant", "=", "other", ")", ",", "binds", "=", "(", "self", ",", ")", ",", "dtype", "=", "binop_return_dtype", "(", "op", ",", "other", ".", "dtype", ",", "self", ".", "dtype", ")", ",", ")", "raise", "BadBinaryOperator", "(", "op", ",", "other", ",", "self", ")", "return", "reflected_binary_operator" ]
Factory function for making binary operator methods on a Factor. Returns a function, "reflected_binary_operator" suitable for implementing functions like __radd__.
[ "Factory", "function", "for", "making", "binary", "operator", "methods", "on", "a", "Factor", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L204-L240
train
Returns a factory function for making binary operator methods on a Factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJ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6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11001 + 0o30) + chr(0b111 + 0o52) + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(1025 - 970) + chr(0b100000 + 0o23), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(935 - 885), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + chr(2166 - 2115) + chr(0b111 + 0o60) + chr(0b110011), 53366 - 53358), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + chr(0b110010) + chr(0b11000 + 0o36) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(48) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + chr(186 - 134), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + '\061' + chr(0b110000 + 0o3) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\064' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + chr(718 - 669) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\065' + chr(1392 - 1341), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\064' + chr(52), 25559 - 25551), ehT0Px3KOsy9('\060' + chr(0b1101101 + 0o2) + chr(55) + chr(2341 - 2289), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(251 - 202) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\061' + chr(1999 - 1947) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + '\x32' + '\065' + chr(308 - 257), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(1051 - 1000) + chr(0b101000 + 0o14) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(0b10000 + 0o45) + chr(0b110110), 8), ehT0Px3KOsy9('\x30' + chr(0b101101 + 0o102) + chr(50) + chr(0b110111) + '\x31', 47498 - 47490), ehT0Px3KOsy9(chr(1214 - 1166) + chr(0b1101111) + chr(0b110001) + chr(1565 - 1514) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110110) + chr(532 - 482), 0b1000), ehT0Px3KOsy9(chr(48) + chr(2515 - 2404) + chr(1545 - 1495) + chr(0b101 + 0o62) + '\066', 30665 - 30657), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + '\067' + chr(54), 0b1000), ehT0Px3KOsy9(chr(1007 - 959) + chr(0b1001 + 0o146) + '\063' + chr(48) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(832 - 784) + chr(0b1101111) + chr(2212 - 2161) + chr(0b11100 + 0o24) + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101001 + 0o6) + chr(51) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11200 - 11089) + chr(2480 - 2429) + '\066' + chr(0b1000 + 0o55), 25271 - 25263), ehT0Px3KOsy9(chr(1131 - 1083) + chr(1792 - 1681) + chr(0b10110 + 0o41) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(262 - 208) + chr(1290 - 1235), 23274 - 23266), ehT0Px3KOsy9('\060' + '\157' + chr(2174 - 2126), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b0 + 0o157) + chr(50) + chr(0b1111 + 0o45), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101 + 0o54) + chr(0b110100 + 0o0) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(0b1101111) + chr(1237 - 1187) + chr(1497 - 1449) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(7142 - 7031) + chr(426 - 377) + chr(0b110100) + chr(0b11110 + 0o31), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(0b110010) + chr(53) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + '\x32' + chr(0b101010 + 0o11) + chr(2243 - 2190), 13291 - 13283), ehT0Px3KOsy9(chr(48) + chr(11421 - 11310) + '\061' + chr(48) + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + chr(4864 - 4753) + '\x31' + chr(50) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7062 - 6951) + chr(49) + '\062' + chr(0b11111 + 0o25), 41442 - 41434)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(6798 - 6687) + chr(0b101111 + 0o6) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'g'), chr(100) + chr(0b1100101) + chr(99) + '\x6f' + chr(1026 - 926) + chr(0b1001110 + 0o27))(chr(0b1110100 + 0o1) + chr(0b1101101 + 0o7) + chr(0b1100110) + chr(45) + chr(2315 - 2259)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ABGwmxXNRFOq(C8dAr6Ujq2Tn): assert not UW6a6w49n0IL(C8dAr6Ujq2Tn) @x1LswTf8Ltgr(AndnJZGtKuQi(C8dAr6Ujq2Tn, commute=ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49), ord("\x08")))) @e1iVrWoIZ7rg def ABGwmxXNRFOq(oVre8I6UXc3b, KK0ERS7DqYrY): if PlSM16l2KDPD(oVre8I6UXc3b, dgwXlm5cakKw): (kNhlqnMhYXCB, _zY3sbqLHto9, _kVftqoKhv4s) = oVre8I6UXc3b.build_binary_op(C8dAr6Ujq2Tn, KK0ERS7DqYrY) return dAD4kyrvgpBh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'a\xc0n\x9e\xd27Qp\x07r\xc4\x9e\x99\x1c\xa6\x1d\xd9\x89\x89\xd1.O\x97'), '\x64' + '\145' + chr(0b1011010 + 0o11) + chr(111) + '\x64' + chr(7024 - 6923))('\165' + '\164' + chr(0b110101 + 0o61) + chr(45) + chr(1617 - 1561)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x8fp\x94\xfc"\x7fjwy\xce\x84'), chr(0b1100100) + chr(0b1100101) + '\143' + '\x6f' + '\144' + chr(101))(chr(4271 - 4154) + chr(116) + '\x66' + '\055' + chr(0b111000)))(left=_zY3sbqLHto9, right=kNhlqnMhYXCB, op=C8dAr6Ujq2Tn), _kVftqoKhv4s, dtype=XreA97FhdMk_(C8dAr6Ujq2Tn, xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xe8T\xc2\xfd\x08B<JA\x9c\xa5'), '\144' + chr(0b1100101) + chr(99) + '\x6f' + '\144' + chr(101))(chr(117) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(2438 - 2382))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xe8T\xc2\xfd\x08B<JA\x9c\xa5'), '\x64' + '\145' + chr(5149 - 5050) + '\157' + chr(0b1100100) + chr(101))('\165' + chr(2007 - 1891) + chr(0b1011000 + 0o16) + '\055' + chr(2439 - 2383))))) elif PlSM16l2KDPD(KK0ERS7DqYrY, RdGQCEqKm_Wb): return dAD4kyrvgpBh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'2\xd8m\x95\xc77M7St\x8b\x95\x8bL\xf3F\xd3\xbf\xde'), '\144' + chr(0b1100101) + '\143' + chr(0b1101011 + 0o4) + chr(2772 - 2672) + chr(0b1000111 + 0o36))(chr(5040 - 4923) + chr(116) + chr(0b1100110) + chr(1106 - 1061) + chr(0b100010 + 0o26)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x8fp\x94\xfc"\x7fjwy\xce\x84'), '\x64' + chr(0b1100101) + '\143' + chr(0b1101111) + chr(100) + chr(0b10 + 0o143))(chr(10430 - 10313) + chr(0b1101101 + 0o7) + '\146' + '\x2d' + '\070'))(op=C8dAr6Ujq2Tn, constant=KK0ERS7DqYrY), binds=(oVre8I6UXc3b,), dtype=XreA97FhdMk_(C8dAr6Ujq2Tn, xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xe8T\xc2\xfd\x08B<JA\x9c\xa5'), chr(4141 - 4041) + chr(101) + chr(0b1000011 + 0o40) + chr(0b1101111) + chr(100) + '\145')('\x75' + chr(8245 - 8129) + '\x66' + chr(170 - 125) + '\070')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xe8T\xc2\xfd\x08B<JA\x9c\xa5'), chr(0b1100100) + chr(1128 - 1027) + chr(4699 - 4600) + '\x6f' + chr(0b1100100) + chr(101))(chr(0b1010101 + 0o40) + chr(116) + chr(0b1100110) + chr(0b1100 + 0o41) + chr(1522 - 1466))))) raise g_OwtHWi2Aiy(C8dAr6Ujq2Tn, KK0ERS7DqYrY, oVre8I6UXc3b) return ABGwmxXNRFOq
quantopian/zipline
zipline/pipeline/factors/factor.py
unary_operator
def unary_operator(op): """ Factory function for making unary operator methods for Factors. """ # Only negate is currently supported. valid_ops = {'-'} if op not in valid_ops: raise ValueError("Invalid unary operator %s." % op) @with_doc("Unary Operator: '%s'" % op) @with_name(unary_op_name(op)) def unary_operator(self): if self.dtype != float64_dtype: raise TypeError( "Can't apply unary operator {op!r} to instance of " "{typename!r} with dtype {dtypename!r}.\n" "{op!r} is only supported for Factors of dtype " "'float64'.".format( op=op, typename=type(self).__name__, dtypename=self.dtype.name, ) ) # This can't be hoisted up a scope because the types returned by # unary_op_return_type aren't defined when the top-level function is # invoked. if isinstance(self, NumericalExpression): return NumExprFactor( "{op}({expr})".format(op=op, expr=self._expr), self.inputs, dtype=float64_dtype, ) else: return NumExprFactor( "{op}x_0".format(op=op), (self,), dtype=float64_dtype, ) return unary_operator
python
def unary_operator(op): """ Factory function for making unary operator methods for Factors. """ # Only negate is currently supported. valid_ops = {'-'} if op not in valid_ops: raise ValueError("Invalid unary operator %s." % op) @with_doc("Unary Operator: '%s'" % op) @with_name(unary_op_name(op)) def unary_operator(self): if self.dtype != float64_dtype: raise TypeError( "Can't apply unary operator {op!r} to instance of " "{typename!r} with dtype {dtypename!r}.\n" "{op!r} is only supported for Factors of dtype " "'float64'.".format( op=op, typename=type(self).__name__, dtypename=self.dtype.name, ) ) # This can't be hoisted up a scope because the types returned by # unary_op_return_type aren't defined when the top-level function is # invoked. if isinstance(self, NumericalExpression): return NumExprFactor( "{op}({expr})".format(op=op, expr=self._expr), self.inputs, dtype=float64_dtype, ) else: return NumExprFactor( "{op}x_0".format(op=op), (self,), dtype=float64_dtype, ) return unary_operator
[ "def", "unary_operator", "(", "op", ")", ":", "# Only negate is currently supported.", "valid_ops", "=", "{", "'-'", "}", "if", "op", "not", "in", "valid_ops", ":", "raise", "ValueError", "(", "\"Invalid unary operator %s.\"", "%", "op", ")", "@", "with_doc", "(", "\"Unary Operator: '%s'\"", "%", "op", ")", "@", "with_name", "(", "unary_op_name", "(", "op", ")", ")", "def", "unary_operator", "(", "self", ")", ":", "if", "self", ".", "dtype", "!=", "float64_dtype", ":", "raise", "TypeError", "(", "\"Can't apply unary operator {op!r} to instance of \"", "\"{typename!r} with dtype {dtypename!r}.\\n\"", "\"{op!r} is only supported for Factors of dtype \"", "\"'float64'.\"", ".", "format", "(", "op", "=", "op", ",", "typename", "=", "type", "(", "self", ")", ".", "__name__", ",", "dtypename", "=", "self", ".", "dtype", ".", "name", ",", ")", ")", "# This can't be hoisted up a scope because the types returned by", "# unary_op_return_type aren't defined when the top-level function is", "# invoked.", "if", "isinstance", "(", "self", ",", "NumericalExpression", ")", ":", "return", "NumExprFactor", "(", "\"{op}({expr})\"", ".", "format", "(", "op", "=", "op", ",", "expr", "=", "self", ".", "_expr", ")", ",", "self", ".", "inputs", ",", "dtype", "=", "float64_dtype", ",", ")", "else", ":", "return", "NumExprFactor", "(", "\"{op}x_0\"", ".", "format", "(", "op", "=", "op", ")", ",", "(", "self", ",", ")", ",", "dtype", "=", "float64_dtype", ",", ")", "return", "unary_operator" ]
Factory function for making unary operator methods for Factors.
[ "Factory", "function", "for", "making", "unary", "operator", "methods", "for", "Factors", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L243-L282
train
Returns a factory function for making unary operator methods for Factors.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,b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iPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1075 - 1027) + chr(111) + chr(55) + chr(0b110111), 50075 - 50067), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(49) + '\064' + chr(0b110011), 49726 - 49718), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101000 + 0o13) + '\060', 37158 - 37150), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + chr(0b110 + 0o61) + chr(0b110 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(50) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + '\060' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(2432 - 2321) + '\x31' + '\064', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(50) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + chr(205 - 154) + chr(0b100011 + 0o20) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11975 - 11864) + chr(1859 - 1809) + chr(0b11 + 0o63) + '\x34', 2079 - 2071), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(0b110011) + chr(48) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1974 - 1924) + '\062', 14197 - 14189), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(53) + chr(0b100100 + 0o15), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + '\x34' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + chr(0b111101 + 0o62) + chr(0b11000 + 0o32) + chr(444 - 394), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(523 - 474) + chr(0b110100) + chr(0b1100 + 0o47), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(546 - 491) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(343 - 295) + chr(11790 - 11679) + chr(2400 - 2350) + '\x32' + chr(1592 - 1543), 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\x6f' + chr(280 - 230) + chr(0b10000 + 0o44) + chr(0b11 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(1073 - 1024) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + chr(2552 - 2441) + chr(0b1110 + 0o44) + chr(2299 - 2246) + chr(980 - 925), 0o10), ehT0Px3KOsy9('\060' + chr(2833 - 2722) + chr(49) + chr(48) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b10100 + 0o40) + chr(48), 59831 - 59823), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1965 - 1916) + chr(54) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\063' + chr(51) + chr(0b110111), 47926 - 47918), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100100 + 0o22) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(12222 - 12111) + chr(0b11 + 0o56) + '\061' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100000 + 0o21) + chr(0b110011 + 0o2), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + '\061' + chr(0b110101) + '\060', 0o10), ehT0Px3KOsy9(chr(2263 - 2215) + '\x6f' + '\x32' + '\062' + chr(871 - 819), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34' + '\062', 0b1000), ehT0Px3KOsy9(chr(1424 - 1376) + chr(111) + chr(0b1 + 0o61) + '\060' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\x6f' + '\x36' + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\x6f' + chr(0b1 + 0o61) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\x33' + '\x30' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(799 - 751) + chr(0b101011 + 0o104) + chr(0b110001) + chr(0b110100), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100111 + 0o12) + chr(0b100110 + 0o15) + chr(52), 0b1000), ehT0Px3KOsy9(chr(940 - 892) + chr(0b1011110 + 0o21) + chr(0b1111 + 0o44) + '\x31' + chr(0b10100 + 0o42), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x36' + chr(0b110101), 50259 - 50251)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11101 + 0o30) + '\060', 14406 - 14398)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x11'), chr(100) + chr(0b100101 + 0o100) + chr(0b1100011) + chr(0b1101111) + chr(3629 - 3529) + '\x65')('\x75' + '\164' + '\146' + '\055' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def wyqWKv7PreE9(C8dAr6Ujq2Tn): ORlJCFRv6Nqd = {xafqLlk3kkUe(SXOLrMavuUCe(b'\x12'), chr(0b1000111 + 0o35) + '\145' + chr(0b1100011) + chr(4350 - 4239) + chr(7708 - 7608) + chr(0b111010 + 0o53))(chr(117) + '\x74' + '\146' + chr(45) + chr(385 - 329))} if C8dAr6Ujq2Tn not in ORlJCFRv6Nqd: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'v\r~y\x95=\xe0, \xb5\xd5\xb2kI\tb\x06J\xf0\xd5\xe0\xddb\x85\x01\xf1'), chr(100) + chr(0b1011010 + 0o13) + chr(0b1100011) + chr(0b1101111) + chr(100) + '\145')(chr(11317 - 11200) + chr(0b1110100) + chr(7654 - 7552) + chr(45) + chr(1888 - 1832)) % C8dAr6Ujq2Tn) @wi_6JDV4IUWJ(xafqLlk3kkUe(SXOLrMavuUCe(b'j\rij\x80t\xcb|0\xa9\xd5\xb4}\x1b\\2D\x1d\xe2\x86'), '\x64' + '\x65' + '\143' + chr(2619 - 2508) + chr(100) + chr(0b1100101))(chr(9748 - 9631) + '\x74' + '\146' + chr(335 - 290) + chr(56)) % C8dAr6Ujq2Tn) @x1LswTf8Ltgr(ikfOvZiha_Ut(C8dAr6Ujq2Tn)) def wyqWKv7PreE9(oVre8I6UXc3b): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'U0^!\xb0\x1f\xeai8\x93\x83\x8b'), '\144' + chr(0b100110 + 0o77) + '\x63' + '\157' + '\144' + chr(2978 - 2877))('\x75' + chr(0b110 + 0o156) + '\146' + chr(0b11 + 0o52) + chr(2094 - 2038))) != rZ1BN3UDHnco: raise sznFqDbNBHlx(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'|\x02f?\x8dt\xe5|%\xb7\xcd\xe0g\x07\x07`\x1a\x18\xfe\xd1\xea\xdd#\xd4\x1d\xad\x101b\x18\xb5P\xf8\x11`\xad,5\xa0FK\x02f{\x9ct\xebju\xa0\xc0\xb9b\x0c\x08s\x0e]\xb0\xd3\xf2\x8f5\xc9\x06\xb7\x10.y\x11\xe4G\xa5Jp\xb6u,\xab[^\x0em9\x8b)\xaa\x06.\xb4\xc4\xe1`\x14F{\x10\x18\xfe\xcf\xe3\xd6b\xd3\x07\xaf@%\x7f\x1c\xf1F\xa5W{\xb0,\x1a\xafVK\x0czk\xd9;\xe2,1\xaf\xcd\xb0wIAt\x0fW\xf0\xd5\xb9\x9be\x8e'), '\144' + chr(101) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(11521 - 11404) + '\x74' + chr(0b1100110) + '\055' + chr(0b10 + 0o66)), xafqLlk3kkUe(SXOLrMavuUCe(b'iWzw\xb15\xd7?\x05\xab\xd1\xaa'), chr(6021 - 5921) + chr(101) + '\x63' + chr(111) + chr(6307 - 6207) + chr(0b1100101))('\165' + '\x74' + chr(9654 - 9552) + chr(0b101101) + chr(0b111000)))(op=C8dAr6Ujq2Tn, typename=xafqLlk3kkUe(wmQmyeWBmUpv(oVre8I6UXc3b), xafqLlk3kkUe(SXOLrMavuUCe(b'x\x01mr\xcd;\xde}\x1e\x97\xf5\xf6'), chr(0b11011 + 0o111) + chr(101) + '\143' + '\x6f' + chr(9023 - 8923) + chr(6378 - 6277))('\165' + chr(0b1010010 + 0o42) + chr(0b1100110) + '\x2d' + chr(56))), dtypename=xafqLlk3kkUe(oVre8I6UXc3b.dtype, xafqLlk3kkUe(SXOLrMavuUCe(b'~*~R\xab.\xc8h\x11\xbd\xd3\x86'), chr(100) + '\x65' + chr(99) + '\x6f' + '\144' + chr(0b1100101))(chr(117) + chr(834 - 718) + '\x66' + '\055' + chr(229 - 173))))) if PlSM16l2KDPD(oVre8I6UXc3b, dgwXlm5cakKw): return dAD4kyrvgpBh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'D\x0cxe\xd1/\xe1t%\xa9\xc9\xe9'), chr(7418 - 7318) + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(0b1100101))('\x75' + chr(116) + '\x66' + chr(0b11001 + 0o24) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'iWzw\xb15\xd7?\x05\xab\xd1\xaa'), chr(100) + '\x65' + chr(0b1001111 + 0o24) + chr(1492 - 1381) + '\x64' + '\145')('\165' + chr(8742 - 8626) + chr(6848 - 6746) + '\x2d' + chr(56)))(op=C8dAr6Ujq2Tn, expr=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'`\x06ph\x8b'), '\x64' + '\145' + chr(0b1100011) + '\x6f' + '\x64' + chr(10019 - 9918))(chr(0b1110101) + chr(116) + chr(5500 - 5398) + chr(45) + chr(2355 - 2299)))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'I;gm\x891\xf4A!\x98\xec\x95'), chr(0b1100100) + chr(0b1100101) + chr(0b1100011) + '\157' + '\144' + '\x65')(chr(4153 - 4036) + '\x74' + '\x66' + '\055' + '\070')), dtype=rZ1BN3UDHnco) else: return dAD4kyrvgpBh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'D\x0cxe\x81\x0b\xb4'), chr(0b110011 + 0o61) + chr(7408 - 7307) + '\143' + chr(0b1101111) + '\x64' + chr(0b1001000 + 0o35))(chr(117) + chr(650 - 534) + chr(0b11011 + 0o113) + '\055' + chr(0b10110 + 0o42)), xafqLlk3kkUe(SXOLrMavuUCe(b'iWzw\xb15\xd7?\x05\xab\xd1\xaa'), chr(0b1100100) + '\145' + chr(8605 - 8506) + chr(111) + '\144' + chr(0b1100101))('\165' + chr(116) + chr(0b1100110 + 0o0) + '\055' + chr(0b110000 + 0o10)))(op=C8dAr6Ujq2Tn), (oVre8I6UXc3b,), dtype=rZ1BN3UDHnco) return wyqWKv7PreE9
quantopian/zipline
zipline/pipeline/factors/factor.py
function_application
def function_application(func): """ Factory function for producing function application methods for Factor subclasses. """ if func not in NUMEXPR_MATH_FUNCS: raise ValueError("Unsupported mathematical function '%s'" % func) @with_doc(func) @with_name(func) def mathfunc(self): if isinstance(self, NumericalExpression): return NumExprFactor( "{func}({expr})".format(func=func, expr=self._expr), self.inputs, dtype=float64_dtype, ) else: return NumExprFactor( "{func}(x_0)".format(func=func), (self,), dtype=float64_dtype, ) return mathfunc
python
def function_application(func): """ Factory function for producing function application methods for Factor subclasses. """ if func not in NUMEXPR_MATH_FUNCS: raise ValueError("Unsupported mathematical function '%s'" % func) @with_doc(func) @with_name(func) def mathfunc(self): if isinstance(self, NumericalExpression): return NumExprFactor( "{func}({expr})".format(func=func, expr=self._expr), self.inputs, dtype=float64_dtype, ) else: return NumExprFactor( "{func}(x_0)".format(func=func), (self,), dtype=float64_dtype, ) return mathfunc
[ "def", "function_application", "(", "func", ")", ":", "if", "func", "not", "in", "NUMEXPR_MATH_FUNCS", ":", "raise", "ValueError", "(", "\"Unsupported mathematical function '%s'\"", "%", "func", ")", "@", "with_doc", "(", "func", ")", "@", "with_name", "(", "func", ")", "def", "mathfunc", "(", "self", ")", ":", "if", "isinstance", "(", "self", ",", "NumericalExpression", ")", ":", "return", "NumExprFactor", "(", "\"{func}({expr})\"", ".", "format", "(", "func", "=", "func", ",", "expr", "=", "self", ".", "_expr", ")", ",", "self", ".", "inputs", ",", "dtype", "=", "float64_dtype", ",", ")", "else", ":", "return", "NumExprFactor", "(", "\"{func}(x_0)\"", ".", "format", "(", "func", "=", "func", ")", ",", "(", "self", ",", ")", ",", "dtype", "=", "float64_dtype", ",", ")", "return", "mathfunc" ]
Factory function for producing function application methods for Factor subclasses.
[ "Factory", "function", "for", "producing", "function", "application", "methods", "for", "Factor", "subclasses", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L285-L308
train
Returns a factory function for producing function application methods for Factor subclasses.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZf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_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(743 - 695) + chr(0b1101111) + chr(147 - 98) + chr(0b110111) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(0b101110 + 0o5) + chr(0b110000) + chr(2181 - 2126), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b100111 + 0o110) + '\062' + '\x31' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + '\157' + chr(1362 - 1312) + chr(0b11000 + 0o35) + chr(50), 7597 - 7589), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(0b110010) + chr(53) + chr(0b1000 + 0o54), 0o10), ehT0Px3KOsy9('\060' + chr(6621 - 6510) + '\x34' + '\065', 17366 - 17358), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(49) + chr(1767 - 1719), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + '\062' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1038 - 989) + chr(0b110010) + chr(1543 - 1495), 0b1000), ehT0Px3KOsy9(chr(1732 - 1684) + '\x6f' + chr(0b110001) + '\x35' + chr(0b1111 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + '\062' + chr(0b110110) + chr(1283 - 1234), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\066' + '\x31', 8), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(395 - 340) + '\067', 0o10), ehT0Px3KOsy9(chr(2018 - 1970) + chr(0b1101111) + '\x33' + '\x36' + chr(0b10001 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101000 + 0o107) + chr(50) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9765 - 9654) + chr(49) + chr(2442 - 2390) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + chr(0b100111 + 0o14) + chr(2299 - 2249) + chr(417 - 369), 0o10), ehT0Px3KOsy9(chr(1137 - 1089) + chr(5407 - 5296) + chr(0b1010 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b11100 + 0o24) + chr(55), 8), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(2347 - 2297) + '\x32', 27510 - 27502), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010000 + 0o37) + chr(1774 - 1724) + chr(49) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + '\063' + chr(0b110100) + chr(0b100100 + 0o16), 62720 - 62712), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100010 + 0o20) + chr(0b110001 + 0o4) + '\x32', 8), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(12060 - 11949) + chr(52) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(6217 - 6106) + chr(0b110010 + 0o1) + chr(0b101101 + 0o11), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\x34', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(0b100110 + 0o14) + chr(49), 20474 - 20466), ehT0Px3KOsy9(chr(2042 - 1994) + chr(0b10111 + 0o130) + '\x31' + '\x36', 58718 - 58710), ehT0Px3KOsy9('\060' + chr(11616 - 11505) + chr(50) + chr(298 - 247) + '\x32', 9190 - 9182), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(0b11 + 0o57) + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1064 - 953) + '\x31' + '\x37', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(4636 - 4525) + chr(0b110011) + chr(0b110011) + chr(1708 - 1657), 0o10), ehT0Px3KOsy9(chr(801 - 753) + '\x6f' + chr(51) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(54) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010 + 0o0) + chr(0b101010 + 0o15) + chr(0b10000 + 0o41), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + chr(49) + chr(48) + chr(0b110000), 53864 - 53856), ehT0Px3KOsy9(chr(0b110000) + chr(613 - 502) + chr(51) + '\060' + chr(0b100001 + 0o17), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1737 - 1686) + chr(0b111 + 0o55) + chr(0b110000 + 0o4), 0b1000), ehT0Px3KOsy9(chr(48) + chr(8043 - 7932) + chr(2109 - 2060) + chr(994 - 946) + chr(0b11001 + 0o36), 27411 - 27403)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + '\x35' + chr(0b101000 + 0o10), 61143 - 61135)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'V'), '\x64' + chr(101) + '\143' + chr(111) + chr(100) + '\145')(chr(0b1110101) + '\x74' + '\146' + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def NXJuj8syXv5o(EzOtJ3kbK5x4): if EzOtJ3kbK5x4 not in R8Ca80XgOVCB: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'-\xa9\xff\xdf\xdcUg\xe2$\t\xd5\x91\xd2\x94b\x0f\xb5i\xa6\xa6\xe0\x81\xcbK>j$`\xf9\xf1f\xb4q\x17\x9e"3\xe7'), '\x64' + chr(101) + '\143' + '\x6f' + chr(3523 - 3423) + chr(2683 - 2582))(chr(0b110000 + 0o105) + '\x74' + '\146' + chr(597 - 552) + '\070') % EzOtJ3kbK5x4) @wi_6JDV4IUWJ(EzOtJ3kbK5x4) @x1LswTf8Ltgr(EzOtJ3kbK5x4) def jEQp9qP8hm9A(oVre8I6UXc3b): if PlSM16l2KDPD(oVre8I6UXc3b, dgwXlm5cakKw): return dAD4kyrvgpBh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xa1\xf9\xc4\xcfX \xeb5\x14\xc1\xc3\xc2\xdc'), '\x64' + chr(7718 - 7617) + '\x63' + chr(111) + '\144' + '\x65')(chr(12336 - 12219) + '\x74' + '\146' + chr(0b101101) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'.\xf3\xfe\xc5\xe4D[\xa3\x00\x1c\xd4\xdb'), chr(0b110000 + 0o64) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(0b100110 + 0o76) + chr(6526 - 6425))(chr(0b1110101) + chr(0b1110100) + chr(102) + chr(0b11001 + 0o24) + chr(0b101011 + 0o15)))(func=EzOtJ3kbK5x4, expr=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"'\xa2\xf4\xda\xde"), chr(0b1100000 + 0o4) + chr(0b101110 + 0o67) + chr(0b101111 + 0o64) + chr(11854 - 11743) + chr(1836 - 1736) + chr(101))(chr(0b1110101) + chr(0b1000011 + 0o61) + chr(0b1100110) + chr(659 - 614) + chr(836 - 780)))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e\x9f\xe3\xdf\xdc@x\xdd$/\xe9\xe4'), '\x64' + chr(8399 - 8298) + chr(7252 - 7153) + chr(0b1101011 + 0o4) + chr(100) + '\x65')(chr(0b10100 + 0o141) + chr(8839 - 8723) + chr(2183 - 2081) + chr(907 - 862) + chr(56))), dtype=rZ1BN3UDHnco) else: return dAD4kyrvgpBh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xa1\xf9\xc4\xcfX \xe8\x0f\\\x98'), chr(100) + '\x65' + '\x63' + chr(8032 - 7921) + chr(0b1010100 + 0o20) + chr(101))(chr(117) + chr(0b1110100) + '\146' + chr(0b100 + 0o51) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'.\xf3\xfe\xc5\xe4D[\xa3\x00\x1c\xd4\xdb'), chr(100) + chr(2832 - 2731) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(117) + '\x74' + chr(0b1000111 + 0o37) + chr(1936 - 1891) + chr(2138 - 2082)))(func=EzOtJ3kbK5x4), (oVre8I6UXc3b,), dtype=rZ1BN3UDHnco) return jEQp9qP8hm9A
quantopian/zipline
zipline/pipeline/factors/factor.py
winsorize
def winsorize(row, min_percentile, max_percentile): """ This implementation is based on scipy.stats.mstats.winsorize """ a = row.copy() nan_count = isnan(row).sum() nonnan_count = a.size - nan_count # NOTE: argsort() sorts nans to the end of the array. idx = a.argsort() # Set values at indices below the min percentile to the value of the entry # at the cutoff. if min_percentile > 0: lower_cutoff = int(min_percentile * nonnan_count) a[idx[:lower_cutoff]] = a[idx[lower_cutoff]] # Set values at indices above the max percentile to the value of the entry # at the cutoff. if max_percentile < 1: upper_cutoff = int(ceil(nonnan_count * max_percentile)) # if max_percentile is close to 1, then upper_cutoff might not # remove any values. if upper_cutoff < nonnan_count: start_of_nans = (-nan_count) if nan_count else None a[idx[upper_cutoff:start_of_nans]] = a[idx[upper_cutoff - 1]] return a
python
def winsorize(row, min_percentile, max_percentile): """ This implementation is based on scipy.stats.mstats.winsorize """ a = row.copy() nan_count = isnan(row).sum() nonnan_count = a.size - nan_count # NOTE: argsort() sorts nans to the end of the array. idx = a.argsort() # Set values at indices below the min percentile to the value of the entry # at the cutoff. if min_percentile > 0: lower_cutoff = int(min_percentile * nonnan_count) a[idx[:lower_cutoff]] = a[idx[lower_cutoff]] # Set values at indices above the max percentile to the value of the entry # at the cutoff. if max_percentile < 1: upper_cutoff = int(ceil(nonnan_count * max_percentile)) # if max_percentile is close to 1, then upper_cutoff might not # remove any values. if upper_cutoff < nonnan_count: start_of_nans = (-nan_count) if nan_count else None a[idx[upper_cutoff:start_of_nans]] = a[idx[upper_cutoff - 1]] return a
[ "def", "winsorize", "(", "row", ",", "min_percentile", ",", "max_percentile", ")", ":", "a", "=", "row", ".", "copy", "(", ")", "nan_count", "=", "isnan", "(", "row", ")", ".", "sum", "(", ")", "nonnan_count", "=", "a", ".", "size", "-", "nan_count", "# NOTE: argsort() sorts nans to the end of the array.", "idx", "=", "a", ".", "argsort", "(", ")", "# Set values at indices below the min percentile to the value of the entry", "# at the cutoff.", "if", "min_percentile", ">", "0", ":", "lower_cutoff", "=", "int", "(", "min_percentile", "*", "nonnan_count", ")", "a", "[", "idx", "[", ":", "lower_cutoff", "]", "]", "=", "a", "[", "idx", "[", "lower_cutoff", "]", "]", "# Set values at indices above the max percentile to the value of the entry", "# at the cutoff.", "if", "max_percentile", "<", "1", ":", "upper_cutoff", "=", "int", "(", "ceil", "(", "nonnan_count", "*", "max_percentile", ")", ")", "# if max_percentile is close to 1, then upper_cutoff might not", "# remove any values.", "if", "upper_cutoff", "<", "nonnan_count", ":", "start_of_nans", "=", "(", "-", "nan_count", ")", "if", "nan_count", "else", "None", "a", "[", "idx", "[", "upper_cutoff", ":", "start_of_nans", "]", "]", "=", "a", "[", "idx", "[", "upper_cutoff", "-", "1", "]", "]", "return", "a" ]
This implementation is based on scipy.stats.mstats.winsorize
[ "This", "implementation", "is", "based", "on", "scipy", ".", "stats", ".", "mstats", ".", "winsorize" ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1671-L1698
train
This implementation is based on scipy. stats. winsorize This implementation is based on scipy. stats. winsorize
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5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ttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1445 - 1395) + '\x32' + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111111 + 0o60) + '\063' + '\x36' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b110010) + '\x30', 0o10), ehT0Px3KOsy9(chr(1956 - 1908) + chr(0b1011000 + 0o27) + chr(51) + chr(2588 - 2534) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11001 + 0o126) + chr(1366 - 1317) + '\x31' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b1001 + 0o146) + chr(0b10 + 0o57) + chr(0b1000 + 0o51) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x35', 41281 - 41273), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\x36' + chr(53), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100000 + 0o23) + '\065' + chr(0b0 + 0o63), 43770 - 43762), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b10 + 0o62) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(726 - 678) + chr(0b110100 + 0o73) + '\063' + chr(55) + '\x35', 40452 - 40444), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + '\x33' + chr(49) + '\064', 0b1000), ehT0Px3KOsy9(chr(2118 - 2070) + chr(0b1101111) + chr(51) + chr(1093 - 1040) + '\x33', 8), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + '\063' + chr(50) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b110010) + chr(53), 58289 - 58281), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\063' + '\060', 0b1000), ehT0Px3KOsy9(chr(153 - 105) + chr(0b1101111) + '\x33' + chr(0b110110) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(274 - 226) + '\157' + '\x31' + '\x33' + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + '\063' + chr(51) + chr(297 - 248), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x36' + chr(2225 - 2176), 35366 - 35358), ehT0Px3KOsy9(chr(1702 - 1654) + chr(0b1101111) + chr(51) + '\067' + chr(0b10001 + 0o42), 16721 - 16713), ehT0Px3KOsy9('\x30' + chr(11659 - 11548) + '\063' + chr(51) + chr(592 - 540), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(49) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + '\x37' + chr(55), 55048 - 55040), ehT0Px3KOsy9('\060' + '\157' + chr(0b110101) + '\066', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(9856 - 9745) + chr(52) + chr(0b101100 + 0o4), 47014 - 47006), ehT0Px3KOsy9(chr(303 - 255) + '\157' + chr(0b110010) + chr(0b110111) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1101111) + chr(0b110001) + chr(135 - 82) + chr(0b100000 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(815 - 765) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b110100) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10001 + 0o41) + chr(0b110100) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + '\x37' + chr(2545 - 2494), 2482 - 2474), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b11001 + 0o31) + chr(2341 - 2287), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(54) + '\x36', 0o10), ehT0Px3KOsy9(chr(1688 - 1640) + chr(3375 - 3264) + chr(0b110 + 0o55) + chr(2277 - 2228) + '\x35', 18100 - 18092), ehT0Px3KOsy9('\060' + '\x6f' + chr(1514 - 1465) + chr(0b101111 + 0o10) + chr(0b101 + 0o60), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(531 - 483), 0o10), ehT0Px3KOsy9(chr(48) + chr(171 - 60) + chr(50) + chr(0b10000 + 0o43), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(307 - 259) + chr(10345 - 10234) + chr(2685 - 2632) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xbd'), chr(0b1100100) + chr(0b1010010 + 0o23) + '\x63' + chr(4850 - 4739) + chr(7935 - 7835) + chr(0b1100101))(chr(0b1110101) + chr(0b1000100 + 0o60) + chr(0b1100110) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def eBBWzLq91Kdg(TAK9K32TkBdA, aBl6WwGvrXAi, XtZb6jTc6QwP): XPh1qbAgrPgG = TAK9K32TkBdA.igThHS4jwVsa() awfJirniIlFf = wN4RVZAxJEhp(TAK9K32TkBdA).xkxBmo49x2An() murosLsFNQKg = XPh1qbAgrPgG.NLcc3BCJnQka - awfJirniIlFf YlqusYB6InkM = XPh1qbAgrPgG.fBdASx302nVl() if aBl6WwGvrXAi > ehT0Px3KOsy9(chr(1756 - 1708) + chr(111) + chr(0b10011 + 0o35), 8): pJyPYO6aHnaW = ehT0Px3KOsy9(aBl6WwGvrXAi * murosLsFNQKg) XPh1qbAgrPgG[YlqusYB6InkM[:pJyPYO6aHnaW]] = XPh1qbAgrPgG[YlqusYB6InkM[pJyPYO6aHnaW]] if XtZb6jTc6QwP < ehT0Px3KOsy9(chr(1879 - 1831) + chr(0b110000 + 0o77) + chr(49), 8): qhIyyAIc787S = ehT0Px3KOsy9(l4tMMBCkqSGk(murosLsFNQKg * XtZb6jTc6QwP)) if qhIyyAIc787S < murosLsFNQKg: xrpW85sWAG8E = -awfJirniIlFf if awfJirniIlFf else None XPh1qbAgrPgG[YlqusYB6InkM[qhIyyAIc787S:xrpW85sWAG8E]] = XPh1qbAgrPgG[YlqusYB6InkM[qhIyyAIc787S - ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(411 - 362), 8)]] return XPh1qbAgrPgG
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.demean
def demean(self, mask=NotSpecified, groupby=NotSpecified): """ Construct a Factor that computes ``self`` and subtracts the mean from row of the result. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row based on the values produced by ``groupby``, de-meaning the partitioned arrays, and stitching the sub-results back together. Parameters ---------- mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when computing means. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to compute means. Examples -------- Let ``f`` be a Factor which would produce the following output:: AAPL MSFT MCD BK 2017-03-13 1.0 2.0 3.0 4.0 2017-03-14 1.5 2.5 3.5 1.0 2017-03-15 2.0 3.0 4.0 1.5 2017-03-16 2.5 3.5 1.0 2.0 Let ``c`` be a Classifier producing the following output:: AAPL MSFT MCD BK 2017-03-13 1 1 2 2 2017-03-14 1 1 2 2 2017-03-15 1 1 2 2 2017-03-16 1 1 2 2 Let ``m`` be a Filter producing the following output:: AAPL MSFT MCD BK 2017-03-13 False True True True 2017-03-14 True False True True 2017-03-15 True True False True 2017-03-16 True True True False Then ``f.demean()`` will subtract the mean from each row produced by ``f``. :: AAPL MSFT MCD BK 2017-03-13 -1.500 -0.500 0.500 1.500 2017-03-14 -0.625 0.375 1.375 -1.125 2017-03-15 -0.625 0.375 1.375 -1.125 2017-03-16 0.250 1.250 -1.250 -0.250 ``f.demean(mask=m)`` will subtract the mean from each row, but means will be calculated ignoring values on the diagonal, and NaNs will written to the diagonal in the output. Diagonal values are ignored because they are the locations where the mask ``m`` produced False. :: AAPL MSFT MCD BK 2017-03-13 NaN -1.000 0.000 1.000 2017-03-14 -0.500 NaN 1.500 -1.000 2017-03-15 -0.166 0.833 NaN -0.666 2017-03-16 0.166 1.166 -1.333 NaN ``f.demean(groupby=c)`` will subtract the group-mean of AAPL/MSFT and MCD/BK from their respective entries. The AAPL/MSFT are grouped together because both assets always produce 1 in the output of the classifier ``c``. Similarly, MCD/BK are grouped together because they always produce 2. :: AAPL MSFT MCD BK 2017-03-13 -0.500 0.500 -0.500 0.500 2017-03-14 -0.500 0.500 1.250 -1.250 2017-03-15 -0.500 0.500 1.250 -1.250 2017-03-16 -0.500 0.500 -0.500 0.500 ``f.demean(mask=m, groupby=c)`` will also subtract the group-mean of AAPL/MSFT and MCD/BK, but means will be calculated ignoring values on the diagonal , and NaNs will be written to the diagonal in the output. :: AAPL MSFT MCD BK 2017-03-13 NaN 0.000 -0.500 0.500 2017-03-14 0.000 NaN 1.250 -1.250 2017-03-15 -0.500 0.500 NaN 0.000 2017-03-16 -0.500 0.500 0.000 NaN Notes ----- Mean is sensitive to the magnitudes of outliers. When working with factor that can potentially produce large outliers, it is often useful to use the ``mask`` parameter to discard values at the extremes of the distribution:: >>> base = MyFactor(...) # doctest: +SKIP >>> normalized = base.demean( ... mask=base.percentile_between(1, 99), ... ) # doctest: +SKIP ``demean()`` is only supported on Factors of dtype float64. See Also -------- :meth:`pandas.DataFrame.groupby` """ return GroupedRowTransform( transform=demean, transform_args=(), factor=self, groupby=groupby, dtype=self.dtype, missing_value=self.missing_value, window_safe=self.window_safe, mask=mask, )
python
def demean(self, mask=NotSpecified, groupby=NotSpecified): """ Construct a Factor that computes ``self`` and subtracts the mean from row of the result. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row based on the values produced by ``groupby``, de-meaning the partitioned arrays, and stitching the sub-results back together. Parameters ---------- mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when computing means. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to compute means. Examples -------- Let ``f`` be a Factor which would produce the following output:: AAPL MSFT MCD BK 2017-03-13 1.0 2.0 3.0 4.0 2017-03-14 1.5 2.5 3.5 1.0 2017-03-15 2.0 3.0 4.0 1.5 2017-03-16 2.5 3.5 1.0 2.0 Let ``c`` be a Classifier producing the following output:: AAPL MSFT MCD BK 2017-03-13 1 1 2 2 2017-03-14 1 1 2 2 2017-03-15 1 1 2 2 2017-03-16 1 1 2 2 Let ``m`` be a Filter producing the following output:: AAPL MSFT MCD BK 2017-03-13 False True True True 2017-03-14 True False True True 2017-03-15 True True False True 2017-03-16 True True True False Then ``f.demean()`` will subtract the mean from each row produced by ``f``. :: AAPL MSFT MCD BK 2017-03-13 -1.500 -0.500 0.500 1.500 2017-03-14 -0.625 0.375 1.375 -1.125 2017-03-15 -0.625 0.375 1.375 -1.125 2017-03-16 0.250 1.250 -1.250 -0.250 ``f.demean(mask=m)`` will subtract the mean from each row, but means will be calculated ignoring values on the diagonal, and NaNs will written to the diagonal in the output. Diagonal values are ignored because they are the locations where the mask ``m`` produced False. :: AAPL MSFT MCD BK 2017-03-13 NaN -1.000 0.000 1.000 2017-03-14 -0.500 NaN 1.500 -1.000 2017-03-15 -0.166 0.833 NaN -0.666 2017-03-16 0.166 1.166 -1.333 NaN ``f.demean(groupby=c)`` will subtract the group-mean of AAPL/MSFT and MCD/BK from their respective entries. The AAPL/MSFT are grouped together because both assets always produce 1 in the output of the classifier ``c``. Similarly, MCD/BK are grouped together because they always produce 2. :: AAPL MSFT MCD BK 2017-03-13 -0.500 0.500 -0.500 0.500 2017-03-14 -0.500 0.500 1.250 -1.250 2017-03-15 -0.500 0.500 1.250 -1.250 2017-03-16 -0.500 0.500 -0.500 0.500 ``f.demean(mask=m, groupby=c)`` will also subtract the group-mean of AAPL/MSFT and MCD/BK, but means will be calculated ignoring values on the diagonal , and NaNs will be written to the diagonal in the output. :: AAPL MSFT MCD BK 2017-03-13 NaN 0.000 -0.500 0.500 2017-03-14 0.000 NaN 1.250 -1.250 2017-03-15 -0.500 0.500 NaN 0.000 2017-03-16 -0.500 0.500 0.000 NaN Notes ----- Mean is sensitive to the magnitudes of outliers. When working with factor that can potentially produce large outliers, it is often useful to use the ``mask`` parameter to discard values at the extremes of the distribution:: >>> base = MyFactor(...) # doctest: +SKIP >>> normalized = base.demean( ... mask=base.percentile_between(1, 99), ... ) # doctest: +SKIP ``demean()`` is only supported on Factors of dtype float64. See Also -------- :meth:`pandas.DataFrame.groupby` """ return GroupedRowTransform( transform=demean, transform_args=(), factor=self, groupby=groupby, dtype=self.dtype, missing_value=self.missing_value, window_safe=self.window_safe, mask=mask, )
[ "def", "demean", "(", "self", ",", "mask", "=", "NotSpecified", ",", "groupby", "=", "NotSpecified", ")", ":", "return", "GroupedRowTransform", "(", "transform", "=", "demean", ",", "transform_args", "=", "(", ")", ",", "factor", "=", "self", ",", "groupby", "=", "groupby", ",", "dtype", "=", "self", ".", "dtype", ",", "missing_value", "=", "self", ".", "missing_value", ",", "window_safe", "=", "self", ".", "window_safe", ",", "mask", "=", "mask", ",", ")" ]
Construct a Factor that computes ``self`` and subtracts the mean from row of the result. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row based on the values produced by ``groupby``, de-meaning the partitioned arrays, and stitching the sub-results back together. Parameters ---------- mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when computing means. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to compute means. Examples -------- Let ``f`` be a Factor which would produce the following output:: AAPL MSFT MCD BK 2017-03-13 1.0 2.0 3.0 4.0 2017-03-14 1.5 2.5 3.5 1.0 2017-03-15 2.0 3.0 4.0 1.5 2017-03-16 2.5 3.5 1.0 2.0 Let ``c`` be a Classifier producing the following output:: AAPL MSFT MCD BK 2017-03-13 1 1 2 2 2017-03-14 1 1 2 2 2017-03-15 1 1 2 2 2017-03-16 1 1 2 2 Let ``m`` be a Filter producing the following output:: AAPL MSFT MCD BK 2017-03-13 False True True True 2017-03-14 True False True True 2017-03-15 True True False True 2017-03-16 True True True False Then ``f.demean()`` will subtract the mean from each row produced by ``f``. :: AAPL MSFT MCD BK 2017-03-13 -1.500 -0.500 0.500 1.500 2017-03-14 -0.625 0.375 1.375 -1.125 2017-03-15 -0.625 0.375 1.375 -1.125 2017-03-16 0.250 1.250 -1.250 -0.250 ``f.demean(mask=m)`` will subtract the mean from each row, but means will be calculated ignoring values on the diagonal, and NaNs will written to the diagonal in the output. Diagonal values are ignored because they are the locations where the mask ``m`` produced False. :: AAPL MSFT MCD BK 2017-03-13 NaN -1.000 0.000 1.000 2017-03-14 -0.500 NaN 1.500 -1.000 2017-03-15 -0.166 0.833 NaN -0.666 2017-03-16 0.166 1.166 -1.333 NaN ``f.demean(groupby=c)`` will subtract the group-mean of AAPL/MSFT and MCD/BK from their respective entries. The AAPL/MSFT are grouped together because both assets always produce 1 in the output of the classifier ``c``. Similarly, MCD/BK are grouped together because they always produce 2. :: AAPL MSFT MCD BK 2017-03-13 -0.500 0.500 -0.500 0.500 2017-03-14 -0.500 0.500 1.250 -1.250 2017-03-15 -0.500 0.500 1.250 -1.250 2017-03-16 -0.500 0.500 -0.500 0.500 ``f.demean(mask=m, groupby=c)`` will also subtract the group-mean of AAPL/MSFT and MCD/BK, but means will be calculated ignoring values on the diagonal , and NaNs will be written to the diagonal in the output. :: AAPL MSFT MCD BK 2017-03-13 NaN 0.000 -0.500 0.500 2017-03-14 0.000 NaN 1.250 -1.250 2017-03-15 -0.500 0.500 NaN 0.000 2017-03-16 -0.500 0.500 0.000 NaN Notes ----- Mean is sensitive to the magnitudes of outliers. When working with factor that can potentially produce large outliers, it is often useful to use the ``mask`` parameter to discard values at the extremes of the distribution:: >>> base = MyFactor(...) # doctest: +SKIP >>> normalized = base.demean( ... mask=base.percentile_between(1, 99), ... ) # doctest: +SKIP ``demean()`` is only supported on Factors of dtype float64. See Also -------- :meth:`pandas.DataFrame.groupby`
[ "Construct", "a", "Factor", "that", "computes", "self", "and", "subtracts", "the", "mean", "from", "row", "of", "the", "result", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L402-L524
train
Return a Factor that computes self and subtracts the mean from the result.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQ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HmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1001110 + 0o41) + '\x33' + chr(0b110011) + '\x35', 0o10), ehT0Px3KOsy9(chr(102 - 54) + '\157' + chr(0b110 + 0o55) + chr(54) + chr(1948 - 1896), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11059 - 10948) + chr(1481 - 1430) + chr(54) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2003 - 1948) + chr(1315 - 1261), 0o10), ehT0Px3KOsy9(chr(1821 - 1773) + chr(0b111110 + 0o61) + '\063' + chr(0b10001 + 0o45) + chr(292 - 240), 8), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(3355 - 3244) + chr(0b110011) + chr(0b101111 + 0o1) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(11883 - 11772) + chr(0b100111 + 0o14) + chr(2757 - 2702) + '\x37', 0o10), ehT0Px3KOsy9(chr(332 - 284) + chr(111) + chr(1475 - 1426) + chr(379 - 330) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1214 - 1165) + '\066' + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1822 - 1769) + chr(0b1110 + 0o42), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2442 - 2389) + chr(1926 - 1878), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b110110) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b10011 + 0o40), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(2719 - 2665) + '\x32', 263 - 255), ehT0Px3KOsy9(chr(1246 - 1198) + chr(0b1101101 + 0o2) + '\067' + chr(52), 12323 - 12315), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(0b101 + 0o62), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\063' + '\x31', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b101100 + 0o5) + '\x31' + chr(0b100000 + 0o25), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110110) + chr(0b0 + 0o66), 13467 - 13459), ehT0Px3KOsy9(chr(2102 - 2054) + chr(0b110 + 0o151) + '\x31' + chr(610 - 562) + chr(48), 44181 - 44173), ehT0Px3KOsy9(chr(1225 - 1177) + chr(9207 - 9096) + '\066' + chr(0b11110 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + '\x32' + '\060' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10297 - 10186) + chr(0b1110 + 0o43) + chr(0b110011) + '\062', 36154 - 36146), ehT0Px3KOsy9(chr(0b110000) + chr(2454 - 2343) + '\x33' + chr(0b11101 + 0o31) + '\x36', 8), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b11 + 0o57) + chr(0b110001) + chr(490 - 437), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b1000 + 0o52) + chr(1970 - 1920), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(384 - 333) + '\065' + chr(692 - 640), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101 + 0o54) + '\x34' + '\067', 8296 - 8288), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + chr(1208 - 1155) + chr(0b1000 + 0o55), 33158 - 33150), ehT0Px3KOsy9(chr(1877 - 1829) + chr(0b1101111) + chr(0b110011) + chr(0b110000) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(54) + chr(0b1010 + 0o55), 0b1000), ehT0Px3KOsy9(chr(1757 - 1709) + chr(10423 - 10312) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11111 + 0o24) + chr(0b101110 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + '\x33', 8), ehT0Px3KOsy9('\060' + '\x6f' + '\065' + '\060', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b11110 + 0o23) + chr(54), 0o10), ehT0Px3KOsy9(chr(485 - 437) + '\157' + chr(0b100110 + 0o14) + '\x33' + '\x30', 13021 - 13013), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b10011 + 0o134) + '\067' + chr(0b11000 + 0o30), 0o10), ehT0Px3KOsy9(chr(1301 - 1253) + chr(0b1101100 + 0o3) + chr(1454 - 1404) + chr(0b101010 + 0o7), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + chr(2298 - 2250) + chr(0b110010 + 0o1), 32903 - 32895)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(9858 - 9747) + '\065' + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3'), chr(2951 - 2851) + '\145' + chr(99) + chr(2613 - 2502) + '\144' + chr(2313 - 2212))('\x75' + chr(0b1110100) + chr(4132 - 4030) + chr(45) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def rWxixXssCFaV(oVre8I6UXc3b, Iz1jSgUKZDvt=wxCCXClP4Gzp, MRtOn47tdSTy=wxCCXClP4Gzp): return hvPM5R9DRrfI(transform=rWxixXssCFaV, transform_args=(), factor=oVre8I6UXc3b, groupby=MRtOn47tdSTy, dtype=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb7\xa7\xa0\x07\xbd\x8b\x91)\x1d`\x1f\xfa'), chr(6071 - 5971) + '\145' + '\x63' + chr(111) + '\x64' + chr(101))('\165' + '\x74' + chr(5572 - 5470) + '\055' + chr(2777 - 2721))), missing_value=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbe\xb9\xc0x\xa7\x99\xb0\x7f\x06x]\xdb'), chr(100) + '\145' + chr(0b1000110 + 0o35) + '\157' + chr(8768 - 8668) + chr(1730 - 1629))(chr(0b110110 + 0o77) + '\164' + chr(0b1001 + 0o135) + chr(45) + chr(0b111000))), window_safe=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x92\xab\x9e\x0e\x9d\x8a\xa0&\x01\x1en\xe9'), '\x64' + chr(0b1010 + 0o133) + chr(4385 - 4286) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(116) + '\x66' + '\x2d' + chr(585 - 529))), mask=Iz1jSgUKZDvt)
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.zscore
def zscore(self, mask=NotSpecified, groupby=NotSpecified): """ Construct a Factor that Z-Scores each day's results. The Z-Score of a row is defined as:: (row - row.mean()) / row.stddev() If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means and standard deviations, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row based on the values produced by ``groupby``, z-scoring the partitioned arrays, and stitching the sub-results back together. Parameters ---------- mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when Z-Scoring. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to compute Z-Scores. Returns ------- zscored : zipline.pipeline.Factor A Factor producing that z-scores the output of self. Notes ----- Mean and standard deviation are sensitive to the magnitudes of outliers. When working with factor that can potentially produce large outliers, it is often useful to use the ``mask`` parameter to discard values at the extremes of the distribution:: >>> base = MyFactor(...) # doctest: +SKIP >>> normalized = base.zscore( ... mask=base.percentile_between(1, 99), ... ) # doctest: +SKIP ``zscore()`` is only supported on Factors of dtype float64. Examples -------- See :meth:`~zipline.pipeline.factors.Factor.demean` for an in-depth example of the semantics for ``mask`` and ``groupby``. See Also -------- :meth:`pandas.DataFrame.groupby` """ return GroupedRowTransform( transform=zscore, transform_args=(), factor=self, groupby=groupby, dtype=self.dtype, missing_value=self.missing_value, mask=mask, window_safe=True, )
python
def zscore(self, mask=NotSpecified, groupby=NotSpecified): """ Construct a Factor that Z-Scores each day's results. The Z-Score of a row is defined as:: (row - row.mean()) / row.stddev() If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means and standard deviations, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row based on the values produced by ``groupby``, z-scoring the partitioned arrays, and stitching the sub-results back together. Parameters ---------- mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when Z-Scoring. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to compute Z-Scores. Returns ------- zscored : zipline.pipeline.Factor A Factor producing that z-scores the output of self. Notes ----- Mean and standard deviation are sensitive to the magnitudes of outliers. When working with factor that can potentially produce large outliers, it is often useful to use the ``mask`` parameter to discard values at the extremes of the distribution:: >>> base = MyFactor(...) # doctest: +SKIP >>> normalized = base.zscore( ... mask=base.percentile_between(1, 99), ... ) # doctest: +SKIP ``zscore()`` is only supported on Factors of dtype float64. Examples -------- See :meth:`~zipline.pipeline.factors.Factor.demean` for an in-depth example of the semantics for ``mask`` and ``groupby``. See Also -------- :meth:`pandas.DataFrame.groupby` """ return GroupedRowTransform( transform=zscore, transform_args=(), factor=self, groupby=groupby, dtype=self.dtype, missing_value=self.missing_value, mask=mask, window_safe=True, )
[ "def", "zscore", "(", "self", ",", "mask", "=", "NotSpecified", ",", "groupby", "=", "NotSpecified", ")", ":", "return", "GroupedRowTransform", "(", "transform", "=", "zscore", ",", "transform_args", "=", "(", ")", ",", "factor", "=", "self", ",", "groupby", "=", "groupby", ",", "dtype", "=", "self", ".", "dtype", ",", "missing_value", "=", "self", ".", "missing_value", ",", "mask", "=", "mask", ",", "window_safe", "=", "True", ",", ")" ]
Construct a Factor that Z-Scores each day's results. The Z-Score of a row is defined as:: (row - row.mean()) / row.stddev() If ``mask`` is supplied, ignore values where ``mask`` returns False when computing row means and standard deviations, and output NaN anywhere the mask is False. If ``groupby`` is supplied, compute by partitioning each row based on the values produced by ``groupby``, z-scoring the partitioned arrays, and stitching the sub-results back together. Parameters ---------- mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when Z-Scoring. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to compute Z-Scores. Returns ------- zscored : zipline.pipeline.Factor A Factor producing that z-scores the output of self. Notes ----- Mean and standard deviation are sensitive to the magnitudes of outliers. When working with factor that can potentially produce large outliers, it is often useful to use the ``mask`` parameter to discard values at the extremes of the distribution:: >>> base = MyFactor(...) # doctest: +SKIP >>> normalized = base.zscore( ... mask=base.percentile_between(1, 99), ... ) # doctest: +SKIP ``zscore()`` is only supported on Factors of dtype float64. Examples -------- See :meth:`~zipline.pipeline.factors.Factor.demean` for an in-depth example of the semantics for ``mask`` and ``groupby``. See Also -------- :meth:`pandas.DataFrame.groupby`
[ "Construct", "a", "Factor", "that", "Z", "-", "Scores", "each", "day", "s", "results", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L531-L591
train
Constructs a Factor that Z - Scores each day s results.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GG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ZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1072 - 1024) + chr(0b1101111) + chr(1966 - 1915) + '\x35' + chr(2035 - 1980), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(51) + '\x32', 0o10), ehT0Px3KOsy9(chr(1439 - 1391) + chr(10121 - 10010) + chr(0b101 + 0o54) + chr(0b11100 + 0o24), 0o10), ehT0Px3KOsy9(chr(1801 - 1753) + chr(0b1101111) + chr(49) + chr(2213 - 2164), 39077 - 39069), ehT0Px3KOsy9(chr(2063 - 2015) + chr(111) + chr(0b110011) + chr(49) + chr(2450 - 2395), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b111010 + 0o65) + '\x32', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(0b101001 + 0o10) + chr(0b110000 + 0o1), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\060' + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101001 + 0o12) + '\065' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110111) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + '\062' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(109 - 58) + chr(55) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1245 - 1196) + chr(960 - 912) + chr(0b110101), 55115 - 55107), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1887 - 1834) + chr(912 - 864), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b111001 + 0o66) + '\061' + '\060' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(0b101110 + 0o2), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b11001 + 0o30) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + '\063' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1996 - 1941) + '\x34', 53373 - 53365), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(54) + chr(451 - 403), 27424 - 27416), ehT0Px3KOsy9(chr(870 - 822) + chr(654 - 543) + '\x35' + '\x35', 0b1000), ehT0Px3KOsy9(chr(187 - 139) + chr(10445 - 10334) + chr(50) + chr(55) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(346 - 298) + chr(6425 - 6314) + chr(2280 - 2230) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(919 - 871) + chr(4375 - 4264) + '\x32' + '\060' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\x34' + chr(0b101001 + 0o11), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(561 - 509) + chr(0b100001 + 0o24), 63580 - 63572), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10110 + 0o35) + chr(1734 - 1685), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1641 - 1530) + chr(55) + chr(2129 - 2080), 0b1000), ehT0Px3KOsy9(chr(335 - 287) + chr(5018 - 4907) + '\063' + chr(1720 - 1670) + '\064', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(3754 - 3643) + '\061' + chr(49) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b10010 + 0o135) + '\062' + '\065', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\064' + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(8142 - 8031) + chr(676 - 626) + chr(0b110100) + chr(0b1000 + 0o50), 54926 - 54918), ehT0Px3KOsy9('\x30' + chr(0b1001110 + 0o41) + chr(0b110010) + chr(2318 - 2264) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1373 - 1323) + '\060' + '\062', 10900 - 10892), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100011 + 0o20) + chr(0b11111 + 0o22) + chr(295 - 242), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\x30' + chr(0b10100 + 0o35), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(1814 - 1764) + chr(51) + chr(0b1011 + 0o45), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(12166 - 12055) + '\x37' + '\063', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b101101 + 0o4) + chr(48) + chr(0b110110), 47726 - 47718)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b101011 + 0o104) + '\065' + chr(217 - 169), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1'), '\144' + chr(0b1100101) + chr(99) + '\157' + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(0b111 + 0o46) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def nnmSv6pSsOQI(oVre8I6UXc3b, Iz1jSgUKZDvt=wxCCXClP4Gzp, MRtOn47tdSTy=wxCCXClP4Gzp): return hvPM5R9DRrfI(transform=nnmSv6pSsOQI, transform_args=(), factor=oVre8I6UXc3b, groupby=MRtOn47tdSTy, dtype=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x85\x89^0\x86I\xe7\xe6\x85w"\xb2'), chr(9017 - 8917) + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(3648 - 3548) + chr(0b1000101 + 0o40))('\x75' + '\164' + '\x66' + chr(45) + chr(0b100011 + 0o25))), missing_value=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c\x97>O\x9c[\xc6\xb0\x9eo`\x93'), '\144' + chr(0b1100010 + 0o3) + '\x63' + chr(631 - 520) + chr(0b1100100) + '\145')('\x75' + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\x38')), mask=Iz1jSgUKZDvt, window_safe=ehT0Px3KOsy9('\060' + chr(0b110001 + 0o76) + chr(0b1 + 0o60), ord("\x08")))
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.rank
def rank(self, method='ordinal', ascending=True, mask=NotSpecified, groupby=NotSpecified): """ Construct a new Factor representing the sorted rank of each column within each row. Parameters ---------- method : str, {'ordinal', 'min', 'max', 'dense', 'average'} The method used to assign ranks to tied elements. See `scipy.stats.rankdata` for a full description of the semantics for each ranking method. Default is 'ordinal'. ascending : bool, optional Whether to return sorted rank in ascending or descending order. Default is True. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, ranks are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- ranks : zipline.pipeline.factors.Rank A new factor that will compute the ranking of the data produced by `self`. Notes ----- The default value for `method` is different from the default for `scipy.stats.rankdata`. See that function's documentation for a full description of the valid inputs to `method`. Missing or non-existent data on a given day will cause an asset to be given a rank of NaN for that day. See Also -------- :func:`scipy.stats.rankdata` :class:`zipline.pipeline.factors.factor.Rank` """ if groupby is NotSpecified: return Rank(self, method=method, ascending=ascending, mask=mask) return GroupedRowTransform( transform=rankdata if ascending else rankdata_1d_descending, transform_args=(method,), factor=self, groupby=groupby, dtype=float64_dtype, missing_value=nan, mask=mask, window_safe=True, )
python
def rank(self, method='ordinal', ascending=True, mask=NotSpecified, groupby=NotSpecified): """ Construct a new Factor representing the sorted rank of each column within each row. Parameters ---------- method : str, {'ordinal', 'min', 'max', 'dense', 'average'} The method used to assign ranks to tied elements. See `scipy.stats.rankdata` for a full description of the semantics for each ranking method. Default is 'ordinal'. ascending : bool, optional Whether to return sorted rank in ascending or descending order. Default is True. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, ranks are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- ranks : zipline.pipeline.factors.Rank A new factor that will compute the ranking of the data produced by `self`. Notes ----- The default value for `method` is different from the default for `scipy.stats.rankdata`. See that function's documentation for a full description of the valid inputs to `method`. Missing or non-existent data on a given day will cause an asset to be given a rank of NaN for that day. See Also -------- :func:`scipy.stats.rankdata` :class:`zipline.pipeline.factors.factor.Rank` """ if groupby is NotSpecified: return Rank(self, method=method, ascending=ascending, mask=mask) return GroupedRowTransform( transform=rankdata if ascending else rankdata_1d_descending, transform_args=(method,), factor=self, groupby=groupby, dtype=float64_dtype, missing_value=nan, mask=mask, window_safe=True, )
[ "def", "rank", "(", "self", ",", "method", "=", "'ordinal'", ",", "ascending", "=", "True", ",", "mask", "=", "NotSpecified", ",", "groupby", "=", "NotSpecified", ")", ":", "if", "groupby", "is", "NotSpecified", ":", "return", "Rank", "(", "self", ",", "method", "=", "method", ",", "ascending", "=", "ascending", ",", "mask", "=", "mask", ")", "return", "GroupedRowTransform", "(", "transform", "=", "rankdata", "if", "ascending", "else", "rankdata_1d_descending", ",", "transform_args", "=", "(", "method", ",", ")", ",", "factor", "=", "self", ",", "groupby", "=", "groupby", ",", "dtype", "=", "float64_dtype", ",", "missing_value", "=", "nan", ",", "mask", "=", "mask", ",", "window_safe", "=", "True", ",", ")" ]
Construct a new Factor representing the sorted rank of each column within each row. Parameters ---------- method : str, {'ordinal', 'min', 'max', 'dense', 'average'} The method used to assign ranks to tied elements. See `scipy.stats.rankdata` for a full description of the semantics for each ranking method. Default is 'ordinal'. ascending : bool, optional Whether to return sorted rank in ascending or descending order. Default is True. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, ranks are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- ranks : zipline.pipeline.factors.Rank A new factor that will compute the ranking of the data produced by `self`. Notes ----- The default value for `method` is different from the default for `scipy.stats.rankdata`. See that function's documentation for a full description of the valid inputs to `method`. Missing or non-existent data on a given day will cause an asset to be given a rank of NaN for that day. See Also -------- :func:`scipy.stats.rankdata` :class:`zipline.pipeline.factors.factor.Rank`
[ "Construct", "a", "new", "Factor", "representing", "the", "sorted", "rank", "of", "each", "column", "within", "each", "row", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L593-L651
train
Returns a new factor that computes the rank of each column in each row.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,LgE_IO_tHXvM,Kk1h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_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(6203 - 6092) + '\061' + chr(0b10000 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11001 + 0o31) + chr(0b110110) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(0b11110 + 0o25) + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + '\x32' + chr(0b10011 + 0o35) + chr(53), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10110 + 0o34) + chr(51) + chr(1671 - 1619), 13030 - 13022), ehT0Px3KOsy9('\060' + chr(0b1000111 + 0o50) + '\064' + chr(0b100101 + 0o21), 0b1000), ehT0Px3KOsy9(chr(326 - 278) + '\x6f' + chr(1906 - 1856) + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\064', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(1000 - 952) + chr(0b100011 + 0o16), 30933 - 30925), ehT0Px3KOsy9('\x30' + '\x6f' + chr(848 - 799) + '\065' + chr(0b110010), 39710 - 39702), ehT0Px3KOsy9(chr(279 - 231) + chr(111) + chr(2229 - 2177) + chr(0b110010), 53418 - 53410), ehT0Px3KOsy9(chr(2122 - 2074) + chr(0b101000 + 0o107) + '\063' + '\066' + chr(2477 - 2427), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b110000 + 0o2) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b100000 + 0o117) + chr(624 - 574) + chr(2344 - 2294) + chr(55), 13005 - 12997), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(8074 - 7963) + chr(2372 - 2322) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2257 - 2207) + chr(0b110110) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b10 + 0o155) + chr(51) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + chr(0b1010 + 0o51) + chr(0b110001) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(1307 - 1259) + chr(111) + '\x31' + '\x30' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b1101111) + chr(0b110011 + 0o2) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x30' + '\064', 57303 - 57295), ehT0Px3KOsy9(chr(1178 - 1130) + chr(0b1101111) + chr(450 - 395) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b101101 + 0o6) + chr(52) + chr(0b101101 + 0o3), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1110 + 0o44) + chr(2164 - 2113) + chr(0b1100 + 0o51), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10010 + 0o40) + chr(0b110001 + 0o4) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(49) + chr(2011 - 1958), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(51) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(0b110011) + chr(0b110100) + chr(0b101011 + 0o6), 46364 - 46356), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + '\065' + chr(50), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\x33' + chr(0b1010 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(679 - 631) + chr(111) + chr(1472 - 1421) + chr(2216 - 2165) + chr(0b11111 + 0o24), 46489 - 46481), ehT0Px3KOsy9(chr(518 - 470) + '\157' + '\067' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(0b100000 + 0o22) + '\065' + chr(51), 59914 - 59906), ehT0Px3KOsy9(chr(48) + chr(0b1011110 + 0o21) + chr(810 - 759) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1603 - 1553) + chr(0b110011) + '\x35', 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b101001 + 0o106) + '\x34' + chr(0b11011 + 0o26), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101001 + 0o11) + chr(54) + chr(0b100100 + 0o17), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101111 + 0o4) + '\061' + chr(1198 - 1146), 0o10), ehT0Px3KOsy9('\x30' + chr(10887 - 10776) + chr(1835 - 1786) + '\x34' + chr(1856 - 1806), 48817 - 48809)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + '\x35' + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'!'), chr(0b111110 + 0o46) + '\145' + chr(0b1000110 + 0o35) + chr(111) + '\x64' + chr(0b1100101))('\x75' + chr(116) + '\x66' + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def SIkZeGCA53HL(oVre8I6UXc3b, CVRCXTcnOnH6=xafqLlk3kkUe(SXOLrMavuUCe(b'`\xc3\xfa\xec\xf2G\xc8'), chr(100) + chr(9156 - 9055) + chr(99) + chr(0b1010000 + 0o37) + chr(0b1111 + 0o125) + chr(0b1100101))(chr(0b110101 + 0o100) + '\164' + '\146' + chr(0b101101) + chr(0b111000)), OtwBK3ePE1cK=ehT0Px3KOsy9('\060' + chr(111) + '\x31', 0o10), Iz1jSgUKZDvt=wxCCXClP4Gzp, MRtOn47tdSTy=wxCCXClP4Gzp): if MRtOn47tdSTy is wxCCXClP4Gzp: return QPkNiasMWk63(oVre8I6UXc3b, method=CVRCXTcnOnH6, ascending=OtwBK3ePE1cK, mask=Iz1jSgUKZDvt) return hvPM5R9DRrfI(transform=MffJSnXVJo7C if OtwBK3ePE1cK else rYN333DPudpA, transform_args=(CVRCXTcnOnH6,), factor=oVre8I6UXc3b, groupby=MRtOn47tdSTy, dtype=rZ1BN3UDHnco, missing_value=wL5W1xj47aOd, mask=Iz1jSgUKZDvt, window_safe=ehT0Px3KOsy9('\060' + '\157' + chr(0b110001), 8))
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.pearsonr
def pearsonr(self, target, correlation_length, mask=NotSpecified): """ Construct a new Factor that computes rolling pearson correlation coefficients between `target` and the columns of `self`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term used to compute correlations against each column of data produced by `self`. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, correlations are computed asset-wise. correlation_length : int Length of the lookback window over which to compute each correlation coefficient. mask : zipline.pipeline.Filter, optional A Filter describing which assets should have their correlation with the target slice computed each day. Returns ------- correlations : zipline.pipeline.factors.RollingPearson A new Factor that will compute correlations between `target` and the columns of `self`. Examples -------- Suppose we want to create a factor that computes the correlation between AAPL's 10-day returns and the 10-day returns of all other assets, computing each correlation over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_correlations = returns.pearsonr( target=returns_slice, correlation_length=30, ) This is equivalent to doing:: aapl_correlations = RollingPearsonOfReturns( target=sid(24), returns_length=10, correlation_length=30, ) See Also -------- :func:`scipy.stats.pearsonr` :class:`zipline.pipeline.factors.RollingPearsonOfReturns` :meth:`Factor.spearmanr` """ from .statistical import RollingPearson return RollingPearson( base_factor=self, target=target, correlation_length=correlation_length, mask=mask, )
python
def pearsonr(self, target, correlation_length, mask=NotSpecified): """ Construct a new Factor that computes rolling pearson correlation coefficients between `target` and the columns of `self`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term used to compute correlations against each column of data produced by `self`. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, correlations are computed asset-wise. correlation_length : int Length of the lookback window over which to compute each correlation coefficient. mask : zipline.pipeline.Filter, optional A Filter describing which assets should have their correlation with the target slice computed each day. Returns ------- correlations : zipline.pipeline.factors.RollingPearson A new Factor that will compute correlations between `target` and the columns of `self`. Examples -------- Suppose we want to create a factor that computes the correlation between AAPL's 10-day returns and the 10-day returns of all other assets, computing each correlation over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_correlations = returns.pearsonr( target=returns_slice, correlation_length=30, ) This is equivalent to doing:: aapl_correlations = RollingPearsonOfReturns( target=sid(24), returns_length=10, correlation_length=30, ) See Also -------- :func:`scipy.stats.pearsonr` :class:`zipline.pipeline.factors.RollingPearsonOfReturns` :meth:`Factor.spearmanr` """ from .statistical import RollingPearson return RollingPearson( base_factor=self, target=target, correlation_length=correlation_length, mask=mask, )
[ "def", "pearsonr", "(", "self", ",", "target", ",", "correlation_length", ",", "mask", "=", "NotSpecified", ")", ":", "from", ".", "statistical", "import", "RollingPearson", "return", "RollingPearson", "(", "base_factor", "=", "self", ",", "target", "=", "target", ",", "correlation_length", "=", "correlation_length", ",", "mask", "=", "mask", ",", ")" ]
Construct a new Factor that computes rolling pearson correlation coefficients between `target` and the columns of `self`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term used to compute correlations against each column of data produced by `self`. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, correlations are computed asset-wise. correlation_length : int Length of the lookback window over which to compute each correlation coefficient. mask : zipline.pipeline.Filter, optional A Filter describing which assets should have their correlation with the target slice computed each day. Returns ------- correlations : zipline.pipeline.factors.RollingPearson A new Factor that will compute correlations between `target` and the columns of `self`. Examples -------- Suppose we want to create a factor that computes the correlation between AAPL's 10-day returns and the 10-day returns of all other assets, computing each correlation over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_correlations = returns.pearsonr( target=returns_slice, correlation_length=30, ) This is equivalent to doing:: aapl_correlations = RollingPearsonOfReturns( target=sid(24), returns_length=10, correlation_length=30, ) See Also -------- :func:`scipy.stats.pearsonr` :class:`zipline.pipeline.factors.RollingPearsonOfReturns` :meth:`Factor.spearmanr`
[ "Construct", "a", "new", "Factor", "that", "computes", "rolling", "pearson", "correlation", "coefficients", "between", "target", "and", "the", "columns", "of", "self", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L656-L716
train
Constructs a Factor that computes the rolling pearson correlation between the target and the columns of self.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,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z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(6365 - 6254) + chr(303 - 253) + chr(0b11011 + 0o31) + chr(1656 - 1606), 40105 - 40097), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + '\x35' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1100 + 0o45) + '\064' + '\065', 39059 - 39051), ehT0Px3KOsy9('\x30' + chr(111) + chr(656 - 605) + chr(0b110010) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100000 + 0o22) + chr(55), 0b1000), ehT0Px3KOsy9(chr(1602 - 1554) + chr(12292 - 12181) + chr(0b110001) + '\066' + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1117 - 1067) + chr(0b110111) + chr(0b100010 + 0o17), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(631 - 581) + '\065' + chr(0b110001 + 0o3), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010110 + 0o31) + '\061' + chr(1288 - 1236) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(815 - 765) + '\067' + chr(0b110100), 53665 - 53657), ehT0Px3KOsy9(chr(48) + chr(0b1001111 + 0o40) + chr(49) + chr(1126 - 1073) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(806 - 757) + chr(0b110101), 37672 - 37664), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b100111 + 0o110) + chr(0b110011) + chr(0b1010 + 0o51) + chr(51), 20492 - 20484), ehT0Px3KOsy9('\060' + chr(2689 - 2578) + chr(1694 - 1644) + '\x33', 24546 - 24538), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + chr(50) + chr(0b10 + 0o60) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b111 + 0o150) + chr(0b101101 + 0o5) + chr(851 - 802) + chr(0b100010 + 0o17), 0b1000), ehT0Px3KOsy9(chr(256 - 208) + chr(1550 - 1439) + '\063' + '\062' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(7903 - 7792) + chr(668 - 617) + '\063' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + '\x36', 47458 - 47450), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(0b110011) + chr(48) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + chr(50) + chr(48) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b111 + 0o55) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b110111 + 0o70) + chr(0b110011) + '\065' + chr(48), 59173 - 59165), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1161 - 1111) + chr(1233 - 1181) + chr(0b110000 + 0o5), 32102 - 32094), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x32' + chr(0b100100 + 0o14) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(2099 - 2048) + chr(48) + chr(0b1 + 0o63), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110100) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1112 - 1061) + chr(48) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100110 + 0o111) + '\061' + chr(51) + chr(0b11001 + 0o35), ord("\x08")), ehT0Px3KOsy9('\060' + chr(917 - 806) + chr(0b110001) + chr(1951 - 1896), 38918 - 38910), ehT0Px3KOsy9(chr(2127 - 2079) + chr(111) + '\061' + chr(987 - 933) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1101 + 0o44) + '\x35' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100011 + 0o14) + '\x33' + chr(0b110010) + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + chr(0b100 + 0o153) + chr(0b110 + 0o55) + '\063' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(7467 - 7356) + chr(51) + chr(1572 - 1522) + chr(0b11101 + 0o32), 7213 - 7205), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(52) + chr(1993 - 1938), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(590 - 539) + chr(50) + chr(0b101 + 0o56), 3529 - 3521), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + '\x34', 0o10), ehT0Px3KOsy9(chr(1674 - 1626) + '\157' + '\062' + chr(0b110110) + '\x31', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1093 - 1042) + chr(556 - 505) + chr(766 - 715), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1217 - 1169) + chr(0b1101111) + chr(0b100101 + 0o20) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c'), chr(0b1100100) + chr(0b1010010 + 0o23) + chr(0b101 + 0o136) + chr(0b100111 + 0o110) + chr(100) + '\145')(chr(10922 - 10805) + '\x74' + '\x66' + chr(0b101101 + 0o0) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TdKvEiWGtp0p(oVre8I6UXc3b, GR1581dR5rDS, FihGZH3Xnm2P, Iz1jSgUKZDvt=wxCCXClP4Gzp): (SdllF2l0wtFJ,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd1Z\x04\xa4~\x07\xcd\xc5\x04\xdd\x06'), chr(6456 - 6356) + '\x65' + '\143' + '\x6f' + chr(8883 - 8783) + chr(0b1100101))(chr(117) + chr(116) + '\146' + chr(0b101101) + chr(0b110111 + 0o1)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0A\t\xbc~\x1a\xde\xfc\x02\xdd\x18\xfe\xb4}'), chr(100) + '\145' + chr(0b1001001 + 0o32) + '\157' + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b1000011 + 0o43) + chr(45) + chr(1000 - 944))), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0A\t\xbc~\x1a\xde\xfc\x02\xdd\x18\xfe\xb4}'), '\144' + '\x65' + '\143' + '\157' + '\144' + chr(0b1100101))(chr(0b1101010 + 0o13) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(56))),) return SdllF2l0wtFJ(base_factor=oVre8I6UXc3b, target=GR1581dR5rDS, correlation_length=FihGZH3Xnm2P, mask=Iz1jSgUKZDvt)
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.spearmanr
def spearmanr(self, target, correlation_length, mask=NotSpecified): """ Construct a new Factor that computes rolling spearman rank correlation coefficients between `target` and the columns of `self`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term used to compute correlations against each column of data produced by `self`. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, correlations are computed asset-wise. correlation_length : int Length of the lookback window over which to compute each correlation coefficient. mask : zipline.pipeline.Filter, optional A Filter describing which assets should have their correlation with the target slice computed each day. Returns ------- correlations : zipline.pipeline.factors.RollingSpearman A new Factor that will compute correlations between `target` and the columns of `self`. Examples -------- Suppose we want to create a factor that computes the correlation between AAPL's 10-day returns and the 10-day returns of all other assets, computing each correlation over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_correlations = returns.spearmanr( target=returns_slice, correlation_length=30, ) This is equivalent to doing:: aapl_correlations = RollingSpearmanOfReturns( target=sid(24), returns_length=10, correlation_length=30, ) See Also -------- :func:`scipy.stats.spearmanr` :class:`zipline.pipeline.factors.RollingSpearmanOfReturns` :meth:`Factor.pearsonr` """ from .statistical import RollingSpearman return RollingSpearman( base_factor=self, target=target, correlation_length=correlation_length, mask=mask, )
python
def spearmanr(self, target, correlation_length, mask=NotSpecified): """ Construct a new Factor that computes rolling spearman rank correlation coefficients between `target` and the columns of `self`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term used to compute correlations against each column of data produced by `self`. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, correlations are computed asset-wise. correlation_length : int Length of the lookback window over which to compute each correlation coefficient. mask : zipline.pipeline.Filter, optional A Filter describing which assets should have their correlation with the target slice computed each day. Returns ------- correlations : zipline.pipeline.factors.RollingSpearman A new Factor that will compute correlations between `target` and the columns of `self`. Examples -------- Suppose we want to create a factor that computes the correlation between AAPL's 10-day returns and the 10-day returns of all other assets, computing each correlation over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_correlations = returns.spearmanr( target=returns_slice, correlation_length=30, ) This is equivalent to doing:: aapl_correlations = RollingSpearmanOfReturns( target=sid(24), returns_length=10, correlation_length=30, ) See Also -------- :func:`scipy.stats.spearmanr` :class:`zipline.pipeline.factors.RollingSpearmanOfReturns` :meth:`Factor.pearsonr` """ from .statistical import RollingSpearman return RollingSpearman( base_factor=self, target=target, correlation_length=correlation_length, mask=mask, )
[ "def", "spearmanr", "(", "self", ",", "target", ",", "correlation_length", ",", "mask", "=", "NotSpecified", ")", ":", "from", ".", "statistical", "import", "RollingSpearman", "return", "RollingSpearman", "(", "base_factor", "=", "self", ",", "target", "=", "target", ",", "correlation_length", "=", "correlation_length", ",", "mask", "=", "mask", ",", ")" ]
Construct a new Factor that computes rolling spearman rank correlation coefficients between `target` and the columns of `self`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term used to compute correlations against each column of data produced by `self`. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, correlations are computed asset-wise. correlation_length : int Length of the lookback window over which to compute each correlation coefficient. mask : zipline.pipeline.Filter, optional A Filter describing which assets should have their correlation with the target slice computed each day. Returns ------- correlations : zipline.pipeline.factors.RollingSpearman A new Factor that will compute correlations between `target` and the columns of `self`. Examples -------- Suppose we want to create a factor that computes the correlation between AAPL's 10-day returns and the 10-day returns of all other assets, computing each correlation over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_correlations = returns.spearmanr( target=returns_slice, correlation_length=30, ) This is equivalent to doing:: aapl_correlations = RollingSpearmanOfReturns( target=sid(24), returns_length=10, correlation_length=30, ) See Also -------- :func:`scipy.stats.spearmanr` :class:`zipline.pipeline.factors.RollingSpearmanOfReturns` :meth:`Factor.pearsonr`
[ "Construct", "a", "new", "Factor", "that", "computes", "rolling", "spearman", "rank", "correlation", "coefficients", "between", "target", "and", "the", "columns", "of", "self", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L721-L781
train
Constructs a Factor that computes the rolling spearman rank correlation between target and the columns of self.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1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C7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\x6f' + chr(1928 - 1878) + chr(324 - 271), 50978 - 50970), ehT0Px3KOsy9('\060' + chr(111) + '\x35' + chr(0b110010), 62047 - 62039), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(10554 - 10443) + '\067' + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(12212 - 12101) + chr(49) + '\061' + '\065', 0o10), ehT0Px3KOsy9(chr(2258 - 2210) + '\157' + chr(49) + chr(0b110111) + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(11276 - 11165) + chr(0b110001) + chr(53) + chr(2084 - 2032), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110100) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(245 - 190) + chr(0b100110 + 0o12), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11010 + 0o125) + chr(0b101000 + 0o13) + chr(53) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10001 + 0o40) + chr(0b110111) + chr(2354 - 2299), 0b1000), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(273 - 223) + '\067' + chr(48), 16364 - 16356), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(2813 - 2702) + '\063' + '\062' + '\x33', 0o10), ehT0Px3KOsy9(chr(2229 - 2181) + chr(111) + '\x33' + '\x33' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100011 + 0o17) + chr(0b10 + 0o63) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(0b110010) + chr(53) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(1562 - 1513) + chr(0b1100 + 0o51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101 + 0o56) + chr(0b11100 + 0o26) + chr(699 - 646), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110100) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\060' + '\x37', 38253 - 38245), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1101111) + chr(50) + '\x31' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x35' + chr(2160 - 2112), 31800 - 31792), ehT0Px3KOsy9(chr(1276 - 1228) + chr(10189 - 10078) + '\x33' + chr(0b110010) + chr(1301 - 1253), 61969 - 61961), ehT0Px3KOsy9('\x30' + '\157' + chr(1454 - 1403) + chr(0b100011 + 0o17) + chr(1740 - 1689), 8), ehT0Px3KOsy9(chr(860 - 812) + chr(111) + chr(0b101111 + 0o2) + chr(0b100000 + 0o20) + chr(1866 - 1815), 44188 - 44180), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + '\x30' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(710 - 662) + '\x6f' + chr(1373 - 1321) + chr(0b101010 + 0o11), 8), ehT0Px3KOsy9(chr(238 - 190) + chr(111) + chr(0b110011) + chr(51) + chr(1890 - 1836), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(51) + '\066' + '\x35', 28827 - 28819), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(50) + '\x36' + chr(0b101111 + 0o5), 33606 - 33598), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\x6f' + chr(0b110001) + '\061' + chr(1091 - 1042), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b110000) + chr(1443 - 1389), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110 + 0o151) + chr(0b110011) + chr(1024 - 970) + chr(0b100011 + 0o15), 15881 - 15873), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(0b10111 + 0o37) + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1626 - 1576) + chr(51) + '\062', 0b1000), ehT0Px3KOsy9(chr(629 - 581) + chr(0b1101111) + chr(0b110001) + chr(0b10010 + 0o44) + chr(0b110 + 0o53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(54) + chr(0b10101 + 0o40), 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1101111) + chr(0b1010 + 0o51) + chr(57 - 6) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + chr(981 - 931) + chr(53) + chr(0b110011), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1110 + 0o47) + chr(2005 - 1957), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b';'), '\x64' + chr(0b1100101) + '\143' + chr(0b1101111) + '\x64' + chr(0b1100101))('\x75' + chr(3875 - 3759) + chr(102) + chr(45) + chr(1421 - 1365)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def YFnpSFjvcSZA(oVre8I6UXc3b, GR1581dR5rDS, FihGZH3Xnm2P, Iz1jSgUKZDvt=wxCCXClP4Gzp): (UuxwN7O9gMeu,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'f^Yw$\x08\x18J\x9b\x8e\x13'), '\x64' + chr(101) + '\143' + chr(7430 - 7319) + chr(100) + chr(0b10011 + 0o122))(chr(0b1110101) + '\164' + '\x66' + '\055' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'GETo$\x15\x0bp\x88\x8a\x1e\xca\xbe\xbd\xc4'), chr(100) + chr(0b111111 + 0o46) + chr(0b1100011) + '\x6f' + chr(9092 - 8992) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(0b1100110) + chr(0b101101) + '\x38')), xafqLlk3kkUe(SXOLrMavuUCe(b'GETo$\x15\x0bp\x88\x8a\x1e\xca\xbe\xbd\xc4'), chr(100) + '\145' + chr(0b1001111 + 0o24) + '\157' + chr(0b1000110 + 0o36) + '\145')(chr(1929 - 1812) + chr(0b0 + 0o164) + chr(0b1100110) + chr(0b100011 + 0o12) + chr(56))),) return UuxwN7O9gMeu(base_factor=oVre8I6UXc3b, target=GR1581dR5rDS, correlation_length=FihGZH3Xnm2P, mask=Iz1jSgUKZDvt)
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.linear_regression
def linear_regression(self, target, regression_length, mask=NotSpecified): """ Construct a new Factor that performs an ordinary least-squares regression predicting the columns of `self` from `target`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term to use as the predictor/independent variable in each regression. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, regressions are computed asset-wise. regression_length : int Length of the lookback window over which to compute each regression. mask : zipline.pipeline.Filter, optional A Filter describing which assets should be regressed with the target slice each day. Returns ------- regressions : zipline.pipeline.factors.RollingLinearRegression A new Factor that will compute linear regressions of `target` against the columns of `self`. Examples -------- Suppose we want to create a factor that regresses AAPL's 10-day returns against the 10-day returns of all other assets, computing each regression over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_regressions = returns.linear_regression( target=returns_slice, regression_length=30, ) This is equivalent to doing:: aapl_regressions = RollingLinearRegressionOfReturns( target=sid(24), returns_length=10, regression_length=30, ) See Also -------- :func:`scipy.stats.linregress` :class:`zipline.pipeline.factors.RollingLinearRegressionOfReturns` """ from .statistical import RollingLinearRegression return RollingLinearRegression( dependent=self, independent=target, regression_length=regression_length, mask=mask, )
python
def linear_regression(self, target, regression_length, mask=NotSpecified): """ Construct a new Factor that performs an ordinary least-squares regression predicting the columns of `self` from `target`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term to use as the predictor/independent variable in each regression. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, regressions are computed asset-wise. regression_length : int Length of the lookback window over which to compute each regression. mask : zipline.pipeline.Filter, optional A Filter describing which assets should be regressed with the target slice each day. Returns ------- regressions : zipline.pipeline.factors.RollingLinearRegression A new Factor that will compute linear regressions of `target` against the columns of `self`. Examples -------- Suppose we want to create a factor that regresses AAPL's 10-day returns against the 10-day returns of all other assets, computing each regression over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_regressions = returns.linear_regression( target=returns_slice, regression_length=30, ) This is equivalent to doing:: aapl_regressions = RollingLinearRegressionOfReturns( target=sid(24), returns_length=10, regression_length=30, ) See Also -------- :func:`scipy.stats.linregress` :class:`zipline.pipeline.factors.RollingLinearRegressionOfReturns` """ from .statistical import RollingLinearRegression return RollingLinearRegression( dependent=self, independent=target, regression_length=regression_length, mask=mask, )
[ "def", "linear_regression", "(", "self", ",", "target", ",", "regression_length", ",", "mask", "=", "NotSpecified", ")", ":", "from", ".", "statistical", "import", "RollingLinearRegression", "return", "RollingLinearRegression", "(", "dependent", "=", "self", ",", "independent", "=", "target", ",", "regression_length", "=", "regression_length", ",", "mask", "=", "mask", ",", ")" ]
Construct a new Factor that performs an ordinary least-squares regression predicting the columns of `self` from `target`. This method can only be called on factors which are deemed safe for use as inputs to other factors. This includes `Returns` and any factors created from `Factor.rank` or `Factor.zscore`. Parameters ---------- target : zipline.pipeline.Term with a numeric dtype The term to use as the predictor/independent variable in each regression. This may be a Factor, a BoundColumn or a Slice. If `target` is two-dimensional, regressions are computed asset-wise. regression_length : int Length of the lookback window over which to compute each regression. mask : zipline.pipeline.Filter, optional A Filter describing which assets should be regressed with the target slice each day. Returns ------- regressions : zipline.pipeline.factors.RollingLinearRegression A new Factor that will compute linear regressions of `target` against the columns of `self`. Examples -------- Suppose we want to create a factor that regresses AAPL's 10-day returns against the 10-day returns of all other assets, computing each regression over 30 days. This can be achieved by doing the following:: returns = Returns(window_length=10) returns_slice = returns[sid(24)] aapl_regressions = returns.linear_regression( target=returns_slice, regression_length=30, ) This is equivalent to doing:: aapl_regressions = RollingLinearRegressionOfReturns( target=sid(24), returns_length=10, regression_length=30, ) See Also -------- :func:`scipy.stats.linregress` :class:`zipline.pipeline.factors.RollingLinearRegressionOfReturns`
[ "Construct", "a", "new", "Factor", "that", "performs", "an", "ordinary", "least", "-", "squares", "regression", "predicting", "the", "columns", "of", "self", "from", "target", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L786-L843
train
Construct a Factor that performs a linear regression predicting the columns of self from target.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,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X4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(2216 - 2168) + chr(0b1100 + 0o143) + chr(50) + chr(55) + chr(1328 - 1277), 62573 - 62565), ehT0Px3KOsy9(chr(794 - 746) + chr(0b110001 + 0o76) + '\x31' + chr(0b110110) + chr(766 - 718), 31653 - 31645), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + '\x33', 47386 - 47378), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(725 - 676) + '\060' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b100001 + 0o20) + chr(0b110100) + '\x34', 0o10), ehT0Px3KOsy9(chr(757 - 709) + chr(0b101001 + 0o106) + '\065' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(138 - 90) + '\157' + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + chr(1399 - 1348) + chr(48) + chr(0b101100 + 0o6), 46118 - 46110), ehT0Px3KOsy9(chr(772 - 724) + '\x6f' + chr(1473 - 1424) + chr(53) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2557 - 2506) + '\062' + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11110 + 0o23) + chr(0b1110 + 0o43) + chr(1081 - 1026), ord("\x08")), ehT0Px3KOsy9(chr(170 - 122) + '\157' + '\x31' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\067' + '\x33', 54278 - 54270), ehT0Px3KOsy9(chr(0b110000) + chr(9935 - 9824) + chr(0b11110 + 0o26) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x36' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + chr(433 - 382) + chr(1082 - 1031) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(473 - 422) + '\x37' + chr(53), 34769 - 34761), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\060' + chr(0b110000), 40960 - 40952), ehT0Px3KOsy9('\060' + chr(4078 - 3967) + '\062' + chr(0b110101) + '\x34', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\064' + chr(0b1 + 0o64), 9593 - 9585), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\x33' + chr(0b110111) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\062' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x34' + chr(400 - 350), 0o10), ehT0Px3KOsy9(chr(2264 - 2216) + '\157' + chr(1954 - 1903) + '\x33' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1104 - 1053) + chr(49) + chr(0b110110), 45168 - 45160), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(48) + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b110001) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + '\064' + chr(1177 - 1128), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8949 - 8838) + '\x31' + chr(50) + chr(0b11 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1100011 + 0o14) + chr(50) + '\067' + chr(0b110010), 30372 - 30364), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + '\x31' + chr(54) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(2019 - 1971) + chr(111) + chr(0b110011) + chr(53) + chr(0b101111 + 0o4), 38959 - 38951), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\066' + '\060', 50975 - 50967), ehT0Px3KOsy9('\060' + chr(111) + chr(2324 - 2275) + '\x30' + '\063', 45792 - 45784), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111) + '\065', 26660 - 26652), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b11111 + 0o23) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001100 + 0o43) + chr(0b110111) + chr(1047 - 996), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(48) + chr(2074 - 2023), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x37' + chr(0b1001 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101010 + 0o105) + chr(1348 - 1298) + chr(0b110110) + '\x35', 12048 - 12040)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1011110 + 0o21) + '\x35' + chr(2171 - 2123), 36895 - 36887)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x95'), chr(100) + chr(0b1100101) + chr(6448 - 6349) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b1110 + 0o146) + chr(102) + chr(0b101101) + chr(0b10011 + 0o45)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def jdeMVXKA6GHc(oVre8I6UXc3b, GR1581dR5rDS, OrV86cMCupie, Iz1jSgUKZDvt=wxCCXClP4Gzp): (NcMyZhE2WnAT,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\x04z1\r]w\xab\x08\xb2#'), '\144' + chr(0b1100 + 0o131) + '\143' + '\x6f' + chr(7750 - 7650) + '\x65')(chr(11932 - 11815) + chr(7045 - 6929) + chr(621 - 519) + chr(245 - 200) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x1fw)\r@d\x8e\x02\xbd*l\x89r\x17\xbe\x8f\xe5\xdfV\x97\xb9\x0c'), chr(5767 - 5667) + chr(101) + chr(0b1100001 + 0o2) + '\157' + chr(0b11000 + 0o114) + chr(0b110001 + 0o64))('\x75' + chr(6828 - 6712) + chr(0b11 + 0o143) + chr(1171 - 1126) + chr(56))), xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x1fw)\r@d\x8e\x02\xbd*l\x89r\x17\xbe\x8f\xe5\xdfV\x97\xb9\x0c'), chr(100) + chr(101) + chr(0b1100011) + chr(4896 - 4785) + '\x64' + '\x65')('\165' + '\164' + chr(0b1100110) + chr(0b10110 + 0o27) + '\x38')),) return NcMyZhE2WnAT(dependent=oVre8I6UXc3b, independent=GR1581dR5rDS, regression_length=OrV86cMCupie, mask=Iz1jSgUKZDvt)
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.winsorize
def winsorize(self, min_percentile, max_percentile, mask=NotSpecified, groupby=NotSpecified): """ Construct a new factor that winsorizes the result of this factor. Winsorizing changes values ranked less than the minimum percentile to the value at the minimum percentile. Similarly, values ranking above the maximum percentile are changed to the value at the maximum percentile. Winsorizing is useful for limiting the impact of extreme data points without completely removing those points. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing percentile cutoffs, and output NaN anywhere the mask is False. If ``groupby`` is supplied, winsorization is applied separately separately to each group defined by ``groupby``. Parameters ---------- min_percentile: float, int Entries with values at or below this percentile will be replaced with the (len(input) * min_percentile)th lowest value. If low values should not be clipped, use 0. max_percentile: float, int Entries with values at or above this percentile will be replaced with the (len(input) * max_percentile)th lowest value. If high values should not be clipped, use 1. mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when winsorizing. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to winsorize. Returns ------- winsorized : zipline.pipeline.Factor A Factor producing a winsorized version of self. Examples -------- .. code-block:: python price = USEquityPricing.close.latest columns={ 'PRICE': price, 'WINSOR_1: price.winsorize( min_percentile=0.25, max_percentile=0.75 ), 'WINSOR_2': price.winsorize( min_percentile=0.50, max_percentile=1.0 ), 'WINSOR_3': price.winsorize( min_percentile=0.0, max_percentile=0.5 ), } Given a pipeline with columns, defined above, the result for a given day could look like: :: 'PRICE' 'WINSOR_1' 'WINSOR_2' 'WINSOR_3' Asset_1 1 2 4 3 Asset_2 2 2 4 3 Asset_3 3 3 4 3 Asset_4 4 4 4 4 Asset_5 5 5 5 4 Asset_6 6 5 5 4 See Also -------- :func:`scipy.stats.mstats.winsorize` :meth:`pandas.DataFrame.groupby` """ if not 0.0 <= min_percentile < max_percentile <= 1.0: raise BadPercentileBounds( min_percentile=min_percentile, max_percentile=max_percentile, upper_bound=1.0, ) return GroupedRowTransform( transform=winsorize, transform_args=(min_percentile, max_percentile), factor=self, groupby=groupby, dtype=self.dtype, missing_value=self.missing_value, mask=mask, window_safe=self.window_safe, )
python
def winsorize(self, min_percentile, max_percentile, mask=NotSpecified, groupby=NotSpecified): """ Construct a new factor that winsorizes the result of this factor. Winsorizing changes values ranked less than the minimum percentile to the value at the minimum percentile. Similarly, values ranking above the maximum percentile are changed to the value at the maximum percentile. Winsorizing is useful for limiting the impact of extreme data points without completely removing those points. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing percentile cutoffs, and output NaN anywhere the mask is False. If ``groupby`` is supplied, winsorization is applied separately separately to each group defined by ``groupby``. Parameters ---------- min_percentile: float, int Entries with values at or below this percentile will be replaced with the (len(input) * min_percentile)th lowest value. If low values should not be clipped, use 0. max_percentile: float, int Entries with values at or above this percentile will be replaced with the (len(input) * max_percentile)th lowest value. If high values should not be clipped, use 1. mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when winsorizing. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to winsorize. Returns ------- winsorized : zipline.pipeline.Factor A Factor producing a winsorized version of self. Examples -------- .. code-block:: python price = USEquityPricing.close.latest columns={ 'PRICE': price, 'WINSOR_1: price.winsorize( min_percentile=0.25, max_percentile=0.75 ), 'WINSOR_2': price.winsorize( min_percentile=0.50, max_percentile=1.0 ), 'WINSOR_3': price.winsorize( min_percentile=0.0, max_percentile=0.5 ), } Given a pipeline with columns, defined above, the result for a given day could look like: :: 'PRICE' 'WINSOR_1' 'WINSOR_2' 'WINSOR_3' Asset_1 1 2 4 3 Asset_2 2 2 4 3 Asset_3 3 3 4 3 Asset_4 4 4 4 4 Asset_5 5 5 5 4 Asset_6 6 5 5 4 See Also -------- :func:`scipy.stats.mstats.winsorize` :meth:`pandas.DataFrame.groupby` """ if not 0.0 <= min_percentile < max_percentile <= 1.0: raise BadPercentileBounds( min_percentile=min_percentile, max_percentile=max_percentile, upper_bound=1.0, ) return GroupedRowTransform( transform=winsorize, transform_args=(min_percentile, max_percentile), factor=self, groupby=groupby, dtype=self.dtype, missing_value=self.missing_value, mask=mask, window_safe=self.window_safe, )
[ "def", "winsorize", "(", "self", ",", "min_percentile", ",", "max_percentile", ",", "mask", "=", "NotSpecified", ",", "groupby", "=", "NotSpecified", ")", ":", "if", "not", "0.0", "<=", "min_percentile", "<", "max_percentile", "<=", "1.0", ":", "raise", "BadPercentileBounds", "(", "min_percentile", "=", "min_percentile", ",", "max_percentile", "=", "max_percentile", ",", "upper_bound", "=", "1.0", ",", ")", "return", "GroupedRowTransform", "(", "transform", "=", "winsorize", ",", "transform_args", "=", "(", "min_percentile", ",", "max_percentile", ")", ",", "factor", "=", "self", ",", "groupby", "=", "groupby", ",", "dtype", "=", "self", ".", "dtype", ",", "missing_value", "=", "self", ".", "missing_value", ",", "mask", "=", "mask", ",", "window_safe", "=", "self", ".", "window_safe", ",", ")" ]
Construct a new factor that winsorizes the result of this factor. Winsorizing changes values ranked less than the minimum percentile to the value at the minimum percentile. Similarly, values ranking above the maximum percentile are changed to the value at the maximum percentile. Winsorizing is useful for limiting the impact of extreme data points without completely removing those points. If ``mask`` is supplied, ignore values where ``mask`` returns False when computing percentile cutoffs, and output NaN anywhere the mask is False. If ``groupby`` is supplied, winsorization is applied separately separately to each group defined by ``groupby``. Parameters ---------- min_percentile: float, int Entries with values at or below this percentile will be replaced with the (len(input) * min_percentile)th lowest value. If low values should not be clipped, use 0. max_percentile: float, int Entries with values at or above this percentile will be replaced with the (len(input) * max_percentile)th lowest value. If high values should not be clipped, use 1. mask : zipline.pipeline.Filter, optional A Filter defining values to ignore when winsorizing. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to winsorize. Returns ------- winsorized : zipline.pipeline.Factor A Factor producing a winsorized version of self. Examples -------- .. code-block:: python price = USEquityPricing.close.latest columns={ 'PRICE': price, 'WINSOR_1: price.winsorize( min_percentile=0.25, max_percentile=0.75 ), 'WINSOR_2': price.winsorize( min_percentile=0.50, max_percentile=1.0 ), 'WINSOR_3': price.winsorize( min_percentile=0.0, max_percentile=0.5 ), } Given a pipeline with columns, defined above, the result for a given day could look like: :: 'PRICE' 'WINSOR_1' 'WINSOR_2' 'WINSOR_3' Asset_1 1 2 4 3 Asset_2 2 2 4 3 Asset_3 3 3 4 3 Asset_4 4 4 4 4 Asset_5 5 5 5 4 Asset_6 6 5 5 4 See Also -------- :func:`scipy.stats.mstats.winsorize` :meth:`pandas.DataFrame.groupby`
[ "Construct", "a", "new", "factor", "that", "winsorizes", "the", "result", "of", "this", "factor", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L852-L947
train
Returns a new factor that winsorizes the result of this factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG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hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1001110 + 0o41) + chr(50) + chr(0b110110), 24179 - 24171), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(0b111 + 0o60) + chr(52), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(55) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011011 + 0o24) + chr(0b110010 + 0o3) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1086 - 1038) + chr(0b100110 + 0o111) + '\062' + chr(0b11001 + 0o35) + chr(1436 - 1381), 0b1000), ehT0Px3KOsy9('\x30' + chr(1379 - 1268) + '\x32' + '\x34' + chr(2274 - 2221), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(1455 - 1407) + chr(320 - 268), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1079 - 1030) + '\x31' + chr(980 - 926), 34968 - 34960), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b110010) + chr(781 - 730), 13196 - 13188), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100110 + 0o14) + chr(0b110111) + chr(1519 - 1470), 0b1000), ehT0Px3KOsy9(chr(729 - 681) + '\x6f' + chr(2100 - 2046) + chr(49), 17672 - 17664), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(49) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1010110 + 0o31) + '\x33' + '\062' + chr(1462 - 1413), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2112 - 2001) + chr(0b110001) + '\066' + chr(168 - 119), ord("\x08")), ehT0Px3KOsy9(chr(1929 - 1881) + '\157' + chr(50) + '\061' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b100001 + 0o25) + chr(0b110100), 61828 - 61820), ehT0Px3KOsy9(chr(1589 - 1541) + chr(0b10000 + 0o137) + chr(0b100100 + 0o16) + chr(0b110001) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(9442 - 9331) + chr(2419 - 2366) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(1443 - 1393) + '\x36' + chr(2285 - 2230), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b1110 + 0o47) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1001 + 0o146) + chr(53) + chr(53), 16452 - 16444), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b101110 + 0o101) + '\061' + '\x34' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + chr(0b110011) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(717 - 669) + chr(0b1101001 + 0o6) + chr(51) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(353 - 303) + '\063' + '\067', 12663 - 12655), ehT0Px3KOsy9(chr(1880 - 1832) + chr(111) + chr(0b10000 + 0o43) + chr(54) + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + '\x35' + chr(54), 37270 - 37262), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(0b110000) + chr(0b110011), 3734 - 3726), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b101111 + 0o2) + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(1731 - 1676) + '\x30', 56393 - 56385), ehT0Px3KOsy9('\x30' + chr(111) + '\x35' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b10100 + 0o133) + chr(49) + chr(0b110010), 8), ehT0Px3KOsy9(chr(183 - 135) + chr(0b1101111) + chr(49) + chr(50) + chr(0b100011 + 0o24), 30177 - 30169), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(53) + chr(0b110100 + 0o0), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(0b10111 + 0o40), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + chr(0b100011 + 0o22) + chr(0b111 + 0o53), 8), ehT0Px3KOsy9(chr(796 - 748) + chr(111) + chr(0b110011) + '\064' + chr(960 - 905), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1163 - 1112) + chr(53) + chr(2340 - 2288), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1011 + 0o50) + chr(49) + '\x34', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110101) + chr(0b100110 + 0o12), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'8'), chr(100) + '\x65' + chr(99) + chr(0b1001110 + 0o41) + '\144' + chr(730 - 629))(chr(7059 - 6942) + '\x74' + chr(102) + chr(0b11000 + 0o25) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def eBBWzLq91Kdg(oVre8I6UXc3b, aBl6WwGvrXAi, XtZb6jTc6QwP, Iz1jSgUKZDvt=wxCCXClP4Gzp, MRtOn47tdSTy=wxCCXClP4Gzp): if not 0.0 <= aBl6WwGvrXAi < XtZb6jTc6QwP <= 1.0: raise Xw0jWJH4Z3As(min_percentile=aBl6WwGvrXAi, max_percentile=XtZb6jTc6QwP, upper_bound=1.0) return hvPM5R9DRrfI(transform=eBBWzLq91Kdg, transform_args=(aBl6WwGvrXAi, XtZb6jTc6QwP), factor=oVre8I6UXc3b, groupby=MRtOn47tdSTy, dtype=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'|\xafk\x13\xfe\xee\xaa+\xfeT\x8ez'), chr(100) + chr(101) + chr(99) + chr(111) + '\144' + '\x65')(chr(117) + chr(0b1011010 + 0o32) + chr(2223 - 2121) + chr(45) + '\070')), missing_value=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'u\xb1\x0bl\xe4\xfc\x8b}\xe5L\xcc['), '\x64' + chr(1290 - 1189) + '\x63' + '\157' + chr(237 - 137) + chr(0b1010011 + 0o22))('\165' + '\x74' + chr(0b1100110) + chr(0b101101) + chr(0b111000))), mask=Iz1jSgUKZDvt, window_safe=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'Y\xa3U\x1a\xde\xef\x9b$\xe2*\xffi'), chr(7217 - 7117) + chr(9132 - 9031) + chr(1216 - 1117) + '\157' + '\144' + '\x65')(chr(0b1000111 + 0o56) + '\164' + chr(102) + chr(45) + chr(0b100110 + 0o22))))
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.quantiles
def quantiles(self, bins, mask=NotSpecified): """ Construct a Classifier computing quantiles of the output of ``self``. Every non-NaN data point the output is labelled with an integer value from 0 to (bins - 1). NaNs are labelled with -1. If ``mask`` is supplied, ignore data points in locations for which ``mask`` produces False, and emit a label of -1 at those locations. Parameters ---------- bins : int Number of bins labels to compute. mask : zipline.pipeline.Filter, optional Mask of values to ignore when computing quantiles. Returns ------- quantiles : zipline.pipeline.classifiers.Quantiles A Classifier producing integer labels ranging from 0 to (bins - 1). """ if mask is NotSpecified: mask = self.mask return Quantiles(inputs=(self,), bins=bins, mask=mask)
python
def quantiles(self, bins, mask=NotSpecified): """ Construct a Classifier computing quantiles of the output of ``self``. Every non-NaN data point the output is labelled with an integer value from 0 to (bins - 1). NaNs are labelled with -1. If ``mask`` is supplied, ignore data points in locations for which ``mask`` produces False, and emit a label of -1 at those locations. Parameters ---------- bins : int Number of bins labels to compute. mask : zipline.pipeline.Filter, optional Mask of values to ignore when computing quantiles. Returns ------- quantiles : zipline.pipeline.classifiers.Quantiles A Classifier producing integer labels ranging from 0 to (bins - 1). """ if mask is NotSpecified: mask = self.mask return Quantiles(inputs=(self,), bins=bins, mask=mask)
[ "def", "quantiles", "(", "self", ",", "bins", ",", "mask", "=", "NotSpecified", ")", ":", "if", "mask", "is", "NotSpecified", ":", "mask", "=", "self", ".", "mask", "return", "Quantiles", "(", "inputs", "=", "(", "self", ",", ")", ",", "bins", "=", "bins", ",", "mask", "=", "mask", ")" ]
Construct a Classifier computing quantiles of the output of ``self``. Every non-NaN data point the output is labelled with an integer value from 0 to (bins - 1). NaNs are labelled with -1. If ``mask`` is supplied, ignore data points in locations for which ``mask`` produces False, and emit a label of -1 at those locations. Parameters ---------- bins : int Number of bins labels to compute. mask : zipline.pipeline.Filter, optional Mask of values to ignore when computing quantiles. Returns ------- quantiles : zipline.pipeline.classifiers.Quantiles A Classifier producing integer labels ranging from 0 to (bins - 1).
[ "Construct", "a", "Classifier", "computing", "quantiles", "of", "the", "output", "of", "self", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L950-L974
train
Constructs a Quantiles object which computes the quantiles of the output of this object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,Yn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LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\064' + chr(1814 - 1760), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(12173 - 12062) + '\063' + chr(1991 - 1937) + chr(52), 46638 - 46630), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + '\x35' + chr(1564 - 1514), 0b1000), ehT0Px3KOsy9(chr(1972 - 1924) + '\x6f' + chr(347 - 298) + chr(0b11111 + 0o21) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(1189 - 1141) + chr(0b1101111) + '\x32' + '\x36' + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b110011 + 0o4) + '\066', 31803 - 31795), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\x6f' + chr(51) + '\x31' + '\066', 5516 - 5508), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(785 - 735) + '\x35' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(2068 - 2020) + chr(111) + chr(0b110010) + '\067' + '\065', 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1000100 + 0o53) + chr(49) + '\x30' + '\065', 8), ehT0Px3KOsy9(chr(48) + chr(0b111110 + 0o61) + chr(1388 - 1333) + chr(0b10101 + 0o40), 1102 - 1094), ehT0Px3KOsy9(chr(0b110000) + chr(7339 - 7228) + chr(0b1000 + 0o52) + chr(0b110010) + chr(0b1001 + 0o56), 29770 - 29762), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b110010) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + '\063' + chr(2276 - 2223) + chr(0b1101 + 0o44), 29758 - 29750), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x37' + chr(2356 - 2302), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(477 - 366) + chr(0b110000 + 0o3) + chr(0b110100) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2203 - 2151) + '\064', 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b111000 + 0o67) + '\062' + chr(1151 - 1099) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(0b100100 + 0o14) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b101100 + 0o103) + chr(50) + '\x31' + chr(430 - 379), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10388 - 10277) + chr(1090 - 1040) + chr(54) + chr(0b101111 + 0o7), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000011 + 0o54) + chr(0b10110 + 0o35) + chr(0b110100) + '\060', 63299 - 63291), ehT0Px3KOsy9(chr(1174 - 1126) + chr(0b1101111) + '\x32' + chr(0b1011 + 0o47) + chr(0b1 + 0o62), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110111) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(0b10101 + 0o34) + '\x31' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(55), 3607 - 3599), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\063' + chr(0b10010 + 0o36) + chr(75 - 27), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101001 + 0o106) + chr(0b110001) + chr(1682 - 1628) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(50) + chr(0b11111 + 0o23) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1007 - 956) + chr(53) + chr(2673 - 2620), 16529 - 16521), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110100) + chr(1347 - 1298), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(50) + chr(0b101010 + 0o10), 60660 - 60652), ehT0Px3KOsy9(chr(1536 - 1488) + chr(111) + '\x34' + chr(0b11001 + 0o34), 0b1000), ehT0Px3KOsy9(chr(768 - 720) + chr(0b1101111) + chr(2471 - 2420) + chr(54) + chr(1639 - 1587), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\062' + chr(0b101101 + 0o7), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2276 - 2227) + '\x31' + chr(0b101100 + 0o7), 8), ehT0Px3KOsy9(chr(1311 - 1263) + chr(7609 - 7498) + '\x32' + '\064' + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1000011 + 0o54) + chr(51) + chr(48) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x34' + chr(492 - 439), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(544 - 494) + chr(0b110100) + '\x30', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(1464 - 1411) + '\060', 35122 - 35114)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8'), '\144' + chr(0b1100101) + '\x63' + chr(111) + '\x64' + chr(2015 - 1914))(chr(0b1110101) + chr(0b1110100) + '\x66' + '\x2d' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def zOokg13L4ZBh(oVre8I6UXc3b, KQ4BDFoY4RVo, Iz1jSgUKZDvt=wxCCXClP4Gzp): if Iz1jSgUKZDvt is wxCCXClP4Gzp: Iz1jSgUKZDvt = oVre8I6UXc3b.Iz1jSgUKZDvt return yaBt8M0xe_x8(inputs=(oVre8I6UXc3b,), bins=KQ4BDFoY4RVo, mask=Iz1jSgUKZDvt)
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.top
def top(self, N, mask=NotSpecified, groupby=NotSpecified): """ Construct a Filter matching the top N asset values of self each day. If ``groupby`` is supplied, returns a Filter matching the top N asset values for each group. Parameters ---------- N : int Number of assets passing the returned filter each day. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, top values are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- filter : zipline.pipeline.filters.Filter """ if N == 1: # Special case: if N == 1, we can avoid doing a full sort on every # group, which is a big win. return self._maximum(mask=mask, groupby=groupby) return self.rank(ascending=False, mask=mask, groupby=groupby) <= N
python
def top(self, N, mask=NotSpecified, groupby=NotSpecified): """ Construct a Filter matching the top N asset values of self each day. If ``groupby`` is supplied, returns a Filter matching the top N asset values for each group. Parameters ---------- N : int Number of assets passing the returned filter each day. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, top values are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- filter : zipline.pipeline.filters.Filter """ if N == 1: # Special case: if N == 1, we can avoid doing a full sort on every # group, which is a big win. return self._maximum(mask=mask, groupby=groupby) return self.rank(ascending=False, mask=mask, groupby=groupby) <= N
[ "def", "top", "(", "self", ",", "N", ",", "mask", "=", "NotSpecified", ",", "groupby", "=", "NotSpecified", ")", ":", "if", "N", "==", "1", ":", "# Special case: if N == 1, we can avoid doing a full sort on every", "# group, which is a big win.", "return", "self", ".", "_maximum", "(", "mask", "=", "mask", ",", "groupby", "=", "groupby", ")", "return", "self", ".", "rank", "(", "ascending", "=", "False", ",", "mask", "=", "mask", ",", "groupby", "=", "groupby", ")", "<=", "N" ]
Construct a Filter matching the top N asset values of self each day. If ``groupby`` is supplied, returns a Filter matching the top N asset values for each group. Parameters ---------- N : int Number of assets passing the returned filter each day. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, top values are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- filter : zipline.pipeline.filters.Filter
[ "Construct", "a", "Filter", "matching", "the", "top", "N", "asset", "values", "of", "self", "each", "day", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1048-L1074
train
Construct a Filter matching the top N asset values of self each day.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,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g,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + chr(0b11000 + 0o32) + chr(0b110101) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b1001 + 0o51) + chr(0b100011 + 0o23), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b10100 + 0o133) + chr(1314 - 1264) + chr(0b110111) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1000000 + 0o57) + chr(0b101000 + 0o11) + chr(541 - 486) + '\x34', 0b1000), ehT0Px3KOsy9(chr(909 - 861) + '\157' + chr(0b110101) + chr(0b101001 + 0o11), 9295 - 9287), ehT0Px3KOsy9(chr(380 - 332) + '\157' + chr(0b11111 + 0o22) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + '\066' + chr(0b11101 + 0o31), 21806 - 21798), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(630 - 581) + chr(1366 - 1318), ord("\x08")), ehT0Px3KOsy9(chr(1281 - 1233) + chr(111) + chr(50) + '\x31' + chr(830 - 779), 1383 - 1375), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(11715 - 11604) + chr(50) + chr(0b110010 + 0o5) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b11011 + 0o124) + chr(0b110011) + chr(0b110000) + chr(1654 - 1606), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(1057 - 1004), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + chr(2024 - 1971) + chr(0b11101 + 0o30), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x34' + chr(0b1010 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1000010 + 0o55) + chr(1708 - 1657) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110100) + '\x36', 1650 - 1642), ehT0Px3KOsy9(chr(48) + chr(111) + '\066' + '\x35', 61229 - 61221), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(502 - 453) + chr(0b1110 + 0o43) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1680 - 1631) + chr(1924 - 1876) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000110 + 0o51) + chr(49) + chr(0b110100) + chr(998 - 947), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100011 + 0o17) + chr(0b110011) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(8002 - 7891) + chr(0b110011) + chr(2437 - 2385) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2654 - 2602) + chr(2324 - 2274), 18981 - 18973), ehT0Px3KOsy9('\060' + chr(111) + chr(1874 - 1823) + chr(53) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110 + 0o54) + chr(0b110100) + '\064', 110 - 102), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(2898 - 2844) + '\062', 2415 - 2407), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b110001) + chr(0b110111) + chr(0b1110 + 0o43), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\066' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(2301 - 2253) + chr(0b1101111) + '\062' + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110110) + '\x32', 61978 - 61970), ehT0Px3KOsy9(chr(0b110000) + chr(12310 - 12199) + chr(0b110011) + chr(52) + chr(742 - 693), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(54) + '\062', 13122 - 13114), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1475 - 1425) + chr(0b1010 + 0o50) + chr(53), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100010 + 0o15) + '\x34' + chr(711 - 658), 46512 - 46504), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x34' + '\063', 8), ehT0Px3KOsy9('\060' + chr(4637 - 4526) + chr(2100 - 2049) + chr(2354 - 2302) + chr(0b1001 + 0o50), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\x30' + chr(1647 - 1596), 41167 - 41159), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(0b110111) + chr(0b110111), 3223 - 3215), ehT0Px3KOsy9(chr(48) + chr(0b1011100 + 0o23) + chr(0b110001) + chr(55) + '\x31', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(0b11101 + 0o23), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x83'), '\x64' + chr(0b1100101) + '\143' + chr(0b1010111 + 0o30) + chr(0b1100100) + chr(7031 - 6930))(chr(117) + chr(11398 - 11282) + chr(636 - 534) + chr(1138 - 1093) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def qxrVBjeryNEZ(oVre8I6UXc3b, vn4sOrFiSB4c, Iz1jSgUKZDvt=wxCCXClP4Gzp, MRtOn47tdSTy=wxCCXClP4Gzp): if vn4sOrFiSB4c == ehT0Px3KOsy9(chr(48) + '\157' + chr(2192 - 2143), 0o10): return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf2\xbb\xd8\x04Cc\xc3e'), '\x64' + chr(0b1100101) + chr(9079 - 8980) + '\157' + '\144' + '\145')(chr(117) + '\x74' + chr(102) + chr(0b11101 + 0o20) + chr(56)))(mask=Iz1jSgUKZDvt, groupby=MRtOn47tdSTy) return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xdf\xb7\xd7\x17'), chr(0b1100100) + chr(0b1100101) + '\x63' + '\157' + chr(0b1011110 + 0o6) + chr(0b110010 + 0o63))('\x75' + '\164' + chr(5165 - 5063) + '\055' + chr(2376 - 2320)))(ascending=ehT0Px3KOsy9('\x30' + '\157' + chr(838 - 790), ord("\x08")), mask=Iz1jSgUKZDvt, groupby=MRtOn47tdSTy) <= vn4sOrFiSB4c
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.bottom
def bottom(self, N, mask=NotSpecified, groupby=NotSpecified): """ Construct a Filter matching the bottom N asset values of self each day. If ``groupby`` is supplied, returns a Filter matching the bottom N asset values for each group. Parameters ---------- N : int Number of assets passing the returned filter each day. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, bottom values are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- filter : zipline.pipeline.Filter """ return self.rank(ascending=True, mask=mask, groupby=groupby) <= N
python
def bottom(self, N, mask=NotSpecified, groupby=NotSpecified): """ Construct a Filter matching the bottom N asset values of self each day. If ``groupby`` is supplied, returns a Filter matching the bottom N asset values for each group. Parameters ---------- N : int Number of assets passing the returned filter each day. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, bottom values are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- filter : zipline.pipeline.Filter """ return self.rank(ascending=True, mask=mask, groupby=groupby) <= N
[ "def", "bottom", "(", "self", ",", "N", ",", "mask", "=", "NotSpecified", ",", "groupby", "=", "NotSpecified", ")", ":", "return", "self", ".", "rank", "(", "ascending", "=", "True", ",", "mask", "=", "mask", ",", "groupby", "=", "groupby", ")", "<=", "N" ]
Construct a Filter matching the bottom N asset values of self each day. If ``groupby`` is supplied, returns a Filter matching the bottom N asset values for each group. Parameters ---------- N : int Number of assets passing the returned filter each day. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when computing ranks. If mask is supplied, bottom values are computed ignoring any asset/date pairs for which `mask` produces a value of False. groupby : zipline.pipeline.Classifier, optional A classifier defining partitions over which to perform ranking. Returns ------- filter : zipline.pipeline.Filter
[ "Construct", "a", "Filter", "matching", "the", "bottom", "N", "asset", "values", "of", "self", "each", "day", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1076-L1098
train
Construct a Filter matching the bottom N asset values of self each day.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDAS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xlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(5621 - 5510) + chr(2389 - 2340) + chr(0b101010 + 0o7) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110100) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(726 - 677) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(478 - 429) + chr(52), 30577 - 30569), ehT0Px3KOsy9('\060' + chr(6257 - 6146) + chr(0b110001) + chr(0b10011 + 0o35) + '\x32', 63859 - 63851), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(2297 - 2186) + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(0b110000) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(55) + chr(2597 - 2545), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101111 + 0o1), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(0b110100) + chr(1904 - 1852), 20266 - 20258), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001 + 0o1) + chr(52) + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\065' + '\062', 0o10), ehT0Px3KOsy9(chr(1717 - 1669) + chr(7838 - 7727) + chr(51) + chr(0b110100) + chr(0b110100), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x33' + '\064', 0b1000), ehT0Px3KOsy9(chr(1734 - 1686) + '\x6f' + chr(2339 - 2289) + '\x30' + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(52) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(0b110010) + chr(51) + chr(667 - 615), 0b1000), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(9550 - 9439) + '\x32' + chr(49) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1464 - 1416) + chr(0b1000000 + 0o57) + chr(51) + '\x33' + chr(0b11000 + 0o30), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\x31' + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(993 - 945) + '\157' + chr(49) + chr(0b110100) + chr(52), 0b1000), ehT0Px3KOsy9(chr(968 - 920) + chr(111) + chr(0b110001) + chr(1440 - 1387), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10 + 0o65) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1011 + 0o53) + chr(0b11000 + 0o33), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(9460 - 9349) + chr(0b1101 + 0o45) + chr(0b100110 + 0o16) + chr(0b101111 + 0o10), 5850 - 5842), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(10779 - 10668) + chr(0b1 + 0o61) + chr(0b100 + 0o55) + '\066', 64581 - 64573), ehT0Px3KOsy9(chr(830 - 782) + '\x6f' + '\x32' + chr(206 - 155) + chr(1639 - 1585), 0b1000), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + '\x31' + chr(49) + '\x34', 8), ehT0Px3KOsy9(chr(2202 - 2154) + chr(5205 - 5094) + '\063' + chr(49) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10101 + 0o36) + '\x32' + '\063', 47210 - 47202), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101100 + 0o6) + chr(0b11010 + 0o35) + chr(52), 0o10), ehT0Px3KOsy9(chr(2279 - 2231) + '\157' + chr(0b110001) + chr(0b0 + 0o63) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4346 - 4235) + '\061' + '\063' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(619 - 569) + chr(0b100100 + 0o22) + chr(0b10101 + 0o35), 0b1000), ehT0Px3KOsy9(chr(48) + chr(4084 - 3973) + '\x33' + chr(2238 - 2189) + chr(433 - 379), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + chr(2399 - 2349) + chr(0b110010) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(1724 - 1676) + chr(0b110011 + 0o74) + chr(0b110001) + chr(51) + chr(52), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(0b110000) + '\x32', 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\x31' + chr(0b11110 + 0o24) + chr(49), 29905 - 29897)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x35' + chr(0b1000 + 0o50), 10168 - 10160)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'd'), '\x64' + chr(101) + chr(99) + chr(12221 - 12110) + '\x64' + '\145')(chr(6471 - 6354) + chr(0b111100 + 0o70) + chr(1313 - 1211) + chr(0b101101) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def kXxsZxlIQUSQ(oVre8I6UXc3b, vn4sOrFiSB4c, Iz1jSgUKZDvt=wxCCXClP4Gzp, MRtOn47tdSTy=wxCCXClP4Gzp): return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'8d\xcca'), chr(0b1011000 + 0o14) + '\145' + chr(0b10111 + 0o114) + '\157' + '\x64' + chr(9873 - 9772))(chr(117) + '\x74' + chr(0b1011001 + 0o15) + '\x2d' + '\070'))(ascending=ehT0Px3KOsy9(chr(1148 - 1100) + chr(111) + chr(0b110001), 0o10), mask=Iz1jSgUKZDvt, groupby=MRtOn47tdSTy) <= vn4sOrFiSB4c
quantopian/zipline
zipline/pipeline/factors/factor.py
Factor.percentile_between
def percentile_between(self, min_percentile, max_percentile, mask=NotSpecified): """ Construct a new Filter representing entries from the output of this Factor that fall within the percentile range defined by min_percentile and max_percentile. Parameters ---------- min_percentile : float [0.0, 100.0] Return True for assets falling above this percentile in the data. max_percentile : float [0.0, 100.0] Return True for assets falling below this percentile in the data. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when percentile calculating thresholds. If mask is supplied, percentile cutoffs are computed each day using only assets for which ``mask`` returns True. Assets for which ``mask`` produces False will produce False in the output of this Factor as well. Returns ------- out : zipline.pipeline.filters.PercentileFilter A new filter that will compute the specified percentile-range mask. See Also -------- zipline.pipeline.filters.filter.PercentileFilter """ return PercentileFilter( self, min_percentile=min_percentile, max_percentile=max_percentile, mask=mask, )
python
def percentile_between(self, min_percentile, max_percentile, mask=NotSpecified): """ Construct a new Filter representing entries from the output of this Factor that fall within the percentile range defined by min_percentile and max_percentile. Parameters ---------- min_percentile : float [0.0, 100.0] Return True for assets falling above this percentile in the data. max_percentile : float [0.0, 100.0] Return True for assets falling below this percentile in the data. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when percentile calculating thresholds. If mask is supplied, percentile cutoffs are computed each day using only assets for which ``mask`` returns True. Assets for which ``mask`` produces False will produce False in the output of this Factor as well. Returns ------- out : zipline.pipeline.filters.PercentileFilter A new filter that will compute the specified percentile-range mask. See Also -------- zipline.pipeline.filters.filter.PercentileFilter """ return PercentileFilter( self, min_percentile=min_percentile, max_percentile=max_percentile, mask=mask, )
[ "def", "percentile_between", "(", "self", ",", "min_percentile", ",", "max_percentile", ",", "mask", "=", "NotSpecified", ")", ":", "return", "PercentileFilter", "(", "self", ",", "min_percentile", "=", "min_percentile", ",", "max_percentile", "=", "max_percentile", ",", "mask", "=", "mask", ",", ")" ]
Construct a new Filter representing entries from the output of this Factor that fall within the percentile range defined by min_percentile and max_percentile. Parameters ---------- min_percentile : float [0.0, 100.0] Return True for assets falling above this percentile in the data. max_percentile : float [0.0, 100.0] Return True for assets falling below this percentile in the data. mask : zipline.pipeline.Filter, optional A Filter representing assets to consider when percentile calculating thresholds. If mask is supplied, percentile cutoffs are computed each day using only assets for which ``mask`` returns True. Assets for which ``mask`` produces False will produce False in the output of this Factor as well. Returns ------- out : zipline.pipeline.filters.PercentileFilter A new filter that will compute the specified percentile-range mask. See Also -------- zipline.pipeline.filters.filter.PercentileFilter
[ "Construct", "a", "new", "Filter", "representing", "entries", "from", "the", "output", "of", "this", "Factor", "that", "fall", "within", "the", "percentile", "range", "defined", "by", "min_percentile", "and", "max_percentile", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1103-L1139
train
Returns a new Filter representing entries that fall within the specified percentile range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O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4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(720 - 669) + '\x31', 10116 - 10108), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1970 - 1920) + '\064' + '\x35', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010) + chr(52) + '\061', 4143 - 4135), ehT0Px3KOsy9('\060' + chr(10850 - 10739) + '\x33' + chr(167 - 118) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\060', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(54) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(51) + chr(0b10111 + 0o32) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b10110 + 0o37) + chr(51), 44050 - 44042), ehT0Px3KOsy9('\x30' + chr(11965 - 11854) + '\063' + '\x30' + chr(0b110000 + 0o7), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101110 + 0o1) + chr(0b110010) + '\x30' + chr(0b1 + 0o57), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + chr(0b1010 + 0o50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11464 - 11353) + chr(0b110111) + chr(2611 - 2558), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100001 + 0o116) + chr(50) + chr(2267 - 2219) + chr(570 - 521), 60926 - 60918), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\x35' + chr(0b101010 + 0o10), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(0b1111 + 0o45) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(55) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3750 - 3639) + chr(0b110011) + chr(1843 - 1792) + chr(54), 45265 - 45257), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\x31' + chr(159 - 111) + chr(374 - 325), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\065' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10768 - 10657) + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\060' + chr(55), 8), ehT0Px3KOsy9(chr(1052 - 1004) + chr(0b1101111) + '\x32' + chr(0b101010 + 0o13), 30645 - 30637), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b101010 + 0o105) + chr(0b110010) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + chr(49) + chr(2398 - 2347) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111011 + 0o64) + chr(0b110001 + 0o0) + chr(1157 - 1102) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(0b110101) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010100 + 0o33) + '\061' + chr(0b100100 + 0o20) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\x35' + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + chr(52) + '\x37', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\065' + chr(0b100 + 0o61), ord("\x08")), ehT0Px3KOsy9('\060' + chr(6816 - 6705) + '\x33' + chr(48) + '\x36', 48419 - 48411), ehT0Px3KOsy9('\x30' + '\x6f' + chr(994 - 944) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1101111) + chr(0b110010) + '\066' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(841 - 791) + chr(0b110101) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + '\x31', 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(51) + chr(0b110001 + 0o0) + chr(0b11000 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10111 + 0o130) + chr(0b110001) + chr(710 - 657) + '\x33', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(2073 - 2023) + chr(0b11001 + 0o31) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x35' + chr(1207 - 1158), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + '\x31' + chr(2147 - 2098), 22050 - 22042)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'7'), '\144' + chr(3538 - 3437) + '\x63' + chr(0b1101111) + '\144' + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b100010 + 0o13) + chr(0b11001 + 0o37)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def zcP8L9i5TrNi(oVre8I6UXc3b, aBl6WwGvrXAi, XtZb6jTc6QwP, Iz1jSgUKZDvt=wxCCXClP4Gzp): return tyd2kRP70T4P(oVre8I6UXc3b, min_percentile=aBl6WwGvrXAi, max_percentile=XtZb6jTc6QwP, mask=Iz1jSgUKZDvt)
quantopian/zipline
zipline/pipeline/factors/factor.py
Rank._validate
def _validate(self): """ Verify that the stored rank method is valid. """ if self._method not in _RANK_METHODS: raise UnknownRankMethod( method=self._method, choices=set(_RANK_METHODS), ) return super(Rank, self)._validate()
python
def _validate(self): """ Verify that the stored rank method is valid. """ if self._method not in _RANK_METHODS: raise UnknownRankMethod( method=self._method, choices=set(_RANK_METHODS), ) return super(Rank, self)._validate()
[ "def", "_validate", "(", "self", ")", ":", "if", "self", ".", "_method", "not", "in", "_RANK_METHODS", ":", "raise", "UnknownRankMethod", "(", "method", "=", "self", ".", "_method", ",", "choices", "=", "set", "(", "_RANK_METHODS", ")", ",", ")", "return", "super", "(", "Rank", ",", "self", ")", ".", "_validate", "(", ")" ]
Verify that the stored rank method is valid.
[ "Verify", "that", "the", "stored", "rank", "method", "is", "valid", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1382-L1391
train
Verify that the stored rank method is valid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9Dhhi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cpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(51) + chr(0b101000 + 0o10), 0o10), ehT0Px3KOsy9(chr(806 - 758) + chr(0b1011101 + 0o22) + chr(0b11100 + 0o25) + '\064' + '\x34', 23485 - 23477), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2400 - 2350) + '\x37' + chr(0b110010 + 0o0), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9929 - 9818) + '\067' + chr(130 - 78), 63849 - 63841), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(50) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(0b1101 + 0o52) + chr(2166 - 2113), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(51) + '\x32' + '\x31', 25938 - 25930), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(49) + chr(1916 - 1861), 0o10), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + '\x32' + chr(0b110101) + chr(49), 0b1000), ehT0Px3KOsy9(chr(48) + chr(9858 - 9747) + chr(0b11111 + 0o23) + '\066' + chr(0b110111), 7953 - 7945), ehT0Px3KOsy9(chr(0b110000) + chr(0b10 + 0o155) + chr(0b110100) + chr(0b101100 + 0o13), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(858 - 747) + '\063' + '\x35' + chr(0b1011 + 0o51), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\066' + chr(519 - 469), 9890 - 9882), ehT0Px3KOsy9('\x30' + chr(11619 - 11508) + chr(51) + chr(0b110010) + chr(49), 8), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1000000 + 0o57) + chr(54) + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\066' + chr(0b110001), 10919 - 10911), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(784 - 735) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(0b110111) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b1100 + 0o46) + chr(54), 53192 - 53184), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\063' + '\x31', 47413 - 47405), ehT0Px3KOsy9('\060' + '\157' + chr(0b101010 + 0o13) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(51) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + chr(0b101010 + 0o7) + chr(132 - 82) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + '\061' + '\065' + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b1011 + 0o47) + chr(0b110010) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(8672 - 8561) + chr(49) + '\x30' + chr(89 - 36), 0o10), ehT0Px3KOsy9(chr(1308 - 1260) + '\157' + chr(0b110010) + chr(55) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\x32' + chr(1884 - 1830) + '\x31', 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(52) + chr(50), 56201 - 56193), ehT0Px3KOsy9(chr(48) + '\x6f' + '\067' + chr(0b10111 + 0o36), 8), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(50) + chr(0b101110 + 0o2) + chr(48), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\x33' + chr(0b11101 + 0o23), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + '\062' + chr(1070 - 1022) + chr(0b10 + 0o65), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1655 - 1605) + chr(0b10000 + 0o41) + chr(0b100010 + 0o20), 0o10), ehT0Px3KOsy9(chr(48) + chr(3639 - 3528) + '\x32' + chr(51) + '\061', 0b1000), ehT0Px3KOsy9(chr(127 - 79) + chr(0b1 + 0o156) + '\062' + chr(423 - 375) + '\x36', 24426 - 24418), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101101 + 0o5) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\060' + chr(604 - 493) + chr(49) + '\x36' + '\x37', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110000 + 0o1) + '\x34' + chr(0b110010), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(842 - 794) + chr(0b101010 + 0o105) + chr(0b110101) + chr(1893 - 1845), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'v'), chr(7241 - 7141) + '\x65' + chr(1984 - 1885) + '\x6f' + chr(0b1010010 + 0o22) + chr(4204 - 4103))('\x75' + chr(116) + chr(0b1100110) + chr(0b100101 + 0o10) + chr(303 - 247)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def mCArq4frRHUO(oVre8I6UXc3b): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\t}\xceT\xbfY'), '\144' + chr(101) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(7430 - 7313) + chr(116) + chr(0b100010 + 0o104) + chr(927 - 882) + chr(56))) not in l9qlevp9SU2k: raise vKcYhnqWtc5q(method=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\t}\xceT\xbfY'), chr(0b1100100) + '\145' + chr(0b100001 + 0o102) + chr(111) + chr(100) + '\x65')('\165' + chr(116) + chr(5401 - 5299) + '\055' + '\070')), choices=MVEN8G6CxlvR(l9qlevp9SU2k)) return xafqLlk3kkUe(KNx0Ujaz9UM0(QPkNiasMWk63, oVre8I6UXc3b), xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x12y\xd6U\xb4\\\xa5\xea'), chr(9150 - 9050) + '\x65' + '\x63' + chr(111) + '\x64' + '\145')(chr(0b1110101) + '\164' + chr(8383 - 8281) + chr(0b101101) + chr(56)))()
quantopian/zipline
zipline/pipeline/factors/factor.py
Rank._compute
def _compute(self, arrays, dates, assets, mask): """ For each row in the input, compute a like-shaped array of per-row ranks. """ return masked_rankdata_2d( arrays[0], mask, self.inputs[0].missing_value, self._method, self._ascending, )
python
def _compute(self, arrays, dates, assets, mask): """ For each row in the input, compute a like-shaped array of per-row ranks. """ return masked_rankdata_2d( arrays[0], mask, self.inputs[0].missing_value, self._method, self._ascending, )
[ "def", "_compute", "(", "self", ",", "arrays", ",", "dates", ",", "assets", ",", "mask", ")", ":", "return", "masked_rankdata_2d", "(", "arrays", "[", "0", "]", ",", "mask", ",", "self", ".", "inputs", "[", "0", "]", ".", "missing_value", ",", "self", ".", "_method", ",", "self", ".", "_ascending", ",", ")" ]
For each row in the input, compute a like-shaped array of per-row ranks.
[ "For", "each", "row", "in", "the", "input", "compute", "a", "like", "-", "shaped", "array", "of", "per", "-", "row", "ranks", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1393-L1404
train
Compute a like - shaped array of per - row ranks.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qo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H72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(10717 - 10606) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(802 - 752) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110101) + chr(52), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(635 - 584) + chr(50) + chr(0b110010 + 0o5), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9333 - 9222) + '\x33' + '\x35' + chr(0b100100 + 0o15), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b1011 + 0o47) + chr(0b11000 + 0o34), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(54) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + '\x33' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + '\063' + chr(536 - 488) + '\x30', 28789 - 28781), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b10101 + 0o40) + chr(0b11011 + 0o33), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + chr(0b110011) + '\x30' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\x32' + chr(0b101011 + 0o6) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + '\x34' + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(7813 - 7702) + chr(0b100 + 0o55) + chr(55), 22661 - 22653), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1111 + 0o43) + chr(1172 - 1119) + chr(55), 21054 - 21046), ehT0Px3KOsy9('\060' + chr(7351 - 7240) + '\x33' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(2169 - 2121) + chr(0b1011111 + 0o20) + chr(0b110011) + chr(0b11110 + 0o23) + '\x36', 21943 - 21935), ehT0Px3KOsy9('\060' + chr(0b11110 + 0o121) + '\x33' + '\065' + '\061', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\063' + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1405 - 1355) + chr(0b110110) + chr(659 - 610), 15742 - 15734), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b110101) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2219 - 2171) + chr(0b1101111) + '\x34' + chr(0b101010 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(1948 - 1900) + chr(0b1010001 + 0o36) + chr(2687 - 2634) + chr(219 - 171), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b0 + 0o61) + chr(0b110111) + chr(0b110010), 52551 - 52543), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(55) + '\060', 9315 - 9307), ehT0Px3KOsy9('\060' + chr(4297 - 4186) + '\065' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\064' + chr(1788 - 1740), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(50) + chr(0b101101 + 0o3), 0o10), ehT0Px3KOsy9(chr(48) + chr(7727 - 7616) + chr(0b110101) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(4224 - 4113) + chr(503 - 452) + chr(0b101010 + 0o10) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101010 + 0o7) + '\x33' + chr(0b10100 + 0o35), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b10001 + 0o44) + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(8275 - 8164) + chr(670 - 620) + '\x31' + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(391 - 280) + chr(0b110001) + chr(276 - 225) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2524 - 2469) + chr(1529 - 1477), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + '\x33' + chr(0b1 + 0o66) + chr(672 - 623), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\066' + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x31' + chr(0b110100), 51116 - 51108), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + '\062' + '\061' + chr(1734 - 1681), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + '\065' + chr(0b101010 + 0o6), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'-'), chr(0b1100100) + '\145' + chr(99) + '\157' + '\144' + chr(0b101011 + 0o72))(chr(0b101011 + 0o112) + chr(0b111110 + 0o66) + chr(0b1100110) + '\055' + chr(2577 - 2521)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def PeHoGDqlkidn(oVre8I6UXc3b, lmEEfdW_XFlN, SLiSZu5nk7Kn, YGFU3oxACPcg, Iz1jSgUKZDvt): return SbFWvKPs2iOj(lmEEfdW_XFlN[ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + chr(0b110000), ord("\x08"))], Iz1jSgUKZDvt, xafqLlk3kkUe(oVre8I6UXc3b.inputs[ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1111 + 0o140) + chr(513 - 465), 8)], xafqLlk3kkUe(SXOLrMavuUCe(b'`\x1b\x1a\x91\xba\r:\xed\xb6~\xb0\xe3'), chr(0b11001 + 0o113) + chr(0b11011 + 0o112) + '\143' + '\157' + chr(100) + chr(101))(chr(11943 - 11826) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(1098 - 1042))), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\\;I\xa3\x81;\x11'), '\144' + chr(9156 - 9055) + chr(99) + chr(0b1101111) + chr(100) + chr(0b1011111 + 0o6))(chr(618 - 501) + chr(4808 - 4692) + chr(0b1001001 + 0o35) + chr(45) + '\x38')), xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\\7_\xb4\x8c:\x11\xb7\xaeI'), chr(6261 - 6161) + chr(0b1100101) + '\143' + '\x6f' + chr(100) + '\x65')(chr(7567 - 7450) + chr(11921 - 11805) + chr(102) + chr(0b101101) + '\070')))
quantopian/zipline
zipline/utils/pandas_utils.py
_time_to_micros
def _time_to_micros(time): """Convert a time into microseconds since midnight. Parameters ---------- time : datetime.time The time to convert. Returns ------- us : int The number of microseconds since midnight. Notes ----- This does not account for leap seconds or daylight savings. """ seconds = time.hour * 60 * 60 + time.minute * 60 + time.second return 1000000 * seconds + time.microsecond
python
def _time_to_micros(time): """Convert a time into microseconds since midnight. Parameters ---------- time : datetime.time The time to convert. Returns ------- us : int The number of microseconds since midnight. Notes ----- This does not account for leap seconds or daylight savings. """ seconds = time.hour * 60 * 60 + time.minute * 60 + time.second return 1000000 * seconds + time.microsecond
[ "def", "_time_to_micros", "(", "time", ")", ":", "seconds", "=", "time", ".", "hour", "*", "60", "*", "60", "+", "time", ".", "minute", "*", "60", "+", "time", ".", "second", "return", "1000000", "*", "seconds", "+", "time", ".", "microsecond" ]
Convert a time into microseconds since midnight. Parameters ---------- time : datetime.time The time to convert. Returns ------- us : int The number of microseconds since midnight. Notes ----- This does not account for leap seconds or daylight savings.
[ "Convert", "a", "time", "into", "microseconds", "since", "midnight", ".", "Parameters", "----------", "time", ":", "datetime", ".", "time", "The", "time", "to", "convert", ".", "Returns", "-------", "us", ":", "int", "The", "number", "of", "microseconds", "since", "midnight", ".", "Notes", "-----", "This", "does", "not", "account", "for", "leap", "seconds", "or", "daylight", "savings", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L48-L63
train
Convert a time into microseconds since midnight.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,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afqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(660 - 612) + chr(111) + chr(1227 - 1177) + chr(54) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(54) + '\067', 7961 - 7953), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(49) + chr(0b1100 + 0o45), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100011 + 0o17) + chr(0b110011) + chr(52), 0o10), ehT0Px3KOsy9(chr(151 - 103) + chr(3712 - 3601) + '\064' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1494 - 1446) + '\157' + '\063' + chr(54) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110100) + chr(51), 0o10), ehT0Px3KOsy9(chr(1993 - 1945) + '\x6f' + chr(0b100 + 0o55) + chr(0b110010) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(310 - 262) + chr(111) + chr(0b110011) + '\066' + chr(50), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + '\x30' + chr(53), 0b1000), ehT0Px3KOsy9(chr(1199 - 1151) + '\x6f' + '\x33' + chr(54) + '\x32', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110111) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010 + 0o145) + chr(50) + '\x35' + chr(0b1011 + 0o53), 36990 - 36982), ehT0Px3KOsy9(chr(916 - 868) + chr(0b11011 + 0o124) + chr(0b110010) + chr(0b110001) + chr(0b11 + 0o57), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110111) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(2752 - 2641) + '\066' + chr(1848 - 1793), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1612 - 1561) + chr(0b110001) + chr(342 - 293), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(78 - 29) + chr(0b100101 + 0o16) + chr(2233 - 2182), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1011 + 0o50) + chr(0b110110) + chr(692 - 637), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + '\061' + chr(1730 - 1676) + chr(246 - 192), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(52) + chr(0b111 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(2060 - 2012) + chr(0b11000 + 0o127) + chr(0b100011 + 0o15), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(2399 - 2349), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(52) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b110111) + '\x33', 40423 - 40415), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(12061 - 11950) + chr(2834 - 2780) + '\x35', 19735 - 19727), ehT0Px3KOsy9(chr(1042 - 994) + chr(111) + chr(0b10110 + 0o35) + '\064' + chr(0b110101), 43492 - 43484), ehT0Px3KOsy9(chr(0b110000) + chr(0b10101 + 0o132) + '\x31' + '\066' + chr(0b10001 + 0o37), 61662 - 61654), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\066' + chr(955 - 905), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(0b110000) + '\x34', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + chr(1895 - 1840) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\060' + chr(8652 - 8541) + '\061' + chr(0b11011 + 0o34) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(111) + '\x33' + chr(757 - 702) + chr(0b110000), 24510 - 24502), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(2336 - 2225) + '\063' + chr(53) + '\x35', 0o10), ehT0Px3KOsy9(chr(2131 - 2083) + chr(0b1101110 + 0o1) + chr(0b110001) + chr(1196 - 1143) + chr(1488 - 1433), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\062' + chr(0b100001 + 0o24) + chr(0b1001 + 0o56), 54481 - 54473), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11010 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2135 - 2080) + chr(2077 - 2029), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b110101) + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9d'), '\144' + chr(101) + '\143' + chr(1905 - 1794) + chr(100) + chr(0b1100101))(chr(7139 - 7022) + chr(7241 - 7125) + '\x66' + chr(45) + chr(2177 - 2121)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def F5RVahLoIc5_(ltvhPP4VhXre): n8shiI_5pCL9 = ltvhPP4VhXre.hour * ehT0Px3KOsy9('\x30' + chr(0b11111 + 0o120) + chr(55) + chr(52), ord("\x08")) * ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(1745 - 1690) + chr(52), 8) + ltvhPP4VhXre.minute * ehT0Px3KOsy9(chr(0b110000) + chr(755 - 644) + chr(0b110111) + chr(0b100111 + 0o15), 8) + ltvhPP4VhXre.second return ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(756 - 645) + chr(51) + chr(2264 - 2210) + chr(705 - 653) + chr(49) + chr(0b100100 + 0o15) + chr(48) + '\060', ord("\x08")) * n8shiI_5pCL9 + xafqLlk3kkUe(ltvhPP4VhXre, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\x1e\xaa\xeeI\x81F2\x9d\xeb\x96'), chr(0b1100100) + chr(0b110111 + 0o56) + '\x63' + chr(0b11 + 0o154) + chr(100) + '\x65')('\x75' + chr(0b1110100) + chr(0b1001100 + 0o32) + '\x2d' + chr(0b111000)))
quantopian/zipline
zipline/utils/pandas_utils.py
mask_between_time
def mask_between_time(dts, start, end, include_start=True, include_end=True): """Return a mask of all of the datetimes in ``dts`` that are between ``start`` and ``end``. Parameters ---------- dts : pd.DatetimeIndex The index to mask. start : time Mask away times less than the start. end : time Mask away times greater than the end. include_start : bool, optional Inclusive on ``start``. include_end : bool, optional Inclusive on ``end``. Returns ------- mask : np.ndarray[bool] A bool array masking ``dts``. See Also -------- :meth:`pandas.DatetimeIndex.indexer_between_time` """ # This function is adapted from # `pandas.Datetime.Index.indexer_between_time` which was originally # written by Wes McKinney, Chang She, and Grant Roch. time_micros = dts._get_time_micros() start_micros = _time_to_micros(start) end_micros = _time_to_micros(end) left_op, right_op, join_op = _opmap[ bool(include_start), bool(include_end), start_micros <= end_micros, ] return join_op( left_op(start_micros, time_micros), right_op(time_micros, end_micros), )
python
def mask_between_time(dts, start, end, include_start=True, include_end=True): """Return a mask of all of the datetimes in ``dts`` that are between ``start`` and ``end``. Parameters ---------- dts : pd.DatetimeIndex The index to mask. start : time Mask away times less than the start. end : time Mask away times greater than the end. include_start : bool, optional Inclusive on ``start``. include_end : bool, optional Inclusive on ``end``. Returns ------- mask : np.ndarray[bool] A bool array masking ``dts``. See Also -------- :meth:`pandas.DatetimeIndex.indexer_between_time` """ # This function is adapted from # `pandas.Datetime.Index.indexer_between_time` which was originally # written by Wes McKinney, Chang She, and Grant Roch. time_micros = dts._get_time_micros() start_micros = _time_to_micros(start) end_micros = _time_to_micros(end) left_op, right_op, join_op = _opmap[ bool(include_start), bool(include_end), start_micros <= end_micros, ] return join_op( left_op(start_micros, time_micros), right_op(time_micros, end_micros), )
[ "def", "mask_between_time", "(", "dts", ",", "start", ",", "end", ",", "include_start", "=", "True", ",", "include_end", "=", "True", ")", ":", "# This function is adapted from", "# `pandas.Datetime.Index.indexer_between_time` which was originally", "# written by Wes McKinney, Chang She, and Grant Roch.", "time_micros", "=", "dts", ".", "_get_time_micros", "(", ")", "start_micros", "=", "_time_to_micros", "(", "start", ")", "end_micros", "=", "_time_to_micros", "(", "end", ")", "left_op", ",", "right_op", ",", "join_op", "=", "_opmap", "[", "bool", "(", "include_start", ")", ",", "bool", "(", "include_end", ")", ",", "start_micros", "<=", "end_micros", ",", "]", "return", "join_op", "(", "left_op", "(", "start_micros", ",", "time_micros", ")", ",", "right_op", "(", "time_micros", ",", "end_micros", ")", ",", ")" ]
Return a mask of all of the datetimes in ``dts`` that are between ``start`` and ``end``. Parameters ---------- dts : pd.DatetimeIndex The index to mask. start : time Mask away times less than the start. end : time Mask away times greater than the end. include_start : bool, optional Inclusive on ``start``. include_end : bool, optional Inclusive on ``end``. Returns ------- mask : np.ndarray[bool] A bool array masking ``dts``. See Also -------- :meth:`pandas.DatetimeIndex.indexer_between_time`
[ "Return", "a", "mask", "of", "all", "of", "the", "datetimes", "in", "dts", "that", "are", "between", "start", "and", "end", ".", "Parameters", "----------", "dts", ":", "pd", ".", "DatetimeIndex", "The", "index", "to", "mask", ".", "start", ":", "time", "Mask", "away", "times", "less", "than", "the", "start", ".", "end", ":", "time", "Mask", "away", "times", "greater", "than", "the", "end", ".", "include_start", ":", "bool", "optional", "Inclusive", "on", "start", ".", "include_end", ":", "bool", "optional", "Inclusive", "on", "end", ".", "Returns", "-------", "mask", ":", "np", ".", "ndarray", "[", "bool", "]", "A", "bool", "array", "masking", "dts", ".", "See", "Also", "--------", ":", "meth", ":", "pandas", ".", "DatetimeIndex", ".", "indexer_between_time" ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L72-L111
train
Return a mask of all of the datetimes in dts that are between start and end.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R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1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\064', 0o10), ehT0Px3KOsy9(chr(1806 - 1758) + chr(0b1101111) + '\x31' + chr(49) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(669 - 619) + chr(2138 - 2087) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x32' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(2175 - 2127) + '\157' + chr(49) + chr(0b10011 + 0o36), 0o10), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + '\063' + '\063' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10101 + 0o132) + '\063' + chr(0b110111) + chr(0b101010 + 0o7), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10676 - 10565) + chr(928 - 879) + chr(307 - 254) + chr(0b111 + 0o54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100101 + 0o12) + chr(0b110011) + chr(0b1 + 0o66) + '\060', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110101) + chr(53), 21412 - 21404), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\x34' + chr(0b10001 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010100 + 0o33) + chr(0b110011) + chr(51) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1028 - 980) + chr(5206 - 5095) + chr(53) + chr(50), 42842 - 42834), ehT0Px3KOsy9(chr(48) + chr(3727 - 3616) + chr(0b110001) + '\x32' + '\x34', 38855 - 38847), ehT0Px3KOsy9('\060' + chr(11590 - 11479) + chr(1988 - 1935) + chr(1481 - 1430), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x33' + chr(0b110110), 45920 - 45912), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100100 + 0o17) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(5104 - 4993) + '\064' + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x35' + chr(0b101100 + 0o12), 12403 - 12395), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(0b101001 + 0o11) + chr(367 - 315) + chr(51), 9384 - 9376), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11100 + 0o31) + chr(1944 - 1890), 8), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(55) + '\060', 11039 - 11031), ehT0Px3KOsy9('\x30' + chr(0b10101 + 0o132) + chr(51) + chr(2698 - 2645) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(879 - 829) + chr(0b10011 + 0o40), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(49) + chr(1076 - 1023), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7403 - 7292) + chr(54) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\157' + chr(0b110011) + chr(0b0 + 0o60) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + '\x33' + chr(0b100001 + 0o17) + '\x34', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(55) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(54) + chr(0b10100 + 0o43), 0o10), ehT0Px3KOsy9(chr(341 - 293) + chr(0b1101111) + chr(0b100110 + 0o14) + chr(0b110010) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x32' + '\x30', 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x36', 2484 - 2476), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(0b110001) + '\x35' + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100111 + 0o10) + chr(0b111 + 0o54) + '\061' + '\x37', 74 - 66), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + chr(1773 - 1719) + chr(0b100111 + 0o11), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\062' + '\x32' + '\065', 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110111) + chr(2230 - 2181), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110100) + chr(0b110001), 31896 - 31888)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(7166 - 7055) + chr(53) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'*'), chr(0b1100100) + chr(101) + chr(8647 - 8548) + chr(0b100100 + 0o113) + chr(100) + chr(0b101100 + 0o71))('\x75' + '\x74' + '\x66' + '\x2d' + chr(0b11010 + 0o36)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def kqJZalGQXQtF(f5Ww7tOW_bKL, avRbFsnfJxQj, whWDZq5_lP01, rQ2UwSZl52Lr=ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001), 21407 - 21399), ZBQnmUWDbhDL=ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + chr(49), 8)): JU_gPyUGJEIJ = f5Ww7tOW_bKL._get_time_micros() GbRoTUEbppDL = F5RVahLoIc5_(avRbFsnfJxQj) Gd2f_U771kxH = F5RVahLoIc5_(whWDZq5_lP01) (G31WshFrxGim, TL4y1wmEmMhI, sbVU50Wp6vzq) = pnjWLfx7lzLn[WbBjf8Y7v9VN(rQ2UwSZl52Lr), WbBjf8Y7v9VN(ZBQnmUWDbhDL), GbRoTUEbppDL <= Gd2f_U771kxH] return sbVU50Wp6vzq(G31WshFrxGim(GbRoTUEbppDL, JU_gPyUGJEIJ), TL4y1wmEmMhI(JU_gPyUGJEIJ, Gd2f_U771kxH))
quantopian/zipline
zipline/utils/pandas_utils.py
find_in_sorted_index
def find_in_sorted_index(dts, dt): """ Find the index of ``dt`` in ``dts``. This function should be used instead of `dts.get_loc(dt)` if the index is large enough that we don't want to initialize a hash table in ``dts``. In particular, this should always be used on minutely trading calendars. Parameters ---------- dts : pd.DatetimeIndex Index in which to look up ``dt``. **Must be sorted**. dt : pd.Timestamp ``dt`` to be looked up. Returns ------- ix : int Integer index such that dts[ix] == dt. Raises ------ KeyError If dt is not in ``dts``. """ ix = dts.searchsorted(dt) if ix == len(dts) or dts[ix] != dt: raise LookupError("{dt} is not in {dts}".format(dt=dt, dts=dts)) return ix
python
def find_in_sorted_index(dts, dt): """ Find the index of ``dt`` in ``dts``. This function should be used instead of `dts.get_loc(dt)` if the index is large enough that we don't want to initialize a hash table in ``dts``. In particular, this should always be used on minutely trading calendars. Parameters ---------- dts : pd.DatetimeIndex Index in which to look up ``dt``. **Must be sorted**. dt : pd.Timestamp ``dt`` to be looked up. Returns ------- ix : int Integer index such that dts[ix] == dt. Raises ------ KeyError If dt is not in ``dts``. """ ix = dts.searchsorted(dt) if ix == len(dts) or dts[ix] != dt: raise LookupError("{dt} is not in {dts}".format(dt=dt, dts=dts)) return ix
[ "def", "find_in_sorted_index", "(", "dts", ",", "dt", ")", ":", "ix", "=", "dts", ".", "searchsorted", "(", "dt", ")", "if", "ix", "==", "len", "(", "dts", ")", "or", "dts", "[", "ix", "]", "!=", "dt", ":", "raise", "LookupError", "(", "\"{dt} is not in {dts}\"", ".", "format", "(", "dt", "=", "dt", ",", "dts", "=", "dts", ")", ")", "return", "ix" ]
Find the index of ``dt`` in ``dts``. This function should be used instead of `dts.get_loc(dt)` if the index is large enough that we don't want to initialize a hash table in ``dts``. In particular, this should always be used on minutely trading calendars. Parameters ---------- dts : pd.DatetimeIndex Index in which to look up ``dt``. **Must be sorted**. dt : pd.Timestamp ``dt`` to be looked up. Returns ------- ix : int Integer index such that dts[ix] == dt. Raises ------ KeyError If dt is not in ``dts``.
[ "Find", "the", "index", "of", "dt", "in", "dts", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L114-L142
train
Find the index of dt in dts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,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1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(1396 - 1346) + chr(0b11111 + 0o30), ord("\x08")), ehT0Px3KOsy9(chr(1048 - 1000) + '\157' + '\x32' + chr(0b1101 + 0o52) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(383 - 335) + '\157' + chr(891 - 842) + '\x36' + chr(2866 - 2812), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + '\x33' + chr(50) + chr(1374 - 1322), 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b1101111) + '\x37' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100111 + 0o110) + chr(51) + chr(2368 - 2315) + '\062', 29192 - 29184), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(111) + '\x31' + '\x32' + chr(55), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49), 27707 - 27699), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(0b101000 + 0o13) + chr(0b101 + 0o62) + chr(633 - 579), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10110 + 0o36) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(3547 - 3436) + chr(2819 - 2765), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b101111 + 0o4) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + '\062' + chr(0b110101), 40650 - 40642), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + '\061' + chr(48) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(910 - 862) + chr(111) + chr(0b10010 + 0o37) + chr(0b11101 + 0o24) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(1539 - 1491) + chr(111) + chr(49) + chr(0b110101) + chr(1787 - 1733), 47496 - 47488), ehT0Px3KOsy9(chr(1788 - 1740) + '\157' + chr(0b101001 + 0o10) + chr(0b1011 + 0o53) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\065' + '\x34', 12728 - 12720), ehT0Px3KOsy9('\060' + chr(6445 - 6334) + chr(0b110011) + chr(0b10110 + 0o40) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\066' + chr(724 - 669), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1010 + 0o47) + '\067' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(0b11 + 0o154) + '\x33' + chr(1936 - 1883) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(930 - 819) + '\062' + chr(0b110 + 0o61) + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110101) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1390 - 1340) + '\061' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(885 - 837) + chr(111) + '\065' + chr(0b11 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(2236 - 2184) + '\062', 22368 - 22360), ehT0Px3KOsy9('\x30' + chr(0b1101101 + 0o2) + '\x32' + chr(53) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(684 - 636) + chr(297 - 186) + chr(0b110010) + chr(55) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101101 + 0o102) + chr(50) + chr(0b110001) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110010) + chr(0b110011) + chr(0b110000), 54010 - 54002), ehT0Px3KOsy9('\060' + chr(0b1010101 + 0o32) + chr(53) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(740 - 691) + chr(0b110101) + chr(0b110110), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b0 + 0o65) + chr(0b11011 + 0o26), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100001 + 0o21) + chr(0b101 + 0o60) + '\x33', 8), ehT0Px3KOsy9(chr(2061 - 2013) + chr(7752 - 7641) + '\064' + chr(55), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\x36' + chr(0b11010 + 0o26), 13537 - 13529), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(0b101110 + 0o6) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b100111 + 0o12) + chr(50), 62807 - 62799), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b110011) + chr(0b100001 + 0o25), 50905 - 50897)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b100000 + 0o117) + chr(1282 - 1229) + '\060', 7473 - 7465)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'9'), chr(3767 - 3667) + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(1581 - 1481) + '\145')('\165' + '\164' + chr(0b1100110) + chr(0b10111 + 0o26) + chr(0b11111 + 0o31)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def sDv7l56Og5Ml(f5Ww7tOW_bKL, OmU3Un949MWT): NhWUxmSUCcoW = f5Ww7tOW_bKL.searchsorted(OmU3Un949MWT) if NhWUxmSUCcoW == c2A0yzQpDQB3(f5Ww7tOW_bKL) or f5Ww7tOW_bKL[NhWUxmSUCcoW] != OmU3Un949MWT: raise jIl9qoALCRyb(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'l\xdf\x02\xa9\x1a\x83$!\x90Hr\xf9<)l\x15\x10\x18\x86J'), chr(7946 - 7846) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1111 + 0o126))(chr(117) + chr(116) + chr(0b1100110) + chr(0b10010 + 0o33) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'A\x8f\x04\xbbr\x8b\x042\xaeWc\xb3'), chr(5372 - 5272) + chr(101) + chr(0b111010 + 0o51) + chr(0b1000010 + 0o55) + '\x64' + '\x65')('\x75' + '\x74' + chr(0b1100110) + chr(45) + chr(0b111000)))(dt=OmU3Un949MWT, dts=f5Ww7tOW_bKL)) return NhWUxmSUCcoW
quantopian/zipline
zipline/utils/pandas_utils.py
nearest_unequal_elements
def nearest_unequal_elements(dts, dt): """ Find values in ``dts`` closest but not equal to ``dt``. Returns a pair of (last_before, first_after). When ``dt`` is less than any element in ``dts``, ``last_before`` is None. When ``dt`` is greater any element in ``dts``, ``first_after`` is None. ``dts`` must be unique and sorted in increasing order. Parameters ---------- dts : pd.DatetimeIndex Dates in which to search. dt : pd.Timestamp Date for which to find bounds. """ if not dts.is_unique: raise ValueError("dts must be unique") if not dts.is_monotonic_increasing: raise ValueError("dts must be sorted in increasing order") if not len(dts): return None, None sortpos = dts.searchsorted(dt, side='left') try: sortval = dts[sortpos] except IndexError: # dt is greater than any value in the array. return dts[-1], None if dt < sortval: lower_ix = sortpos - 1 upper_ix = sortpos elif dt == sortval: lower_ix = sortpos - 1 upper_ix = sortpos + 1 else: lower_ix = sortpos upper_ix = sortpos + 1 lower_value = dts[lower_ix] if lower_ix >= 0 else None upper_value = dts[upper_ix] if upper_ix < len(dts) else None return lower_value, upper_value
python
def nearest_unequal_elements(dts, dt): """ Find values in ``dts`` closest but not equal to ``dt``. Returns a pair of (last_before, first_after). When ``dt`` is less than any element in ``dts``, ``last_before`` is None. When ``dt`` is greater any element in ``dts``, ``first_after`` is None. ``dts`` must be unique and sorted in increasing order. Parameters ---------- dts : pd.DatetimeIndex Dates in which to search. dt : pd.Timestamp Date for which to find bounds. """ if not dts.is_unique: raise ValueError("dts must be unique") if not dts.is_monotonic_increasing: raise ValueError("dts must be sorted in increasing order") if not len(dts): return None, None sortpos = dts.searchsorted(dt, side='left') try: sortval = dts[sortpos] except IndexError: # dt is greater than any value in the array. return dts[-1], None if dt < sortval: lower_ix = sortpos - 1 upper_ix = sortpos elif dt == sortval: lower_ix = sortpos - 1 upper_ix = sortpos + 1 else: lower_ix = sortpos upper_ix = sortpos + 1 lower_value = dts[lower_ix] if lower_ix >= 0 else None upper_value = dts[upper_ix] if upper_ix < len(dts) else None return lower_value, upper_value
[ "def", "nearest_unequal_elements", "(", "dts", ",", "dt", ")", ":", "if", "not", "dts", ".", "is_unique", ":", "raise", "ValueError", "(", "\"dts must be unique\"", ")", "if", "not", "dts", ".", "is_monotonic_increasing", ":", "raise", "ValueError", "(", "\"dts must be sorted in increasing order\"", ")", "if", "not", "len", "(", "dts", ")", ":", "return", "None", ",", "None", "sortpos", "=", "dts", ".", "searchsorted", "(", "dt", ",", "side", "=", "'left'", ")", "try", ":", "sortval", "=", "dts", "[", "sortpos", "]", "except", "IndexError", ":", "# dt is greater than any value in the array.", "return", "dts", "[", "-", "1", "]", ",", "None", "if", "dt", "<", "sortval", ":", "lower_ix", "=", "sortpos", "-", "1", "upper_ix", "=", "sortpos", "elif", "dt", "==", "sortval", ":", "lower_ix", "=", "sortpos", "-", "1", "upper_ix", "=", "sortpos", "+", "1", "else", ":", "lower_ix", "=", "sortpos", "upper_ix", "=", "sortpos", "+", "1", "lower_value", "=", "dts", "[", "lower_ix", "]", "if", "lower_ix", ">=", "0", "else", "None", "upper_value", "=", "dts", "[", "upper_ix", "]", "if", "upper_ix", "<", "len", "(", "dts", ")", "else", "None", "return", "lower_value", ",", "upper_value" ]
Find values in ``dts`` closest but not equal to ``dt``. Returns a pair of (last_before, first_after). When ``dt`` is less than any element in ``dts``, ``last_before`` is None. When ``dt`` is greater any element in ``dts``, ``first_after`` is None. ``dts`` must be unique and sorted in increasing order. Parameters ---------- dts : pd.DatetimeIndex Dates in which to search. dt : pd.Timestamp Date for which to find bounds.
[ "Find", "values", "in", "dts", "closest", "but", "not", "equal", "to", "dt", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L145-L192
train
Find values in dts closest but not equal to dt.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7C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XL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(479 - 431) + chr(0b11 + 0o154) + chr(0b101111 + 0o2) + '\x33' + '\x32', 46254 - 46246), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + chr(0b10010 + 0o37) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11010 + 0o27) + chr(2071 - 2019) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(1284 - 1234) + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x35' + chr(1141 - 1091), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(10266 - 10155) + chr(50) + chr(0b110110) + chr(0b10101 + 0o33), 14298 - 14290), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\157' + chr(1708 - 1659) + chr(0b110011), 41704 - 41696), ehT0Px3KOsy9(chr(1005 - 957) + chr(0b1001101 + 0o42) + '\061' + chr(0b110010) + chr(0b100 + 0o62), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + '\x31' + chr(2328 - 2278) + chr(0b1101 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\x32' + chr(942 - 894), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110001) + '\x37' + chr(52), 48520 - 48512), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b110000) + chr(55), 0o10), ehT0Px3KOsy9(chr(1643 - 1595) + chr(111) + chr(0b110010) + '\x36' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + '\064' + chr(0b110011), 46248 - 46240), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + chr(2224 - 2175), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1343 - 1294) + '\064' + chr(149 - 96), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\062' + chr(2792 - 2739), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\061' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b1111 + 0o44) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + '\x33', 38088 - 38080), ehT0Px3KOsy9(chr(1378 - 1330) + '\x6f' + chr(0b1101 + 0o45) + chr(0b101010 + 0o13) + chr(0b110001), 10617 - 10609), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\x32' + '\060', 5136 - 5128), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1120 - 1070) + chr(48) + chr(1064 - 1014), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + chr(49) + chr(2382 - 2331) + chr(1944 - 1889), 14541 - 14533), ehT0Px3KOsy9('\x30' + chr(6386 - 6275) + chr(0b110100) + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + '\062' + chr(49) + chr(2141 - 2091), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(7560 - 7449) + chr(53) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + chr(0b110000) + '\064', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b10011 + 0o36) + chr(323 - 273), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101011 + 0o104) + chr(0b100111 + 0o13) + '\063' + chr(0b11010 + 0o27), 57191 - 57183), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + '\x31' + '\x31', 0o10), ehT0Px3KOsy9('\x30' + chr(8875 - 8764) + '\061' + chr(2884 - 2829) + '\x34', 8), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\x34' + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(9220 - 9109) + '\x33' + '\x33' + chr(0b110010 + 0o5), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110110 + 0o71) + '\061' + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b101101 + 0o5) + chr(0b11 + 0o64), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b101101 + 0o10) + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000000 + 0o57) + chr(0b101101 + 0o4) + '\x36', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b111110 + 0o61) + chr(2608 - 2555) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b't'), chr(0b1100100) + '\145' + chr(1036 - 937) + chr(2432 - 2321) + chr(0b1100100) + '\x65')(chr(117) + chr(116) + '\146' + '\055' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def xGd53LkmQxoZ(f5Ww7tOW_bKL, OmU3Un949MWT): if not xafqLlk3kkUe(f5Ww7tOW_bKL, xafqLlk3kkUe(SXOLrMavuUCe(b'3y=\xa1Dp\xc1~3'), '\x64' + chr(4086 - 3985) + chr(99) + '\157' + '\144' + '\145')(chr(8812 - 8695) + chr(0b1110100) + chr(0b1100110) + chr(0b101101) + chr(56))): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'>~\x11\xf4Gl\xc3\x7fvd10\t\xe9\xdfR\\\x00'), chr(4449 - 4349) + chr(0b111011 + 0o52) + chr(99) + '\157' + chr(100) + chr(0b1100101))(chr(117) + chr(6705 - 6589) + '\146' + chr(1195 - 1150) + chr(0b111000))) if not xafqLlk3kkUe(f5Ww7tOW_bKL, xafqLlk3kkUe(SXOLrMavuUCe(b'3y=\xb9Ew\xdf\x7f9h=s#\xee\xd8@[\x004}\xb2u\xce'), chr(0b1100100) + chr(0b1100101) + chr(0b10101 + 0o116) + chr(111) + chr(3890 - 3790) + chr(4888 - 4787))(chr(117) + '\164' + chr(0b101 + 0o141) + chr(1874 - 1829) + '\070')): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'>~\x11\xf4Gl\xc3\x7fvd10\x0f\xe8\xc4WL\x01ug\xb5;\xc0\xbe\xe1-A\xeb\\\xad\xa4\xfe\xe9\x13\xd4\xbbi%'), chr(0b1100100) + chr(5620 - 5519) + chr(0b1100011) + chr(111) + '\x64' + chr(4092 - 3991))('\x75' + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\x38')) if not c2A0yzQpDQB3(f5Ww7tOW_bKL): return (None, None) nAI4UpkJyZZd = f5Ww7tOW_bKL.searchsorted(OmU3Un949MWT, side=xafqLlk3kkUe(SXOLrMavuUCe(b'6o\x04\xa0'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(1800 - 1689) + chr(100) + chr(0b1001 + 0o134))('\165' + '\x74' + '\x66' + '\x2d' + '\x38')) try: SxnZcBqPXQXc = f5Ww7tOW_bKL[nAI4UpkJyZZd] except _fsda0v2_OKU: return (f5Ww7tOW_bKL[-ehT0Px3KOsy9(chr(237 - 189) + '\157' + chr(1562 - 1513), 0o10)], None) if OmU3Un949MWT < SxnZcBqPXQXc: GeGJBxxhBTgR = nAI4UpkJyZZd - ehT0Px3KOsy9(chr(0b110000) + chr(5608 - 5497) + chr(0b10011 + 0o36), 8) FdE15V45Pp7_ = nAI4UpkJyZZd elif OmU3Un949MWT == SxnZcBqPXQXc: GeGJBxxhBTgR = nAI4UpkJyZZd - ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(4192 - 4081) + chr(387 - 338), 8) FdE15V45Pp7_ = nAI4UpkJyZZd + ehT0Px3KOsy9(chr(0b110000) + chr(0b100010 + 0o115) + chr(49), 8) else: GeGJBxxhBTgR = nAI4UpkJyZZd FdE15V45Pp7_ = nAI4UpkJyZZd + ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(232 - 183), 8) tWNVltbiogrk = f5Ww7tOW_bKL[GeGJBxxhBTgR] if GeGJBxxhBTgR >= ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\060', 45676 - 45668) else None QMMQqTDmQaG3 = f5Ww7tOW_bKL[FdE15V45Pp7_] if FdE15V45Pp7_ < c2A0yzQpDQB3(f5Ww7tOW_bKL) else None return (tWNVltbiogrk, QMMQqTDmQaG3)
quantopian/zipline
zipline/utils/pandas_utils.py
categorical_df_concat
def categorical_df_concat(df_list, inplace=False): """ Prepare list of pandas DataFrames to be used as input to pd.concat. Ensure any columns of type 'category' have the same categories across each dataframe. Parameters ---------- df_list : list List of dataframes with same columns. inplace : bool True if input list can be modified. Default is False. Returns ------- concatenated : df Dataframe of concatenated list. """ if not inplace: df_list = deepcopy(df_list) # Assert each dataframe has the same columns/dtypes df = df_list[0] if not all([(df.dtypes.equals(df_i.dtypes)) for df_i in df_list[1:]]): raise ValueError("Input DataFrames must have the same columns/dtypes.") categorical_columns = df.columns[df.dtypes == 'category'] for col in categorical_columns: new_categories = sorted( set().union( *(frame[col].cat.categories for frame in df_list) ) ) with ignore_pandas_nan_categorical_warning(): for df in df_list: df[col].cat.set_categories(new_categories, inplace=True) return pd.concat(df_list)
python
def categorical_df_concat(df_list, inplace=False): """ Prepare list of pandas DataFrames to be used as input to pd.concat. Ensure any columns of type 'category' have the same categories across each dataframe. Parameters ---------- df_list : list List of dataframes with same columns. inplace : bool True if input list can be modified. Default is False. Returns ------- concatenated : df Dataframe of concatenated list. """ if not inplace: df_list = deepcopy(df_list) # Assert each dataframe has the same columns/dtypes df = df_list[0] if not all([(df.dtypes.equals(df_i.dtypes)) for df_i in df_list[1:]]): raise ValueError("Input DataFrames must have the same columns/dtypes.") categorical_columns = df.columns[df.dtypes == 'category'] for col in categorical_columns: new_categories = sorted( set().union( *(frame[col].cat.categories for frame in df_list) ) ) with ignore_pandas_nan_categorical_warning(): for df in df_list: df[col].cat.set_categories(new_categories, inplace=True) return pd.concat(df_list)
[ "def", "categorical_df_concat", "(", "df_list", ",", "inplace", "=", "False", ")", ":", "if", "not", "inplace", ":", "df_list", "=", "deepcopy", "(", "df_list", ")", "# Assert each dataframe has the same columns/dtypes", "df", "=", "df_list", "[", "0", "]", "if", "not", "all", "(", "[", "(", "df", ".", "dtypes", ".", "equals", "(", "df_i", ".", "dtypes", ")", ")", "for", "df_i", "in", "df_list", "[", "1", ":", "]", "]", ")", ":", "raise", "ValueError", "(", "\"Input DataFrames must have the same columns/dtypes.\"", ")", "categorical_columns", "=", "df", ".", "columns", "[", "df", ".", "dtypes", "==", "'category'", "]", "for", "col", "in", "categorical_columns", ":", "new_categories", "=", "sorted", "(", "set", "(", ")", ".", "union", "(", "*", "(", "frame", "[", "col", "]", ".", "cat", ".", "categories", "for", "frame", "in", "df_list", ")", ")", ")", "with", "ignore_pandas_nan_categorical_warning", "(", ")", ":", "for", "df", "in", "df_list", ":", "df", "[", "col", "]", ".", "cat", ".", "set_categories", "(", "new_categories", ",", "inplace", "=", "True", ")", "return", "pd", ".", "concat", "(", "df_list", ")" ]
Prepare list of pandas DataFrames to be used as input to pd.concat. Ensure any columns of type 'category' have the same categories across each dataframe. Parameters ---------- df_list : list List of dataframes with same columns. inplace : bool True if input list can be modified. Default is False. Returns ------- concatenated : df Dataframe of concatenated list.
[ "Prepare", "list", "of", "pandas", "DataFrames", "to", "be", "used", "as", "input", "to", "pd", ".", "concat", ".", "Ensure", "any", "columns", "of", "type", "category", "have", "the", "same", "categories", "across", "each", "dataframe", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L247-L287
train
Concatenate a list of pandas DataFrames with categorical columns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthx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,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(315 - 267) + '\157' + chr(0b11101 + 0o24) + chr(0b10010 + 0o43) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1213 - 1159) + '\x37', 50596 - 50588), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(0b110001) + chr(0b110101) + chr(0b110010), 21198 - 21190), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + '\062' + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(265 - 154) + chr(49) + chr(2153 - 2102) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b101111 + 0o1) + '\x6f' + '\063' + '\x37' + chr(0b11111 + 0o27), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(55) + chr(0b11100 + 0o27), 45762 - 45754), ehT0Px3KOsy9(chr(1476 - 1428) + '\157' + chr(0b110000 + 0o1) + '\061' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(49) + chr(0b110011), 34640 - 34632), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(53), 6570 - 6562), ehT0Px3KOsy9('\060' + chr(6252 - 6141) + chr(49) + '\065' + chr(53), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1111 + 0o43) + chr(105 - 53) + '\x30', 27943 - 27935), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1011100 + 0o23) + '\061' + chr(53) + chr(1572 - 1523), 0o10), ehT0Px3KOsy9('\x30' + chr(6802 - 6691) + chr(0b1110 + 0o45) + chr(0b0 + 0o67) + chr(50), 35783 - 35775), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1734 - 1685) + chr(0b110000) + chr(0b11111 + 0o30), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101011 + 0o4) + chr(0b101101 + 0o6) + chr(48) + '\062', 50711 - 50703), ehT0Px3KOsy9(chr(0b110000) + chr(2530 - 2419) + '\x33' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(816 - 768) + '\157' + chr(1092 - 1041) + chr(55) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2197 - 2145) + chr(1014 - 960), 0b1000), ehT0Px3KOsy9(chr(1131 - 1083) + '\157' + chr(0b100010 + 0o20) + chr(0b110101) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(158 - 110) + '\157' + chr(51) + chr(765 - 716) + chr(1074 - 1021), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1010101 + 0o32) + '\x31', 41478 - 41470), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1100100 + 0o13) + '\x32' + chr(61 - 10) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1856 - 1808) + chr(0b1101111) + chr(872 - 821) + chr(0b110011) + chr(55), 0o10), ehT0Px3KOsy9(chr(2184 - 2136) + chr(0b1001010 + 0o45) + '\061' + chr(586 - 534) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1964 - 1916) + '\157' + '\061' + '\x30' + chr(272 - 221), 10518 - 10510), ehT0Px3KOsy9('\x30' + chr(3509 - 3398) + chr(1953 - 1902) + '\066' + chr(0b110110), 10412 - 10404), ehT0Px3KOsy9('\060' + chr(7553 - 7442) + '\x33' + chr(0b100 + 0o54) + chr(0b100100 + 0o17), 17861 - 17853), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(2539 - 2486) + chr(1940 - 1891), 0o10), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\062' + chr(0b1010 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(0b100011 + 0o16) + chr(49), 8), ehT0Px3KOsy9('\060' + '\157' + '\x32' + chr(55) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b111 + 0o52) + chr(0b110011) + chr(50), 0o10), ehT0Px3KOsy9(chr(491 - 443) + chr(0b111001 + 0o66) + chr(2087 - 2037) + chr(0b110001) + chr(0b110011), 62413 - 62405), ehT0Px3KOsy9('\060' + chr(2133 - 2022) + '\x31' + '\067' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(0b10011 + 0o36) + chr(2639 - 2586) + chr(0b11 + 0o60), 0o10), ehT0Px3KOsy9('\060' + chr(1317 - 1206) + '\x33' + '\x36' + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(52) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\067' + chr(2159 - 2109), 8), ehT0Px3KOsy9(chr(842 - 794) + chr(12235 - 12124) + '\x33' + chr(51) + chr(779 - 729), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(0b110001 + 0o4) + '\x30', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'C'), chr(0b1010101 + 0o17) + chr(0b1100101) + '\x63' + '\157' + chr(1037 - 937) + '\145')('\165' + chr(116) + chr(0b1100110) + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def pPePn3tfRvbw(Ap5Ts1nna41y, KhzrMpzISODo=ehT0Px3KOsy9(chr(48 - 0) + chr(0b1000000 + 0o57) + '\x30', 0o10)): if not KhzrMpzISODo: Ap5Ts1nna41y = GUxGQElCEOAD(Ap5Ts1nna41y) aVhM9WzaWXU5 = Ap5Ts1nna41y[ehT0Px3KOsy9(chr(0b110000) + chr(0b100101 + 0o112) + '\x30', 8)] if not Dl48nj1rbi23([xafqLlk3kkUe(aVhM9WzaWXU5.dtypes, xafqLlk3kkUe(SXOLrMavuUCe(b'\x08F\x1fu7\x8d'), chr(0b1100100) + chr(101) + '\143' + '\157' + chr(0b1100100) + chr(0b111010 + 0o53))(chr(117) + chr(116) + chr(0b1101 + 0o131) + chr(45) + chr(0b111000)))(xafqLlk3kkUe(lNyX5dlzJ27O, xafqLlk3kkUe(SXOLrMavuUCe(b'\tC\x13d>\x8d'), '\144' + chr(0b1011110 + 0o7) + chr(5601 - 5502) + chr(0b1101111) + chr(100) + '\x65')('\x75' + '\x74' + '\146' + chr(0b101101) + chr(0b111000)))) for lNyX5dlzJ27O in Ap5Ts1nna41y[ehT0Px3KOsy9('\x30' + chr(111) + chr(2169 - 2120), 8):]]): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'$Y\x1aa/\xde\xff(?D+\xd2\x08\x97"\xb1:\x93S\xde\xb9!\xf7\xbe\x12&\xd6\xb7\x81ti\xcd;\xe6\x1bK\x92\xcb\x96\xaf\x00Y\x19;?\x8a\xc29.VC'), chr(0b1000010 + 0o42) + chr(0b1100101) + '\x63' + '\x6f' + chr(0b1100100) + chr(0b1110 + 0o127))(chr(11281 - 11164) + chr(116) + chr(0b1100100 + 0o2) + '\055' + chr(56))) olB8asKya53Y = aVhM9WzaWXU5.qKlXBtn3PKy4[aVhM9WzaWXU5.dtypes == xafqLlk3kkUe(SXOLrMavuUCe(b'\x0eV\x1eq<\x91\xc90'), chr(0b1100100) + chr(0b1001111 + 0o26) + chr(4918 - 4819) + chr(3315 - 3204) + chr(0b1100100) + '\145')(chr(0b1101111 + 0o6) + '\x74' + '\146' + '\055' + chr(0b11010 + 0o36))] for Qa2uSJqQPT3w in olB8asKya53Y: QVK8u7RnAnpO = vUlqIvNSaRMa(MVEN8G6CxlvR().ImVX4ET3vKwG(*(C4IqNNmLfHXB[Qa2uSJqQPT3w].cat.mZZDAT49UzAb for C4IqNNmLfHXB in Ap5Ts1nna41y))) with tUe9mJOVWKTU(): for aVhM9WzaWXU5 in Ap5Ts1nna41y: xafqLlk3kkUe(aVhM9WzaWXU5[Qa2uSJqQPT3w].cat, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1eR\x1eK8\x9f\xcf,,J\x1f\xc9\x0c\x89'), '\144' + chr(101) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(101))('\165' + chr(8620 - 8504) + chr(0b1101 + 0o131) + '\055' + chr(2747 - 2691)))(QVK8u7RnAnpO, inplace=ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + '\x31', 8)) return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\x0eX\x04w:\x8a'), '\x64' + chr(640 - 539) + chr(0b1100011) + '\157' + '\144' + chr(0b1011000 + 0o15))('\x75' + '\164' + chr(0b1010001 + 0o25) + chr(0b101101) + chr(0b111000)))(Ap5Ts1nna41y)
quantopian/zipline
zipline/utils/pandas_utils.py
check_indexes_all_same
def check_indexes_all_same(indexes, message="Indexes are not equal."): """Check that a list of Index objects are all equal. Parameters ---------- indexes : iterable[pd.Index] Iterable of indexes to check. Raises ------ ValueError If the indexes are not all the same. """ iterator = iter(indexes) first = next(iterator) for other in iterator: same = (first == other) if not same.all(): bad_loc = np.flatnonzero(~same)[0] raise ValueError( "{}\nFirst difference is at index {}: " "{} != {}".format( message, bad_loc, first[bad_loc], other[bad_loc] ), )
python
def check_indexes_all_same(indexes, message="Indexes are not equal."): """Check that a list of Index objects are all equal. Parameters ---------- indexes : iterable[pd.Index] Iterable of indexes to check. Raises ------ ValueError If the indexes are not all the same. """ iterator = iter(indexes) first = next(iterator) for other in iterator: same = (first == other) if not same.all(): bad_loc = np.flatnonzero(~same)[0] raise ValueError( "{}\nFirst difference is at index {}: " "{} != {}".format( message, bad_loc, first[bad_loc], other[bad_loc] ), )
[ "def", "check_indexes_all_same", "(", "indexes", ",", "message", "=", "\"Indexes are not equal.\"", ")", ":", "iterator", "=", "iter", "(", "indexes", ")", "first", "=", "next", "(", "iterator", ")", "for", "other", "in", "iterator", ":", "same", "=", "(", "first", "==", "other", ")", "if", "not", "same", ".", "all", "(", ")", ":", "bad_loc", "=", "np", ".", "flatnonzero", "(", "~", "same", ")", "[", "0", "]", "raise", "ValueError", "(", "\"{}\\nFirst difference is at index {}: \"", "\"{} != {}\"", ".", "format", "(", "message", ",", "bad_loc", ",", "first", "[", "bad_loc", "]", ",", "other", "[", "bad_loc", "]", ")", ",", ")" ]
Check that a list of Index objects are all equal. Parameters ---------- indexes : iterable[pd.Index] Iterable of indexes to check. Raises ------ ValueError If the indexes are not all the same.
[ "Check", "that", "a", "list", "of", "Index", "objects", "are", "all", "equal", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L325-L349
train
Checks that a list of Index objects are all equal.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHO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w68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1291 - 1240) + '\x34' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(6778 - 6667) + chr(50) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(1865 - 1817) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b110111) + chr(0b1000 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(316 - 266) + chr(504 - 455) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b110110) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(1024 - 913) + '\061' + chr(0b110000) + chr(0b0 + 0o60), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + '\x33' + chr(0b11011 + 0o30), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + '\x36' + chr(0b1101 + 0o45), ord("\x08")), ehT0Px3KOsy9('\060' + chr(1376 - 1265) + '\x33' + chr(0b100101 + 0o21) + chr(0b10 + 0o62), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(858 - 810) + '\x6f' + chr(50) + chr(55) + chr(0b100000 + 0o22), 0o10), ehT0Px3KOsy9(chr(1025 - 977) + chr(111) + chr(49) + '\x31' + chr(0b110011), 54596 - 54588), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(437 - 387) + chr(48) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1011 + 0o46) + '\x36' + chr(0b10 + 0o60), 0b1000), ehT0Px3KOsy9(chr(48) + chr(6737 - 6626) + '\062' + chr(1563 - 1513) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(0b1100 + 0o50) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(556 - 507) + '\x30' + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(249 - 198) + chr(48) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + '\x34' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(1798 - 1747) + chr(1068 - 1016) + '\x33', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(2008 - 1958) + '\064' + chr(50), 55497 - 55489), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(52) + '\x33', 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(0b110011) + chr(0b10101 + 0o37) + chr(1387 - 1337), 8), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b100110 + 0o111) + chr(49) + '\x33' + '\064', 21825 - 21817), ehT0Px3KOsy9('\060' + chr(8824 - 8713) + chr(1604 - 1553) + chr(1264 - 1213) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + chr(50) + '\062' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + chr(49) + '\060' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(50) + chr(0b11111 + 0o25), 56868 - 56860), ehT0Px3KOsy9(chr(48) + chr(5403 - 5292) + chr(0b110010) + '\x30' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(0b101110 + 0o6) + chr(688 - 640), 27113 - 27105), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(352 - 297) + chr(215 - 165), 17734 - 17726), ehT0Px3KOsy9(chr(829 - 781) + chr(111) + chr(54) + chr(0b110000), 53275 - 53267), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1 + 0o60) + chr(55) + '\x31', 4444 - 4436), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\060' + chr(1733 - 1678), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(52) + chr(51), 53714 - 53706), ehT0Px3KOsy9(chr(48) + chr(0b1011100 + 0o23) + '\x36' + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b1010 + 0o46) + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1437 - 1383), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(0b10010 + 0o43) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xcc'), '\x64' + chr(0b1100101) + chr(0b1000000 + 0o43) + '\x6f' + chr(5692 - 5592) + '\x65')(chr(0b1110101) + '\164' + '\146' + chr(0b11001 + 0o24) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Ab2m0tPhm58G(AjrnLNzw5Jx9, R2mbIkZzeu1B=xafqLlk3kkUe(SXOLrMavuUCe(b'\xaby#\xdc\xf3\x163\xbb\xd3\x86a\x9a%\xea\x06\xb4\x025\xb7@\x8f\x8c'), chr(2226 - 2126) + '\145' + chr(99) + chr(0b1101111) + '\x64' + '\145')(chr(0b1110101) + chr(8637 - 8521) + chr(0b1100110) + chr(0b100110 + 0o7) + chr(56))): qS80gn7HOKhx = ZdP978XkGspL(AjrnLNzw5Jx9) It1LJs8swHZQ = nSwwHEeM4cxI(qS80gn7HOKhx) for KK0ERS7DqYrY in qS80gn7HOKhx: UUoRswg4OYYo = It1LJs8swHZQ == KK0ERS7DqYrY if not xafqLlk3kkUe(UUoRswg4OYYo, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6{s\x81\xe5\x19q\xe9\xd0\x9d6\x89'), chr(0b11000 + 0o114) + chr(0b101011 + 0o72) + chr(0b1100011) + chr(0b1000011 + 0o54) + chr(6654 - 6554) + '\x65')('\x75' + chr(116) + chr(4319 - 4217) + chr(0b10110 + 0o27) + '\070'))(): HTDNVs_w9phs = WqUC3KWvYVup.flatnonzero(~UUoRswg4OYYo)[ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(48), ord("\x08"))] raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x99jM\xff\xe2\x013\xef\x92\x90m\xdc-\xe0\x00\xf1\t\'\xa7\x01\x8a\xd1\xc3\x83(\xfbl\xfd"1\xfb\x80\x81MC\xe7\x18N\xe5\'\xdf7<\xc4'), '\x64' + '\145' + chr(0b1100011) + chr(0b1101111) + '\x64' + '\x65')(chr(0b1110101) + chr(0b1101110 + 0o6) + chr(102) + chr(178 - 133) + chr(0b110000 + 0o10)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xb4#5\xd6\xc3\x12\x13\xa8\xe2\x84a\xd0'), chr(0b1100100) + chr(101) + chr(99) + chr(7927 - 7816) + '\144' + '\x65')(chr(0b1110101) + chr(116) + chr(0b11010 + 0o114) + chr(0b101101) + '\x38'))(R2mbIkZzeu1B, HTDNVs_w9phs, It1LJs8swHZQ[HTDNVs_w9phs], KK0ERS7DqYrY[HTDNVs_w9phs]))
quantopian/zipline
zipline/pipeline/loaders/events.py
required_event_fields
def required_event_fields(next_value_columns, previous_value_columns): """ Compute the set of resource columns required to serve ``next_value_columns`` and ``previous_value_columns``. """ # These metadata columns are used to align event indexers. return { TS_FIELD_NAME, SID_FIELD_NAME, EVENT_DATE_FIELD_NAME, }.union( # We also expect any of the field names that our loadable columns # are mapped to. viewvalues(next_value_columns), viewvalues(previous_value_columns), )
python
def required_event_fields(next_value_columns, previous_value_columns): """ Compute the set of resource columns required to serve ``next_value_columns`` and ``previous_value_columns``. """ # These metadata columns are used to align event indexers. return { TS_FIELD_NAME, SID_FIELD_NAME, EVENT_DATE_FIELD_NAME, }.union( # We also expect any of the field names that our loadable columns # are mapped to. viewvalues(next_value_columns), viewvalues(previous_value_columns), )
[ "def", "required_event_fields", "(", "next_value_columns", ",", "previous_value_columns", ")", ":", "# These metadata columns are used to align event indexers.", "return", "{", "TS_FIELD_NAME", ",", "SID_FIELD_NAME", ",", "EVENT_DATE_FIELD_NAME", ",", "}", ".", "union", "(", "# We also expect any of the field names that our loadable columns", "# are mapped to.", "viewvalues", "(", "next_value_columns", ")", ",", "viewvalues", "(", "previous_value_columns", ")", ",", ")" ]
Compute the set of resource columns required to serve ``next_value_columns`` and ``previous_value_columns``.
[ "Compute", "the", "set", "of", "resource", "columns", "required", "to", "serve", "next_value_columns", "and", "previous_value_columns", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/events.py#L21-L36
train
Compute the set of resource columns required to serve the event indexers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,y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O3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110111) + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(7920 - 7809) + '\063' + chr(0b11101 + 0o27), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b110101) + chr(0b110011 + 0o2), 30287 - 30279), ehT0Px3KOsy9('\x30' + chr(0b101 + 0o152) + chr(0b110010) + chr(0b101101 + 0o4) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1189 - 1078) + chr(51) + chr(0b110010) + chr(52), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b100100 + 0o22) + chr(50), 56189 - 56181), ehT0Px3KOsy9('\060' + chr(11573 - 11462) + '\x31' + '\x30' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + '\063' + chr(0b11100 + 0o31) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3153 - 3042) + chr(50) + chr(51) + chr(1640 - 1585), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1000101 + 0o52) + chr(0b110110) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(0b110010) + chr(0b110101) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10010 + 0o37) + chr(0b101100 + 0o10) + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(53) + chr(1821 - 1769), 52329 - 52321), ehT0Px3KOsy9(chr(1808 - 1760) + '\x6f' + '\x32' + '\x33' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(54) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11110 + 0o26) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b11000 + 0o36) + chr(0b11000 + 0o32), 54334 - 54326), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + '\063' + chr(1756 - 1707), 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + '\157' + chr(0b110010) + '\064' + chr(156 - 103), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(772 - 722), 4522 - 4514), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1100101 + 0o12) + chr(0b100010 + 0o20) + chr(0b1011 + 0o47) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b110101) + chr(0b10101 + 0o40), 28441 - 28433), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + '\x31' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(50) + '\x30' + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\157' + chr(1178 - 1127) + chr(50), 8), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(111) + '\062' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(2016 - 1968) + chr(111) + '\067' + chr(0b100010 + 0o21), 8), ehT0Px3KOsy9(chr(48) + chr(3774 - 3663) + chr(0b110001) + chr(0b0 + 0o62), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110000 + 0o1) + '\065' + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(192 - 141) + '\060' + '\060', 40103 - 40095), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(0b110111) + chr(0b11100 + 0o26), 30628 - 30620), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b110001) + chr(1128 - 1078), 26245 - 26237), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + '\x33' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\x31' + chr(0b0 + 0o67) + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1011 + 0o46) + chr(53) + '\062', 7334 - 7326), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(1274 - 1221) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1633 - 1585) + chr(111) + '\063' + chr(855 - 804) + chr(0b110 + 0o54), 30391 - 30383), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(1972 - 1861) + chr(2471 - 2421) + '\x34' + chr(0b110110), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\065' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x15'), chr(3415 - 3315) + chr(0b1100101) + '\143' + '\x6f' + chr(0b1100100) + chr(0b1100101 + 0o0))(chr(0b1110101) + chr(4754 - 4638) + chr(102) + chr(954 - 909) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Hxo4PF0lpVDK(SZ8ymhwla19C, XTYFdIEmcIbX): return xafqLlk3kkUe({JJJdkkmgUz5m, w7OgnUPP5JMd, mICGquiP0k1w}, xafqLlk3kkUe(SXOLrMavuUCe(b'rq\xfb\xd5\xe0\xb7\x12\xdc\xe9z\xde#'), '\144' + chr(0b110110 + 0o57) + '\x63' + chr(0b1001111 + 0o40) + chr(100) + chr(101))('\165' + chr(6213 - 6097) + chr(102) + chr(0b101101) + chr(56)))(OW4HFecz1tS1(SZ8ymhwla19C), OW4HFecz1tS1(XTYFdIEmcIbX))
quantopian/zipline
zipline/pipeline/loaders/events.py
validate_column_specs
def validate_column_specs(events, next_value_columns, previous_value_columns): """ Verify that the columns of ``events`` can be used by an EventsLoader to serve the BoundColumns described by ``next_value_columns`` and ``previous_value_columns``. """ required = required_event_fields(next_value_columns, previous_value_columns) received = set(events.columns) missing = required - received if missing: raise ValueError( "EventsLoader missing required columns {missing}.\n" "Got Columns: {received}\n" "Expected Columns: {required}".format( missing=sorted(missing), received=sorted(received), required=sorted(required), ) )
python
def validate_column_specs(events, next_value_columns, previous_value_columns): """ Verify that the columns of ``events`` can be used by an EventsLoader to serve the BoundColumns described by ``next_value_columns`` and ``previous_value_columns``. """ required = required_event_fields(next_value_columns, previous_value_columns) received = set(events.columns) missing = required - received if missing: raise ValueError( "EventsLoader missing required columns {missing}.\n" "Got Columns: {received}\n" "Expected Columns: {required}".format( missing=sorted(missing), received=sorted(received), required=sorted(required), ) )
[ "def", "validate_column_specs", "(", "events", ",", "next_value_columns", ",", "previous_value_columns", ")", ":", "required", "=", "required_event_fields", "(", "next_value_columns", ",", "previous_value_columns", ")", "received", "=", "set", "(", "events", ".", "columns", ")", "missing", "=", "required", "-", "received", "if", "missing", ":", "raise", "ValueError", "(", "\"EventsLoader missing required columns {missing}.\\n\"", "\"Got Columns: {received}\\n\"", "\"Expected Columns: {required}\"", ".", "format", "(", "missing", "=", "sorted", "(", "missing", ")", ",", "received", "=", "sorted", "(", "received", ")", ",", "required", "=", "sorted", "(", "required", ")", ",", ")", ")" ]
Verify that the columns of ``events`` can be used by an EventsLoader to serve the BoundColumns described by ``next_value_columns`` and ``previous_value_columns``.
[ "Verify", "that", "the", "columns", "of", "events", "can", "be", "used", "by", "an", "EventsLoader", "to", "serve", "the", "BoundColumns", "described", "by", "next_value_columns", "and", "previous_value_columns", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/events.py#L39-L58
train
Validate that the columns of events are valid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTr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ZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(275 - 227) + chr(0b1101111) + '\061' + chr(1244 - 1196) + chr(0b100000 + 0o24), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + '\067', 0o10), ehT0Px3KOsy9(chr(336 - 288) + chr(0b1101111) + '\x32' + '\x34' + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111100 + 0o63) + chr(0b110011) + chr(2011 - 1956) + chr(2691 - 2639), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + '\061' + chr(0b11010 + 0o27) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(304 - 255) + chr(1772 - 1719) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(6516 - 6405) + chr(0b110001) + chr(0b110110), 34390 - 34382), ehT0Px3KOsy9('\x30' + chr(0b1010001 + 0o36) + chr(1533 - 1482) + chr(1133 - 1080) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(1610 - 1562) + '\x6f' + chr(0b110001) + chr(54) + '\x35', 56137 - 56129), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(2462 - 2351) + chr(587 - 537) + '\062' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + '\063' + chr(0b1100 + 0o44), ord("\x08")), ehT0Px3KOsy9(chr(401 - 353) + '\x6f' + chr(55) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1010110 + 0o31) + chr(0b110010) + '\061' + chr(0b11101 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(48) + chr(0b11100 + 0o31), 0o10), ehT0Px3KOsy9(chr(1628 - 1580) + chr(11732 - 11621) + chr(0b1101 + 0o46) + chr(50), 0o10), ehT0Px3KOsy9(chr(1720 - 1672) + chr(267 - 156) + '\062' + chr(1088 - 1034) + '\x31', 63091 - 63083), ehT0Px3KOsy9(chr(2255 - 2207) + chr(3999 - 3888) + chr(1467 - 1416) + chr(0b101111 + 0o4) + chr(0b101 + 0o55), 41667 - 41659), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1100 + 0o45) + chr(1053 - 1005) + chr(55), 35820 - 35812), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x35' + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110100 + 0o3) + chr(1162 - 1114), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110001) + chr(0b110011) + chr(0b110000 + 0o1), 52666 - 52658), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110100) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001 + 0o0) + '\x36' + chr(2101 - 2047), 17497 - 17489), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + chr(1805 - 1755) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(9606 - 9495) + '\x33' + chr(53) + chr(0b11110 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(257 - 209) + chr(0b110010 + 0o75) + chr(0b1001 + 0o51) + chr(0b110100) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(825 - 777) + chr(111) + chr(0b1101 + 0o45) + '\x34' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\x6f' + chr(0b110010) + chr(0b110110) + chr(0b110001), 8), ehT0Px3KOsy9(chr(0b110000) + chr(4991 - 4880) + chr(51) + '\067' + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11100 + 0o123) + chr(51) + '\x36', 878 - 870), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1100 + 0o143) + chr(0b110001), 58100 - 58092), ehT0Px3KOsy9('\060' + chr(111) + chr(0b1001 + 0o52) + chr(2154 - 2104) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1045 - 997) + chr(0b1101111) + chr(50) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(4443 - 4332) + '\x32' + chr(55) + chr(1466 - 1414), 31350 - 31342), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + chr(0b10 + 0o64) + chr(0b110011), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + '\060' + chr(0b10001 + 0o40), 36437 - 36429), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\x33' + '\062' + chr(51), 35015 - 35007), ehT0Px3KOsy9(chr(318 - 270) + chr(111) + chr(0b100101 + 0o16) + chr(0b110010) + chr(942 - 892), ord("\x08")), ehT0Px3KOsy9(chr(569 - 521) + chr(0b11110 + 0o121) + chr(0b10111 + 0o33) + chr(53) + chr(0b1111 + 0o44), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(2235 - 2187) + chr(1242 - 1194), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b111101 + 0o62) + chr(0b10101 + 0o40) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'j'), chr(8231 - 8131) + '\x65' + '\143' + chr(8141 - 8030) + '\144' + '\x65')(chr(8326 - 8209) + '\x74' + chr(0b1100110) + chr(1682 - 1637) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def fqqMjWRgfh2m(Yvpk8VHZJdyk, SZ8ymhwla19C, XTYFdIEmcIbX): z8EjpoYOeMAd = Hxo4PF0lpVDK(SZ8ymhwla19C, XTYFdIEmcIbX) G4A8883iMrco = MVEN8G6CxlvR(Yvpk8VHZJdyk.qKlXBtn3PKy4) XO3DPCTKfaWs = z8EjpoYOeMAd - G4A8883iMrco if XO3DPCTKfaWs: raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x01Y\xc0\x929\x19B\x81\x14\xf7}L\xaa(s\xc2\xa9.\x83\x9fyT\x13\xa4\x9e\xcf\xd5\xd4\x9d>b\xbe}\xc9\xde/\xa0\xf2\xd0\xad-\\\xd6\x95#\rs\xc0\x7f\xd4wJ\xaa\x06u\xdd\xaf*\x83\x8bc\x06\r\xa7\x8e\xc5\xc2\xd8\x8f{e\xac\x1b\xf9\xcb1\xb6\xb1\xdf\xa5 \x0f\xe6\x93!\x1fc\x80\x06\xa98E\xf8 k\xc4\xb35\x88\x9c$'), chr(0b1100100) + '\x65' + chr(2712 - 2613) + '\157' + chr(0b1100100) + chr(0b1011011 + 0o12))(chr(0b1110101) + chr(0b1100000 + 0o24) + '\146' + chr(0b100111 + 0o6) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\x1b\xd7\x93\x05\x0b]\xdd%\xe3}T'), chr(3962 - 3862) + chr(2351 - 2250) + '\143' + '\157' + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(45) + '\070'))(missing=vUlqIvNSaRMa(XO3DPCTKfaWs), received=vUlqIvNSaRMa(G4A8883iMrco), required=vUlqIvNSaRMa(z8EjpoYOeMAd)))
quantopian/zipline
zipline/pipeline/loaders/events.py
EventsLoader.split_next_and_previous_event_columns
def split_next_and_previous_event_columns(self, requested_columns): """ Split requested columns into columns that should load the next known value and columns that should load the previous known value. Parameters ---------- requested_columns : iterable[BoundColumn] Returns ------- next_cols, previous_cols : iterable[BoundColumn], iterable[BoundColumn] ``requested_columns``, partitioned into sub-sequences based on whether the column should produce values from the next event or the previous event """ def next_or_previous(c): if c in self.next_value_columns: return 'next' elif c in self.previous_value_columns: return 'previous' raise ValueError( "{c} not found in next_value_columns " "or previous_value_columns".format(c=c) ) groups = groupby(next_or_previous, requested_columns) return groups.get('next', ()), groups.get('previous', ())
python
def split_next_and_previous_event_columns(self, requested_columns): """ Split requested columns into columns that should load the next known value and columns that should load the previous known value. Parameters ---------- requested_columns : iterable[BoundColumn] Returns ------- next_cols, previous_cols : iterable[BoundColumn], iterable[BoundColumn] ``requested_columns``, partitioned into sub-sequences based on whether the column should produce values from the next event or the previous event """ def next_or_previous(c): if c in self.next_value_columns: return 'next' elif c in self.previous_value_columns: return 'previous' raise ValueError( "{c} not found in next_value_columns " "or previous_value_columns".format(c=c) ) groups = groupby(next_or_previous, requested_columns) return groups.get('next', ()), groups.get('previous', ())
[ "def", "split_next_and_previous_event_columns", "(", "self", ",", "requested_columns", ")", ":", "def", "next_or_previous", "(", "c", ")", ":", "if", "c", "in", "self", ".", "next_value_columns", ":", "return", "'next'", "elif", "c", "in", "self", ".", "previous_value_columns", ":", "return", "'previous'", "raise", "ValueError", "(", "\"{c} not found in next_value_columns \"", "\"or previous_value_columns\"", ".", "format", "(", "c", "=", "c", ")", ")", "groups", "=", "groupby", "(", "next_or_previous", ",", "requested_columns", ")", "return", "groups", ".", "get", "(", "'next'", ",", "(", ")", ")", ",", "groups", ".", "get", "(", "'previous'", ",", "(", ")", ")" ]
Split requested columns into columns that should load the next known value and columns that should load the previous known value. Parameters ---------- requested_columns : iterable[BoundColumn] Returns ------- next_cols, previous_cols : iterable[BoundColumn], iterable[BoundColumn] ``requested_columns``, partitioned into sub-sequences based on whether the column should produce values from the next event or the previous event
[ "Split", "requested", "columns", "into", "columns", "that", "should", "load", "the", "next", "known", "value", "and", "columns", "that", "should", "load", "the", "previous", "known", "value", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/loaders/events.py#L119-L146
train
Split requested_columns into next and previous event columns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ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2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + '\x31' + '\062' + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(0b110001) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(55) + chr(0b1111 + 0o42), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\x33' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\064' + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(7083 - 6972) + '\x36' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + '\061' + chr(0b110 + 0o52), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(50) + chr(0b110110) + '\x34', 46985 - 46977), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + chr(2480 - 2428) + chr(2148 - 2097), 0o10), ehT0Px3KOsy9(chr(48) + chr(321 - 210) + '\x34' + chr(0b101110 + 0o3), 0b1000), ehT0Px3KOsy9('\060' + chr(10800 - 10689) + chr(2422 - 2371) + chr(0b110010) + chr(985 - 930), 15369 - 15361), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101 + 0o55) + '\066', 49436 - 49428), ehT0Px3KOsy9('\060' + chr(0b1001 + 0o146) + chr(2080 - 2030) + '\067' + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b101000 + 0o13) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x37' + '\065', 61297 - 61289), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b11100 + 0o123) + '\063' + chr(51) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(0b1111 + 0o46) + chr(894 - 846), 2121 - 2113), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(634 - 582) + chr(1291 - 1240), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(933 - 882) + chr(0b110010) + '\060', 24427 - 24419), ehT0Px3KOsy9(chr(48) + chr(7118 - 7007) + chr(78 - 28) + '\067' + chr(1081 - 1028), 0o10), ehT0Px3KOsy9(chr(625 - 577) + chr(3259 - 3148) + '\x33' + '\060' + chr(0b111 + 0o54), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x32' + chr(53) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(0b101000 + 0o15) + chr(0b110000 + 0o0), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(0b0 + 0o61) + chr(0b110001) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\x32' + '\061', 9855 - 9847), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110101) + '\x34', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\061', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\067', 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(9400 - 9289) + chr(0b110010) + chr(51) + chr(0b110101 + 0o2), ord("\x08")), ehT0Px3KOsy9(chr(2167 - 2119) + '\x6f' + chr(50) + chr(0b1100 + 0o52) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b101110 + 0o101) + '\x31' + chr(1085 - 1035) + '\x34', 52196 - 52188), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(48) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(1344 - 1296) + chr(0b110111 + 0o70) + '\062' + chr(0b110000) + chr(0b101110 + 0o5), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110011), 8), ehT0Px3KOsy9('\060' + chr(0b100010 + 0o115) + '\x31' + chr(52) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1100011 + 0o14) + chr(0b110011) + '\x33' + chr(0b110000), 45585 - 45577), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(1069 - 1018) + chr(54) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + '\064' + chr(1121 - 1072), 8), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(0b110010) + chr(0b11100 + 0o31) + chr(0b110110), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(0b110101) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'y'), chr(8673 - 8573) + chr(10178 - 10077) + '\143' + chr(2778 - 2667) + '\x64' + '\145')(chr(0b1101100 + 0o11) + '\164' + chr(102) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def SwTaSQmPRJV9(oVre8I6UXc3b, JwcrctAXA3zi): def mAZZKLu0w01C(qzn1Ctg9WgNh): if qzn1Ctg9WgNh in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'9*A,}D\xa9\xd8VD\x88u\xd65H\xb2FP'), '\x64' + chr(101) + chr(99) + '\157' + chr(0b110000 + 0o64) + chr(0b110111 + 0o56))('\165' + chr(116) + chr(6331 - 6229) + chr(1894 - 1849) + chr(300 - 244))): return xafqLlk3kkUe(SXOLrMavuUCe(b'9*A,'), chr(1723 - 1623) + chr(0b1100101) + chr(9680 - 9581) + chr(3337 - 3226) + chr(100) + '\x65')(chr(117) + chr(11223 - 11107) + chr(102) + '\055' + chr(0b10110 + 0o42)) elif qzn1Ctg9WgNh in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"'=\\.K]\xbd\xc7|W\xb6z\xcc<b\xbcGO\xa5\xd0\xad\xde"), chr(6600 - 6500) + chr(0b1010 + 0o133) + '\x63' + chr(140 - 29) + chr(697 - 597) + chr(0b1000110 + 0o37))(chr(8908 - 8791) + chr(0b1010001 + 0o43) + chr(102) + '\055' + '\x38')): return xafqLlk3kkUe(SXOLrMavuUCe(b"'=\\.K]\xbd\xc7"), '\x64' + chr(0b1100101) + '\143' + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(117) + chr(0b110010 + 0o102) + '\146' + '\055' + '\070') raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b',,DxL]\xbc\x94EN\xa2x\xddyT\xb1\x08M\xb5\xc5\xb7\xf2^,\xfd\x19|P\xfc\xdc82v\xedhD\xb7\x86\x01\xde%*O1MG\xbb\xebU@\xbbc\xdc\x06^\xb0DV\xbd\xd3\xb0'), chr(0b1100100) + '\x65' + chr(1099 - 1000) + chr(111) + chr(0b1001001 + 0o33) + '\x65')('\165' + chr(0b1110100) + chr(102) + chr(45) + chr(468 - 412)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x01{K7jS\x9b\x87sQ\xb2|'), chr(0b11101 + 0o107) + chr(2925 - 2824) + chr(0b1100011) + chr(0b1101111) + '\144' + chr(7637 - 7536))('\165' + chr(10182 - 10066) + '\146' + chr(1076 - 1031) + chr(2456 - 2400)))(c=qzn1Ctg9WgNh)) _kYt8hUq51WB = MRtOn47tdSTy(mAZZKLu0w01C, JwcrctAXA3zi) return (xafqLlk3kkUe(_kYt8hUq51WB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x06w[mwK\xbc\xf5\x13W\xa6^'), '\x64' + chr(101) + '\x63' + chr(0b1101111) + chr(100) + chr(0b11111 + 0o106))('\x75' + '\164' + '\146' + '\055' + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'9*A,'), chr(100) + '\x65' + chr(0b110001 + 0o62) + '\x6f' + chr(0b110000 + 0o64) + chr(0b100000 + 0o105))(chr(117) + chr(116) + chr(1951 - 1849) + chr(0b10111 + 0o26) + chr(2269 - 2213)), ()), xafqLlk3kkUe(_kYt8hUq51WB, xafqLlk3kkUe(SXOLrMavuUCe(b'\x06w[mwK\xbc\xf5\x13W\xa6^'), '\x64' + chr(9925 - 9824) + chr(0b1100011) + chr(111) + '\144' + chr(2668 - 2567))(chr(0b1110101) + '\x74' + chr(0b1011 + 0o133) + '\055' + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b"'=\\.K]\xbd\xc7"), chr(100) + '\x65' + '\143' + '\157' + '\144' + chr(101))(chr(117) + '\164' + chr(0b1100110) + '\055' + '\070'), ()))
quantopian/zipline
zipline/lib/labelarray.py
compare_arrays
def compare_arrays(left, right): "Eq check with a short-circuit for identical objects." return ( left is right or ((left.shape == right.shape) and (left == right).all()) )
python
def compare_arrays(left, right): "Eq check with a short-circuit for identical objects." return ( left is right or ((left.shape == right.shape) and (left == right).all()) )
[ "def", "compare_arrays", "(", "left", ",", "right", ")", ":", "return", "(", "left", "is", "right", "or", "(", "(", "left", ".", "shape", "==", "right", ".", "shape", ")", "and", "(", "left", "==", "right", ")", ".", "all", "(", ")", ")", ")" ]
Eq check with a short-circuit for identical objects.
[ "Eq", "check", "with", "a", "short", "-", "circuit", "for", "identical", "objects", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L38-L43
train
Eq check with a short - circuit for identical objects.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT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QC9iu2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1387 - 1339) + '\157' + chr(50) + chr(0b101111 + 0o5) + chr(533 - 479), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(50) + '\x37' + chr(0b10110 + 0o36), 9573 - 9565), ehT0Px3KOsy9(chr(1553 - 1505) + '\x6f' + chr(1355 - 1304) + chr(0b100000 + 0o20) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(1866 - 1818) + '\157' + chr(51) + '\060' + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(12214 - 12103) + chr(0b110011) + chr(49) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\157' + chr(0b110000 + 0o2) + chr(0b111 + 0o54) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b111111 + 0o60) + chr(51) + chr(48) + chr(0b1 + 0o64), 0o10), ehT0Px3KOsy9(chr(48) + chr(9330 - 9219) + chr(2340 - 2290) + '\x31' + chr(2704 - 2650), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(0b111 + 0o51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b11110 + 0o121) + chr(0b110001) + chr(813 - 760) + '\x35', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1941 - 1892) + '\065' + chr(0b1110 + 0o50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1000010 + 0o55) + chr(50) + '\063' + chr(50), 1056 - 1048), ehT0Px3KOsy9('\060' + chr(0b1010010 + 0o35) + chr(0b110001) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b100100 + 0o15) + chr(49), 57600 - 57592), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(0b110110) + '\066', 40181 - 40173), ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(0b110010) + '\x30' + chr(2415 - 2365), 0o10), ehT0Px3KOsy9('\060' + chr(0b111101 + 0o62) + chr(0b100101 + 0o16) + '\x36' + chr(0b10001 + 0o44), 0o10), ehT0Px3KOsy9(chr(380 - 332) + chr(0b100100 + 0o113) + chr(0b110011) + chr(0b110010) + chr(0b0 + 0o64), 43786 - 43778), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + '\061' + chr(0b10001 + 0o45) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(1920 - 1872) + chr(0b1101111 + 0o0) + chr(0b11000 + 0o30), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101 + 0o152) + '\x31' + chr(0b100 + 0o60) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2123 - 2069) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110010) + chr(0b110100), 8), ehT0Px3KOsy9('\060' + chr(7671 - 7560) + chr(1995 - 1944) + '\061' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(1459 - 1348) + '\x37' + '\063', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11234 - 11123) + chr(50) + chr(1713 - 1663), ord("\x08")), ehT0Px3KOsy9('\060' + chr(11078 - 10967) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(1603 - 1555) + '\157' + '\x32' + '\060' + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(55) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + chr(231 - 181) + chr(0b1010 + 0o53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1010001 + 0o36) + chr(51) + '\063' + chr(1055 - 1005), ord("\x08")), ehT0Px3KOsy9(chr(1122 - 1074) + chr(8597 - 8486) + '\062' + '\061', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\060' + '\x34', 8), ehT0Px3KOsy9(chr(1100 - 1052) + chr(0b1101111) + chr(49) + chr(48) + chr(2578 - 2524), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9963 - 9852) + '\062' + chr(0b110 + 0o54) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + '\062' + chr(0b10010 + 0o36) + '\x35', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11100 + 0o25) + chr(1225 - 1172) + '\066', 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + '\x33' + '\061' + chr(0b100101 + 0o22), 8), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + '\x35' + chr(931 - 876), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + chr(0b110001) + '\x36' + chr(0b1000 + 0o55), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1011110 + 0o21) + chr(0b110101) + chr(0b1111 + 0o41), 11214 - 11206)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x88'), chr(6441 - 6341) + '\145' + chr(0b1100011) + chr(111) + '\x64' + chr(0b1100101))('\x75' + chr(0b1110100) + chr(0b1001011 + 0o33) + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def gBm1tUoONAw3(mtX6HPOlWiYu, isOYmsUx1jxa): return mtX6HPOlWiYu is isOYmsUx1jxa or (xafqLlk3kkUe(mtX6HPOlWiYu, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xdd\xb6\x9d\xac\xd5\xa2\xe2D\x1d\r\xf8'), chr(0b1010101 + 0o17) + chr(0b1110 + 0o127) + '\143' + '\157' + chr(0b1010001 + 0o23) + '\145')(chr(0b1000000 + 0o65) + '\x74' + chr(0b1100110) + '\x2d' + chr(2701 - 2645))) == xafqLlk3kkUe(isOYmsUx1jxa, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\xdd\xb6\x9d\xac\xd5\xa2\xe2D\x1d\r\xf8'), chr(0b1001010 + 0o32) + chr(4112 - 4011) + chr(8944 - 8845) + '\157' + '\144' + chr(101))(chr(4166 - 4049) + chr(0b1101010 + 0o12) + chr(0b1100110) + chr(0b10001 + 0o34) + chr(56))) and xafqLlk3kkUe(mtX6HPOlWiYu == isOYmsUx1jxa, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe2\xd0\xf7\xfc\xa4\xf3\xf4\xfcr\x04\\\xa9'), chr(0b10001 + 0o123) + chr(1678 - 1577) + '\x63' + chr(0b111100 + 0o63) + chr(3509 - 3409) + chr(5329 - 5228))(chr(6416 - 6299) + '\164' + chr(102) + chr(0b101101) + chr(56)))())
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.from_codes_and_metadata
def from_codes_and_metadata(cls, codes, categories, reverse_categories, missing_value): """ Rehydrate a LabelArray from the codes and metadata. Parameters ---------- codes : np.ndarray[integral] The codes for the label array. categories : np.ndarray[object] The unique string categories. reverse_categories : dict[str, int] The mapping from category to its code-index. missing_value : any The value used to represent missing data. """ ret = codes.view(type=cls, dtype=np.void) ret._categories = categories ret._reverse_categories = reverse_categories ret._missing_value = missing_value return ret
python
def from_codes_and_metadata(cls, codes, categories, reverse_categories, missing_value): """ Rehydrate a LabelArray from the codes and metadata. Parameters ---------- codes : np.ndarray[integral] The codes for the label array. categories : np.ndarray[object] The unique string categories. reverse_categories : dict[str, int] The mapping from category to its code-index. missing_value : any The value used to represent missing data. """ ret = codes.view(type=cls, dtype=np.void) ret._categories = categories ret._reverse_categories = reverse_categories ret._missing_value = missing_value return ret
[ "def", "from_codes_and_metadata", "(", "cls", ",", "codes", ",", "categories", ",", "reverse_categories", ",", "missing_value", ")", ":", "ret", "=", "codes", ".", "view", "(", "type", "=", "cls", ",", "dtype", "=", "np", ".", "void", ")", "ret", ".", "_categories", "=", "categories", "ret", ".", "_reverse_categories", "=", "reverse_categories", "ret", ".", "_missing_value", "=", "missing_value", "return", "ret" ]
Rehydrate a LabelArray from the codes and metadata. Parameters ---------- codes : np.ndarray[integral] The codes for the label array. categories : np.ndarray[object] The unique string categories. reverse_categories : dict[str, int] The mapping from category to its code-index. missing_value : any The value used to represent missing data.
[ "Rehydrate", "a", "LabelArray", "from", "the", "codes", "and", "metadata", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L194-L217
train
Rehydrate a LabelArray from the codes and metadata.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ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2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1010011 + 0o34) + chr(0b101101 + 0o5) + chr(0b10011 + 0o35) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(54) + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(52) + chr(122 - 72), 40744 - 40736), ehT0Px3KOsy9(chr(1905 - 1857) + chr(111) + chr(51) + '\x30' + chr(2565 - 2512), 7040 - 7032), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(53) + chr(2378 - 2326), 48358 - 48350), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b110110) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(0b10000 + 0o46) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\065' + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(48) + chr(0b10111 + 0o31), 5711 - 5703), ehT0Px3KOsy9('\x30' + chr(0b1000110 + 0o51) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\x6f' + chr(49) + '\x30' + chr(0b1011 + 0o45), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(735 - 684) + chr(1459 - 1411) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1100 + 0o143) + '\061' + chr(1082 - 1034) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(0b1 + 0o65) + chr(55), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\063' + chr(1907 - 1857) + chr(1897 - 1845), ord("\x08")), ehT0Px3KOsy9(chr(760 - 712) + chr(0b1101111) + chr(0b100011 + 0o20) + chr(998 - 948), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\x33' + chr(0b101010 + 0o7), 0b1000), ehT0Px3KOsy9(chr(1746 - 1698) + chr(0b1110 + 0o141) + chr(583 - 533) + chr(0b110011) + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(2861 - 2807) + '\x37', 18588 - 18580), ehT0Px3KOsy9(chr(0b110000) + chr(11350 - 11239) + '\061' + '\x32' + chr(1977 - 1926), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(0b110101) + chr(1733 - 1681), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010 + 0o1) + chr(903 - 848) + '\063', 0b1000), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + '\x33' + chr(0b11010 + 0o33) + chr(0b10011 + 0o41), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1000111 + 0o50) + '\x32' + chr(0b11110 + 0o25) + chr(0b1101 + 0o43), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + '\x31' + chr(0b1001 + 0o47) + chr(51), 31584 - 31576), ehT0Px3KOsy9(chr(363 - 315) + '\157' + chr(54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b10000 + 0o43) + chr(0b11011 + 0o26) + chr(0b10101 + 0o37), 4744 - 4736), ehT0Px3KOsy9(chr(0b10100 + 0o34) + '\x6f' + chr(689 - 640) + chr(0b101011 + 0o6) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(50) + '\x37' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\066' + chr(0b1101 + 0o47), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1 + 0o156) + chr(0b11111 + 0o24), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(0b10000 + 0o42), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1960 - 1909) + chr(52) + chr(54), 0o10), ehT0Px3KOsy9(chr(871 - 823) + chr(0b1101111) + chr(49) + '\066' + chr(0b10010 + 0o44), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1011100 + 0o23) + chr(0b110010) + chr(1678 - 1624) + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\067' + chr(0b1000 + 0o53), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + '\064' + chr(0b11000 + 0o34), 0b1000), ehT0Px3KOsy9(chr(1613 - 1565) + chr(0b1000 + 0o147) + chr(525 - 474) + '\x34' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(2179 - 2131) + chr(0b11001 + 0o126) + chr(0b110011) + '\x31' + chr(0b110010), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1501 - 1453) + chr(0b1101111) + chr(53) + chr(1450 - 1402), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xaf'), chr(0b1001011 + 0o31) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\x64' + chr(2202 - 2101))(chr(0b1011101 + 0o30) + chr(0b1110100) + chr(102) + chr(0b101101) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def g5wjfVazVgaH(NSstowUUZlxS, AoWJEgIAbHh_, mZZDAT49UzAb, RUh5Ov7z62h9, cM6FSYO3vPuj): VHn4CV4Ymrei = AoWJEgIAbHh_.view(type=NSstowUUZlxS, dtype=WqUC3KWvYVup.void) VHn4CV4Ymrei.D31dwMzh4wPl = mZZDAT49UzAb VHn4CV4Ymrei.AX_We0VvUqx4 = RUh5Ov7z62h9 VHn4CV4Ymrei.Vhy0WHA_SJ6G = cM6FSYO3vPuj return VHn4CV4Ymrei
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.as_int_array
def as_int_array(self): """ Convert self into a regular ndarray of ints. This is an O(1) operation. It does not copy the underlying data. """ return self.view( type=ndarray, dtype=unsigned_int_dtype_with_size_in_bytes(self.itemsize), )
python
def as_int_array(self): """ Convert self into a regular ndarray of ints. This is an O(1) operation. It does not copy the underlying data. """ return self.view( type=ndarray, dtype=unsigned_int_dtype_with_size_in_bytes(self.itemsize), )
[ "def", "as_int_array", "(", "self", ")", ":", "return", "self", ".", "view", "(", "type", "=", "ndarray", ",", "dtype", "=", "unsigned_int_dtype_with_size_in_bytes", "(", "self", ".", "itemsize", ")", ",", ")" ]
Convert self into a regular ndarray of ints. This is an O(1) operation. It does not copy the underlying data.
[ "Convert", "self", "into", "a", "regular", "ndarray", "of", "ints", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L303-L312
train
Convert self into a regular ndarray of ints.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6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3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(2288 - 2240) + chr(111) + chr(495 - 442) + chr(50), 7981 - 7973), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(7145 - 7034) + chr(0b110011) + chr(0b110001) + '\x30', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\x31' + '\067' + chr(755 - 707), 57330 - 57322), ehT0Px3KOsy9(chr(0b110000) + chr(2828 - 2717) + '\x31' + chr(49) + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1001101 + 0o42) + '\063' + chr(1095 - 1047) + chr(0b11101 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b110111) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101001 + 0o12) + '\x36' + '\x35', 54605 - 54597), ehT0Px3KOsy9(chr(0b110000) + chr(5477 - 5366) + chr(0b10110 + 0o33) + chr(0b10100 + 0o42) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1835 - 1787) + chr(0b1101111) + '\063' + chr(49) + '\x36', 31036 - 31028), ehT0Px3KOsy9(chr(984 - 936) + chr(11092 - 10981) + chr(1481 - 1431) + chr(0b110010 + 0o3) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + chr(2190 - 2141) + chr(0b1100 + 0o52) + chr(0b101111 + 0o4), 0b1000), ehT0Px3KOsy9(chr(1444 - 1396) + chr(111) + '\063' + '\x32' + chr(0b1100 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + '\x34' + chr(0b11111 + 0o25), ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(4172 - 4061) + '\062' + '\x35' + chr(0b10111 + 0o37), 0o10), ehT0Px3KOsy9(chr(969 - 921) + chr(0b1101000 + 0o7) + chr(0b110011) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(2543 - 2432) + '\x33' + chr(0b110000) + '\065', 0o10), ehT0Px3KOsy9(chr(1923 - 1875) + chr(8567 - 8456) + chr(49) + '\064', 0o10), ehT0Px3KOsy9(chr(199 - 151) + '\157' + chr(2293 - 2244) + chr(48) + chr(1801 - 1748), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1116 - 1065) + chr(177 - 125) + chr(0b101110 + 0o10), ord("\x08")), ehT0Px3KOsy9('\060' + chr(4639 - 4528) + chr(0b101011 + 0o7) + '\x36' + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11100 + 0o123) + chr(0b110100) + chr(0b101 + 0o55), 31736 - 31728), ehT0Px3KOsy9(chr(1670 - 1622) + chr(0b11001 + 0o126) + '\x31' + chr(0b110011) + chr(0b101 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(856 - 808) + chr(0b1111 + 0o140) + chr(0b110010) + '\060' + chr(55), 12042 - 12034), ehT0Px3KOsy9(chr(49 - 1) + '\157' + '\063' + chr(53) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(50) + chr(0b101101 + 0o6) + chr(48), 50225 - 50217), ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\063' + '\x37', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10011 + 0o40) + chr(0b100001 + 0o22) + chr(0b11111 + 0o21), 12198 - 12190), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1001 + 0o50) + chr(50) + chr(0b11101 + 0o32), ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(5986 - 5875) + chr(212 - 163) + chr(55), 31001 - 30993), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(190 - 135) + '\060', 49046 - 49038), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101000 + 0o12) + chr(0b110010), 31775 - 31767), ehT0Px3KOsy9(chr(1662 - 1614) + chr(0b1101111) + chr(0b10 + 0o57) + chr(0b1101 + 0o43) + chr(451 - 397), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + chr(0b11000 + 0o30), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\x31' + '\x35' + chr(2391 - 2341), 53946 - 53938), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(52) + chr(0b10100 + 0o43), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3021 - 2910) + chr(0b110010) + '\061' + '\067', 0o10), ehT0Px3KOsy9(chr(79 - 31) + '\157' + chr(0b110011) + chr(2617 - 2562) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1240 - 1191) + chr(0b110111) + chr(2688 - 2636), 0b1000), ehT0Px3KOsy9(chr(1413 - 1365) + chr(0b1101111) + chr(0b110010) + '\065' + chr(51), 46054 - 46046), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(10528 - 10417) + '\063' + '\065' + '\x33', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1014 - 966) + chr(111) + chr(0b110101) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x04'), chr(100) + chr(3232 - 3131) + chr(99) + chr(0b111000 + 0o67) + chr(100) + '\145')(chr(0b1101001 + 0o14) + chr(3617 - 3501) + chr(0b1000101 + 0o41) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TG6ylcp9a8f0(oVre8I6UXc3b): return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\\\xa1\x1d;'), chr(0b1100100) + chr(101) + chr(0b1011 + 0o130) + '\157' + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(0b111000)))(type=VtU1DncglWAm, dtype=QhNO7qQetJaB(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'C\xbc\x1d!\xb0\x17\x8f\x14'), '\x64' + '\x65' + chr(0b1100011) + chr(111) + '\x64' + chr(4132 - 4031))(chr(0b1110101) + chr(6815 - 6699) + '\146' + '\055' + chr(2330 - 2274)))))
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.as_categorical
def as_categorical(self): """ Coerce self into a pandas categorical. This is only defined on 1D arrays, since that's all pandas supports. """ if len(self.shape) > 1: raise ValueError("Can't convert a 2D array to a categorical.") with ignore_pandas_nan_categorical_warning(): return pd.Categorical.from_codes( self.as_int_array(), # We need to make a copy because pandas >= 0.17 fails if this # buffer isn't writeable. self.categories.copy(), ordered=False, )
python
def as_categorical(self): """ Coerce self into a pandas categorical. This is only defined on 1D arrays, since that's all pandas supports. """ if len(self.shape) > 1: raise ValueError("Can't convert a 2D array to a categorical.") with ignore_pandas_nan_categorical_warning(): return pd.Categorical.from_codes( self.as_int_array(), # We need to make a copy because pandas >= 0.17 fails if this # buffer isn't writeable. self.categories.copy(), ordered=False, )
[ "def", "as_categorical", "(", "self", ")", ":", "if", "len", "(", "self", ".", "shape", ")", ">", "1", ":", "raise", "ValueError", "(", "\"Can't convert a 2D array to a categorical.\"", ")", "with", "ignore_pandas_nan_categorical_warning", "(", ")", ":", "return", "pd", ".", "Categorical", ".", "from_codes", "(", "self", ".", "as_int_array", "(", ")", ",", "# We need to make a copy because pandas >= 0.17 fails if this", "# buffer isn't writeable.", "self", ".", "categories", ".", "copy", "(", ")", ",", "ordered", "=", "False", ",", ")" ]
Coerce self into a pandas categorical. This is only defined on 1D arrays, since that's all pandas supports.
[ "Coerce", "self", "into", "a", "pandas", "categorical", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L322-L338
train
Coerce self into a pandas categorical.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ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yaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1286 - 1237) + '\x35' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(0b111000 + 0o67) + '\063' + '\x31' + chr(51), 46006 - 45998), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\x6f' + '\062' + '\x32' + chr(0b100100 + 0o23), 23508 - 23500), ehT0Px3KOsy9(chr(1452 - 1404) + '\x6f' + chr(1306 - 1257) + '\066' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\060' + '\066', 0o10), ehT0Px3KOsy9(chr(2120 - 2072) + chr(0b1010110 + 0o31) + chr(51) + chr(0b110101) + chr(0b101000 + 0o15), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b100001 + 0o22) + '\065' + '\x35', 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b10100 + 0o35) + '\x35' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + chr(0b111 + 0o52) + chr(52) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\066' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x34' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b0 + 0o61) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + '\x32' + '\x35' + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(5331 - 5220) + chr(0b110000 + 0o2) + chr(764 - 715) + chr(0b110001), 21043 - 21035), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(1952 - 1904) + chr(1309 - 1257), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(52) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(1217 - 1106) + chr(0b110010) + chr(49) + chr(0b10000 + 0o42), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101101 + 0o5) + '\x34' + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b101 + 0o56) + chr(1563 - 1508) + chr(0b110000), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(426 - 371) + chr(0b1011 + 0o51), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + '\x31' + chr(0b110100), 29625 - 29617), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b101100 + 0o103) + chr(587 - 538) + chr(0b101010 + 0o10) + chr(0b11111 + 0o23), 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(0b11110 + 0o23) + chr(0b101 + 0o60) + '\060', 0b1000), ehT0Px3KOsy9(chr(1661 - 1613) + chr(111) + '\062' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(739 - 691) + chr(0b1101111) + chr(0b100011 + 0o20) + '\x30' + chr(54), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x36' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(0b1 + 0o60) + chr(1829 - 1780) + chr(0b1110 + 0o44), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(11115 - 11004) + chr(0b10000 + 0o41) + chr(0b101000 + 0o12) + '\065', 40476 - 40468), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2423 - 2373), 19070 - 19062), ehT0Px3KOsy9(chr(48) + chr(6481 - 6370) + chr(49) + chr(96 - 44) + '\x36', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(0b100001 + 0o20) + '\065' + chr(0b110000 + 0o6), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2546 - 2435) + '\x31' + '\x34' + chr(0b101001 + 0o14), 15863 - 15855), ehT0Px3KOsy9('\x30' + chr(9524 - 9413) + chr(0b110001) + chr(2356 - 2306) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\067' + '\062', 24567 - 24559), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + chr(1053 - 1000) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(1338 - 1287) + chr(0b110110) + chr(0b10011 + 0o37), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(54) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\061' + '\x37' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(149 - 98) + '\060' + chr(2499 - 2446), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(7454 - 7343) + chr(53) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'E'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b100000 + 0o117) + chr(0b1100100) + chr(9093 - 8992))(chr(0b110011 + 0o102) + '\164' + chr(1310 - 1208) + chr(45) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def PerEmruKO7BI(oVre8I6UXc3b): if c2A0yzQpDQB3(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x05\xaa\xe2+ \xa1\x8a\x032\x83\x84j'), chr(2594 - 2494) + '\145' + chr(0b1100011) + chr(0b1100000 + 0o17) + chr(100) + '\145')(chr(0b101 + 0o160) + chr(116) + chr(0b1100110) + chr(0b110 + 0o47) + chr(0b1010 + 0o56)))) > ehT0Px3KOsy9(chr(48) + chr(0b10101 + 0o132) + chr(49), 0o10): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'(\xaa\xf9U2\xcd\x8e\x00\x08\x85\x82z\xde\xa9\xa5\x87\xb8\xe7\xd8]> \tm\xe6F%ucF\r\x04 _M\x9dh\\\x1f\xa4\x07\xe5'), chr(0b101110 + 0o66) + chr(101) + chr(0b1011101 + 0o6) + '\x6f' + '\144' + '\x65')(chr(0b1101001 + 0o14) + chr(116) + '\146' + chr(0b101101) + '\070')) with tUe9mJOVWKTU(): return xafqLlk3kkUe(dubtF9GfzOdC.Categorical, xafqLlk3kkUe(SXOLrMavuUCe(b'\r\xb9\xf8\x1f\x19\x8e\x82\x0b\x03\x80'), chr(3223 - 3123) + chr(0b1011011 + 0o12) + '\x63' + chr(0b1101111) + chr(0b101111 + 0o65) + chr(0b1100101))(chr(0b101010 + 0o113) + chr(0b100011 + 0o121) + chr(0b1100110) + '\055' + chr(0b11010 + 0o36)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\n\xb8\xc8\x1b(\x99\xb2\x0e\x14\x81\x86q'), chr(0b1100100) + chr(3924 - 3823) + chr(0b1100000 + 0o3) + chr(0b1101111) + '\144' + chr(388 - 287))(chr(0b1110101) + chr(5437 - 5321) + chr(0b1100110) + chr(0b1101 + 0o40) + '\070'))(), xafqLlk3kkUe(oVre8I6UXc3b.categories, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xac\xc3\x1a\x0e\xbe\xd9\x05\x11\xa5\x94i'), '\x64' + chr(9524 - 9423) + chr(99) + chr(111) + chr(0b1001000 + 0o34) + '\x65')(chr(117) + chr(0b1110100) + '\146' + chr(0b101101) + '\x38'))(), ordered=ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(0b110000), ord("\x08")))
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.as_categorical_frame
def as_categorical_frame(self, index, columns, name=None): """ Coerce self into a pandas DataFrame of Categoricals. """ if len(self.shape) != 2: raise ValueError( "Can't convert a non-2D LabelArray into a DataFrame." ) expected_shape = (len(index), len(columns)) if expected_shape != self.shape: raise ValueError( "Can't construct a DataFrame with provided indices:\n\n" "LabelArray shape is {actual}, but index and columns imply " "that shape should be {expected}.".format( actual=self.shape, expected=expected_shape, ) ) return pd.Series( index=pd.MultiIndex.from_product([index, columns]), data=self.ravel().as_categorical(), name=name, ).unstack()
python
def as_categorical_frame(self, index, columns, name=None): """ Coerce self into a pandas DataFrame of Categoricals. """ if len(self.shape) != 2: raise ValueError( "Can't convert a non-2D LabelArray into a DataFrame." ) expected_shape = (len(index), len(columns)) if expected_shape != self.shape: raise ValueError( "Can't construct a DataFrame with provided indices:\n\n" "LabelArray shape is {actual}, but index and columns imply " "that shape should be {expected}.".format( actual=self.shape, expected=expected_shape, ) ) return pd.Series( index=pd.MultiIndex.from_product([index, columns]), data=self.ravel().as_categorical(), name=name, ).unstack()
[ "def", "as_categorical_frame", "(", "self", ",", "index", ",", "columns", ",", "name", "=", "None", ")", ":", "if", "len", "(", "self", ".", "shape", ")", "!=", "2", ":", "raise", "ValueError", "(", "\"Can't convert a non-2D LabelArray into a DataFrame.\"", ")", "expected_shape", "=", "(", "len", "(", "index", ")", ",", "len", "(", "columns", ")", ")", "if", "expected_shape", "!=", "self", ".", "shape", ":", "raise", "ValueError", "(", "\"Can't construct a DataFrame with provided indices:\\n\\n\"", "\"LabelArray shape is {actual}, but index and columns imply \"", "\"that shape should be {expected}.\"", ".", "format", "(", "actual", "=", "self", ".", "shape", ",", "expected", "=", "expected_shape", ",", ")", ")", "return", "pd", ".", "Series", "(", "index", "=", "pd", ".", "MultiIndex", ".", "from_product", "(", "[", "index", ",", "columns", "]", ")", ",", "data", "=", "self", ".", "ravel", "(", ")", ".", "as_categorical", "(", ")", ",", "name", "=", "name", ",", ")", ".", "unstack", "(", ")" ]
Coerce self into a pandas DataFrame of Categoricals.
[ "Coerce", "self", "into", "a", "pandas", "DataFrame", "of", "Categoricals", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L340-L364
train
Coerce self into a pandas DataFrame of Categoricals.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9Y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B3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b110000 + 0o77) + chr(53) + '\060', 51734 - 51726), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1669 - 1620) + chr(48) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(177 - 128) + chr(0b110101) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2675 - 2622) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x35' + chr(0b110100 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1101111) + '\x33' + chr(546 - 491) + '\067', 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + chr(49) + chr(0b100 + 0o63) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101100 + 0o103) + chr(55) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\x36' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(293 - 245) + '\x6f' + chr(0b110010) + chr(1943 - 1892) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1078 - 1029) + chr(1991 - 1942) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b10111 + 0o32) + chr(913 - 862) + chr(0b1000 + 0o54), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b11010 + 0o30) + chr(2530 - 2476) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\065' + chr(0b111 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(1858 - 1747) + '\x33' + chr(0b110101) + chr(1360 - 1307), 55914 - 55906), ehT0Px3KOsy9(chr(0b110000) + chr(1067 - 956) + chr(0b110001) + '\066' + '\064', 0o10), ehT0Px3KOsy9(chr(1091 - 1043) + chr(0b10101 + 0o132) + chr(50) + '\067' + chr(949 - 896), 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + chr(51) + '\x31' + chr(2329 - 2275), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + '\x6f' + chr(50) + chr(50) + '\065', 44129 - 44121), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b110011) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\157' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1001011 + 0o44) + chr(0b110001) + '\062' + chr(0b110000), 21212 - 21204), ehT0Px3KOsy9(chr(682 - 634) + '\157' + '\x31' + '\062', 55189 - 55181), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1011100 + 0o23) + chr(641 - 591) + chr(0b110000) + chr(1322 - 1271), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101000 + 0o7) + chr(1477 - 1422), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(55) + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(1388 - 1339) + '\062' + chr(0b11100 + 0o32), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\x32' + chr(0b11 + 0o60), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\x6f' + chr(0b110011) + chr(861 - 808) + chr(52), 0b1000), ehT0Px3KOsy9(chr(635 - 587) + chr(0b1100010 + 0o15) + '\064' + chr(0b100100 + 0o16), 12510 - 12502), ehT0Px3KOsy9(chr(1579 - 1531) + '\x6f' + chr(1705 - 1651) + '\060', 24526 - 24518), ehT0Px3KOsy9(chr(1025 - 977) + '\x6f' + chr(0b101110 + 0o3) + '\x32', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b11101 + 0o26) + '\063' + '\062', 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b100000 + 0o117) + chr(0b110001) + '\x36' + '\063', 37939 - 37931), ehT0Px3KOsy9(chr(48) + chr(8403 - 8292) + '\062' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b10000 + 0o41) + '\x34' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b11 + 0o63) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(495 - 447) + chr(0b111000 + 0o67) + '\x33' + chr(0b10110 + 0o33) + '\066', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b11101 + 0o122) + chr(1825 - 1776) + chr(51) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b100000 + 0o21) + chr(414 - 365) + chr(53), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1862 - 1814) + chr(0b1101111) + '\x35' + '\x30', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x06'), chr(0b1100100) + chr(0b110111 + 0o56) + chr(99) + chr(111) + chr(100) + chr(8958 - 8857))(chr(0b110100 + 0o101) + chr(0b1110100) + chr(470 - 368) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def HHcNS_LlBh7V(oVre8I6UXc3b, XdowRbJKZWL9, qKlXBtn3PKy4, AIvJRzLdDfgF=None): if c2A0yzQpDQB3(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'F \x1crJ\xb3\x19V\xa1\xe9/>'), chr(100) + '\145' + '\143' + chr(0b10001 + 0o136) + chr(0b1100100) + '\145')(chr(13340 - 13223) + chr(8383 - 8267) + '\146' + chr(1938 - 1893) + '\070'))) != ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1001011 + 0o44) + '\x32', ord("\x08")): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'k \x07\x0cX\xdf\x1dU\x9b\xef).\xc7\xc8\x8cT\xd3\xa1\xfbu6\x14*\xcff\xda3\xbf\xadPBk\xa3Sz\x0e\xc5\xa1},\x08\x05\x08_M\xb9\x0c[\x98\xfcb'), '\x64' + '\145' + chr(99) + chr(111) + chr(1777 - 1677) + '\x65')(chr(0b1010000 + 0o45) + '\164' + chr(102) + '\x2d' + '\070')) mvAOqe9e97vc = (c2A0yzQpDQB3(XdowRbJKZWL9), c2A0yzQpDQB3(qKlXBtn3PKy4)) if mvAOqe9e97vc != xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'F \x1crJ\xb3\x19V\xa1\xe9/>'), '\144' + chr(5599 - 5498) + chr(3629 - 3530) + '\x6f' + '\144' + '\x65')(chr(0b1110101) + '\x74' + chr(8535 - 8433) + chr(0b100111 + 0o6) + chr(0b111000))): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"k \x07\x0cX\xdf\x1dU\x9b\xea8.\xc6\x8b\x99T\xdc\xee\xd19p1L\xf1f\xd53\xf3\x9bKDb\xfa\x03a\x0f\xc7\xa79(La\x00EH\x96\x1d_\x86\xa3FV\xff\x89\x8f\x11\xd1\x8f\xe7*e)*\xf0o\xd9&\xb6\xccKC*\xa1\x12p\x14\xc4\xaf10\x04a\x0b^X\xdf\x17T\x91\xfc4|\xd2\x86\x89T\xde\xa1\xf9-i>y\xa3n\xd5&\xbf\x95\x02Db\xbb\x073\x13\xd9\xaf-(\x082\x01DY\x93\x1a\x1a\x97\xfcl'\xd6\x90\x9d\x11\xde\xba\xf0<y~"), chr(0b1100100) + '\145' + chr(0b1011010 + 0o11) + '\x6f' + '\144' + chr(101))(chr(0b1010000 + 0o45) + chr(0b0 + 0o164) + chr(0b1100110) + chr(0b101101) + chr(1604 - 1548)), xafqLlk3kkUe(SXOLrMavuUCe(b'~u\x1bDd\x9e-\t\xa5\xe9)6'), '\144' + chr(0b1011110 + 0o7) + chr(9018 - 8919) + chr(111) + chr(100) + chr(101))('\165' + chr(0b1001010 + 0o52) + chr(3975 - 3873) + chr(0b101101) + chr(1289 - 1233)))(actual=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'F \x1crJ\xb3\x19V\xa1\xe9/>'), chr(0b101000 + 0o74) + '\x65' + '\x63' + chr(0b1101111) + '\144' + chr(101))(chr(0b110111 + 0o76) + '\x74' + '\146' + chr(0b1110 + 0o37) + chr(2509 - 2453))), expected=mvAOqe9e97vc)) return xafqLlk3kkUe(dubtF9GfzOdC.Series(index=dubtF9GfzOdC.MultiIndex.from_product([XdowRbJKZWL9, qKlXBtn3PKy4]), data=oVre8I6UXc3b.ravel().as_categorical(), name=AIvJRzLdDfgF), xafqLlk3kkUe(SXOLrMavuUCe(b']/\x1a_M\x9c\x15'), chr(0b1100100) + '\x65' + chr(99) + '\x6f' + '\144' + '\x65')(chr(0b101011 + 0o112) + chr(116) + '\x66' + chr(0b101101) + chr(0b101110 + 0o12)))()
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.set_scalar
def set_scalar(self, indexer, value): """ Set scalar value into the array. Parameters ---------- indexer : any The indexer to set the value at. value : str The value to assign at the given locations. Raises ------ ValueError Raised when ``value`` is not a value element of this this label array. """ try: value_code = self.reverse_categories[value] except KeyError: raise ValueError("%r is not in LabelArray categories." % value) self.as_int_array()[indexer] = value_code
python
def set_scalar(self, indexer, value): """ Set scalar value into the array. Parameters ---------- indexer : any The indexer to set the value at. value : str The value to assign at the given locations. Raises ------ ValueError Raised when ``value`` is not a value element of this this label array. """ try: value_code = self.reverse_categories[value] except KeyError: raise ValueError("%r is not in LabelArray categories." % value) self.as_int_array()[indexer] = value_code
[ "def", "set_scalar", "(", "self", ",", "indexer", ",", "value", ")", ":", "try", ":", "value_code", "=", "self", ".", "reverse_categories", "[", "value", "]", "except", "KeyError", ":", "raise", "ValueError", "(", "\"%r is not in LabelArray categories.\"", "%", "value", ")", "self", ".", "as_int_array", "(", ")", "[", "indexer", "]", "=", "value_code" ]
Set scalar value into the array. Parameters ---------- indexer : any The indexer to set the value at. value : str The value to assign at the given locations. Raises ------ ValueError Raised when ``value`` is not a value element of this this label array.
[ "Set", "scalar", "value", "into", "the", "array", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L400-L422
train
Set the scalar value into the array.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTb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yYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + chr(0b110010) + chr(0b1100 + 0o47) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(888 - 838) + '\061' + chr(1305 - 1257), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4568 - 4457) + chr(0b110010) + chr(52) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b100101 + 0o112) + chr(1311 - 1262) + chr(384 - 335) + '\x35', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + '\x37' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + chr(55) + '\061', 0o10), ehT0Px3KOsy9(chr(1090 - 1042) + chr(0b1101111) + chr(571 - 520) + chr(0b11 + 0o64) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010 + 0o0) + '\x30' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x36' + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001 + 0o2) + '\x35' + chr(0b100 + 0o62), 23129 - 23121), ehT0Px3KOsy9('\x30' + chr(9096 - 8985) + '\062' + chr(2210 - 2157) + chr(50), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b110010) + chr(230 - 180), 42536 - 42528), ehT0Px3KOsy9('\x30' + '\157' + chr(1341 - 1290) + chr(0b101101 + 0o3) + '\x35', 18939 - 18931), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\064' + '\065', 20929 - 20921), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(1355 - 1305) + chr(1454 - 1400), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(6374 - 6263) + '\x32' + chr(2176 - 2125) + chr(52), 27023 - 27015), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(1682 - 1633), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(290 - 239) + chr(0b11010 + 0o26), 27134 - 27126), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(354 - 306) + chr(1696 - 1585) + chr(51) + '\x36' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(53) + '\x31', 4376 - 4368), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b10110 + 0o131) + '\063' + chr(447 - 396) + chr(0b101010 + 0o11), 0o10), ehT0Px3KOsy9(chr(717 - 669) + chr(0b1101111) + chr(613 - 563) + '\062' + '\067', 60630 - 60622), ehT0Px3KOsy9(chr(1256 - 1208) + '\x6f' + chr(0b110011) + chr(1475 - 1422) + '\065', 46629 - 46621), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b110101) + '\067', 49489 - 49481), ehT0Px3KOsy9(chr(48) + chr(0b1000110 + 0o51) + chr(0b1010 + 0o47) + chr(0b101001 + 0o14) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b110010 + 0o2) + chr(2711 - 2658), 8), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(48) + '\064', 7448 - 7440), ehT0Px3KOsy9(chr(48) + chr(0b10110 + 0o131) + chr(0b110001) + chr(57 - 9) + chr(52), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10 + 0o57) + chr(1065 - 1015) + chr(3009 - 2954), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\064' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1414 - 1366), 0o10), ehT0Px3KOsy9(chr(819 - 771) + chr(111) + chr(51) + chr(0b1110 + 0o46), 37023 - 37015), ehT0Px3KOsy9(chr(1134 - 1086) + chr(0b1101001 + 0o6) + chr(0b11010 + 0o27) + chr(633 - 583) + chr(0b10000 + 0o42), 8), ehT0Px3KOsy9(chr(48) + chr(10719 - 10608) + chr(0b110010) + '\066' + chr(0b1100 + 0o51), 0b1000), ehT0Px3KOsy9(chr(1303 - 1255) + chr(0b1101111) + '\061' + chr(54) + chr(0b101000 + 0o17), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(809 - 761) + '\157' + chr(0b100001 + 0o25) + '\x33', 8), ehT0Px3KOsy9('\060' + chr(0b110 + 0o151) + '\063' + '\061', 8), ehT0Px3KOsy9('\x30' + '\157' + '\067', 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\065' + '\x30', 35997 - 35989)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb3'), chr(100) + chr(8297 - 8196) + chr(0b1100011) + '\x6f' + chr(0b11101 + 0o107) + '\x65')('\165' + chr(0b101000 + 0o114) + '\x66' + chr(291 - 246) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def b6mLBMMp8AO3(oVre8I6UXc3b, BvJfssszZMhp, QmmgWUB13VCJ): try: rRjIcU73BkCM = oVre8I6UXc3b.reverse_categories[QmmgWUB13VCJ] except RQ6CSRrFArYB: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8\xfa\x82$\x08Y\x92\xe9G\xce\xc3<\xe5\xe9\xf7\xfe|t@\x82\x9b\xba\xee\xcd\xcc\x0c\xd1!#8Riy!\x9b'), chr(100) + chr(0b111110 + 0o47) + chr(99) + '\157' + chr(0b1100100) + chr(101))(chr(117) + '\x74' + '\146' + '\055' + '\x38') % QmmgWUB13VCJ) oVre8I6UXc3b.TG6ylcp9a8f0()[BvJfssszZMhp] = rRjIcU73BkCM
quantopian/zipline
zipline/lib/labelarray.py
LabelArray._equality_check
def _equality_check(op): """ Shared code for __eq__ and __ne__, parameterized on the actual comparison operator to use. """ def method(self, other): if isinstance(other, LabelArray): self_mv = self.missing_value other_mv = other.missing_value if self_mv != other_mv: raise MissingValueMismatch(self_mv, other_mv) self_categories = self.categories other_categories = other.categories if not compare_arrays(self_categories, other_categories): raise CategoryMismatch(self_categories, other_categories) return ( op(self.as_int_array(), other.as_int_array()) & self.not_missing() & other.not_missing() ) elif isinstance(other, ndarray): # Compare to ndarrays as though we were an array of strings. # This is fairly expensive, and should generally be avoided. return op(self.as_string_array(), other) & self.not_missing() elif isinstance(other, self.SUPPORTED_SCALAR_TYPES): i = self._reverse_categories.get(other, -1) return op(self.as_int_array(), i) & self.not_missing() return op(super(LabelArray, self), other) return method
python
def _equality_check(op): """ Shared code for __eq__ and __ne__, parameterized on the actual comparison operator to use. """ def method(self, other): if isinstance(other, LabelArray): self_mv = self.missing_value other_mv = other.missing_value if self_mv != other_mv: raise MissingValueMismatch(self_mv, other_mv) self_categories = self.categories other_categories = other.categories if not compare_arrays(self_categories, other_categories): raise CategoryMismatch(self_categories, other_categories) return ( op(self.as_int_array(), other.as_int_array()) & self.not_missing() & other.not_missing() ) elif isinstance(other, ndarray): # Compare to ndarrays as though we were an array of strings. # This is fairly expensive, and should generally be avoided. return op(self.as_string_array(), other) & self.not_missing() elif isinstance(other, self.SUPPORTED_SCALAR_TYPES): i = self._reverse_categories.get(other, -1) return op(self.as_int_array(), i) & self.not_missing() return op(super(LabelArray, self), other) return method
[ "def", "_equality_check", "(", "op", ")", ":", "def", "method", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "LabelArray", ")", ":", "self_mv", "=", "self", ".", "missing_value", "other_mv", "=", "other", ".", "missing_value", "if", "self_mv", "!=", "other_mv", ":", "raise", "MissingValueMismatch", "(", "self_mv", ",", "other_mv", ")", "self_categories", "=", "self", ".", "categories", "other_categories", "=", "other", ".", "categories", "if", "not", "compare_arrays", "(", "self_categories", ",", "other_categories", ")", ":", "raise", "CategoryMismatch", "(", "self_categories", ",", "other_categories", ")", "return", "(", "op", "(", "self", ".", "as_int_array", "(", ")", ",", "other", ".", "as_int_array", "(", ")", ")", "&", "self", ".", "not_missing", "(", ")", "&", "other", ".", "not_missing", "(", ")", ")", "elif", "isinstance", "(", "other", ",", "ndarray", ")", ":", "# Compare to ndarrays as though we were an array of strings.", "# This is fairly expensive, and should generally be avoided.", "return", "op", "(", "self", ".", "as_string_array", "(", ")", ",", "other", ")", "&", "self", ".", "not_missing", "(", ")", "elif", "isinstance", "(", "other", ",", "self", ".", "SUPPORTED_SCALAR_TYPES", ")", ":", "i", "=", "self", ".", "_reverse_categories", ".", "get", "(", "other", ",", "-", "1", ")", "return", "op", "(", "self", ".", "as_int_array", "(", ")", ",", "i", ")", "&", "self", ".", "not_missing", "(", ")", "return", "op", "(", "super", "(", "LabelArray", ",", "self", ")", ",", "other", ")", "return", "method" ]
Shared code for __eq__ and __ne__, parameterized on the actual comparison operator to use.
[ "Shared", "code", "for", "__eq__", "and", "__ne__", "parameterized", "on", "the", "actual", "comparison", "operator", "to", "use", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L462-L496
train
A method that returns a comparison of two LabelArrays.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ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_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b100 + 0o153) + '\066' + '\x32', 10900 - 10892), ehT0Px3KOsy9('\060' + chr(0b1110 + 0o141) + chr(480 - 431) + chr(0b110101) + '\x31', 44930 - 44922), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + '\063' + '\064' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(3819 - 3708) + chr(50) + '\060' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + '\x32' + chr(0b11111 + 0o26) + chr(1178 - 1127), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1100 + 0o47) + chr(53) + chr(51), 0b1000), ehT0Px3KOsy9(chr(1953 - 1905) + chr(0b1101 + 0o142) + chr(0b110010) + chr(0b110010) + chr(2317 - 2262), 26839 - 26831), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(51) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(4535 - 4424) + chr(0b101010 + 0o7) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + '\062' + chr(0b110001) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1214 - 1166) + chr(0b1101111) + chr(0b110010) + chr(0b110011) + chr(1218 - 1167), ord("\x08")), ehT0Px3KOsy9(chr(98 - 50) + chr(0b1101111) + chr(1288 - 1233) + chr(1632 - 1579), 64962 - 64954), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + '\x31' + chr(0b101110 + 0o4), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11011 + 0o30) + chr(2159 - 2108) + chr(53), 27727 - 27719), ehT0Px3KOsy9(chr(48) + chr(3731 - 3620) + chr(1775 - 1725) + chr(50) + chr(54), 10423 - 10415), ehT0Px3KOsy9(chr(1666 - 1618) + chr(0b10011 + 0o134) + chr(54), 27502 - 27494), ehT0Px3KOsy9('\x30' + '\157' + chr(849 - 800) + chr(0b110110) + chr(0b110100), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110001), 22706 - 22698), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + '\061' + '\x36', 51997 - 51989), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x34' + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + chr(0b110010) + '\x33', 38611 - 38603), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b110101) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1241 - 1192) + '\063' + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(11551 - 11440) + chr(0b11110 + 0o23) + chr(61 - 10) + chr(0b110101), 18337 - 18329), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(0b110101) + chr(55), 41617 - 41609), ehT0Px3KOsy9(chr(48) + chr(0b1100010 + 0o15) + chr(49) + chr(0b110111) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(725 - 673) + chr(52), 33840 - 33832), ehT0Px3KOsy9('\x30' + chr(1560 - 1449) + chr(0b100010 + 0o20) + chr(1847 - 1793) + chr(1434 - 1379), 0o10), ehT0Px3KOsy9(chr(48) + chr(11370 - 11259) + chr(1747 - 1697) + chr(0b10100 + 0o40) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\x34' + chr(191 - 142), 0o10), ehT0Px3KOsy9(chr(1953 - 1905) + '\157' + chr(0b11111 + 0o22) + chr(1879 - 1829) + chr(0b10011 + 0o35), 0o10), ehT0Px3KOsy9(chr(2094 - 2046) + '\157' + '\063' + '\x31' + '\062', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\063' + '\x35', 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + '\060' + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(8719 - 8608) + chr(0b100011 + 0o17) + chr(2591 - 2537) + '\067', 8), ehT0Px3KOsy9(chr(1962 - 1914) + '\x6f' + '\x32' + chr(0b110111) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b10101 + 0o36) + '\060', 0o10), ehT0Px3KOsy9(chr(1083 - 1035) + chr(4480 - 4369) + chr(51) + '\060' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(12050 - 11939) + '\066', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(2572 - 2518) + '\x30', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2028 - 1975) + chr(0b101011 + 0o5), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c'), chr(100) + '\145' + chr(0b1100011) + '\x6f' + chr(100) + chr(4272 - 4171))(chr(0b1110101) + chr(0b100100 + 0o120) + '\146' + chr(394 - 349) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def NyyEpxj0pG7i(C8dAr6Ujq2Tn): def CVRCXTcnOnH6(oVre8I6UXc3b, KK0ERS7DqYrY): if PlSM16l2KDPD(KK0ERS7DqYrY, xHaqLS1eUVFC): VGjukapxERiJ = oVre8I6UXc3b.cM6FSYO3vPuj LwBZSqIJ3NGW = KK0ERS7DqYrY.cM6FSYO3vPuj if VGjukapxERiJ != LwBZSqIJ3NGW: raise a4z6QhPCirx6(VGjukapxERiJ, LwBZSqIJ3NGW) ExKCRkRdwfv8 = oVre8I6UXc3b.mZZDAT49UzAb AjouL4WlZlgS = KK0ERS7DqYrY.mZZDAT49UzAb if not gBm1tUoONAw3(ExKCRkRdwfv8, AjouL4WlZlgS): raise ojM4zAdlIMSy(ExKCRkRdwfv8, AjouL4WlZlgS) return C8dAr6Ujq2Tn(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'f.\xd6\xfe\xc7\x88\xe7\xe2h\xb0\xfd\r'), chr(0b10110 + 0o116) + chr(1417 - 1316) + chr(6161 - 6062) + chr(111) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b111010 + 0o72) + chr(0b10100 + 0o122) + '\055' + chr(56)))(), xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'f.\xd6\xfe\xc7\x88\xe7\xe2h\xb0\xfd\r'), '\x64' + chr(0b1100101) + chr(0b110100 + 0o57) + '\157' + '\144' + chr(5479 - 5378))('\165' + chr(116) + '\x66' + chr(45) + chr(1088 - 1032)))()) & xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\\\x06\x94\xd8\xc6\x82\xe4\xa8`\xe6\xfc'), chr(100) + chr(101) + chr(0b101000 + 0o73) + '\157' + chr(100) + chr(9268 - 9167))(chr(117) + chr(116) + '\x66' + '\055' + '\x38'))() & xafqLlk3kkUe(KK0ERS7DqYrY, xafqLlk3kkUe(SXOLrMavuUCe(b'\\\x06\x94\xd8\xc6\x82\xe4\xa8`\xe6\xfc'), chr(0b1010 + 0o132) + '\145' + chr(0b1011000 + 0o13) + chr(111) + '\144' + '\x65')(chr(0b1110101) + '\x74' + chr(0b1 + 0o145) + '\x2d' + chr(56)))() elif PlSM16l2KDPD(KK0ERS7DqYrY, VtU1DncglWAm): return C8dAr6Ujq2Tn(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'S\x1a\xbf\xf4\xdf\x99\xfe\xb5n\xd7\xfaO\xb8\xbc\xef'), '\x64' + chr(101) + chr(5719 - 5620) + chr(0b1001000 + 0o47) + chr(0b110110 + 0o56) + chr(0b1010001 + 0o24))(chr(0b1110101) + chr(1567 - 1451) + chr(0b1100110) + '\055' + chr(56)))(), KK0ERS7DqYrY) & xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\\\x06\x94\xd8\xc6\x82\xe4\xa8`\xe6\xfc'), chr(0b1101 + 0o127) + chr(0b1100101) + '\x63' + chr(111) + chr(6902 - 6802) + '\x65')('\x75' + '\164' + chr(0b1100000 + 0o6) + chr(0b101101) + '\x38'))() elif PlSM16l2KDPD(KK0ERS7DqYrY, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'a<\xb0\xd7\xe4\xb9\xc3\x9eM\xd7\xc8~\x8b\x91\xd7T+EW\xb6V\xfe'), chr(100) + '\x65' + '\x63' + chr(111) + chr(100) + chr(0b111011 + 0o52))(chr(12967 - 12850) + chr(116) + chr(0b1001010 + 0o34) + '\055' + chr(1347 - 1291)))): WVxHKyX45z_L = oVre8I6UXc3b._reverse_categories.Q8b5UytA0vqH(KK0ERS7DqYrY, -ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(11846 - 11735) + chr(49), 29935 - 29927)) return C8dAr6Ujq2Tn(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'f.\xd6\xfe\xc7\x88\xe7\xe2h\xb0\xfd\r'), '\x64' + '\145' + chr(99) + '\x6f' + '\144' + chr(2875 - 2774))(chr(2980 - 2863) + '\164' + chr(0b111100 + 0o52) + chr(45) + chr(0b111000)))(), WVxHKyX45z_L) & xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\\\x06\x94\xd8\xc6\x82\xe4\xa8`\xe6\xfc'), chr(100) + chr(101) + chr(0b1100011) + '\x6f' + '\x64' + '\145')('\165' + chr(0b1110100) + '\146' + chr(1350 - 1305) + chr(0b100000 + 0o30)))() return C8dAr6Ujq2Tn(KNx0Ujaz9UM0(xHaqLS1eUVFC, oVre8I6UXc3b), KK0ERS7DqYrY) return CVRCXTcnOnH6
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.empty_like
def empty_like(self, shape): """ Make an empty LabelArray with the same categories as ``self``, filled with ``self.missing_value``. """ return type(self).from_codes_and_metadata( codes=np.full( shape, self.reverse_categories[self.missing_value], dtype=unsigned_int_dtype_with_size_in_bytes(self.itemsize), ), categories=self.categories, reverse_categories=self.reverse_categories, missing_value=self.missing_value, )
python
def empty_like(self, shape): """ Make an empty LabelArray with the same categories as ``self``, filled with ``self.missing_value``. """ return type(self).from_codes_and_metadata( codes=np.full( shape, self.reverse_categories[self.missing_value], dtype=unsigned_int_dtype_with_size_in_bytes(self.itemsize), ), categories=self.categories, reverse_categories=self.reverse_categories, missing_value=self.missing_value, )
[ "def", "empty_like", "(", "self", ",", "shape", ")", ":", "return", "type", "(", "self", ")", ".", "from_codes_and_metadata", "(", "codes", "=", "np", ".", "full", "(", "shape", ",", "self", ".", "reverse_categories", "[", "self", ".", "missing_value", "]", ",", "dtype", "=", "unsigned_int_dtype_with_size_in_bytes", "(", "self", ".", "itemsize", ")", ",", ")", ",", "categories", "=", "self", ".", "categories", ",", "reverse_categories", "=", "self", ".", "reverse_categories", ",", "missing_value", "=", "self", ".", "missing_value", ",", ")" ]
Make an empty LabelArray with the same categories as ``self``, filled with ``self.missing_value``.
[ "Make", "an", "empty", "LabelArray", "with", "the", "same", "categories", "as", "self", "filled", "with", "self", ".", "missing_value", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L605-L619
train
Make an empty LabelArray with the same categories as self filled with self. missing_value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60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,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(201 - 150) + chr(1721 - 1670) + chr(55), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\x30' + chr(0b110101 + 0o2), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + chr(0b101101 + 0o5) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(48) + chr(0b110110), 3119 - 3111), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101001 + 0o10) + '\062' + chr(636 - 581), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b110001 + 0o76) + chr(1852 - 1801) + '\067' + chr(0b110011 + 0o2), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\x35' + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2230 - 2119) + '\062' + '\062' + chr(806 - 752), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2030 - 1981) + chr(282 - 231) + chr(49), 65488 - 65480), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10101 + 0o36) + chr(0b11100 + 0o32) + chr(845 - 795), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1000110 + 0o51) + chr(1728 - 1677) + '\x33' + chr(0b101101 + 0o12), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(1829 - 1781) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10417 - 10306) + chr(53) + '\x32', 0o10), ehT0Px3KOsy9(chr(1359 - 1311) + chr(7356 - 7245) + chr(1749 - 1700) + chr(0b110110) + chr(0b10011 + 0o40), 62539 - 62531), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b1000 + 0o53) + '\064', 8583 - 8575), ehT0Px3KOsy9(chr(2185 - 2137) + chr(5434 - 5323) + chr(0b110010) + chr(84 - 30) + '\x31', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100000 + 0o17) + '\x35' + '\x30', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(5160 - 5049) + chr(0b110011) + chr(54) + chr(2403 - 2348), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111001 + 0o66) + '\x33' + chr(50) + chr(508 - 457), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100001 + 0o16) + chr(49) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1460 - 1412) + '\x6f' + chr(0b1010 + 0o51) + chr(0b110111) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(53) + chr(1281 - 1231), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(175 - 122) + chr(50), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100111 + 0o13) + chr(2007 - 1959) + '\062', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\x33', 0b1000), ehT0Px3KOsy9(chr(1228 - 1180) + chr(6756 - 6645) + chr(52) + chr(0b10001 + 0o41), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(4961 - 4850) + chr(684 - 633) + chr(0b100000 + 0o27) + '\x35', 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1100000 + 0o17) + chr(0b110001) + chr(0b110110) + '\060', 49257 - 49249), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b10001 + 0o44), 52668 - 52660), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\x36' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(0b110011) + chr(0b1000 + 0o55) + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101010 + 0o13) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10110 + 0o33) + chr(0b110110) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110111) + '\067', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b11100 + 0o32) + '\x30', 47937 - 47929), ehT0Px3KOsy9('\060' + chr(9747 - 9636) + '\062', 0o10), ehT0Px3KOsy9('\x30' + chr(4649 - 4538) + '\066' + chr(55), 33872 - 33864), ehT0Px3KOsy9('\x30' + chr(9578 - 9467) + chr(0b110011) + chr(51) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + chr(1399 - 1347) + chr(1208 - 1160), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10762 - 10651) + chr(0b101111 + 0o10) + chr(0b110001), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2249 - 2201) + '\x6f' + chr(0b100010 + 0o23) + '\060', 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xf1'), chr(0b101010 + 0o72) + chr(0b1100101) + chr(0b1100011) + chr(0b1010001 + 0o36) + '\x64' + '\x65')(chr(0b1000110 + 0o57) + chr(0b1001001 + 0o53) + chr(102) + chr(1158 - 1113) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def DusprIe_X4aH(oVre8I6UXc3b, nauYfLglTpcb): return xafqLlk3kkUe(wmQmyeWBmUpv(oVre8I6UXc3b), xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xb5\xfc+\x08\x9e\x06\xf2<\x81\x80\xa1D\x17\x83\xdcM\x83\xb2o\x9f^\x8b'), chr(100) + chr(0b1100101) + '\143' + '\157' + chr(100) + chr(0b1100101))('\x75' + '\164' + chr(0b1010100 + 0o22) + chr(45) + '\070'))(codes=xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb9\xb2\xff*'), chr(3186 - 3086) + '\145' + '\143' + chr(111) + chr(8321 - 8221) + chr(101))('\x75' + chr(116) + chr(3487 - 3385) + chr(1151 - 1106) + '\070'))(nauYfLglTpcb, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xa2\xe5#%\x8e\x0c\xc9:\x93\xab\xa5M\x1c\xae\xd8M\x84'), '\x64' + chr(5486 - 5385) + chr(0b101110 + 0o65) + '\157' + chr(6224 - 6124) + chr(2502 - 2401))(chr(117) + chr(6513 - 6397) + chr(0b1000010 + 0o44) + chr(0b101101) + chr(864 - 808)))[xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc\x8a\xa5\x00\x04\xa4&\xa5/\xa2\xaa\xaa'), chr(0b111100 + 0o50) + chr(101) + chr(7377 - 7278) + '\x6f' + chr(100) + chr(0b1100010 + 0o3))(chr(117) + chr(0b1110100) + chr(102) + chr(0b101101) + chr(1012 - 956)))], dtype=QhNO7qQetJaB(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb6\xb3\xf6+$\x94\x13\xf3'), chr(9477 - 9377) + chr(0b11100 + 0o111) + '\x63' + '\157' + chr(0b10010 + 0o122) + '\145')(chr(117) + chr(0b1110100) + '\146' + chr(669 - 624) + chr(629 - 573))))), categories=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb2\x9d\xc9\x02\x16\xa9]\xaf\x0c\x88\x9e\xa2'), '\144' + '\145' + chr(99) + chr(111) + chr(0b110011 + 0o61) + chr(0b1011111 + 0o6))('\x75' + chr(0b1000010 + 0o62) + '\x66' + chr(0b101101 + 0o0) + chr(3090 - 3034))), reverse_categories=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xad\xa2\xe5#%\x8e\x0c\xc9:\x93\xab\xa5M\x1c\xae\xd8M\x84'), chr(0b100000 + 0o104) + chr(101) + chr(99) + chr(0b10000 + 0o137) + '\x64' + chr(0b1101 + 0o130))(chr(117) + chr(116) + '\146' + chr(0b101101) + chr(0b1 + 0o67))), missing_value=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbc\x8a\xa5\x00\x04\xa4&\xa5/\xa2\xaa\xaa'), '\x64' + chr(0b1000110 + 0o37) + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(101))('\165' + chr(116) + '\146' + chr(45) + chr(0b100000 + 0o30))))
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.map_predicate
def map_predicate(self, f): """ Map a function from str -> bool element-wise over ``self``. ``f`` will be applied exactly once to each non-missing unique value in ``self``. Missing values will always return False. """ # Functions passed to this are of type str -> bool. Don't ever call # them on None, which is the only non-str value we ever store in # categories. if self.missing_value is None: def f_to_use(x): return False if x is None else f(x) else: f_to_use = f # Call f on each unique value in our categories. results = np.vectorize(f_to_use, otypes=[bool_dtype])(self.categories) # missing_value should produce False no matter what results[self.reverse_categories[self.missing_value]] = False # unpack the results form each unique value into their corresponding # locations in our indices. return results[self.as_int_array()]
python
def map_predicate(self, f): """ Map a function from str -> bool element-wise over ``self``. ``f`` will be applied exactly once to each non-missing unique value in ``self``. Missing values will always return False. """ # Functions passed to this are of type str -> bool. Don't ever call # them on None, which is the only non-str value we ever store in # categories. if self.missing_value is None: def f_to_use(x): return False if x is None else f(x) else: f_to_use = f # Call f on each unique value in our categories. results = np.vectorize(f_to_use, otypes=[bool_dtype])(self.categories) # missing_value should produce False no matter what results[self.reverse_categories[self.missing_value]] = False # unpack the results form each unique value into their corresponding # locations in our indices. return results[self.as_int_array()]
[ "def", "map_predicate", "(", "self", ",", "f", ")", ":", "# Functions passed to this are of type str -> bool. Don't ever call", "# them on None, which is the only non-str value we ever store in", "# categories.", "if", "self", ".", "missing_value", "is", "None", ":", "def", "f_to_use", "(", "x", ")", ":", "return", "False", "if", "x", "is", "None", "else", "f", "(", "x", ")", "else", ":", "f_to_use", "=", "f", "# Call f on each unique value in our categories.", "results", "=", "np", ".", "vectorize", "(", "f_to_use", ",", "otypes", "=", "[", "bool_dtype", "]", ")", "(", "self", ".", "categories", ")", "# missing_value should produce False no matter what", "results", "[", "self", ".", "reverse_categories", "[", "self", ".", "missing_value", "]", "]", "=", "False", "# unpack the results form each unique value into their corresponding", "# locations in our indices.", "return", "results", "[", "self", ".", "as_int_array", "(", ")", "]" ]
Map a function from str -> bool element-wise over ``self``. ``f`` will be applied exactly once to each non-missing unique value in ``self``. Missing values will always return False.
[ "Map", "a", "function", "from", "str", "-", ">", "bool", "element", "-", "wise", "over", "self", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/labelarray.py#L621-L645
train
Map a function from str - > bool element - wise over self.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljP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XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1000111 + 0o50) + '\x32' + chr(0b110111) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(6463 - 6352) + chr(0b110010) + chr(0b10110 + 0o32) + '\066', 44077 - 44069), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(0b100101 + 0o15) + chr(0b11111 + 0o23) + chr(235 - 185), 0b1000), ehT0Px3KOsy9('\060' + chr(0b111100 + 0o63) + chr(0b101001 + 0o13) + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(249 - 198) + chr(0b110100) + chr(1579 - 1528), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001001 + 0o46) + chr(169 - 119) + chr(0b1100 + 0o45) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b110100) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\063' + chr(0b10101 + 0o37), 7096 - 7088), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + '\x34' + chr(1000 - 951), 11527 - 11519), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11001 + 0o32) + '\060' + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1010100 + 0o33) + chr(0b110001) + chr(2028 - 1978) + chr(0b110001), 42375 - 42367), ehT0Px3KOsy9('\060' + chr(4336 - 4225) + '\x33' + chr(1629 - 1581) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(55) + chr(0b101000 + 0o17), 24854 - 24846), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\x36' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1111 + 0o42) + chr(51) + chr(0b11000 + 0o35), 28097 - 28089), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110000) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(1395 - 1346) + chr(223 - 168) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + '\060' + chr(580 - 532), 7759 - 7751), ehT0Px3KOsy9(chr(1463 - 1415) + '\157' + chr(0b101 + 0o54) + chr(0b110110) + '\x37', 39776 - 39768), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(50) + '\x33' + chr(0b10100 + 0o40), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + chr(0b110001) + chr(0b110010) + '\x37', 61374 - 61366), ehT0Px3KOsy9(chr(995 - 947) + chr(0b1101111 + 0o0) + '\x31' + chr(54) + '\064', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(1460 - 1409) + chr(0b10001 + 0o37), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000000 + 0o57) + chr(0b110011) + chr(0b110111) + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(54) + '\061', 13716 - 13708), ehT0Px3KOsy9(chr(1033 - 985) + chr(0b1101110 + 0o1) + '\063' + chr(52) + chr(2742 - 2689), 62302 - 62294), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x31' + chr(0b100 + 0o55), ord("\x08")), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + '\061' + '\066' + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b11101 + 0o122) + chr(0b101101 + 0o6) + chr(0b110011) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1255 - 1144) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(0b110011) + '\062' + chr(1930 - 1877), 0b1000), ehT0Px3KOsy9(chr(875 - 827) + chr(0b1011100 + 0o23) + '\x32' + chr(0b110011) + chr(689 - 641), 8), ehT0Px3KOsy9(chr(0b110000) + chr(6257 - 6146) + '\063' + '\x37' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + chr(743 - 693) + chr(55) + '\x31', 0b1000), ehT0Px3KOsy9(chr(680 - 632) + chr(111) + chr(0b1 + 0o60) + chr(0b101000 + 0o10) + chr(110 - 61), 0o10), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + '\063' + chr(0b110101) + chr(1842 - 1788), 12357 - 12349), ehT0Px3KOsy9(chr(843 - 795) + '\157' + '\x32' + '\060' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\x33' + chr(0b110101), 8), ehT0Px3KOsy9(chr(2258 - 2210) + chr(111) + chr(0b10010 + 0o45) + chr(1619 - 1571), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110111) + '\x37', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1521 - 1473) + chr(111) + chr(0b10100 + 0o41) + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x93'), chr(100) + '\145' + chr(0b1100011) + '\157' + '\x64' + chr(0b111001 + 0o54))(chr(0b1101111 + 0o6) + chr(0b1110100) + chr(950 - 848) + chr(1886 - 1841) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TPSBDMwGbnVk(oVre8I6UXc3b, EGyt1xfPT1P6): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xde\xcb\xa4d\xb0\xd1+o\xd7\x91$\xaf'), chr(4751 - 4651) + chr(0b1100101) + '\x63' + chr(0b1101111) + chr(0b1001101 + 0o27) + chr(101))(chr(11914 - 11797) + chr(0b1011110 + 0o26) + chr(3001 - 2899) + chr(0b101101) + chr(56))) is None: def KZQBcWhNzXiu(OeWW0F1dBPRQ): return ehT0Px3KOsy9(chr(979 - 931) + chr(111) + '\060', 0o10) if OeWW0F1dBPRQ is None else EGyt1xfPT1P6(OeWW0F1dBPRQ) else: KZQBcWhNzXiu = EGyt1xfPT1P6 iIGKX2zSEGYP = WqUC3KWvYVup.vectorize(KZQBcWhNzXiu, otypes=[RxCWrR7Zbq1B])(oVre8I6UXc3b.mZZDAT49UzAb) iIGKX2zSEGYP[oVre8I6UXc3b.RUh5Ov7z62h9[oVre8I6UXc3b.cM6FSYO3vPuj]] = ehT0Px3KOsy9('\x30' + chr(111) + '\060', 8) return iIGKX2zSEGYP[xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\xc1\xa4[\x8f\xeb\x14e\xc0\xf97\xf5'), chr(0b1100100) + '\x65' + '\143' + '\x6f' + chr(5677 - 5577) + '\145')(chr(0b1101100 + 0o11) + chr(116) + '\x66' + chr(45) + '\x38'))()]
quantopian/zipline
zipline/lib/labelarray.py
LabelArray.map
def map(self, f): """ Map a function from str -> str element-wise over ``self``. ``f`` will be applied exactly once to each non-missing unique value in ``self``. Missing values will always map to ``self.missing_value``. """ # f() should only return None if None is our missing value. if self.missing_value is None: allowed_outtypes = self.SUPPORTED_SCALAR_TYPES else: allowed_outtypes = self.SUPPORTED_NON_NONE_SCALAR_TYPES def f_to_use(x, missing_value=self.missing_value, otypes=allowed_outtypes): # Don't call f on the missing value; those locations don't exist # semantically. We return _sortable_sentinel rather than None # because the np.unique call below sorts the categories array, # which raises an error on Python 3 because None and str aren't # comparable. if x == missing_value: return _sortable_sentinel ret = f(x) if not isinstance(ret, otypes): raise TypeError( "LabelArray.map expected function {f} to return a string" " or None, but got {type} instead.\n" "Value was {value}.".format( f=f.__name__, type=type(ret).__name__, value=ret, ) ) if ret == missing_value: return _sortable_sentinel return ret new_categories_with_duplicates = ( np.vectorize(f_to_use, otypes=[object])(self.categories) ) # If f() maps multiple inputs to the same output, then we can end up # with the same code duplicated multiple times. Compress the categories # by running them through np.unique, and then use the reverse lookup # table to compress codes as well. new_categories, bloated_inverse_index = np.unique( new_categories_with_duplicates, return_inverse=True ) if new_categories[0] is _sortable_sentinel: # f_to_use return _sortable_sentinel for locations that should be # missing values in our output. Since np.unique returns the uniques # in sorted order, and since _sortable_sentinel sorts before any # string, we only need to check the first array entry. new_categories[0] = self.missing_value # `reverse_index` will always be a 64 bit integer even if we can hold a # smaller array. reverse_index = bloated_inverse_index.astype( smallest_uint_that_can_hold(len(new_categories)) ) new_codes = np.take(reverse_index, self.as_int_array()) return self.from_codes_and_metadata( new_codes, new_categories, dict(zip(new_categories, range(len(new_categories)))), missing_value=self.missing_value, )
python
def map(self, f): """ Map a function from str -> str element-wise over ``self``. ``f`` will be applied exactly once to each non-missing unique value in ``self``. Missing values will always map to ``self.missing_value``. """ # f() should only return None if None is our missing value. if self.missing_value is None: allowed_outtypes = self.SUPPORTED_SCALAR_TYPES else: allowed_outtypes = self.SUPPORTED_NON_NONE_SCALAR_TYPES def f_to_use(x, missing_value=self.missing_value, otypes=allowed_outtypes): # Don't call f on the missing value; those locations don't exist # semantically. We return _sortable_sentinel rather than None # because the np.unique call below sorts the categories array, # which raises an error on Python 3 because None and str aren't # comparable. if x == missing_value: return _sortable_sentinel ret = f(x) if not isinstance(ret, otypes): raise TypeError( "LabelArray.map expected function {f} to return a string" " or None, but got {type} instead.\n" "Value was {value}.".format( f=f.__name__, type=type(ret).__name__, value=ret, ) ) if ret == missing_value: return _sortable_sentinel return ret new_categories_with_duplicates = ( np.vectorize(f_to_use, otypes=[object])(self.categories) ) # If f() maps multiple inputs to the same output, then we can end up # with the same code duplicated multiple times. Compress the categories # by running them through np.unique, and then use the reverse lookup # table to compress codes as well. new_categories, bloated_inverse_index = np.unique( new_categories_with_duplicates, return_inverse=True ) if new_categories[0] is _sortable_sentinel: # f_to_use return _sortable_sentinel for locations that should be # missing values in our output. Since np.unique returns the uniques # in sorted order, and since _sortable_sentinel sorts before any # string, we only need to check the first array entry. new_categories[0] = self.missing_value # `reverse_index` will always be a 64 bit integer even if we can hold a # smaller array. reverse_index = bloated_inverse_index.astype( smallest_uint_that_can_hold(len(new_categories)) ) new_codes = np.take(reverse_index, self.as_int_array()) return self.from_codes_and_metadata( new_codes, new_categories, dict(zip(new_categories, range(len(new_categories)))), missing_value=self.missing_value, )
[ "def", "map", "(", "self", ",", "f", ")", ":", "# f() should only return None if None is our missing value.", "if", "self", ".", "missing_value", "is", "None", ":", "allowed_outtypes", "=", "self", ".", "SUPPORTED_SCALAR_TYPES", "else", ":", "allowed_outtypes", "=", "self", ".", "SUPPORTED_NON_NONE_SCALAR_TYPES", "def", "f_to_use", "(", "x", ",", "missing_value", "=", "self", ".", "missing_value", ",", "otypes", "=", "allowed_outtypes", ")", ":", "# Don't call f on the missing value; those locations don't exist", "# semantically. We return _sortable_sentinel rather than None", "# because the np.unique call below sorts the categories array,", "# which raises an error on Python 3 because None and str aren't", "# comparable.", "if", "x", "==", "missing_value", ":", "return", "_sortable_sentinel", "ret", "=", "f", "(", "x", ")", "if", "not", "isinstance", "(", "ret", ",", "otypes", ")", ":", "raise", "TypeError", "(", "\"LabelArray.map expected function {f} to return a string\"", "\" or None, but got {type} instead.\\n\"", "\"Value was {value}.\"", ".", "format", "(", "f", "=", "f", ".", "__name__", ",", "type", "=", "type", "(", "ret", ")", ".", "__name__", ",", "value", "=", "ret", ",", ")", ")", "if", "ret", "==", "missing_value", ":", "return", "_sortable_sentinel", "return", "ret", "new_categories_with_duplicates", "=", "(", "np", ".", "vectorize", "(", "f_to_use", ",", "otypes", "=", "[", "object", "]", ")", "(", "self", ".", "categories", ")", ")", "# If f() maps multiple inputs to the same output, then we can end up", "# with the same code duplicated multiple times. Compress the categories", "# by running them through np.unique, and then use the reverse lookup", "# table to compress codes as well.", "new_categories", ",", "bloated_inverse_index", "=", "np", ".", "unique", "(", "new_categories_with_duplicates", ",", "return_inverse", "=", "True", ")", "if", "new_categories", "[", "0", "]", "is", "_sortable_sentinel", ":", "# f_to_use return _sortable_sentinel for locations that should be", "# missing values in our output. Since np.unique returns the uniques", "# in sorted order, and since _sortable_sentinel sorts before any", "# string, we only need to check the first array entry.", "new_categories", "[", "0", "]", "=", "self", ".", "missing_value", "# `reverse_index` will always be a 64 bit integer even if we can hold a", "# smaller array.", "reverse_index", "=", "bloated_inverse_index", ".", "astype", "(", "smallest_uint_that_can_hold", "(", "len", "(", "new_categories", ")", ")", ")", "new_codes", "=", "np", ".", "take", "(", "reverse_index", ",", "self", ".", "as_int_array", "(", ")", ")", "return", "self", ".", "from_codes_and_metadata", "(", "new_codes", ",", "new_categories", ",", "dict", "(", "zip", "(", "new_categories", ",", "range", "(", "len", "(", "new_categories", ")", ")", ")", ")", ",", "missing_value", "=", "self", ".", "missing_value", ",", ")" ]
Map a function from str -> str element-wise over ``self``. ``f`` will be applied exactly once to each non-missing unique value in ``self``. Missing values will always map to ``self.missing_value``.
[ "Map", "a", "function", "from", "str", "-", ">", "str", "element", "-", "wise", "over", "self", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/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Z0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1941 - 1893) + chr(0b1101111 + 0o0) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(181 - 133) + '\157' + '\x32' + chr(0b110101) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(0b10 + 0o61) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001110 + 0o41) + '\067' + '\x34', 22877 - 22869), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\063', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(53) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(10386 - 10275) + '\062' + '\x33' + chr(0b110100 + 0o2), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + chr(50) + chr(2207 - 2153), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11408 - 11297) + chr(50) + chr(1161 - 1106) + chr(0b1101 + 0o46), 0o10), ehT0Px3KOsy9(chr(1927 - 1879) + chr(0b1101111) + chr(1365 - 1311) + chr(324 - 274), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(3340 - 3229) + '\067' + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(50) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1171 - 1123) + '\157' + chr(1766 - 1717) + chr(0b110110) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1725 - 1676) + '\x31' + chr(478 - 425), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(0b11100 + 0o32) + chr(0b100000 + 0o26), ord("\x08")), ehT0Px3KOsy9(chr(1340 - 1292) + '\x6f' + '\x33' + chr(3001 - 2946) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1001111 + 0o40) + chr(0b110011) + chr(49) + '\063', 54052 - 54044), ehT0Px3KOsy9('\x30' + chr(0b101111 + 0o100) + chr(0b11100 + 0o25) + '\061' + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b100011 + 0o15) + chr(111) + chr(2653 - 2601) + chr(49), 65011 - 65003), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(0b110001) + chr(0b100011 + 0o15) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(1410 - 1360) + '\x34', 0o10), ehT0Px3KOsy9(chr(1044 - 996) + chr(6151 - 6040) + '\x32' + chr(0b10001 + 0o46) + chr(52), 35100 - 35092), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11000 + 0o32) + '\067' + '\062', 45924 - 45916), ehT0Px3KOsy9(chr(0b100 + 0o54) + '\x6f' + chr(0b11110 + 0o23) + chr(0b11100 + 0o30), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(1059 - 1010) + chr(0b110001) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1100111 + 0o10) + '\061' + '\x37' + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\x36' + chr(50), 61284 - 61276), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110001) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x34' + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(7560 - 7449) + chr(0b110011) + '\x30' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x36' + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(5613 - 5502) + '\x33' + '\x34' + '\065', 1906 - 1898), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100101 + 0o15) + chr(53) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + chr(1116 - 1064), 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(1300 - 1246) + chr(1220 - 1171), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b101110 + 0o2) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + chr(0b110000) + chr(0b101110 + 0o10), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110011) + '\x35' + chr(55), 4995 - 4987), ehT0Px3KOsy9('\x30' + chr(7687 - 7576) + '\x31' + chr(99 - 45) + '\066', 8), ehT0Px3KOsy9(chr(2103 - 2055) + chr(8751 - 8640) + chr(0b110110) + '\061', 62211 - 62203)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(121 - 73) + '\157' + chr(2673 - 2620) + '\060', 63117 - 63109)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'*'), '\x64' + '\x65' + chr(99) + chr(5066 - 4955) + chr(0b1001000 + 0o34) + chr(5005 - 4904))(chr(7709 - 7592) + '\164' + chr(7292 - 7190) + chr(0b10110 + 0o27) + chr(1983 - 1927)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def abA97kOQKaLo(oVre8I6UXc3b, EGyt1xfPT1P6): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'g\xe4mzH\xf3\xd1e\xcdbK\xbb'), chr(100) + '\145' + '\143' + '\x6f' + '\144' + chr(0b100000 + 0o105))(chr(117) + chr(0b1000111 + 0o55) + chr(0b1010101 + 0o21) + chr(45) + chr(56))) is None: f0kep0ZC0NW8 = oVre8I6UXc3b.SUPPORTED_SCALAR_TYPES else: f0kep0ZC0NW8 = oVre8I6UXc3b.SUPPORTED_NON_NONE_SCALAR_TYPES def KZQBcWhNzXiu(OeWW0F1dBPRQ, cM6FSYO3vPuj=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'g\xe4mzH\xf3\xd1e\xcdbK\xbb'), '\144' + chr(0b1100101) + chr(99) + chr(3104 - 2993) + chr(4337 - 4237) + chr(101))(chr(0b1010110 + 0o37) + chr(0b110001 + 0o103) + '\146' + chr(0b101101) + chr(0b111000))), nIO8Ui7IbevD=f0kep0ZC0NW8): if OeWW0F1dBPRQ == cM6FSYO3vPuj: return A2o5k9t4HuWJ VHn4CV4Ymrei = EGyt1xfPT1P6(OeWW0F1dBPRQ) if not PlSM16l2KDPD(VHn4CV4Ymrei, nIO8Ui7IbevD): raise sznFqDbNBHlx(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'H\xc89Yw\xeb\xec$\xdaK\x10\xbc\x17=\x16\x9f\xb3=D! \xd9\xde,+\x0b\x9c\xae\x17\xaf[\x8b\x8e\x7f\x97\xbd\xe6\x9b\x19\x11v\xcc/Ii\xc4\xbe7\x9bAJ\xa3\x1f#Q\xda\xa4?\x01\x0c;\xd2\xdf m\x1c\x87\xb9C\xa1[\x91\x8e\x7f\x85\xb9\xb6\x8a\x0b\x11m\xc7(H~\xcb\xfax\xb1d_\xbd\x03(\x16\x8d\xaa>\x019"\xdd\xd6y(\x03\xdc'), chr(0b1010111 + 0o15) + chr(101) + '\x63' + chr(0b1101111) + '\144' + chr(101))('\165' + chr(2833 - 2717) + '\x66' + chr(0b101101) + chr(2364 - 2308)), xafqLlk3kkUe(SXOLrMavuUCe(b'R\x9d)SS\xcb\xcde\xebB[\xbb'), chr(0b10011 + 0o121) + '\145' + chr(0b110100 + 0o57) + '\157' + chr(0b1100100) + chr(0b1000111 + 0o36))(chr(0b1110101) + chr(116) + '\x66' + '\055' + '\x38'))(f=xafqLlk3kkUe(EGyt1xfPT1P6, xafqLlk3kkUe(SXOLrMavuUCe(b"C\xcb>V/\xc5\xc4'\xf0~\x7f\xe7"), chr(0b1100100) + chr(0b1100101) + chr(0b10110 + 0o115) + chr(8215 - 8104) + chr(0b111100 + 0o50) + chr(6197 - 6096))(chr(0b1001 + 0o154) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b111000))), type=xafqLlk3kkUe(wmQmyeWBmUpv(VHn4CV4Ymrei), xafqLlk3kkUe(SXOLrMavuUCe(b"C\xcb>V/\xc5\xc4'\xf0~\x7f\xe7"), '\x64' + chr(0b11000 + 0o115) + chr(0b1100011) + chr(111) + chr(0b1100100) + '\145')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(45) + chr(0b110110 + 0o2))), value=VHn4CV4Ymrei)) if VHn4CV4Ymrei == cM6FSYO3vPuj: return A2o5k9t4HuWJ return VHn4CV4Ymrei cDtvs6XL8Qh2 = WqUC3KWvYVup.vectorize(KZQBcWhNzXiu, otypes=[sR_24x3xd4bh])(oVre8I6UXc3b.mZZDAT49UzAb) (QVK8u7RnAnpO, LcweL8SI7vvx) = WqUC3KWvYVup.unique(cDtvs6XL8Qh2, return_inverse=ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(49), 0o10)) if QVK8u7RnAnpO[ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(246 - 198), 0o10)] is A2o5k9t4HuWJ: QVK8u7RnAnpO[ehT0Px3KOsy9(chr(132 - 84) + '\x6f' + '\x30', 8)] = oVre8I6UXc3b.cM6FSYO3vPuj OC_XF0K7ZcZD = LcweL8SI7vvx.astype(MrPe3jScMX3w(c2A0yzQpDQB3(QVK8u7RnAnpO))) ZOp_qeUX5QuP = WqUC3KWvYVup.take(OC_XF0K7ZcZD, oVre8I6UXc3b.TG6ylcp9a8f0()) return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'b\xdb4QD\xc9\xf12\xdeAa\xb0\x18)i\x97\xae9@&5\xc8\xdb'), chr(5890 - 5790) + '\145' + chr(1477 - 1378) + chr(111) + chr(0b110010 + 0o62) + '\x65')('\165' + chr(11059 - 10943) + '\x66' + chr(45) + '\x38'))(ZOp_qeUX5QuP, QVK8u7RnAnpO, wLqBDw8l0eIm(pZ0NK2y6HRbn(QVK8u7RnAnpO, vQr8gNKaIaWE(c2A0yzQpDQB3(QVK8u7RnAnpO)))), missing_value=xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'g\xe4mzH\xf3\xd1e\xcdbK\xbb'), '\144' + '\x65' + chr(0b111111 + 0o44) + chr(111) + chr(0b1100100) + '\145')('\165' + chr(0b11111 + 0o125) + '\146' + chr(0b101101) + chr(0b1110 + 0o52))))
quantopian/zipline
zipline/finance/execution.py
asymmetric_round_price
def asymmetric_round_price(price, prefer_round_down, tick_size, diff=0.95): """ Asymmetric rounding function for adjusting prices to the specified number of places in a way that "improves" the price. For limit prices, this means preferring to round down on buys and preferring to round up on sells. For stop prices, it means the reverse. If prefer_round_down == True: When .05 below to .95 above a specified decimal place, use it. If prefer_round_down == False: When .95 below to .05 above a specified decimal place, use it. In math-speak: If prefer_round_down: [<X-1>.0095, X.0195) -> round to X.01. If not prefer_round_down: (<X-1>.0005, X.0105] -> round to X.01. """ precision = zp_math.number_of_decimal_places(tick_size) multiplier = int(tick_size * (10 ** precision)) diff -= 0.5 # shift the difference down diff *= (10 ** -precision) # adjust diff to precision of tick size diff *= multiplier # adjust diff to value of tick_size # Subtracting an epsilon from diff to enforce the open-ness of the upper # bound on buys and the lower bound on sells. Using the actual system # epsilon doesn't quite get there, so use a slightly less epsilon-ey value. epsilon = float_info.epsilon * 10 diff = diff - epsilon # relies on rounding half away from zero, unlike numpy's bankers' rounding rounded = tick_size * consistent_round( (price - (diff if prefer_round_down else -diff)) / tick_size ) if zp_math.tolerant_equals(rounded, 0.0): return 0.0 return rounded
python
def asymmetric_round_price(price, prefer_round_down, tick_size, diff=0.95): """ Asymmetric rounding function for adjusting prices to the specified number of places in a way that "improves" the price. For limit prices, this means preferring to round down on buys and preferring to round up on sells. For stop prices, it means the reverse. If prefer_round_down == True: When .05 below to .95 above a specified decimal place, use it. If prefer_round_down == False: When .95 below to .05 above a specified decimal place, use it. In math-speak: If prefer_round_down: [<X-1>.0095, X.0195) -> round to X.01. If not prefer_round_down: (<X-1>.0005, X.0105] -> round to X.01. """ precision = zp_math.number_of_decimal_places(tick_size) multiplier = int(tick_size * (10 ** precision)) diff -= 0.5 # shift the difference down diff *= (10 ** -precision) # adjust diff to precision of tick size diff *= multiplier # adjust diff to value of tick_size # Subtracting an epsilon from diff to enforce the open-ness of the upper # bound on buys and the lower bound on sells. Using the actual system # epsilon doesn't quite get there, so use a slightly less epsilon-ey value. epsilon = float_info.epsilon * 10 diff = diff - epsilon # relies on rounding half away from zero, unlike numpy's bankers' rounding rounded = tick_size * consistent_round( (price - (diff if prefer_round_down else -diff)) / tick_size ) if zp_math.tolerant_equals(rounded, 0.0): return 0.0 return rounded
[ "def", "asymmetric_round_price", "(", "price", ",", "prefer_round_down", ",", "tick_size", ",", "diff", "=", "0.95", ")", ":", "precision", "=", "zp_math", ".", "number_of_decimal_places", "(", "tick_size", ")", "multiplier", "=", "int", "(", "tick_size", "*", "(", "10", "**", "precision", ")", ")", "diff", "-=", "0.5", "# shift the difference down", "diff", "*=", "(", "10", "**", "-", "precision", ")", "# adjust diff to precision of tick size", "diff", "*=", "multiplier", "# adjust diff to value of tick_size", "# Subtracting an epsilon from diff to enforce the open-ness of the upper", "# bound on buys and the lower bound on sells. Using the actual system", "# epsilon doesn't quite get there, so use a slightly less epsilon-ey value.", "epsilon", "=", "float_info", ".", "epsilon", "*", "10", "diff", "=", "diff", "-", "epsilon", "# relies on rounding half away from zero, unlike numpy's bankers' rounding", "rounded", "=", "tick_size", "*", "consistent_round", "(", "(", "price", "-", "(", "diff", "if", "prefer_round_down", "else", "-", "diff", ")", ")", "/", "tick_size", ")", "if", "zp_math", ".", "tolerant_equals", "(", "rounded", ",", "0.0", ")", ":", "return", "0.0", "return", "rounded" ]
Asymmetric rounding function for adjusting prices to the specified number of places in a way that "improves" the price. For limit prices, this means preferring to round down on buys and preferring to round up on sells. For stop prices, it means the reverse. If prefer_round_down == True: When .05 below to .95 above a specified decimal place, use it. If prefer_round_down == False: When .95 below to .05 above a specified decimal place, use it. In math-speak: If prefer_round_down: [<X-1>.0095, X.0195) -> round to X.01. If not prefer_round_down: (<X-1>.0005, X.0105] -> round to X.01.
[ "Asymmetric", "rounding", "function", "for", "adjusting", "prices", "to", "the", "specified", "number", "of", "places", "in", "a", "way", "that", "improves", "the", "price", ".", "For", "limit", "prices", "this", "means", "preferring", "to", "round", "down", "on", "buys", "and", "preferring", "to", "round", "up", "on", "sells", ".", "For", "stop", "prices", "it", "means", "the", "reverse", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/finance/execution.py#L159-L193
train
Asymmetric rounding function for rounding a price to a specified number of places in a way that improves the price.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ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Bb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(111) + chr(0b100010 + 0o21) + chr(0b10001 + 0o41), ord("\x08")), ehT0Px3KOsy9(chr(1330 - 1282) + chr(3395 - 3284) + '\x33' + chr(1073 - 1021), 41213 - 41205), ehT0Px3KOsy9(chr(0b110000) + chr(7503 - 7392) + chr(49) + '\062' + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + '\x30' + chr(55), 55530 - 55522), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(52) + '\064', 55528 - 55520), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\063' + chr(308 - 253), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(55) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(603 - 552) + '\x32', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(2005 - 1952) + chr(0b110010), 877 - 869), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(0b110011) + chr(50) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6765 - 6654) + chr(0b100101 + 0o16) + '\x30' + '\067', 8), ehT0Px3KOsy9(chr(48) + chr(11216 - 11105) + '\062' + chr(0b10110 + 0o40) + chr(0b11110 + 0o25), 48007 - 47999), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(0b100110 + 0o20) + '\060', 40788 - 40780), ehT0Px3KOsy9(chr(228 - 180) + '\157' + chr(50) + chr(0b100010 + 0o22) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b110111) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(1461 - 1411) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1039 - 990) + chr(0b100011 + 0o24) + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100110 + 0o11) + '\x33' + chr(0b110111) + '\x31', 9652 - 9644), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2207 - 2156) + '\063' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1870 - 1822) + chr(0b101110 + 0o101) + chr(0b110011) + chr(0b0 + 0o66) + '\x31', 13804 - 13796), ehT0Px3KOsy9('\x30' + chr(0b100010 + 0o115) + chr(51) + chr(1521 - 1473) + chr(454 - 402), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + chr(0b1100 + 0o47) + '\x37' + chr(0b10001 + 0o40), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b101110 + 0o5) + chr(1071 - 1018), 24236 - 24228), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b110100) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(2558 - 2503) + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(0b101111 + 0o1) + chr(677 - 628), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101011 + 0o104) + chr(1741 - 1686) + chr(1028 - 979), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\x30' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(349 - 294) + chr(1454 - 1399), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1632 - 1582) + chr(53) + chr(53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(6640 - 6529) + chr(0b110010) + chr(0b110 + 0o55) + chr(1531 - 1481), 8), ehT0Px3KOsy9(chr(48) + chr(0b11011 + 0o124) + chr(0b1100 + 0o45) + chr(0b110001) + '\066', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + chr(0b1000 + 0o52) + chr(0b101001 + 0o10) + chr(1738 - 1686), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(0b110100), 5832 - 5824), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b11000 + 0o36), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + '\x37' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1518 - 1470) + chr(3079 - 2968) + chr(2124 - 2073) + chr(53) + '\x34', 0b1000), ehT0Px3KOsy9(chr(926 - 878) + chr(1551 - 1440) + chr(0b110001) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(294 - 243) + chr(52) + '\067', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + '\065' + chr(69 - 21), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'4'), '\x64' + '\145' + chr(0b1110 + 0o125) + chr(3450 - 3339) + '\144' + chr(7526 - 7425))('\165' + chr(116) + '\x66' + chr(1642 - 1597) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def DHDa0QZbUyZo(t4W21LCLQw1O, HbMBq8rX1GfT, wcLyWxnyCUUZ, A3JtwFGKVTf0=0.95): gX1fbCVtNNXn = W33AHBCGWxHv.number_of_decimal_places(wcLyWxnyCUUZ) S0Mp0SOoXply = ehT0Px3KOsy9(wcLyWxnyCUUZ * ehT0Px3KOsy9('\060' + chr(111) + '\061' + '\062', 0o10) ** gX1fbCVtNNXn) A3JtwFGKVTf0 -= 0.5 A3JtwFGKVTf0 *= ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1125 - 1076) + chr(0b11111 + 0o23), 8) ** (-gX1fbCVtNNXn) A3JtwFGKVTf0 *= S0Mp0SOoXply Xtig2zAKpR0T = qMYk2t_dUI5z.Xtig2zAKpR0T * ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(10893 - 10782) + '\061' + chr(0b110010), 8) A3JtwFGKVTf0 = A3JtwFGKVTf0 - Xtig2zAKpR0T E6oCgyLjKbnl = wcLyWxnyCUUZ * J6pFSjpNsQ89((t4W21LCLQw1O - (A3JtwFGKVTf0 if HbMBq8rX1GfT else -A3JtwFGKVTf0)) / wcLyWxnyCUUZ) if xafqLlk3kkUe(W33AHBCGWxHv, xafqLlk3kkUe(SXOLrMavuUCe(b'ns=\xa2\x96>\x13\xee5\xb4\xb6\xc6\xd1\xcd\n'), chr(9842 - 9742) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(100) + '\145')('\165' + chr(0b1010110 + 0o36) + chr(0b100010 + 0o104) + '\x2d' + '\x38'))(E6oCgyLjKbnl, 0.0): return 0.0 return E6oCgyLjKbnl
quantopian/zipline
zipline/finance/execution.py
check_stoplimit_prices
def check_stoplimit_prices(price, label): """ Check to make sure the stop/limit prices are reasonable and raise a BadOrderParameters exception if not. """ try: if not isfinite(price): raise BadOrderParameters( msg="Attempted to place an order with a {} price " "of {}.".format(label, price) ) # This catches arbitrary objects except TypeError: raise BadOrderParameters( msg="Attempted to place an order with a {} price " "of {}.".format(label, type(price)) ) if price < 0: raise BadOrderParameters( msg="Can't place a {} order with a negative price.".format(label) )
python
def check_stoplimit_prices(price, label): """ Check to make sure the stop/limit prices are reasonable and raise a BadOrderParameters exception if not. """ try: if not isfinite(price): raise BadOrderParameters( msg="Attempted to place an order with a {} price " "of {}.".format(label, price) ) # This catches arbitrary objects except TypeError: raise BadOrderParameters( msg="Attempted to place an order with a {} price " "of {}.".format(label, type(price)) ) if price < 0: raise BadOrderParameters( msg="Can't place a {} order with a negative price.".format(label) )
[ "def", "check_stoplimit_prices", "(", "price", ",", "label", ")", ":", "try", ":", "if", "not", "isfinite", "(", "price", ")", ":", "raise", "BadOrderParameters", "(", "msg", "=", "\"Attempted to place an order with a {} price \"", "\"of {}.\"", ".", "format", "(", "label", ",", "price", ")", ")", "# This catches arbitrary objects", "except", "TypeError", ":", "raise", "BadOrderParameters", "(", "msg", "=", "\"Attempted to place an order with a {} price \"", "\"of {}.\"", ".", "format", "(", "label", ",", "type", "(", "price", ")", ")", ")", "if", "price", "<", "0", ":", "raise", "BadOrderParameters", "(", "msg", "=", "\"Can't place a {} order with a negative price.\"", ".", "format", "(", "label", ")", ")" ]
Check to make sure the stop/limit prices are reasonable and raise a BadOrderParameters exception if not.
[ "Check", "to", "make", "sure", "the", "stop", "/", "limit", "prices", "are", "reasonable", "and", "raise", "a", "BadOrderParameters", "exception", "if", "not", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/finance/execution.py#L196-L217
train
Check to make sure the stop and limit prices are reasonable and raise a BadOrderParameters exception if not.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0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C9iu2kLpS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b1000001 + 0o56) + '\x31' + chr(891 - 838) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(2634 - 2523) + chr(993 - 942) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1860 - 1812) + chr(954 - 843) + chr(49) + '\061' + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + chr(2198 - 2087) + '\x33' + '\x36' + chr(563 - 515), 56883 - 56875), ehT0Px3KOsy9(chr(1691 - 1643) + '\x6f' + chr(0b101010 + 0o7) + chr(0b101000 + 0o16) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + '\063' + '\x35' + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\x36' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + '\x32' + chr(0b101010 + 0o15) + chr(51), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(48) + chr(693 - 639), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + '\x37' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(12170 - 12059) + chr(53) + chr(2708 - 2653), 17963 - 17955), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(0b1111 + 0o43) + chr(0b10011 + 0o42) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(2143 - 2093) + chr(0b10011 + 0o37) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4693 - 4582) + chr(51) + '\x35' + '\062', 0b1000), ehT0Px3KOsy9(chr(877 - 829) + chr(2416 - 2305) + chr(0b11101 + 0o24) + '\062' + chr(0b0 + 0o62), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + chr(487 - 438) + chr(0b110001) + chr(1667 - 1617), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(3864 - 3753) + chr(0b0 + 0o61) + chr(51) + chr(0b110011), 16883 - 16875), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10100 + 0o37) + chr(0b110111) + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\060' + chr(55), 24263 - 24255), ehT0Px3KOsy9(chr(1513 - 1465) + chr(111) + '\062' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + '\063' + chr(0b110101), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(1182 - 1130) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010000 + 0o37) + chr(50) + chr(0b110010) + chr(0b111 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(49) + '\064' + chr(1490 - 1435), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1190 - 1141) + chr(0b10100 + 0o35) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b110001) + chr(0b110000 + 0o5), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(48) + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(0b110010) + chr(0b100110 + 0o12) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + chr(0b101001 + 0o11) + chr(0b11 + 0o61) + chr(0b110111), 51475 - 51467), ehT0Px3KOsy9(chr(496 - 448) + '\157' + chr(0b11000 + 0o32) + chr(1615 - 1564) + chr(51), 57341 - 57333), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(0b110010) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(2060 - 2012) + chr(0b1101111) + chr(51) + chr(0b101111 + 0o2), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(2615 - 2563), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + '\064' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(881 - 826) + '\x35', 47252 - 47244), ehT0Px3KOsy9('\x30' + chr(111) + chr(2206 - 2157) + chr(51) + chr(951 - 896), 52976 - 52968), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(1151 - 1040) + chr(0b110110) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(4093 - 3982) + chr(51) + '\x33', 51554 - 51546), ehT0Px3KOsy9('\x30' + chr(4276 - 4165) + '\x33' + chr(0b110100) + chr(1247 - 1194), 46716 - 46708), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + '\062' + '\x37' + chr(0b10 + 0o64), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(111) + '\x35' + chr(1353 - 1305), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'B'), chr(100) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1000011 + 0o61) + chr(7624 - 7522) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def uiknnXB6fqEX(t4W21LCLQw1O, TRUOLFLuD08x): try: if not XNkaS3uEoMmp(t4W21LCLQw1O): raise b3PtVqwis0aq(msg=xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'-h<\x95\x1b\x9b\x04\xde"\xdc[\xc2\xb4\x9a>+8\x99\xe7w3\x01\xf8\x15-(4\xa2\xd0\xf2\xa4q$\xc7\x1d$K;\x95\xcc\x05\x7f-\xd0\x19\x8dP\xc0;\xd2'), chr(0b10 + 0o142) + chr(101) + chr(99) + '\157' + '\144' + chr(101))(chr(0b1100111 + 0o16) + chr(0b1110100) + chr(102) + chr(932 - 887) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b':(:\x9f>\x8a#\x88\x16\x8cJ\xc7'), '\144' + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(100) + chr(2405 - 2304))(chr(117) + chr(0b1011110 + 0o26) + chr(3892 - 3790) + '\x2d' + '\070'))(TRUOLFLuD08x, t4W21LCLQw1O)) except sznFqDbNBHlx: raise b3PtVqwis0aq(msg=xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'-h<\x95\x1b\x9b\x04\xde"\xdc[\xc2\xb4\x9a>+8\x99\xe7w3\x01\xf8\x15-(4\xa2\xd0\xf2\xa4q$\xc7\x1d$K;\x95\xcc\x05\x7f-\xd0\x19\x8dP\xc0;\xd2'), chr(100) + chr(101) + chr(0b1010 + 0o131) + '\x6f' + chr(0b1100100) + '\x65')(chr(6870 - 6753) + chr(0b1011001 + 0o33) + chr(0b1011010 + 0o14) + '\055' + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b':(:\x9f>\x8a#\x88\x16\x8cJ\xc7'), chr(100) + '\x65' + '\143' + chr(111) + chr(0b1100100) + chr(101))('\165' + chr(0b100101 + 0o117) + chr(0b1100110) + chr(0b101101) + '\x38'))(TRUOLFLuD08x, wmQmyeWBmUpv(t4W21LCLQw1O))) if t4W21LCLQw1O < ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(9094 - 8983) + chr(2077 - 2029), 0b1000): raise b3PtVqwis0aq(msg=xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"/}&\xd7\x02\xcb\x00\xd7'\x9fJ\x8d\xf5\xca)7{\x93\xb5r8S\xb7\x10 9.\xa2\xc6\xbb\xbe|c\xc7I6@~\xc5\xce\x1eu+\x95X"), '\x64' + '\x65' + '\x63' + '\157' + chr(100) + chr(0b1100101))(chr(9784 - 9667) + chr(0b1110100) + chr(0b1100110) + chr(0b101001 + 0o4) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b':(:\x9f>\x8a#\x88\x16\x8cJ\xc7'), '\144' + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(100) + chr(0b1100101))('\165' + chr(0b1111 + 0o145) + chr(102) + chr(1163 - 1118) + chr(664 - 608)))(TRUOLFLuD08x))
quantopian/zipline
zipline/data/bundles/csvdir.py
csvdir_bundle
def csvdir_bundle(environ, asset_db_writer, minute_bar_writer, daily_bar_writer, adjustment_writer, calendar, start_session, end_session, cache, show_progress, output_dir, tframes=None, csvdir=None): """ Build a zipline data bundle from the directory with csv files. """ if not csvdir: csvdir = environ.get('CSVDIR') if not csvdir: raise ValueError("CSVDIR environment variable is not set") if not os.path.isdir(csvdir): raise ValueError("%s is not a directory" % csvdir) if not tframes: tframes = set(["daily", "minute"]).intersection(os.listdir(csvdir)) if not tframes: raise ValueError("'daily' and 'minute' directories " "not found in '%s'" % csvdir) divs_splits = {'divs': DataFrame(columns=['sid', 'amount', 'ex_date', 'record_date', 'declared_date', 'pay_date']), 'splits': DataFrame(columns=['sid', 'ratio', 'effective_date'])} for tframe in tframes: ddir = os.path.join(csvdir, tframe) symbols = sorted(item.split('.csv')[0] for item in os.listdir(ddir) if '.csv' in item) if not symbols: raise ValueError("no <symbol>.csv* files found in %s" % ddir) dtype = [('start_date', 'datetime64[ns]'), ('end_date', 'datetime64[ns]'), ('auto_close_date', 'datetime64[ns]'), ('symbol', 'object')] metadata = DataFrame(empty(len(symbols), dtype=dtype)) if tframe == 'minute': writer = minute_bar_writer else: writer = daily_bar_writer writer.write(_pricing_iter(ddir, symbols, metadata, divs_splits, show_progress), show_progress=show_progress) # Hardcode the exchange to "CSVDIR" for all assets and (elsewhere) # register "CSVDIR" to resolve to the NYSE calendar, because these # are all equities and thus can use the NYSE calendar. metadata['exchange'] = "CSVDIR" asset_db_writer.write(equities=metadata) divs_splits['divs']['sid'] = divs_splits['divs']['sid'].astype(int) divs_splits['splits']['sid'] = divs_splits['splits']['sid'].astype(int) adjustment_writer.write(splits=divs_splits['splits'], dividends=divs_splits['divs'])
python
def csvdir_bundle(environ, asset_db_writer, minute_bar_writer, daily_bar_writer, adjustment_writer, calendar, start_session, end_session, cache, show_progress, output_dir, tframes=None, csvdir=None): """ Build a zipline data bundle from the directory with csv files. """ if not csvdir: csvdir = environ.get('CSVDIR') if not csvdir: raise ValueError("CSVDIR environment variable is not set") if not os.path.isdir(csvdir): raise ValueError("%s is not a directory" % csvdir) if not tframes: tframes = set(["daily", "minute"]).intersection(os.listdir(csvdir)) if not tframes: raise ValueError("'daily' and 'minute' directories " "not found in '%s'" % csvdir) divs_splits = {'divs': DataFrame(columns=['sid', 'amount', 'ex_date', 'record_date', 'declared_date', 'pay_date']), 'splits': DataFrame(columns=['sid', 'ratio', 'effective_date'])} for tframe in tframes: ddir = os.path.join(csvdir, tframe) symbols = sorted(item.split('.csv')[0] for item in os.listdir(ddir) if '.csv' in item) if not symbols: raise ValueError("no <symbol>.csv* files found in %s" % ddir) dtype = [('start_date', 'datetime64[ns]'), ('end_date', 'datetime64[ns]'), ('auto_close_date', 'datetime64[ns]'), ('symbol', 'object')] metadata = DataFrame(empty(len(symbols), dtype=dtype)) if tframe == 'minute': writer = minute_bar_writer else: writer = daily_bar_writer writer.write(_pricing_iter(ddir, symbols, metadata, divs_splits, show_progress), show_progress=show_progress) # Hardcode the exchange to "CSVDIR" for all assets and (elsewhere) # register "CSVDIR" to resolve to the NYSE calendar, because these # are all equities and thus can use the NYSE calendar. metadata['exchange'] = "CSVDIR" asset_db_writer.write(equities=metadata) divs_splits['divs']['sid'] = divs_splits['divs']['sid'].astype(int) divs_splits['splits']['sid'] = divs_splits['splits']['sid'].astype(int) adjustment_writer.write(splits=divs_splits['splits'], dividends=divs_splits['divs'])
[ "def", "csvdir_bundle", "(", "environ", ",", "asset_db_writer", ",", "minute_bar_writer", ",", "daily_bar_writer", ",", "adjustment_writer", ",", "calendar", ",", "start_session", ",", "end_session", ",", "cache", ",", "show_progress", ",", "output_dir", ",", "tframes", "=", "None", ",", "csvdir", "=", "None", ")", ":", "if", "not", "csvdir", ":", "csvdir", "=", "environ", ".", "get", "(", "'CSVDIR'", ")", "if", "not", "csvdir", ":", "raise", "ValueError", "(", "\"CSVDIR environment variable is not set\"", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "csvdir", ")", ":", "raise", "ValueError", "(", "\"%s is not a directory\"", "%", "csvdir", ")", "if", "not", "tframes", ":", "tframes", "=", "set", "(", "[", "\"daily\"", ",", "\"minute\"", "]", ")", ".", "intersection", "(", "os", ".", "listdir", "(", "csvdir", ")", ")", "if", "not", "tframes", ":", "raise", "ValueError", "(", "\"'daily' and 'minute' directories \"", "\"not found in '%s'\"", "%", "csvdir", ")", "divs_splits", "=", "{", "'divs'", ":", "DataFrame", "(", "columns", "=", "[", "'sid'", ",", "'amount'", ",", "'ex_date'", ",", "'record_date'", ",", "'declared_date'", ",", "'pay_date'", "]", ")", ",", "'splits'", ":", "DataFrame", "(", "columns", "=", "[", "'sid'", ",", "'ratio'", ",", "'effective_date'", "]", ")", "}", "for", "tframe", "in", "tframes", ":", "ddir", "=", "os", ".", "path", ".", "join", "(", "csvdir", ",", "tframe", ")", "symbols", "=", "sorted", "(", "item", ".", "split", "(", "'.csv'", ")", "[", "0", "]", "for", "item", "in", "os", ".", "listdir", "(", "ddir", ")", "if", "'.csv'", "in", "item", ")", "if", "not", "symbols", ":", "raise", "ValueError", "(", "\"no <symbol>.csv* files found in %s\"", "%", "ddir", ")", "dtype", "=", "[", "(", "'start_date'", ",", "'datetime64[ns]'", ")", ",", "(", "'end_date'", ",", "'datetime64[ns]'", ")", ",", "(", "'auto_close_date'", ",", "'datetime64[ns]'", ")", ",", "(", "'symbol'", ",", "'object'", ")", "]", "metadata", "=", "DataFrame", "(", "empty", "(", "len", "(", "symbols", ")", ",", "dtype", "=", "dtype", ")", ")", "if", "tframe", "==", "'minute'", ":", "writer", "=", "minute_bar_writer", "else", ":", "writer", "=", "daily_bar_writer", "writer", ".", "write", "(", "_pricing_iter", "(", "ddir", ",", "symbols", ",", "metadata", ",", "divs_splits", ",", "show_progress", ")", ",", "show_progress", "=", "show_progress", ")", "# Hardcode the exchange to \"CSVDIR\" for all assets and (elsewhere)", "# register \"CSVDIR\" to resolve to the NYSE calendar, because these", "# are all equities and thus can use the NYSE calendar.", "metadata", "[", "'exchange'", "]", "=", "\"CSVDIR\"", "asset_db_writer", ".", "write", "(", "equities", "=", "metadata", ")", "divs_splits", "[", "'divs'", "]", "[", "'sid'", "]", "=", "divs_splits", "[", "'divs'", "]", "[", "'sid'", "]", ".", "astype", "(", "int", ")", "divs_splits", "[", "'splits'", "]", "[", "'sid'", "]", "=", "divs_splits", "[", "'splits'", "]", "[", "'sid'", "]", ".", "astype", "(", "int", ")", "adjustment_writer", ".", "write", "(", "splits", "=", "divs_splits", "[", "'splits'", "]", ",", "dividends", "=", "divs_splits", "[", "'divs'", "]", ")" ]
Build a zipline data bundle from the directory with csv files.
[ "Build", "a", "zipline", "data", "bundle", "from", "the", "directory", "with", "csv", "files", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/bundles/csvdir.py#L98-L168
train
Build a zipline data bundle from a directory with csv files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,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ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(991 - 941) + chr(0b110011 + 0o1) + chr(0b110010 + 0o2), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11011 + 0o34) + chr(331 - 283), 280 - 272), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1010001 + 0o36) + '\x33' + chr(574 - 521) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(0b110100) + chr(0b101000 + 0o14), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(51) + '\060' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + '\063' + chr(0b100000 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001000 + 0o47) + chr(0b1011 + 0o47) + '\067' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(2256 - 2145) + '\062' + chr(0b110011) + chr(55), 27575 - 27567), ehT0Px3KOsy9(chr(749 - 701) + chr(0b1101111) + '\061' + chr(0b10010 + 0o40) + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1010 + 0o50) + chr(0b110111) + chr(50), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(0b11001 + 0o34) + '\066', 46892 - 46884), ehT0Px3KOsy9(chr(1135 - 1087) + chr(11102 - 10991) + chr(975 - 926) + chr(0b1101 + 0o50) + chr(379 - 328), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(5245 - 5134) + chr(1260 - 1211) + chr(1652 - 1597) + chr(0b1110 + 0o47), 0o10), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + '\061' + '\062' + '\x36', 24498 - 24490), ehT0Px3KOsy9('\060' + chr(1978 - 1867) + chr(2439 - 2389) + chr(0b110100 + 0o1) + chr(0b110101 + 0o1), 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(492 - 443) + chr(0b110110) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(2947 - 2836) + chr(51) + chr(948 - 896) + chr(2657 - 2603), 42818 - 42810), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + '\x36' + chr(0b101000 + 0o10), 0o10), ehT0Px3KOsy9(chr(983 - 935) + chr(0b111000 + 0o67) + chr(0b11011 + 0o27) + chr(0b11 + 0o62), 15574 - 15566), ehT0Px3KOsy9(chr(2149 - 2101) + chr(0b1101111) + '\x33', 0o10), ehT0Px3KOsy9(chr(335 - 287) + chr(0b1101010 + 0o5) + chr(0b11100 + 0o27) + chr(1284 - 1229) + chr(55), 45752 - 45744), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1852 - 1802) + '\061' + chr(0b100111 + 0o16), 37656 - 37648), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b0 + 0o63) + chr(50) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(0b1011111 + 0o20) + chr(768 - 717) + '\x30' + '\x34', 48594 - 48586), ehT0Px3KOsy9('\060' + chr(0b111100 + 0o63) + chr(0b101000 + 0o12) + '\x36' + chr(481 - 433), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(0b11011 + 0o33) + chr(0b101010 + 0o6), ord("\x08")), ehT0Px3KOsy9(chr(1562 - 1514) + '\x6f' + '\062' + chr(1495 - 1442) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b11010 + 0o26) + '\157' + '\067' + chr(49), 40821 - 40813), ehT0Px3KOsy9(chr(1591 - 1543) + '\157' + chr(49) + chr(698 - 649) + chr(0b100100 + 0o16), 13626 - 13618), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(792 - 738) + '\x32', 1054 - 1046), ehT0Px3KOsy9(chr(150 - 102) + chr(111) + '\x31' + chr(0b110011) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100100 + 0o15) + chr(0b101011 + 0o6) + chr(0b100010 + 0o23), 0b1000), ehT0Px3KOsy9('\060' + chr(6586 - 6475) + chr(0b110101) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(357 - 246) + chr(49) + chr(53) + chr(0b11 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\065' + chr(68 - 15), ord("\x08")), ehT0Px3KOsy9(chr(1619 - 1571) + chr(0b1000011 + 0o54) + chr(0b110 + 0o54) + '\x34' + '\061', 54571 - 54563), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(808 - 759) + chr(0b110101) + chr(0b100 + 0o63), 6179 - 6171), ehT0Px3KOsy9(chr(1213 - 1165) + chr(5816 - 5705) + '\066' + chr(0b10111 + 0o36), 0b1000), ehT0Px3KOsy9(chr(48) + chr(5084 - 4973) + chr(54) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(499 - 448) + chr(0b110111) + chr(0b11001 + 0o31), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(441 - 393) + chr(111) + '\x35' + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a'), '\144' + '\x65' + chr(0b1100011) + '\x6f' + '\144' + '\x65')('\x75' + '\164' + chr(0b1100110) + chr(45) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TYWrUl9CWqZc(rNK60KZ67nXB, H2urTN8C8M5R, fiSHAQXMY_UA, XgyKD3xf4XSp, VESY84ZhSCpr, poUKhjo0_BbB, DXo3YHqyow5e, qRfpaQSMkwXK, j1lPDdxcDbRB, _rgtfo4EPgcH, nd0OX_BS6_o4, mQkMne9JiBJz=None, ILhDmqSVBT3x=None): if not ILhDmqSVBT3x: ILhDmqSVBT3x = rNK60KZ67nXB.Q8b5UytA0vqH(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7k\xbf \x88\x89'), chr(0b1100100) + '\x65' + chr(99) + chr(3267 - 3156) + chr(0b10110 + 0o116) + chr(2589 - 2488))(chr(0b1010011 + 0o42) + chr(116) + chr(0b110000 + 0o66) + chr(0b1 + 0o54) + chr(0b110111 + 0o1))) if not ILhDmqSVBT3x: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7k\xbf \x88\x89\x9a\xfa<\xcc\xc7\x19\x128\xc3\x12\x88D5u\x9e\xff\xbe\xa5\xd2\x1c\xcc\x19#\x01~#A\x1d\xcd\xd2\nA'), '\x64' + '\x65' + '\x63' + chr(11878 - 11767) + chr(100) + chr(5798 - 5697))(chr(0b1000111 + 0o56) + chr(0b10100 + 0o140) + chr(0b1100110) + chr(1729 - 1684) + chr(0b100000 + 0o30))) if not xafqLlk3kkUe(oqhJDdMJfuwx.path, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcdK\x8d\r\xb3'), chr(100) + chr(1140 - 1039) + chr(999 - 900) + chr(0b110101 + 0o72) + chr(100) + chr(0b10010 + 0o123))('\165' + chr(116) + chr(0b10110 + 0o120) + '\055' + '\070'))(ILhDmqSVBT3x): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\x81K\xc9\r\xb2\xfb\xd4\xf0&\x9a\xcfK\x19?\xdc\x12\x85Dzq\x86'), chr(0b1100100) + chr(0b110100 + 0o61) + '\143' + chr(0b110100 + 0o73) + chr(7627 - 7527) + '\x65')(chr(0b1110101) + '\x74' + chr(0b110100 + 0o62) + chr(45) + chr(0b111000)) % ILhDmqSVBT3x) if not mQkMne9JiBJz: mQkMne9JiBJz = MVEN8G6CxlvR([xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Y\x80\x08\xb8'), chr(0b1100100) + chr(0b1100101) + '\x63' + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(117) + '\x74' + '\146' + chr(565 - 520) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9Q\x87\x11\xb5\xbe'), chr(100) + chr(0b1011010 + 0o13) + '\x63' + '\x6f' + chr(100) + chr(0b1100101))(chr(0b1101110 + 0o7) + chr(0b110011 + 0o101) + chr(0b1100110) + chr(166 - 121) + chr(1544 - 1488))]).intersection(oqhJDdMJfuwx.listdir(ILhDmqSVBT3x)) if not mQkMne9JiBJz: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\\\x88\r\xad\xa2\x9d\xbf3\xd4\xcaKZ;\xc7\x19\x93Dp$\xdf\xe9\xbe\xb6\xd5\x13\xddV8\x1b;>\x0e\x07\x82\xd5OSX\x8f\xca\\\xc9\r\xaf\xfb\x9d\xba!\x9d'), chr(0b1100100) + '\x65' + chr(0b1100011) + '\x6f' + chr(100) + '\x65')(chr(0b100101 + 0o120) + '\x74' + chr(0b10110 + 0o120) + chr(45) + chr(0b100 + 0o64)) % ILhDmqSVBT3x) CafT2XGNtBCA = {xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Q\x9f\x17'), '\x64' + chr(0b1100101) + chr(99) + chr(10003 - 9892) + '\x64' + '\x65')(chr(2929 - 2812) + chr(0b1110100) + '\146' + chr(45) + chr(0b111000)): TTWbaLX2VikC(columns=[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7Q\x8d'), chr(0b1100100) + chr(101) + chr(99) + chr(111) + '\x64' + chr(101))(chr(1374 - 1257) + chr(0b1110100) + chr(4785 - 4683) + chr(45) + chr(0b100000 + 0o30)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5U\x86\x11\xaf\xaf'), chr(100) + chr(101) + chr(0b100111 + 0o74) + chr(3153 - 3042) + chr(639 - 539) + chr(5606 - 5505))(chr(0b100100 + 0o121) + chr(0b1001011 + 0o51) + '\x66' + chr(0b1111 + 0o36) + chr(0b111000 + 0o0)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1@\xb6\x00\xa0\xaf\xdf'), chr(100) + chr(0b1001101 + 0o30) + chr(6464 - 6365) + chr(0b101000 + 0o107) + chr(100) + chr(9287 - 9186))('\x75' + '\x74' + chr(102) + chr(0b100000 + 0o15) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6]\x8a\x0b\xb3\xbf\xe5\xfb3\xce\xcb'), '\144' + '\145' + '\x63' + chr(544 - 433) + chr(100) + chr(101))(chr(0b1110101) + chr(0b1101011 + 0o11) + '\x66' + chr(0b100011 + 0o12) + chr(619 - 563)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0]\x8a\x08\xa0\xa9\xdf\xfb\r\xde\xcf\x1f\x18'), '\144' + chr(0b1100101) + chr(2353 - 2254) + '\x6f' + '\x64' + chr(101))('\x75' + chr(116) + chr(102) + '\055' + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4Y\x90;\xa5\xba\xce\xfa'), chr(0b110000 + 0o64) + '\x65' + '\143' + chr(0b1001011 + 0o44) + chr(0b1100100) + chr(9129 - 9028))(chr(117) + '\164' + chr(102) + chr(0b101101) + '\x38')]), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7H\x85\r\xb5\xa8'), '\144' + chr(0b1100101) + chr(237 - 138) + chr(111) + '\144' + '\x65')(chr(117) + chr(0b10010 + 0o142) + chr(0b110010 + 0o64) + chr(45) + chr(0b110101 + 0o3)): TTWbaLX2VikC(columns=[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7Q\x8d'), '\x64' + chr(101) + '\x63' + '\x6f' + chr(100) + '\145')(chr(117) + chr(0b1110100) + chr(0b1001110 + 0o30) + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd6Y\x9d\r\xae'), chr(2674 - 2574) + '\x65' + chr(99) + chr(0b1100100 + 0o13) + chr(0b111100 + 0o50) + chr(101))(chr(117) + '\x74' + '\x66' + chr(405 - 360) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1^\x8f\x01\xa2\xaf\xd3\xe97\xe5\xca\n\t3'), chr(8164 - 8064) + chr(0b1010111 + 0o16) + chr(99) + chr(0b1101111) + chr(7895 - 7795) + chr(5149 - 5048))(chr(0b1110101) + chr(0b1 + 0o163) + '\x66' + chr(886 - 841) + '\x38')])} for jZyo6efTNNpX in mQkMne9JiBJz: sFuVETDWV7aE = oqhJDdMJfuwx.path._oWXztVNnqHF(ILhDmqSVBT3x, jZyo6efTNNpX) gTbywfQd6zu7 = vUlqIvNSaRMa((N7j7ePTXzzI0.split(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a[\x9a\x12'), chr(0b1100100) + '\x65' + chr(0b1100011) + chr(111) + chr(100) + chr(5470 - 5369))('\165' + '\x74' + chr(3687 - 3585) + chr(0b100000 + 0o15) + chr(56)))[ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\060', ord("\x08"))] for N7j7ePTXzzI0 in oqhJDdMJfuwx.listdir(sFuVETDWV7aE) if xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a[\x9a\x12'), chr(2192 - 2092) + chr(2742 - 2641) + chr(0b1100011) + '\157' + chr(100) + '\x65')(chr(10107 - 9990) + chr(9678 - 9562) + '\146' + '\055' + '\070') in N7j7ePTXzzI0)) if not gTbywfQd6zu7: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'\xcaW\xc9X\xb2\xa2\xd7\xfd=\xd6\x90E\x1e%\xd8]\xc6V|o\x9a\xfe\xf7\xa2\xdf\x05\xc7]j\x1b0m\x0b\x1a'), '\x64' + chr(7290 - 7189) + chr(99) + '\157' + chr(0b1100100) + chr(8897 - 8796))('\x75' + '\164' + chr(0b1100110) + chr(277 - 232) + chr(56)) % sFuVETDWV7aE) jSV9IKnemH7K = [(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7L\x88\x16\xb5\x84\xde\xfe&\xdf'), chr(0b1000001 + 0o43) + '\x65' + '\x63' + chr(111) + '\144' + chr(0b1010001 + 0o24))(chr(0b1010000 + 0o45) + chr(0b1110100) + chr(1339 - 1237) + chr(0b10010 + 0o33) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Y\x9d\x01\xb5\xb2\xd7\xfad\x8e\xf5\x05\x0e\x0b'), '\x64' + chr(908 - 807) + chr(2675 - 2576) + '\157' + chr(6289 - 6189) + chr(0b100101 + 0o100))(chr(0b1000100 + 0o61) + chr(0b101 + 0o157) + chr(0b11110 + 0o110) + '\x2d' + chr(2081 - 2025))), (xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1V\x8d;\xa5\xba\xce\xfa'), '\144' + '\x65' + '\x63' + '\157' + '\x64' + chr(0b110001 + 0o64))(chr(6665 - 6548) + chr(116) + chr(1261 - 1159) + '\x2d' + chr(0b10001 + 0o47)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Y\x9d\x01\xb5\xb2\xd7\xfad\x8e\xf5\x05\x0e\x0b'), '\x64' + '\145' + chr(0b1100011) + chr(111) + '\x64' + '\x65')(chr(117) + chr(0b1110100) + chr(102) + chr(45) + '\070')), (xafqLlk3kkUe(SXOLrMavuUCe(b'\xc5M\x9d\x0b\x9e\xb8\xd6\xf0!\xdf\xf1\x0f\x1c"\xcb'), chr(581 - 481) + chr(0b111100 + 0o51) + chr(7962 - 7863) + chr(111) + chr(0b1100100) + chr(4544 - 4443))(chr(0b1100111 + 0o16) + chr(0b100100 + 0o120) + chr(0b110001 + 0o65) + chr(45) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Y\x9d\x01\xb5\xb2\xd7\xfad\x8e\xf5\x05\x0e\x0b'), chr(100) + '\x65' + '\143' + '\157' + chr(0b110110 + 0o56) + chr(0b1100101))('\165' + chr(0b1110100) + chr(0b110101 + 0o61) + '\055' + chr(0b10100 + 0o44))), (xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7A\x84\x06\xae\xb7'), '\x64' + chr(0b1001111 + 0o26) + chr(7711 - 7612) + '\x6f' + '\x64' + chr(101))('\165' + '\x74' + chr(0b1011010 + 0o14) + '\055' + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xcbZ\x83\x01\xa2\xaf'), chr(8233 - 8133) + '\145' + chr(99) + chr(111) + '\144' + chr(0b1001111 + 0o26))(chr(0b1110101) + '\x74' + chr(0b110011 + 0o63) + '\055' + chr(0b111000)))] mU7wOAGoTnlM = TTWbaLX2VikC(QxT4AUiPWdm4(c2A0yzQpDQB3(gTbywfQd6zu7), dtype=jSV9IKnemH7K)) if jZyo6efTNNpX == xafqLlk3kkUe(SXOLrMavuUCe(b'\xc9Q\x87\x11\xb5\xbe'), chr(100) + '\x65' + chr(1722 - 1623) + chr(12115 - 12004) + chr(2154 - 2054) + '\145')('\165' + chr(116) + chr(102) + '\x2d' + '\x38'): AkL2ZqopDgiR = fiSHAQXMY_UA else: AkL2ZqopDgiR = XgyKD3xf4XSp xafqLlk3kkUe(AkL2ZqopDgiR, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3J\x80\x10\xa4'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + '\x66' + chr(0b101101) + chr(0b111000)))(VkXnzSrBCP1j(sFuVETDWV7aE, gTbywfQd6zu7, mU7wOAGoTnlM, CafT2XGNtBCA, _rgtfo4EPgcH), show_progress=_rgtfo4EPgcH) mU7wOAGoTnlM[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc1@\x8a\x0c\xa0\xb5\xdd\xfa'), '\x64' + chr(9732 - 9631) + '\143' + '\x6f' + '\144' + '\x65')(chr(9252 - 9135) + chr(116) + '\146' + chr(45) + '\x38')] = xafqLlk3kkUe(SXOLrMavuUCe(b'\xe7k\xbf \x88\x89'), chr(0b1100100) + chr(0b1100101) + '\143' + '\157' + chr(5160 - 5060) + '\x65')(chr(12871 - 12754) + chr(0b1110010 + 0o2) + '\x66' + chr(0b10010 + 0o33) + '\070') xafqLlk3kkUe(H2urTN8C8M5R, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3J\x80\x10\xa4'), '\144' + chr(0b1100001 + 0o4) + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(102) + chr(0b10000 + 0o35) + '\x38'))(equities=mU7wOAGoTnlM) CafT2XGNtBCA[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Q\x9f\x17'), '\144' + '\x65' + chr(0b110011 + 0o60) + chr(111) + '\x64' + '\x65')(chr(117) + chr(2972 - 2856) + '\x66' + chr(0b101101) + chr(0b110110 + 0o2))][xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7Q\x8d'), '\144' + chr(0b110011 + 0o62) + '\x63' + chr(10726 - 10615) + chr(0b1100100) + '\145')('\165' + chr(0b10001 + 0o143) + chr(0b1100110) + chr(0b100100 + 0o11) + chr(2923 - 2867))] = CafT2XGNtBCA[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Q\x9f\x17'), chr(100) + chr(0b101 + 0o140) + chr(99) + '\x6f' + '\x64' + chr(0b100101 + 0o100))(chr(8506 - 8389) + chr(5741 - 5625) + chr(3781 - 3679) + '\055' + '\x38')][xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7Q\x8d'), chr(100) + chr(0b1100101) + '\143' + chr(0b110101 + 0o72) + chr(428 - 328) + chr(0b1001101 + 0o30))('\x75' + chr(8146 - 8030) + chr(0b110110 + 0o60) + chr(0b101101) + chr(0b111000))].astype(ehT0Px3KOsy9) CafT2XGNtBCA[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7H\x85\r\xb5\xa8'), '\x64' + chr(0b1100101) + chr(99) + chr(0b11010 + 0o125) + chr(0b110101 + 0o57) + '\145')(chr(117) + '\x74' + '\146' + '\055' + chr(2594 - 2538))][xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7Q\x8d'), '\144' + '\x65' + '\143' + chr(0b1101111) + chr(0b1100100) + '\145')('\x75' + chr(116) + '\x66' + chr(45) + '\x38')] = CafT2XGNtBCA[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7H\x85\r\xb5\xa8'), '\144' + chr(0b111011 + 0o52) + '\x63' + chr(0b110100 + 0o73) + chr(100) + chr(2703 - 2602))('\x75' + '\164' + '\146' + chr(1323 - 1278) + chr(0b111000))][xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7Q\x8d'), '\x64' + chr(0b11110 + 0o107) + chr(0b1100011) + chr(9564 - 9453) + chr(100) + chr(0b1100101))('\x75' + chr(116) + '\146' + chr(989 - 944) + chr(989 - 933))].astype(ehT0Px3KOsy9) xafqLlk3kkUe(VESY84ZhSCpr, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd3J\x80\x10\xa4'), chr(3952 - 3852) + '\x65' + '\143' + chr(111) + '\x64' + '\x65')('\x75' + chr(10111 - 9995) + chr(0b1 + 0o145) + '\055' + chr(56)))(splits=CafT2XGNtBCA[xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7H\x85\r\xb5\xa8'), chr(0b1000 + 0o134) + chr(101) + '\143' + '\x6f' + chr(0b1011100 + 0o10) + chr(101))(chr(0b1010101 + 0o40) + chr(331 - 215) + '\x66' + chr(0b101101) + chr(0b10 + 0o66))], dividends=CafT2XGNtBCA[xafqLlk3kkUe(SXOLrMavuUCe(b'\xc0Q\x9f\x17'), '\x64' + chr(3660 - 3559) + chr(5016 - 4917) + chr(111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(116) + chr(6002 - 5900) + '\x2d' + chr(0b11100 + 0o34))])
quantopian/zipline
zipline/pipeline/api_utils.py
restrict_to_dtype
def restrict_to_dtype(dtype, message_template): """ A factory for decorators that restrict Term methods to only be callable on Terms with a specific dtype. This is conceptually similar to zipline.utils.input_validation.expect_dtypes, but provides more flexibility for providing error messages that are specifically targeting Term methods. Parameters ---------- dtype : numpy.dtype The dtype on which the decorated method may be called. message_template : str A template for the error message to be raised. `message_template.format` will be called with keyword arguments `method_name`, `expected_dtype`, and `received_dtype`. Examples -------- @restrict_to_dtype( dtype=float64_dtype, message_template=( "{method_name}() was called on a factor of dtype {received_dtype}." "{method_name}() requires factors of dtype{expected_dtype}." ), ) def some_factor_method(self, ...): self.stuff_that_requires_being_float64(...) """ def processor(term_method, _, term_instance): term_dtype = term_instance.dtype if term_dtype != dtype: raise TypeError( message_template.format( method_name=term_method.__name__, expected_dtype=dtype.name, received_dtype=term_dtype, ) ) return term_instance return preprocess(self=processor)
python
def restrict_to_dtype(dtype, message_template): """ A factory for decorators that restrict Term methods to only be callable on Terms with a specific dtype. This is conceptually similar to zipline.utils.input_validation.expect_dtypes, but provides more flexibility for providing error messages that are specifically targeting Term methods. Parameters ---------- dtype : numpy.dtype The dtype on which the decorated method may be called. message_template : str A template for the error message to be raised. `message_template.format` will be called with keyword arguments `method_name`, `expected_dtype`, and `received_dtype`. Examples -------- @restrict_to_dtype( dtype=float64_dtype, message_template=( "{method_name}() was called on a factor of dtype {received_dtype}." "{method_name}() requires factors of dtype{expected_dtype}." ), ) def some_factor_method(self, ...): self.stuff_that_requires_being_float64(...) """ def processor(term_method, _, term_instance): term_dtype = term_instance.dtype if term_dtype != dtype: raise TypeError( message_template.format( method_name=term_method.__name__, expected_dtype=dtype.name, received_dtype=term_dtype, ) ) return term_instance return preprocess(self=processor)
[ "def", "restrict_to_dtype", "(", "dtype", ",", "message_template", ")", ":", "def", "processor", "(", "term_method", ",", "_", ",", "term_instance", ")", ":", "term_dtype", "=", "term_instance", ".", "dtype", "if", "term_dtype", "!=", "dtype", ":", "raise", "TypeError", "(", "message_template", ".", "format", "(", "method_name", "=", "term_method", ".", "__name__", ",", "expected_dtype", "=", "dtype", ".", "name", ",", "received_dtype", "=", "term_dtype", ",", ")", ")", "return", "term_instance", "return", "preprocess", "(", "self", "=", "processor", ")" ]
A factory for decorators that restrict Term methods to only be callable on Terms with a specific dtype. This is conceptually similar to zipline.utils.input_validation.expect_dtypes, but provides more flexibility for providing error messages that are specifically targeting Term methods. Parameters ---------- dtype : numpy.dtype The dtype on which the decorated method may be called. message_template : str A template for the error message to be raised. `message_template.format` will be called with keyword arguments `method_name`, `expected_dtype`, and `received_dtype`. Examples -------- @restrict_to_dtype( dtype=float64_dtype, message_template=( "{method_name}() was called on a factor of dtype {received_dtype}." "{method_name}() requires factors of dtype{expected_dtype}." ), ) def some_factor_method(self, ...): self.stuff_that_requires_being_float64(...)
[ "A", "factory", "for", "decorators", "that", "restrict", "Term", "methods", "to", "only", "be", "callable", "on", "Terms", "with", "a", "specific", "dtype", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/api_utils.py#L7-L49
train
Returns a new object that restricts terms to only be callable on terms of a specific dtype.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9Dh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tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(734 - 686) + '\x6f' + chr(0b110100) + chr(0b1100 + 0o53), 0b1000), ehT0Px3KOsy9(chr(1150 - 1102) + chr(0b101101 + 0o102) + chr(1567 - 1518) + chr(50) + chr(49), 37104 - 37096), ehT0Px3KOsy9(chr(0b110000) + chr(10887 - 10776) + chr(0b100 + 0o57) + chr(0b101011 + 0o10) + chr(0b110010), 2503 - 2495), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110100) + '\064', 29396 - 29388), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(784 - 735) + chr(54) + chr(0b10 + 0o56), ord("\x08")), ehT0Px3KOsy9(chr(698 - 650) + chr(0b11110 + 0o121) + chr(0b110010) + '\067' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(830 - 782) + chr(5043 - 4932) + chr(0b11010 + 0o35) + chr(1986 - 1936), 0b1000), ehT0Px3KOsy9('\x30' + chr(9344 - 9233) + chr(1520 - 1470) + chr(413 - 365) + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + '\064' + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(0b110011 + 0o0) + chr(238 - 183) + '\067', 14323 - 14315), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(0b1100 + 0o44) + chr(50), 33135 - 33127), ehT0Px3KOsy9(chr(2276 - 2228) + '\157' + '\x31' + chr(2068 - 2013) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b100 + 0o54) + chr(50), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(0b100101 + 0o16) + chr(52) + chr(1188 - 1138), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(611 - 559) + chr(2042 - 1992), ord("\x08")), ehT0Px3KOsy9(chr(1100 - 1052) + chr(0b1101111) + chr(0b110110) + chr(0b1011 + 0o54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110 + 0o55) + chr(52) + '\065', 19481 - 19473), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(4450 - 4339) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(386 - 335), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b101111 + 0o5) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(797 - 686) + '\x32' + chr(0b1111 + 0o41) + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\x6f' + chr(0b100110 + 0o15) + '\x34' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + '\060' + chr(2032 - 1983), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2327 - 2278) + '\063' + chr(0b100010 + 0o23), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110001) + '\x32' + chr(0b110011), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + '\x32' + '\x33', 29270 - 29262), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(53) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(997 - 949) + chr(0b1101111) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(1729 - 1678) + chr(0b10111 + 0o37) + chr(1887 - 1837), 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b1 + 0o66) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b1101111) + '\063' + '\x37' + chr(0b10111 + 0o37), 22470 - 22462), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b110111) + chr(1405 - 1350), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(808 - 759) + chr(0b110100) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10852 - 10741) + chr(388 - 333) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + '\x30' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1110 + 0o44) + '\064' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + '\x32' + '\x35' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + chr(54) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(50) + '\x34' + chr(0b100000 + 0o25), 0o10), ehT0Px3KOsy9(chr(1671 - 1623) + chr(0b110 + 0o151) + '\061' + chr(2710 - 2655) + chr(52), 6604 - 6596)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1595 - 1547) + '\x6f' + '\x35' + chr(0b10110 + 0o32), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\t'), '\144' + chr(0b11010 + 0o113) + '\143' + '\x6f' + chr(100) + '\x65')(chr(117) + '\164' + '\146' + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def J49eUcuyMry5(jSV9IKnemH7K, FCJXjfqnGPYP): def Qv_npqgRBB71(OoVlUITxkJrb, VNGQdHSFPrso, Oo4Yjwq5RGv3): jzGHCLTXRUtq = Oo4Yjwq5RGv3.jSV9IKnemH7K if jzGHCLTXRUtq != jSV9IKnemH7K: raise sznFqDbNBHlx(xafqLlk3kkUe(FCJXjfqnGPYP, xafqLlk3kkUe(SXOLrMavuUCe(b"qe\xa8K8\xdbi\xb1\xb2\x8f'\x14"), chr(100) + chr(0b1100101) + chr(0b110001 + 0o62) + chr(11918 - 11807) + chr(0b1100100) + '\145')('\x75' + chr(0b1100001 + 0o23) + chr(1053 - 951) + chr(45) + '\x38'))(method_name=xafqLlk3kkUe(OoVlUITxkJrb, xafqLlk3kkUe(SXOLrMavuUCe(b'`3\xbfND\xd5`\xf3\xa9\xb3\x03H'), chr(0b1010001 + 0o23) + '\145' + chr(3316 - 3217) + chr(7075 - 6964) + chr(9555 - 9455) + chr(101))('\x75' + chr(116) + chr(102) + chr(1134 - 1089) + chr(0b111000))), expected_dtype=xafqLlk3kkUe(jSV9IKnemH7K, xafqLlk3kkUe(SXOLrMavuUCe(b'f\x18\xacn"\xc0v\xe6\xa6\x99%8'), chr(0b111000 + 0o54) + chr(0b11110 + 0o107) + '\x63' + '\157' + chr(100) + chr(6723 - 6622))(chr(0b10011 + 0o142) + chr(116) + '\x66' + '\055' + '\070')), received_dtype=jzGHCLTXRUtq)) return Oo4Yjwq5RGv3 return n8IJXbSueTJV(self=Qv_npqgRBB71)
quantopian/zipline
zipline/sources/benchmark_source.py
BenchmarkSource.daily_returns
def daily_returns(self, start, end=None): """Returns the daily returns for the given period. Parameters ---------- start : datetime The inclusive starting session label. end : datetime, optional The inclusive ending session label. If not provided, treat ``start`` as a scalar key. Returns ------- returns : pd.Series or float The returns in the given period. The index will be the trading calendar in the range [start, end]. If just ``start`` is provided, return the scalar value on that day. """ if end is None: return self._daily_returns[start] return self._daily_returns[start:end]
python
def daily_returns(self, start, end=None): """Returns the daily returns for the given period. Parameters ---------- start : datetime The inclusive starting session label. end : datetime, optional The inclusive ending session label. If not provided, treat ``start`` as a scalar key. Returns ------- returns : pd.Series or float The returns in the given period. The index will be the trading calendar in the range [start, end]. If just ``start`` is provided, return the scalar value on that day. """ if end is None: return self._daily_returns[start] return self._daily_returns[start:end]
[ "def", "daily_returns", "(", "self", ",", "start", ",", "end", "=", "None", ")", ":", "if", "end", "is", "None", ":", "return", "self", ".", "_daily_returns", "[", "start", "]", "return", "self", ".", "_daily_returns", "[", "start", ":", "end", "]" ]
Returns the daily returns for the given period. Parameters ---------- start : datetime The inclusive starting session label. end : datetime, optional The inclusive ending session label. If not provided, treat ``start`` as a scalar key. Returns ------- returns : pd.Series or float The returns in the given period. The index will be the trading calendar in the range [start, end]. If just ``start`` is provided, return the scalar value on that day.
[ "Returns", "the", "daily", "returns", "for", "the", "given", "period", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/sources/benchmark_source.py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N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(513 - 402) + chr(0b110011) + '\x37' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110101) + '\064', 49028 - 49020), ehT0Px3KOsy9(chr(151 - 103) + chr(111) + chr(50) + chr(1465 - 1417) + chr(54), 65115 - 65107), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\157' + '\062' + '\x34', 9621 - 9613), ehT0Px3KOsy9(chr(859 - 811) + chr(7734 - 7623) + chr(51) + chr(0b110100) + chr(0b11000 + 0o35), 18952 - 18944), ehT0Px3KOsy9(chr(0b110000) + chr(6886 - 6775) + chr(1096 - 1045) + chr(51) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(0b11100 + 0o123) + chr(0b110001) + chr(2997 - 2942) + '\x30', 38902 - 38894), ehT0Px3KOsy9(chr(0b110000) + chr(8540 - 8429) + '\x33' + chr(0b1101 + 0o43) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(0b110000) + chr(2057 - 2009), 37540 - 37532), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\066' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(111) + chr(0b110010) + '\061' + chr(0b100 + 0o61), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x32' + chr(55) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(408 - 353) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(8766 - 8655) + chr(0b101000 + 0o13) + chr(49) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(49) + chr(54) + '\x32', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\062' + chr(0b110000), 27829 - 27821), ehT0Px3KOsy9('\060' + chr(0b1101011 + 0o4) + '\x32' + chr(54) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(8348 - 8237) + chr(2223 - 2174) + chr(50) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(48) + chr(0b10011 + 0o42), 50718 - 50710), ehT0Px3KOsy9(chr(180 - 132) + chr(111) + chr(55) + chr(0b110000), 31211 - 31203), ehT0Px3KOsy9('\060' + chr(111) + '\x37' + '\x35', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b100111 + 0o110) + chr(51) + '\x34' + chr(0b110101), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + '\060' + '\060', 8), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + chr(49) + chr(0b101110 + 0o4) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\064' + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\062' + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b1001 + 0o56) + chr(0b10100 + 0o34), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10110 + 0o34) + chr(0b1000 + 0o52) + chr(53), 49222 - 49214), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b110011), 59251 - 59243), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(670 - 621) + '\062' + chr(565 - 513), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2087 - 2037) + '\x31', 29911 - 29903), ehT0Px3KOsy9('\x30' + chr(111) + chr(493 - 444) + chr(0b10110 + 0o35) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b1001 + 0o52) + '\x37', 217 - 209), ehT0Px3KOsy9(chr(0b1010 + 0o46) + '\157' + chr(0b110001) + '\066' + '\x33', 0o10), ehT0Px3KOsy9(chr(1061 - 1013) + chr(5449 - 5338) + '\x31' + chr(51) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000010 + 0o55) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(2098 - 2050) + '\x6f' + '\063' + chr(0b11111 + 0o30) + chr(0b100111 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(978 - 930) + chr(0b1101111) + chr(0b11001 + 0o31) + chr(0b110000) + chr(0b100000 + 0o21), 3547 - 3539), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b1011 + 0o45) + chr(51), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1010001 + 0o36) + chr(0b110101) + '\060', 42324 - 42316)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd2'), chr(0b100011 + 0o101) + chr(0b1001100 + 0o31) + '\143' + '\x6f' + '\144' + chr(0b11010 + 0o113))('\165' + chr(116) + chr(1181 - 1079) + '\x2d' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def EXys4_fNCFq3(oVre8I6UXc3b, avRbFsnfJxQj, whWDZq5_lP01=None): if whWDZq5_lP01 is None: return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"\xa3H\xe7}\x89\xa2'\xb4\xe5B\xf8\xcc\xd4\xbf"), '\144' + chr(0b1100101) + chr(99) + chr(111) + chr(0b1010000 + 0o24) + '\x65')(chr(0b1110101) + chr(116) + '\146' + chr(45) + chr(0b111000)))[avRbFsnfJxQj] return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"\xa3H\xe7}\x89\xa2'\xb4\xe5B\xf8\xcc\xd4\xbf"), chr(0b11001 + 0o113) + '\145' + chr(8961 - 8862) + '\x6f' + '\x64' + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(102) + '\x2d' + chr(56)))[avRbFsnfJxQj:whWDZq5_lP01]
quantopian/zipline
zipline/sources/benchmark_source.py
BenchmarkSource._initialize_precalculated_series
def _initialize_precalculated_series(self, asset, trading_calendar, trading_days, data_portal): """ Internal method that pre-calculates the benchmark return series for use in the simulation. Parameters ---------- asset: Asset to use trading_calendar: TradingCalendar trading_days: pd.DateTimeIndex data_portal: DataPortal Notes ----- If the benchmark asset started trading after the simulation start, or finished trading before the simulation end, exceptions are raised. If the benchmark asset started trading the same day as the simulation start, the first available minute price on that day is used instead of the previous close. We use history to get an adjusted price history for each day's close, as of the look-back date (the last day of the simulation). Prices are fully adjusted for dividends, splits, and mergers. Returns ------- returns : pd.Series indexed by trading day, whose values represent the % change from close to close. daily_returns : pd.Series the partial daily returns for each minute """ if self.emission_rate == "minute": minutes = trading_calendar.minutes_for_sessions_in_range( self.sessions[0], self.sessions[-1] ) benchmark_series = data_portal.get_history_window( [asset], minutes[-1], bar_count=len(minutes) + 1, frequency="1m", field="price", data_frequency=self.emission_rate, ffill=True )[asset] return ( benchmark_series.pct_change()[1:], self.downsample_minute_return_series( trading_calendar, benchmark_series, ), ) start_date = asset.start_date if start_date < trading_days[0]: # get the window of close prices for benchmark_asset from the # last trading day of the simulation, going up to one day # before the simulation start day (so that we can get the % # change on day 1) benchmark_series = data_portal.get_history_window( [asset], trading_days[-1], bar_count=len(trading_days) + 1, frequency="1d", field="price", data_frequency=self.emission_rate, ffill=True )[asset] returns = benchmark_series.pct_change()[1:] return returns, returns elif start_date == trading_days[0]: # Attempt to handle case where stock data starts on first # day, in this case use the open to close return. benchmark_series = data_portal.get_history_window( [asset], trading_days[-1], bar_count=len(trading_days), frequency="1d", field="price", data_frequency=self.emission_rate, ffill=True )[asset] # get a minute history window of the first day first_open = data_portal.get_spot_value( asset, 'open', trading_days[0], 'daily', ) first_close = data_portal.get_spot_value( asset, 'close', trading_days[0], 'daily', ) first_day_return = (first_close - first_open) / first_open returns = benchmark_series.pct_change()[:] returns[0] = first_day_return return returns, returns else: raise ValueError( 'cannot set benchmark to asset that does not exist during' ' the simulation period (asset start date=%r)' % start_date )
python
def _initialize_precalculated_series(self, asset, trading_calendar, trading_days, data_portal): """ Internal method that pre-calculates the benchmark return series for use in the simulation. Parameters ---------- asset: Asset to use trading_calendar: TradingCalendar trading_days: pd.DateTimeIndex data_portal: DataPortal Notes ----- If the benchmark asset started trading after the simulation start, or finished trading before the simulation end, exceptions are raised. If the benchmark asset started trading the same day as the simulation start, the first available minute price on that day is used instead of the previous close. We use history to get an adjusted price history for each day's close, as of the look-back date (the last day of the simulation). Prices are fully adjusted for dividends, splits, and mergers. Returns ------- returns : pd.Series indexed by trading day, whose values represent the % change from close to close. daily_returns : pd.Series the partial daily returns for each minute """ if self.emission_rate == "minute": minutes = trading_calendar.minutes_for_sessions_in_range( self.sessions[0], self.sessions[-1] ) benchmark_series = data_portal.get_history_window( [asset], minutes[-1], bar_count=len(minutes) + 1, frequency="1m", field="price", data_frequency=self.emission_rate, ffill=True )[asset] return ( benchmark_series.pct_change()[1:], self.downsample_minute_return_series( trading_calendar, benchmark_series, ), ) start_date = asset.start_date if start_date < trading_days[0]: # get the window of close prices for benchmark_asset from the # last trading day of the simulation, going up to one day # before the simulation start day (so that we can get the % # change on day 1) benchmark_series = data_portal.get_history_window( [asset], trading_days[-1], bar_count=len(trading_days) + 1, frequency="1d", field="price", data_frequency=self.emission_rate, ffill=True )[asset] returns = benchmark_series.pct_change()[1:] return returns, returns elif start_date == trading_days[0]: # Attempt to handle case where stock data starts on first # day, in this case use the open to close return. benchmark_series = data_portal.get_history_window( [asset], trading_days[-1], bar_count=len(trading_days), frequency="1d", field="price", data_frequency=self.emission_rate, ffill=True )[asset] # get a minute history window of the first day first_open = data_portal.get_spot_value( asset, 'open', trading_days[0], 'daily', ) first_close = data_portal.get_spot_value( asset, 'close', trading_days[0], 'daily', ) first_day_return = (first_close - first_open) / first_open returns = benchmark_series.pct_change()[:] returns[0] = first_day_return return returns, returns else: raise ValueError( 'cannot set benchmark to asset that does not exist during' ' the simulation period (asset start date=%r)' % start_date )
[ "def", "_initialize_precalculated_series", "(", "self", ",", "asset", ",", "trading_calendar", ",", "trading_days", ",", "data_portal", ")", ":", "if", "self", ".", "emission_rate", "==", "\"minute\"", ":", "minutes", "=", "trading_calendar", ".", "minutes_for_sessions_in_range", "(", "self", ".", "sessions", "[", "0", "]", ",", "self", ".", "sessions", "[", "-", "1", "]", ")", "benchmark_series", "=", "data_portal", ".", "get_history_window", "(", "[", "asset", "]", ",", "minutes", "[", "-", "1", "]", ",", "bar_count", "=", "len", "(", "minutes", ")", "+", "1", ",", "frequency", "=", "\"1m\"", ",", "field", "=", "\"price\"", ",", "data_frequency", "=", "self", ".", "emission_rate", ",", "ffill", "=", "True", ")", "[", "asset", "]", "return", "(", "benchmark_series", ".", "pct_change", "(", ")", "[", "1", ":", "]", ",", "self", ".", "downsample_minute_return_series", "(", "trading_calendar", ",", "benchmark_series", ",", ")", ",", ")", "start_date", "=", "asset", ".", "start_date", "if", "start_date", "<", "trading_days", "[", "0", "]", ":", "# get the window of close prices for benchmark_asset from the", "# last trading day of the simulation, going up to one day", "# before the simulation start day (so that we can get the %", "# change on day 1)", "benchmark_series", "=", "data_portal", ".", "get_history_window", "(", "[", "asset", "]", ",", "trading_days", "[", "-", "1", "]", ",", "bar_count", "=", "len", "(", "trading_days", ")", "+", "1", ",", "frequency", "=", "\"1d\"", ",", "field", "=", "\"price\"", ",", "data_frequency", "=", "self", ".", "emission_rate", ",", "ffill", "=", "True", ")", "[", "asset", "]", "returns", "=", "benchmark_series", ".", "pct_change", "(", ")", "[", "1", ":", "]", "return", "returns", ",", "returns", "elif", "start_date", "==", "trading_days", "[", "0", "]", ":", "# Attempt to handle case where stock data starts on first", "# day, in this case use the open to close return.", "benchmark_series", "=", "data_portal", ".", "get_history_window", "(", "[", "asset", "]", ",", "trading_days", "[", "-", "1", "]", ",", "bar_count", "=", "len", "(", "trading_days", ")", ",", "frequency", "=", "\"1d\"", ",", "field", "=", "\"price\"", ",", "data_frequency", "=", "self", ".", "emission_rate", ",", "ffill", "=", "True", ")", "[", "asset", "]", "# get a minute history window of the first day", "first_open", "=", "data_portal", ".", "get_spot_value", "(", "asset", ",", "'open'", ",", "trading_days", "[", "0", "]", ",", "'daily'", ",", ")", "first_close", "=", "data_portal", ".", "get_spot_value", "(", "asset", ",", "'close'", ",", "trading_days", "[", "0", "]", ",", "'daily'", ",", ")", "first_day_return", "=", "(", "first_close", "-", "first_open", ")", "/", "first_open", "returns", "=", "benchmark_series", ".", "pct_change", "(", ")", "[", ":", "]", "returns", "[", "0", "]", "=", "first_day_return", "return", "returns", ",", "returns", "else", ":", "raise", "ValueError", "(", "'cannot set benchmark to asset that does not exist during'", "' the simulation period (asset start date=%r)'", "%", "start_date", ")" ]
Internal method that pre-calculates the benchmark return series for use in the simulation. Parameters ---------- asset: Asset to use trading_calendar: TradingCalendar trading_days: pd.DateTimeIndex data_portal: DataPortal Notes ----- If the benchmark asset started trading after the simulation start, or finished trading before the simulation end, exceptions are raised. If the benchmark asset started trading the same day as the simulation start, the first available minute price on that day is used instead of the previous close. We use history to get an adjusted price history for each day's close, as of the look-back date (the last day of the simulation). Prices are fully adjusted for dividends, splits, and mergers. Returns ------- returns : pd.Series indexed by trading day, whose values represent the % change from close to close. daily_returns : pd.Series the partial daily returns for each minute
[ "Internal", "method", "that", "pre", "-", "calculates", "the", "benchmark", "return", "series", "for", "use", "in", "the", "simulation", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/sources/benchmark_source.py#L196-L312
train
Internal method that pre - calculates the benchmark return series for the given asset.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0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ortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(49) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\157' + '\x34' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\065' + '\x35', 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\067' + chr(0b101 + 0o57), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(5079 - 4968) + '\061' + chr(0b110111) + '\064', 64097 - 64089), ehT0Px3KOsy9(chr(0b110000) + chr(0b11111 + 0o120) + chr(50) + chr(0b0 + 0o62) + chr(850 - 795), 0o10), ehT0Px3KOsy9(chr(183 - 135) + chr(0b1101111) + '\062' + chr(50) + chr(0b110101), 8924 - 8916), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b100 + 0o153) + chr(49) + chr(52) + '\061', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + chr(2428 - 2317) + chr(0b110100) + chr(0b11001 + 0o30), 49298 - 49290), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b110101) + chr(0b110111), 3416 - 3408), ehT0Px3KOsy9('\060' + '\157' + chr(137 - 87) + chr(0b10100 + 0o36) + '\x35', 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\064' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36' + chr(49), 25378 - 25370), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34' + '\x36', 48022 - 48014), ehT0Px3KOsy9(chr(48) + chr(2475 - 2364) + chr(0b1111 + 0o45) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1495 - 1444) + '\x33' + chr(0b110100), 62818 - 62810), ehT0Px3KOsy9(chr(48) + chr(5830 - 5719) + chr(50) + '\064' + chr(54), 47111 - 47103), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(48) + '\x33', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101000 + 0o107) + chr(2015 - 1966) + chr(2032 - 1977) + chr(1692 - 1639), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x33' + chr(2166 - 2111) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(3888 - 3777) + chr(0b110010 + 0o3) + chr(53), 8), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(7186 - 7075) + chr(50) + chr(49) + chr(473 - 418), 53611 - 53603), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011) + '\065' + chr(0b110010), 38639 - 38631), ehT0Px3KOsy9(chr(1985 - 1937) + chr(111) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2117 - 2065) + chr(49), 8), ehT0Px3KOsy9(chr(1736 - 1688) + chr(0b1101111) + chr(49) + chr(323 - 275) + chr(687 - 639), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(55) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\066', 4334 - 4326), ehT0Px3KOsy9(chr(389 - 341) + chr(0b101100 + 0o103) + chr(0b110001) + '\060' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(1993 - 1945) + chr(0b1010000 + 0o37) + chr(0b110001 + 0o1) + '\x33' + chr(0b100110 + 0o20), 6347 - 6339), ehT0Px3KOsy9(chr(428 - 380) + chr(1295 - 1184) + chr(0b110010) + chr(0b110001) + chr(3019 - 2964), 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(6815 - 6704) + chr(0b110010) + chr(0b1101 + 0o43) + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + chr(2226 - 2175) + chr(0b111 + 0o51) + chr(51), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + chr(49) + chr(55) + chr(0b100100 + 0o15), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110111) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(1588 - 1540) + chr(6392 - 6281) + '\x33' + chr(0b110101), 59703 - 59695), ehT0Px3KOsy9('\060' + chr(4707 - 4596) + '\061' + chr(0b110100) + chr(0b0 + 0o64), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\066' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(2391 - 2339) + chr(1438 - 1387), 51441 - 51433)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(53) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'&'), chr(0b1100100) + '\x65' + '\143' + '\x6f' + chr(4507 - 4407) + '\x65')(chr(7851 - 7734) + '\x74' + chr(0b10111 + 0o117) + '\055' + chr(0b11001 + 0o37)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def xnw7xKMDxnTM(oVre8I6UXc3b, tKJAwKiE1Zya, GUE1BY_7JDnn, YlNBidr8uuv4, zp1vVg_LFx8b): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'mIDO\x0f\xfe\xfa\x0f}S\x0e\xe1F'), '\144' + '\145' + chr(7444 - 7345) + '\157' + chr(0b1011000 + 0o14) + chr(0b1011110 + 0o7))('\165' + chr(0b101010 + 0o112) + chr(0b1010110 + 0o20) + chr(1148 - 1103) + chr(56))) == xafqLlk3kkUe(SXOLrMavuUCe(b'eMCI\x08\xf2'), '\144' + chr(0b1100101) + '\x63' + chr(0b110000 + 0o77) + chr(0b1001011 + 0o31) + '\145')(chr(0b1110101) + '\x74' + chr(0b1001000 + 0o36) + chr(0b100000 + 0o15) + chr(56)): _GMnm_MXTM2t = GUE1BY_7JDnn.minutes_for_sessions_in_range(oVre8I6UXc3b.sessions[ehT0Px3KOsy9(chr(1946 - 1898) + chr(111) + chr(48), 0o10)], oVre8I6UXc3b.sessions[-ehT0Px3KOsy9(chr(1042 - 994) + chr(111) + chr(0b110001), ord("\x08"))]) RJU42h9EEEXE = zp1vVg_LFx8b.get_history_window([tKJAwKiE1Zya], _GMnm_MXTM2t[-ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + chr(49), 8)], bar_count=c2A0yzQpDQB3(_GMnm_MXTM2t) + ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + chr(0b10011 + 0o36), 8), frequency=xafqLlk3kkUe(SXOLrMavuUCe(b'9I'), chr(6387 - 6287) + '\x65' + '\x63' + '\x6f' + chr(332 - 232) + chr(0b1100101))(chr(8328 - 8211) + '\164' + chr(0b1010111 + 0o17) + chr(0b101101) + chr(0b0 + 0o70)), field=xafqLlk3kkUe(SXOLrMavuUCe(b'xVD_\x19'), chr(0b11100 + 0o110) + chr(3282 - 3181) + chr(0b1100011) + chr(4746 - 4635) + '\x64' + chr(101))(chr(117) + chr(1669 - 1553) + '\x66' + chr(45) + '\070'), data_frequency=oVre8I6UXc3b.emission_rate, ffill=ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(1851 - 1740) + '\061', 8))[tKJAwKiE1Zya] return (xafqLlk3kkUe(RJU42h9EEEXE, xafqLlk3kkUe(SXOLrMavuUCe(b'xGYc\x1f\xff\xf4\x0fED'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(0b1101111) + chr(8450 - 8350) + chr(7847 - 7746))(chr(0b1110101) + chr(5073 - 4957) + chr(0b1100110) + chr(45) + '\x38'))()[ehT0Px3KOsy9('\060' + '\157' + '\x31', 8):], xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'lKZR\x0f\xf6\xf8\x11ND0\xf8J_SV\xb9\xf9\xb1\x18\x88X\xfd\x84XR%Jo&\xed'), chr(0b1100100) + '\145' + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\145')('\x75' + '\164' + '\x66' + '\x2d' + chr(0b111000)))(GUE1BY_7JDnn, RJU42h9EEEXE)) NcwNd9gvgEB5 = tKJAwKiE1Zya.start_date if NcwNd9gvgEB5 < YlNBidr8uuv4[ehT0Px3KOsy9('\060' + chr(8594 - 8483) + chr(2091 - 2043), 8)]: RJU42h9EEEXE = zp1vVg_LFx8b.get_history_window([tKJAwKiE1Zya], YlNBidr8uuv4[-ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2210 - 2161), 8)], bar_count=c2A0yzQpDQB3(YlNBidr8uuv4) + ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2349 - 2300), 8), frequency=xafqLlk3kkUe(SXOLrMavuUCe(b'9@'), chr(100) + '\x65' + chr(5575 - 5476) + chr(111) + chr(100) + '\x65')('\165' + chr(116) + '\x66' + '\055' + chr(0b111000)), field=xafqLlk3kkUe(SXOLrMavuUCe(b'xVD_\x19'), chr(0b1001011 + 0o31) + chr(101) + chr(0b11001 + 0o112) + chr(111) + chr(0b1011011 + 0o11) + chr(101))(chr(117) + '\x74' + chr(0b1100110) + chr(625 - 580) + chr(0b101010 + 0o16)), data_frequency=oVre8I6UXc3b.emission_rate, ffill=ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + chr(49), 8))[tKJAwKiE1Zya] HMmxlqB6_Lkj = RJU42h9EEEXE.pct_change()[ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001), 8):] return (HMmxlqB6_Lkj, HMmxlqB6_Lkj) elif NcwNd9gvgEB5 == YlNBidr8uuv4[ehT0Px3KOsy9('\x30' + '\157' + chr(48), 8)]: RJU42h9EEEXE = zp1vVg_LFx8b.get_history_window([tKJAwKiE1Zya], YlNBidr8uuv4[-ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1011010 + 0o25) + chr(0b110001), 8)], bar_count=c2A0yzQpDQB3(YlNBidr8uuv4), frequency=xafqLlk3kkUe(SXOLrMavuUCe(b'9@'), '\144' + chr(0b1100101) + '\x63' + chr(10704 - 10593) + chr(100) + chr(2206 - 2105))(chr(0b111000 + 0o75) + '\x74' + '\x66' + chr(45) + chr(0b111000)), field=xafqLlk3kkUe(SXOLrMavuUCe(b'xVD_\x19'), chr(5154 - 5054) + '\145' + '\143' + '\157' + chr(0b100001 + 0o103) + chr(101))('\165' + '\164' + '\146' + '\x2d' + chr(56)), data_frequency=oVre8I6UXc3b.emission_rate, ffill=ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + '\061', 8))[tKJAwKiE1Zya] yU1RJq_GJSvq = zp1vVg_LFx8b.get_spot_value(tKJAwKiE1Zya, xafqLlk3kkUe(SXOLrMavuUCe(b'gTHR'), chr(100) + chr(383 - 282) + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b1100001 + 0o24) + '\164' + chr(0b1100110) + chr(0b101101) + '\x38'), YlNBidr8uuv4[ehT0Px3KOsy9(chr(0b110000) + chr(6070 - 5959) + chr(0b110000), 8)], xafqLlk3kkUe(SXOLrMavuUCe(b'lEDP\x05'), '\144' + '\145' + chr(6153 - 6054) + chr(0b1101111) + '\144' + '\145')(chr(0b1110101) + chr(0b1110100) + chr(2036 - 1934) + chr(638 - 593) + chr(56))) TV3Y9ghxbEcC = zp1vVg_LFx8b.get_spot_value(tKJAwKiE1Zya, xafqLlk3kkUe(SXOLrMavuUCe(b'kHBO\x19'), chr(0b1100100) + '\145' + chr(0b1011001 + 0o12) + chr(0b1101101 + 0o2) + chr(100) + chr(0b101001 + 0o74))(chr(0b1110101) + chr(621 - 505) + chr(9478 - 9376) + '\x2d' + chr(0b11000 + 0o40)), YlNBidr8uuv4[ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\060', 8)], xafqLlk3kkUe(SXOLrMavuUCe(b'lEDP\x05'), chr(0b1100100) + chr(0b1010111 + 0o16) + chr(0b110011 + 0o60) + chr(9971 - 9860) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + '\146' + chr(0b101101) + '\x38')) V_ExQHA3teKr = (TV3Y9ghxbEcC - yU1RJq_GJSvq) / yU1RJq_GJSvq HMmxlqB6_Lkj = RJU42h9EEEXE.pct_change()[:] HMmxlqB6_Lkj[ehT0Px3KOsy9('\x30' + '\x6f' + chr(1740 - 1692), 8)] = V_ExQHA3teKr return (HMmxlqB6_Lkj, HMmxlqB6_Lkj) else: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'kECR\x13\xe3\xb5\x12GUO\xf7F_EJ\xb1\xc7\xb1\x16\xdcY\xe0\xcafR3]rc\xea\xe7\xe1\xb7YYr\x01G\xc3fKY\x1c\x19\xef\xfc\x12V\x01\x0b\xe0QXHE\xfc\xd2\xab\x18\xdc^\xe6\x87rM!Lo,\xf0\xaf\xf0\xa6\x0bTr\x00\x14\xcbiW^Y\x08\xb7\xe6\x15CS\x1b\xb5GPRG\xe1\x83\xb1T'), chr(9214 - 9114) + chr(101) + chr(7948 - 7849) + '\x6f' + chr(0b110 + 0o136) + chr(101))(chr(0b1110101) + chr(116) + chr(0b1100110) + chr(99 - 54) + chr(0b100111 + 0o21)) % NcwNd9gvgEB5)
quantopian/zipline
zipline/utils/run_algo.py
_run
def _run(handle_data, initialize, before_trading_start, analyze, algofile, algotext, defines, data_frequency, capital_base, bundle, bundle_timestamp, start, end, output, trading_calendar, print_algo, metrics_set, local_namespace, environ, blotter, benchmark_returns): """Run a backtest for the given algorithm. This is shared between the cli and :func:`zipline.run_algo`. """ if benchmark_returns is None: benchmark_returns, _ = load_market_data(environ=environ) if algotext is not None: if local_namespace: ip = get_ipython() # noqa namespace = ip.user_ns else: namespace = {} for assign in defines: try: name, value = assign.split('=', 2) except ValueError: raise ValueError( 'invalid define %r, should be of the form name=value' % assign, ) try: # evaluate in the same namespace so names may refer to # eachother namespace[name] = eval(value, namespace) except Exception as e: raise ValueError( 'failed to execute definition for name %r: %s' % (name, e), ) elif defines: raise _RunAlgoError( 'cannot pass define without `algotext`', "cannot pass '-D' / '--define' without '-t' / '--algotext'", ) else: namespace = {} if algofile is not None: algotext = algofile.read() if print_algo: if PYGMENTS: highlight( algotext, PythonLexer(), TerminalFormatter(), outfile=sys.stdout, ) else: click.echo(algotext) if trading_calendar is None: trading_calendar = get_calendar('XNYS') # date parameter validation if trading_calendar.session_distance(start, end) < 1: raise _RunAlgoError( 'There are no trading days between %s and %s' % ( start.date(), end.date(), ), ) bundle_data = bundles.load( bundle, environ, bundle_timestamp, ) first_trading_day = \ bundle_data.equity_minute_bar_reader.first_trading_day data = DataPortal( bundle_data.asset_finder, trading_calendar=trading_calendar, first_trading_day=first_trading_day, equity_minute_reader=bundle_data.equity_minute_bar_reader, equity_daily_reader=bundle_data.equity_daily_bar_reader, adjustment_reader=bundle_data.adjustment_reader, ) pipeline_loader = USEquityPricingLoader( bundle_data.equity_daily_bar_reader, bundle_data.adjustment_reader, ) def choose_loader(column): if column in USEquityPricing.columns: return pipeline_loader raise ValueError( "No PipelineLoader registered for column %s." % column ) if isinstance(metrics_set, six.string_types): try: metrics_set = metrics.load(metrics_set) except ValueError as e: raise _RunAlgoError(str(e)) if isinstance(blotter, six.string_types): try: blotter = load(Blotter, blotter) except ValueError as e: raise _RunAlgoError(str(e)) perf = TradingAlgorithm( namespace=namespace, data_portal=data, get_pipeline_loader=choose_loader, trading_calendar=trading_calendar, sim_params=SimulationParameters( start_session=start, end_session=end, trading_calendar=trading_calendar, capital_base=capital_base, data_frequency=data_frequency, ), metrics_set=metrics_set, blotter=blotter, benchmark_returns=benchmark_returns, **{ 'initialize': initialize, 'handle_data': handle_data, 'before_trading_start': before_trading_start, 'analyze': analyze, } if algotext is None else { 'algo_filename': getattr(algofile, 'name', '<algorithm>'), 'script': algotext, } ).run() if output == '-': click.echo(str(perf)) elif output != os.devnull: # make the zipline magic not write any data perf.to_pickle(output) return perf
python
def _run(handle_data, initialize, before_trading_start, analyze, algofile, algotext, defines, data_frequency, capital_base, bundle, bundle_timestamp, start, end, output, trading_calendar, print_algo, metrics_set, local_namespace, environ, blotter, benchmark_returns): """Run a backtest for the given algorithm. This is shared between the cli and :func:`zipline.run_algo`. """ if benchmark_returns is None: benchmark_returns, _ = load_market_data(environ=environ) if algotext is not None: if local_namespace: ip = get_ipython() # noqa namespace = ip.user_ns else: namespace = {} for assign in defines: try: name, value = assign.split('=', 2) except ValueError: raise ValueError( 'invalid define %r, should be of the form name=value' % assign, ) try: # evaluate in the same namespace so names may refer to # eachother namespace[name] = eval(value, namespace) except Exception as e: raise ValueError( 'failed to execute definition for name %r: %s' % (name, e), ) elif defines: raise _RunAlgoError( 'cannot pass define without `algotext`', "cannot pass '-D' / '--define' without '-t' / '--algotext'", ) else: namespace = {} if algofile is not None: algotext = algofile.read() if print_algo: if PYGMENTS: highlight( algotext, PythonLexer(), TerminalFormatter(), outfile=sys.stdout, ) else: click.echo(algotext) if trading_calendar is None: trading_calendar = get_calendar('XNYS') # date parameter validation if trading_calendar.session_distance(start, end) < 1: raise _RunAlgoError( 'There are no trading days between %s and %s' % ( start.date(), end.date(), ), ) bundle_data = bundles.load( bundle, environ, bundle_timestamp, ) first_trading_day = \ bundle_data.equity_minute_bar_reader.first_trading_day data = DataPortal( bundle_data.asset_finder, trading_calendar=trading_calendar, first_trading_day=first_trading_day, equity_minute_reader=bundle_data.equity_minute_bar_reader, equity_daily_reader=bundle_data.equity_daily_bar_reader, adjustment_reader=bundle_data.adjustment_reader, ) pipeline_loader = USEquityPricingLoader( bundle_data.equity_daily_bar_reader, bundle_data.adjustment_reader, ) def choose_loader(column): if column in USEquityPricing.columns: return pipeline_loader raise ValueError( "No PipelineLoader registered for column %s." % column ) if isinstance(metrics_set, six.string_types): try: metrics_set = metrics.load(metrics_set) except ValueError as e: raise _RunAlgoError(str(e)) if isinstance(blotter, six.string_types): try: blotter = load(Blotter, blotter) except ValueError as e: raise _RunAlgoError(str(e)) perf = TradingAlgorithm( namespace=namespace, data_portal=data, get_pipeline_loader=choose_loader, trading_calendar=trading_calendar, sim_params=SimulationParameters( start_session=start, end_session=end, trading_calendar=trading_calendar, capital_base=capital_base, data_frequency=data_frequency, ), metrics_set=metrics_set, blotter=blotter, benchmark_returns=benchmark_returns, **{ 'initialize': initialize, 'handle_data': handle_data, 'before_trading_start': before_trading_start, 'analyze': analyze, } if algotext is None else { 'algo_filename': getattr(algofile, 'name', '<algorithm>'), 'script': algotext, } ).run() if output == '-': click.echo(str(perf)) elif output != os.devnull: # make the zipline magic not write any data perf.to_pickle(output) return perf
[ "def", "_run", "(", "handle_data", ",", "initialize", ",", "before_trading_start", ",", "analyze", ",", "algofile", ",", "algotext", ",", "defines", ",", "data_frequency", ",", "capital_base", ",", "bundle", ",", "bundle_timestamp", ",", "start", ",", "end", ",", "output", ",", "trading_calendar", ",", "print_algo", ",", "metrics_set", ",", "local_namespace", ",", "environ", ",", "blotter", ",", "benchmark_returns", ")", ":", "if", "benchmark_returns", "is", "None", ":", "benchmark_returns", ",", "_", "=", "load_market_data", "(", "environ", "=", "environ", ")", "if", "algotext", "is", "not", "None", ":", "if", "local_namespace", ":", "ip", "=", "get_ipython", "(", ")", "# noqa", "namespace", "=", "ip", ".", "user_ns", "else", ":", "namespace", "=", "{", "}", "for", "assign", "in", "defines", ":", "try", ":", "name", ",", "value", "=", "assign", ".", "split", "(", "'='", ",", "2", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'invalid define %r, should be of the form name=value'", "%", "assign", ",", ")", "try", ":", "# evaluate in the same namespace so names may refer to", "# eachother", "namespace", "[", "name", "]", "=", "eval", "(", "value", ",", "namespace", ")", "except", "Exception", "as", "e", ":", "raise", "ValueError", "(", "'failed to execute definition for name %r: %s'", "%", "(", "name", ",", "e", ")", ",", ")", "elif", "defines", ":", "raise", "_RunAlgoError", "(", "'cannot pass define without `algotext`'", ",", "\"cannot pass '-D' / '--define' without '-t' / '--algotext'\"", ",", ")", "else", ":", "namespace", "=", "{", "}", "if", "algofile", "is", "not", "None", ":", "algotext", "=", "algofile", ".", "read", "(", ")", "if", "print_algo", ":", "if", "PYGMENTS", ":", "highlight", "(", "algotext", ",", "PythonLexer", "(", ")", ",", "TerminalFormatter", "(", ")", ",", "outfile", "=", "sys", ".", "stdout", ",", ")", "else", ":", "click", ".", "echo", "(", "algotext", ")", "if", "trading_calendar", "is", "None", ":", "trading_calendar", "=", "get_calendar", "(", "'XNYS'", ")", "# date parameter validation", "if", "trading_calendar", ".", "session_distance", "(", "start", ",", "end", ")", "<", "1", ":", "raise", "_RunAlgoError", "(", "'There are no trading days between %s and %s'", "%", "(", "start", ".", "date", "(", ")", ",", "end", ".", "date", "(", ")", ",", ")", ",", ")", "bundle_data", "=", "bundles", ".", "load", "(", "bundle", ",", "environ", ",", "bundle_timestamp", ",", ")", "first_trading_day", "=", "bundle_data", ".", "equity_minute_bar_reader", ".", "first_trading_day", "data", "=", "DataPortal", "(", "bundle_data", ".", "asset_finder", ",", "trading_calendar", "=", "trading_calendar", ",", "first_trading_day", "=", "first_trading_day", ",", "equity_minute_reader", "=", "bundle_data", ".", "equity_minute_bar_reader", ",", "equity_daily_reader", "=", "bundle_data", ".", "equity_daily_bar_reader", ",", "adjustment_reader", "=", "bundle_data", ".", "adjustment_reader", ",", ")", "pipeline_loader", "=", "USEquityPricingLoader", "(", "bundle_data", ".", "equity_daily_bar_reader", ",", "bundle_data", ".", "adjustment_reader", ",", ")", "def", "choose_loader", "(", "column", ")", ":", "if", "column", "in", "USEquityPricing", ".", "columns", ":", "return", "pipeline_loader", "raise", "ValueError", "(", "\"No PipelineLoader registered for column %s.\"", "%", "column", ")", "if", "isinstance", "(", "metrics_set", ",", "six", ".", "string_types", ")", ":", "try", ":", "metrics_set", "=", "metrics", ".", "load", "(", "metrics_set", ")", "except", "ValueError", "as", "e", ":", "raise", "_RunAlgoError", "(", "str", "(", "e", ")", ")", "if", "isinstance", "(", "blotter", ",", "six", ".", "string_types", ")", ":", "try", ":", "blotter", "=", "load", "(", "Blotter", ",", "blotter", ")", "except", "ValueError", "as", "e", ":", "raise", "_RunAlgoError", "(", "str", "(", "e", ")", ")", "perf", "=", "TradingAlgorithm", "(", "namespace", "=", "namespace", ",", "data_portal", "=", "data", ",", "get_pipeline_loader", "=", "choose_loader", ",", "trading_calendar", "=", "trading_calendar", ",", "sim_params", "=", "SimulationParameters", "(", "start_session", "=", "start", ",", "end_session", "=", "end", ",", "trading_calendar", "=", "trading_calendar", ",", "capital_base", "=", "capital_base", ",", "data_frequency", "=", "data_frequency", ",", ")", ",", "metrics_set", "=", "metrics_set", ",", "blotter", "=", "blotter", ",", "benchmark_returns", "=", "benchmark_returns", ",", "*", "*", "{", "'initialize'", ":", "initialize", ",", "'handle_data'", ":", "handle_data", ",", "'before_trading_start'", ":", "before_trading_start", ",", "'analyze'", ":", "analyze", ",", "}", "if", "algotext", "is", "None", "else", "{", "'algo_filename'", ":", "getattr", "(", "algofile", ",", "'name'", ",", "'<algorithm>'", ")", ",", "'script'", ":", "algotext", ",", "}", ")", ".", "run", "(", ")", "if", "output", "==", "'-'", ":", "click", ".", "echo", "(", "str", "(", "perf", ")", ")", "elif", "output", "!=", "os", ".", "devnull", ":", "# make the zipline magic not write any data", "perf", ".", "to_pickle", "(", "output", ")", "return", "perf" ]
Run a backtest for the given algorithm. This is shared between the cli and :func:`zipline.run_algo`.
[ "Run", "a", "backtest", "for", "the", "given", "algorithm", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/run_algo.py#L56-L213
train
Run a single algorithm.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgF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Ue,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1000111 + 0o50) + chr(0b1110 + 0o51) + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(10308 - 10197) + chr(0b101110 + 0o7), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11 + 0o154) + '\063' + chr(904 - 849) + chr(189 - 135), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10010 + 0o135) + chr(0b1 + 0o62) + '\x35' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1710 - 1662) + chr(111) + chr(51) + '\x37' + chr(1234 - 1179), 0o10), ehT0Px3KOsy9(chr(101 - 53) + '\157' + chr(0b110001) + chr(53) + chr(0b110010), 12402 - 12394), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\062' + chr(50), 53875 - 53867), ehT0Px3KOsy9('\060' + chr(0b1000111 + 0o50) + '\x32' + chr(2490 - 2440) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(51) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(2240 - 2190) + chr(2006 - 1958) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(4230 - 4119) + '\062' + chr(51), 39810 - 39802), ehT0Px3KOsy9(chr(1902 - 1854) + '\157' + chr(0b100110 + 0o15) + chr(1200 - 1146) + chr(0b101110 + 0o6), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b101010 + 0o11) + chr(196 - 147) + '\x30', 65320 - 65312), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + chr(0b10010 + 0o40) + chr(0b110111), 55927 - 55919), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(50) + '\x30', 43565 - 43557), ehT0Px3KOsy9('\060' + '\x6f' + chr(1303 - 1254) + chr(0b110 + 0o52) + chr(0b110111), 40681 - 40673), ehT0Px3KOsy9(chr(1144 - 1096) + chr(0b1001101 + 0o42) + chr(49) + chr(0b110101) + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9471 - 9360) + chr(2737 - 2682) + chr(0b100000 + 0o20), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110101) + chr(775 - 720), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b10 + 0o61) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(0b100101 + 0o15) + chr(2041 - 1987) + '\067', 9655 - 9647), ehT0Px3KOsy9('\x30' + '\x6f' + '\061' + '\065' + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(5629 - 5518) + chr(0b110011) + '\x36' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(2082 - 2033) + '\064' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + chr(0b110010) + '\062', 38237 - 38229), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + chr(2286 - 2235) + chr(0b1 + 0o61) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10011 + 0o36) + chr(55) + chr(727 - 676), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + chr(0b110010) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + chr(0b10101 + 0o34) + chr(0b100110 + 0o15) + '\x33', 0o10), ehT0Px3KOsy9(chr(344 - 296) + '\x6f' + chr(49) + chr(0b110111) + '\x36', 5561 - 5553), ehT0Px3KOsy9(chr(100 - 52) + chr(0b1101111) + '\063' + '\064' + chr(0b110101), 35409 - 35401), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(49) + chr(55) + chr(0b11100 + 0o27), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + chr(55) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(777 - 722) + chr(2624 - 2569), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\064' + '\067', 8), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(50) + chr(0b110011 + 0o4) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1007 - 957) + '\x35' + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b111000 + 0o67) + '\x37' + chr(0b110100), 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + chr(2742 - 2687), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\067' + chr(0b110000), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\065' + chr(1160 - 1112), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x12'), '\x64' + '\145' + chr(0b101011 + 0o70) + chr(111) + '\x64' + chr(6956 - 6855))('\165' + chr(0b1101110 + 0o6) + chr(5372 - 5270) + '\x2d' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def xnaCGCEHQH3F(PlnZOTvWE7g0, MuiHFrkYeUQ4, Gs6DaNzmND_d, fI_kFCmE76LC, NnQHX5fD1Zem, rbX9ASHzRG83, ZCo66HHa0lvP, bXS4MokNqKbm, kbRhDi9e7qqO, BdOvlW9oyNT1, PgtClxoRs7TB, avRbFsnfJxQj, whWDZq5_lP01, e1jVqMSBZ01Y, GUE1BY_7JDnn, F5yvBDS8VEtU, UqUxZ3isRi_J, N0I__FlILn33, rNK60KZ67nXB, WcJlIx2C2pWn, ie_gijH_06GP): if ie_gijH_06GP is None: (ie_gijH_06GP, VNGQdHSFPrso) = Y0ITzvhkgX51(environ=rNK60KZ67nXB) if rbX9ASHzRG83 is not None: if N0I__FlILn33: Hsra_lSlb8Qx = OPDYBgmbqzSc() y7wzAiF9iB4_ = Hsra_lSlb8Qx.user_ns else: y7wzAiF9iB4_ = {} for XH9bAgNQ2txV in ZCo66HHa0lvP: try: (AIvJRzLdDfgF, QmmgWUB13VCJ) = XH9bAgNQ2txV.split(xafqLlk3kkUe(SXOLrMavuUCe(b'\x01'), chr(0b11110 + 0o106) + '\145' + '\143' + chr(0b1101000 + 0o7) + chr(3667 - 3567) + '\x65')('\165' + chr(11579 - 11463) + chr(0b10100 + 0o122) + chr(525 - 480) + chr(0b111000)), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11110 + 0o24), 33133 - 33125)) except q1QCh3W88sgk: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'Uk\x88\x88\x93\x03v\xb0x\xe6u\x9d\xa620b\x1f\x14\x0f+\xdf\x02\x83\x0b6\xf1\x19s{\x11\x83[\xcc\xd7\x02\x9a\xc9SmU\x1ck\x9f\x84\x9aWd\xf1p\xf6v'), chr(4279 - 4179) + chr(9873 - 9772) + chr(5653 - 5554) + chr(0b111001 + 0o66) + '\x64' + chr(4434 - 4333))('\165' + '\x74' + '\x66' + chr(0b101101) + '\x38') % XH9bAgNQ2txV) try: y7wzAiF9iB4_[AIvJRzLdDfgF] = MCqssyYhLtLC(QmmgWUB13VCJ, y7wzAiF9iB4_) except jLmadlzMdunT as GlnVAPeT6CUe: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'Zd\x97\x85\x9a\x0e2\xe4s\xa3v\x8c\xad4e3\x08\x18K=\xd1\x04\x98\x0e&\xb8\x14x{\x18\x8a\t\x98\xd1\x06\xd7\xca\x1c:J\x06%\xdb\x9a'), chr(0b1100100) + chr(101) + chr(99) + chr(111) + '\x64' + chr(0b101110 + 0o67))(chr(117) + '\164' + chr(0b1100110) + chr(0b101101) + chr(56)) % (AIvJRzLdDfgF, GlnVAPeT6CUe)) elif ZCo66HHa0lvP: raise tVqs1da6k4uo(xafqLlk3kkUe(SXOLrMavuUCe(b"_d\x90\x87\x90\x1e2\xe0}\xf0`\xd4\xac2v.\x03]\x0f/\xde\x19\x9e\x08'\xa5[v:\x12\x82\x14\xcc\xda\x1f\xce\xcf"), chr(5123 - 5023) + chr(0b1000101 + 0o40) + chr(99) + chr(0b1101111) + chr(5907 - 5807) + '\145')(chr(1344 - 1227) + '\x74' + chr(0b110111 + 0o57) + chr(0b101101) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'_d\x90\x87\x90\x1e2\xe0}\xf0`\xd4\xefzT`M\x17\x0f\x7f\x9a@\x92\x024\xb8\x15s|^\x92\x12\xcc\xd7\x08\xcf\xdb\x1c8\x15H"\xde\xc6\xdfM?\xbd}\xeft\x9b\xbc2h3J'), chr(6586 - 6486) + chr(0b100110 + 0o77) + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(0b1110101) + '\164' + '\146' + '\x2d' + chr(0b111000))) else: y7wzAiF9iB4_ = {} if NnQHX5fD1Zem is not None: rbX9ASHzRG83 = NnQHX5fD1Zem.U6MiWrhuCi2Y() if F5yvBDS8VEtU: if qB3n2s4r5shl: KBJTxET860F_(rbX9ASHzRG83, xvUJexGpQ4qx(), cEPqG4hL4kLo(), outfile=xafqLlk3kkUe(a2SYDDomXDZ2, xafqLlk3kkUe(SXOLrMavuUCe(b'{k\x88\xb0\x95XV\xf7E\xe9v\x9b'), chr(0b1110 + 0o126) + '\x65' + chr(99) + '\157' + chr(0b1100100) + '\x65')('\x75' + chr(0b1110100) + chr(0b1110 + 0o130) + '\055' + chr(0b111000)))) else: xafqLlk3kkUe(zsE8htsrFxS3, xafqLlk3kkUe(SXOLrMavuUCe(b'zh\xc8\xb9\xa0_`\xfbo\xecP\xbc'), chr(0b1100100) + '\145' + chr(0b111111 + 0o44) + chr(111) + '\x64' + chr(101))(chr(117) + '\164' + chr(0b1100110) + chr(45) + chr(0b11111 + 0o31)))(rbX9ASHzRG83) if GUE1BY_7JDnn is None: GUE1BY_7JDnn = qV4fO1AoRtpp(xafqLlk3kkUe(SXOLrMavuUCe(b'dK\xa7\xba'), chr(0b10111 + 0o115) + chr(0b1011010 + 0o13) + chr(2891 - 2792) + chr(0b1011001 + 0o26) + chr(0b1100100) + chr(0b11000 + 0o115))(chr(6945 - 6828) + chr(474 - 358) + '\x66' + chr(0b101101) + '\x38')) if xafqLlk3kkUe(GUE1BY_7JDnn, xafqLlk3kkUe(SXOLrMavuUCe(b'O`\x8d\x9a\x96\x05|\xcfx\xea`\x80\xa99s"'), '\144' + chr(101) + '\x63' + chr(111) + chr(3793 - 3693) + chr(0b110100 + 0o61))('\165' + '\164' + '\x66' + '\x2d' + '\070'))(avRbFsnfJxQj, whWDZq5_lP01) < ehT0Px3KOsy9('\x30' + chr(12136 - 12025) + chr(0b110001), ord("\x08")): raise tVqs1da6k4uo(xafqLlk3kkUe(SXOLrMavuUCe(b'hm\x9b\x9b\x9aJs\xe2y\xa3}\x9b\xe8#b&\tQA?\x97\t\x97\x1e!\xf1\x19s/\t\x80\x1e\xd6\x9fB\xc9\x8f]q\\\x1c \x8d'), '\144' + '\145' + '\143' + '\157' + chr(100) + '\x65')(chr(6079 - 5962) + chr(3904 - 3788) + chr(102) + chr(0b10011 + 0o32) + chr(2560 - 2504)) % (xafqLlk3kkUe(avRbFsnfJxQj, xafqLlk3kkUe(SXOLrMavuUCe(b'Xd\x8a\x8c'), chr(0b1010111 + 0o15) + '\x65' + chr(9302 - 9203) + '\x6f' + chr(0b1100100) + chr(101))('\x75' + chr(116) + '\x66' + '\x2d' + '\070'))(), xafqLlk3kkUe(whWDZq5_lP01, xafqLlk3kkUe(SXOLrMavuUCe(b'Xd\x8a\x8c'), chr(0b1100100) + chr(5705 - 5604) + chr(2521 - 2422) + chr(0b1101111) + '\x64' + chr(0b1010011 + 0o22))(chr(5803 - 5686) + chr(5120 - 5004) + chr(102) + chr(45) + chr(56)))())) fye1kYE1Kttt = e6TIGpvOn5Jf.mxtdQMeiwJZJ(BdOvlW9oyNT1, rNK60KZ67nXB, PgtClxoRs7TB) dFUu8gPYz3Rg = fye1kYE1Kttt.equity_minute_bar_reader.first_trading_day ULnjp6D6efFH = oSHDZAZfoCsi(fye1kYE1Kttt.asset_finder, trading_calendar=GUE1BY_7JDnn, first_trading_day=dFUu8gPYz3Rg, equity_minute_reader=fye1kYE1Kttt.equity_minute_bar_reader, equity_daily_reader=fye1kYE1Kttt.equity_daily_bar_reader, adjustment_reader=fye1kYE1Kttt.adjustment_reader) LGt4aRa2ejFA = CTdtxjjDEiDJ(fye1kYE1Kttt.equity_daily_bar_reader, fye1kYE1Kttt.adjustment_reader) def dbTfemc1CHPZ(Pl0JgJDv0QqN): if Pl0JgJDv0QqN in xafqLlk3kkUe(ZmKDDorPlspX, xafqLlk3kkUe(SXOLrMavuUCe(b'MN\x92\xb1\xbd\x1e|\xa3L\xc8j\xc0'), chr(0b1000000 + 0o44) + chr(101) + '\x63' + chr(111) + chr(100) + chr(0b1100101))(chr(0b1011001 + 0o34) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b100111 + 0o21))): return LGt4aRa2ejFA raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'rj\xde\xb9\x96\x1aw\xfcu\xedv\xb8\xa76t"\x1f\x18]=\xd0\x04\x85\x137\xa3\x1er{\x18\x8a\t\x98\xdc\x08\xd6\xdaQq\x18\x19v\xd0'), chr(0b1000101 + 0o37) + chr(3906 - 3805) + '\143' + chr(2016 - 1905) + chr(0b1100100) + chr(4227 - 4126))(chr(117) + '\x74' + chr(0b10011 + 0o123) + chr(999 - 954) + chr(0b111000)) % Pl0JgJDv0QqN) if PlSM16l2KDPD(UqUxZ3isRi_J, xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'Oq\x8c\x80\x91\rM\xe4e\xf3v\x87'), chr(100) + chr(0b1100101) + chr(99) + chr(111) + chr(0b10011 + 0o121) + chr(6337 - 6236))(chr(117) + chr(0b1001110 + 0o46) + chr(0b1100110) + '\x2d' + chr(0b100000 + 0o30)))): try: UqUxZ3isRi_J = yYegMqDoSfs5.mxtdQMeiwJZJ(UqUxZ3isRi_J) except q1QCh3W88sgk as GlnVAPeT6CUe: raise tVqs1da6k4uo(M8_cKLkHVB2V(GlnVAPeT6CUe)) if PlSM16l2KDPD(WcJlIx2C2pWn, xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'Oq\x8c\x80\x91\rM\xe4e\xf3v\x87'), '\144' + '\145' + chr(0b1100011) + chr(0b10 + 0o155) + chr(6923 - 6823) + '\x65')(chr(117) + '\164' + '\146' + chr(0b101101) + chr(0b111000)))): try: WcJlIx2C2pWn = mxtdQMeiwJZJ(WU8Kc2MM3uWt, WcJlIx2C2pWn) except q1QCh3W88sgk as GlnVAPeT6CUe: raise tVqs1da6k4uo(M8_cKLkHVB2V(GlnVAPeT6CUe)) FDrs8ZfAkDxp = CjSeVkyJ8VrZ(namespace=y7wzAiF9iB4_, data_portal=ULnjp6D6efFH, get_pipeline_loader=dbTfemc1CHPZ, trading_calendar=GUE1BY_7JDnn, sim_params=xGpYKA6knASv(start_session=avRbFsnfJxQj, end_session=whWDZq5_lP01, trading_calendar=GUE1BY_7JDnn, capital_base=kbRhDi9e7qqO, data_frequency=bXS4MokNqKbm), metrics_set=UqUxZ3isRi_J, blotter=WcJlIx2C2pWn, benchmark_returns=ie_gijH_06GP, **{xafqLlk3kkUe(SXOLrMavuUCe(b'Uk\x97\x9d\x96\x0b~\xf9f\xe6'), '\x64' + chr(0b1100101) + '\x63' + chr(0b1100001 + 0o16) + chr(0b1100100) + chr(7450 - 7349))('\x75' + chr(4852 - 4736) + chr(0b1100110) + chr(45) + '\070'): MuiHFrkYeUQ4, xafqLlk3kkUe(SXOLrMavuUCe(b'Td\x90\x8d\x93\x0fM\xf4}\xf7r'), '\x64' + '\x65' + '\x63' + chr(111) + chr(0b111000 + 0o54) + chr(101))(chr(0b1110101) + '\x74' + chr(9246 - 9144) + chr(0b101101) + chr(2134 - 2078)): PlnZOTvWE7g0, xafqLlk3kkUe(SXOLrMavuUCe(b'^`\x98\x86\x8d\x0fM\xe4n\xe2w\x9d\xa60O4\x19Y],'), chr(100) + chr(0b1100101) + '\143' + '\157' + chr(190 - 90) + '\145')(chr(3382 - 3265) + '\164' + chr(0b1100110) + chr(45) + chr(0b111000)): Gs6DaNzmND_d, xafqLlk3kkUe(SXOLrMavuUCe(b']k\x9f\x85\x86\x10w'), '\144' + chr(0b1100101) + chr(0b1001000 + 0o33) + chr(0b11101 + 0o122) + chr(5136 - 5036) + '\145')(chr(926 - 809) + chr(0b1001 + 0o153) + chr(0b1100110) + '\x2d' + chr(0b111000)): fI_kFCmE76LC} if rbX9ASHzRG83 is None else {xafqLlk3kkUe(SXOLrMavuUCe(b']i\x99\x86\xa0\x0c{\xfcy\xedr\x99\xad'), '\x64' + chr(8506 - 8405) + chr(522 - 423) + chr(0b1101111) + '\x64' + '\x65')('\165' + '\x74' + chr(7181 - 7079) + chr(45) + chr(0b111000 + 0o0)): xafqLlk3kkUe(NnQHX5fD1Zem, xafqLlk3kkUe(SXOLrMavuUCe(b'Rd\x93\x8c'), chr(0b1100100) + chr(7415 - 7314) + '\x63' + '\157' + chr(0b1100100) + '\145')('\x75' + chr(920 - 804) + chr(8978 - 8876) + chr(0b100101 + 0o10) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x00d\x92\x8e\x90\x18{\xe4t\xee-'), chr(0b1100100) + '\x65' + chr(7516 - 7417) + '\157' + chr(0b11101 + 0o107) + '\145')(chr(0b1110101) + chr(0b101111 + 0o105) + chr(102) + chr(45) + chr(56))), xafqLlk3kkUe(SXOLrMavuUCe(b'Of\x8c\x80\x8f\x1e'), '\x64' + chr(101) + chr(99) + '\x6f' + chr(8453 - 8353) + chr(0b11110 + 0o107))(chr(6644 - 6527) + chr(0b1110100) + '\146' + '\055' + chr(240 - 184)): rbX9ASHzRG83}).sgt5BU61bwZ2() if e1jVqMSBZ01Y == xafqLlk3kkUe(SXOLrMavuUCe(b'\x11'), chr(0b10100 + 0o120) + chr(101) + chr(3278 - 3179) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))('\165' + '\164' + '\x66' + '\x2d' + chr(0b111000)): xafqLlk3kkUe(zsE8htsrFxS3, xafqLlk3kkUe(SXOLrMavuUCe(b'zh\xc8\xb9\xa0_`\xfbo\xecP\xbc'), '\144' + chr(0b1100101) + chr(99) + chr(0b10 + 0o155) + chr(1882 - 1782) + '\x65')(chr(117) + chr(12219 - 12103) + chr(0b100100 + 0o102) + '\055' + '\x38'))(M8_cKLkHVB2V(FDrs8ZfAkDxp)) elif e1jVqMSBZ01Y != xafqLlk3kkUe(oqhJDdMJfuwx, xafqLlk3kkUe(SXOLrMavuUCe(b'X`\x88\x87\x8a\x06~'), '\144' + chr(0b1010001 + 0o24) + '\143' + chr(1992 - 1881) + chr(100) + chr(0b1111 + 0o126))(chr(117) + chr(116) + chr(278 - 176) + chr(0b1 + 0o54) + chr(0b111000))): xafqLlk3kkUe(FDrs8ZfAkDxp, xafqLlk3kkUe(SXOLrMavuUCe(b'Hj\xa1\x99\x96\ty\xfcy'), chr(0b1000111 + 0o35) + '\145' + chr(0b1000000 + 0o43) + '\x6f' + '\144' + chr(0b1100101))(chr(11927 - 11810) + '\x74' + chr(102) + '\055' + chr(0b111000)))(e1jVqMSBZ01Y) return FDrs8ZfAkDxp
quantopian/zipline
zipline/utils/run_algo.py
load_extensions
def load_extensions(default, extensions, strict, environ, reload=False): """Load all of the given extensions. This should be called by run_algo or the cli. Parameters ---------- default : bool Load the default exension (~/.zipline/extension.py)? extension : iterable[str] The paths to the extensions to load. If the path ends in ``.py`` it is treated as a script and executed. If it does not end in ``.py`` it is treated as a module to be imported. strict : bool Should failure to load an extension raise. If this is false it will still warn. environ : mapping The environment to use to find the default extension path. reload : bool, optional Reload any extensions that have already been loaded. """ if default: default_extension_path = pth.default_extension(environ=environ) pth.ensure_file(default_extension_path) # put the default extension first so other extensions can depend on # the order they are loaded extensions = concatv([default_extension_path], extensions) for ext in extensions: if ext in _loaded_extensions and not reload: continue try: # load all of the zipline extensionss if ext.endswith('.py'): with open(ext) as f: ns = {} six.exec_(compile(f.read(), ext, 'exec'), ns, ns) else: __import__(ext) except Exception as e: if strict: # if `strict` we should raise the actual exception and fail raise # without `strict` we should just log the failure warnings.warn( 'Failed to load extension: %r\n%s' % (ext, e), stacklevel=2 ) else: _loaded_extensions.add(ext)
python
def load_extensions(default, extensions, strict, environ, reload=False): """Load all of the given extensions. This should be called by run_algo or the cli. Parameters ---------- default : bool Load the default exension (~/.zipline/extension.py)? extension : iterable[str] The paths to the extensions to load. If the path ends in ``.py`` it is treated as a script and executed. If it does not end in ``.py`` it is treated as a module to be imported. strict : bool Should failure to load an extension raise. If this is false it will still warn. environ : mapping The environment to use to find the default extension path. reload : bool, optional Reload any extensions that have already been loaded. """ if default: default_extension_path = pth.default_extension(environ=environ) pth.ensure_file(default_extension_path) # put the default extension first so other extensions can depend on # the order they are loaded extensions = concatv([default_extension_path], extensions) for ext in extensions: if ext in _loaded_extensions and not reload: continue try: # load all of the zipline extensionss if ext.endswith('.py'): with open(ext) as f: ns = {} six.exec_(compile(f.read(), ext, 'exec'), ns, ns) else: __import__(ext) except Exception as e: if strict: # if `strict` we should raise the actual exception and fail raise # without `strict` we should just log the failure warnings.warn( 'Failed to load extension: %r\n%s' % (ext, e), stacklevel=2 ) else: _loaded_extensions.add(ext)
[ "def", "load_extensions", "(", "default", ",", "extensions", ",", "strict", ",", "environ", ",", "reload", "=", "False", ")", ":", "if", "default", ":", "default_extension_path", "=", "pth", ".", "default_extension", "(", "environ", "=", "environ", ")", "pth", ".", "ensure_file", "(", "default_extension_path", ")", "# put the default extension first so other extensions can depend on", "# the order they are loaded", "extensions", "=", "concatv", "(", "[", "default_extension_path", "]", ",", "extensions", ")", "for", "ext", "in", "extensions", ":", "if", "ext", "in", "_loaded_extensions", "and", "not", "reload", ":", "continue", "try", ":", "# load all of the zipline extensionss", "if", "ext", ".", "endswith", "(", "'.py'", ")", ":", "with", "open", "(", "ext", ")", "as", "f", ":", "ns", "=", "{", "}", "six", ".", "exec_", "(", "compile", "(", "f", ".", "read", "(", ")", ",", "ext", ",", "'exec'", ")", ",", "ns", ",", "ns", ")", "else", ":", "__import__", "(", "ext", ")", "except", "Exception", "as", "e", ":", "if", "strict", ":", "# if `strict` we should raise the actual exception and fail", "raise", "# without `strict` we should just log the failure", "warnings", ".", "warn", "(", "'Failed to load extension: %r\\n%s'", "%", "(", "ext", ",", "e", ")", ",", "stacklevel", "=", "2", ")", "else", ":", "_loaded_extensions", ".", "add", "(", "ext", ")" ]
Load all of the given extensions. This should be called by run_algo or the cli. Parameters ---------- default : bool Load the default exension (~/.zipline/extension.py)? extension : iterable[str] The paths to the extensions to load. If the path ends in ``.py`` it is treated as a script and executed. If it does not end in ``.py`` it is treated as a module to be imported. strict : bool Should failure to load an extension raise. If this is false it will still warn. environ : mapping The environment to use to find the default extension path. reload : bool, optional Reload any extensions that have already been loaded.
[ "Load", "all", "of", "the", "given", "extensions", ".", "This", "should", "be", "called", "by", "run_algo", "or", "the", "cli", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/run_algo.py#L220-L268
train
Load all of the given extensions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbc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Qr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1087 - 1032) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(5730 - 5619) + '\062' + '\x30' + '\067', 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(111) + '\063' + chr(2110 - 2059) + chr(113 - 60), 38089 - 38081), ehT0Px3KOsy9(chr(0b110000) + chr(0b110100 + 0o73) + '\x31' + chr(50) + '\x34', 10025 - 10017), ehT0Px3KOsy9(chr(473 - 425) + chr(0b1101111) + chr(0b110011) + chr(0b10000 + 0o46) + chr(55), 11669 - 11661), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1629 - 1578) + chr(0b11110 + 0o31) + chr(0b110010 + 0o0), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10010 + 0o37) + chr(55) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(49) + chr(268 - 214) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2619 - 2508) + chr(0b110010) + chr(2181 - 2126) + chr(506 - 458), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(449 - 400) + chr(1660 - 1611) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + '\062' + chr(0b101111 + 0o4) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(0b101000 + 0o15) + '\067', 49150 - 49142), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(0b101001 + 0o7) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11011 + 0o26) + chr(53) + '\066', 15830 - 15822), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110101) + chr(0b110100 + 0o3), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + '\x31' + chr(55), 12467 - 12459), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101110 + 0o3) + chr(0b10100 + 0o37) + chr(55), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(2265 - 2212) + chr(50), 0o10), ehT0Px3KOsy9(chr(118 - 70) + chr(0b1101111) + '\061' + '\x32' + chr(0b110101 + 0o1), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(12301 - 12190) + chr(2206 - 2155) + '\x32' + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + '\066' + '\066', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + chr(180 - 131) + chr(0b11010 + 0o33), 55540 - 55532), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2473 - 2423) + '\x30' + chr(2044 - 1992), 42030 - 42022), ehT0Px3KOsy9(chr(1355 - 1307) + chr(111) + '\x32' + '\061' + chr(51), 0b1000), ehT0Px3KOsy9(chr(701 - 653) + chr(111) + '\x32' + chr(0b100000 + 0o21) + chr(1112 - 1061), 8), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\x6f' + chr(0b110010) + chr(54) + '\060', 979 - 971), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110000) + '\063', 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(1999 - 1947) + chr(0b110011 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(55) + chr(0b110010), 62397 - 62389), ehT0Px3KOsy9(chr(2057 - 2009) + '\157' + chr(0b110001) + '\067' + '\061', 55050 - 55042), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\x32' + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + chr(2022 - 1972) + chr(1906 - 1851) + '\060', 8), ehT0Px3KOsy9(chr(603 - 555) + '\x6f' + chr(0b101101 + 0o4) + '\x37' + chr(941 - 888), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\064' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(209 - 155) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100 + 0o57) + '\x34' + chr(0b1101 + 0o43), 7634 - 7626), ehT0Px3KOsy9('\x30' + chr(111) + '\062' + '\x30' + chr(1554 - 1504), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b101111 + 0o7) + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\067' + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + chr(4721 - 4610) + chr(0b110010) + chr(49) + chr(0b1100 + 0o50), 42187 - 42179)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\065' + '\060', 65353 - 65345)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x14'), chr(0b1100100) + chr(0b111010 + 0o53) + chr(1524 - 1425) + chr(0b1101111) + chr(5344 - 5244) + '\145')('\x75' + chr(8418 - 8302) + chr(102) + '\055' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TuTSDgCxtKIN(t1v7afVhe01t, vYNPjcMEjAPo, twLmjCg72jpu, rNK60KZ67nXB, MPVUZkFiCQc8=ehT0Px3KOsy9('\060' + '\157' + '\x30', 0o10)): if t1v7afVhe01t: BfDGV294vMKo = pcNidiB9q0YZ.default_extension(environ=rNK60KZ67nXB) xafqLlk3kkUe(pcNidiB9q0YZ, xafqLlk3kkUe(SXOLrMavuUCe(b"_\xe9\xae!\x85\x9f#\x16\xd1'\xff"), chr(0b1100100) + chr(0b1100101) + chr(99) + '\157' + chr(100) + chr(0b101101 + 0o70))('\x75' + chr(0b100010 + 0o122) + '\146' + chr(45) + chr(2084 - 2028)))(BfDGV294vMKo) vYNPjcMEjAPo = JMsIX9NjRT3o([BfDGV294vMKo], vYNPjcMEjAPo) for gC4CNOEOq9Vm in vYNPjcMEjAPo: if gC4CNOEOq9Vm in TAAwSjnvmpCD and (not MPVUZkFiCQc8): continue try: if xafqLlk3kkUe(gC4CNOEOq9Vm, xafqLlk3kkUe(SXOLrMavuUCe(b"_\xe9\xb9'\x80\x93\x08\x18"), '\144' + chr(0b1100101) + '\143' + '\157' + chr(100) + chr(101))(chr(0b1000111 + 0o56) + chr(116) + '\x66' + chr(0b101101) + '\070'))(xafqLlk3kkUe(SXOLrMavuUCe(b'\x14\xf7\xa4'), chr(0b1100100) + chr(4415 - 4314) + chr(5159 - 5060) + '\x6f' + chr(0b111110 + 0o46) + '\x65')(chr(0b1000110 + 0o57) + chr(0b1110100) + chr(102) + chr(0b101101) + '\070')): with _fwkIVCGgtAN(gC4CNOEOq9Vm) as EGyt1xfPT1P6: P5kL4W7NFvvr = {} xafqLlk3kkUe(sYby0kpfssd4, xafqLlk3kkUe(SXOLrMavuUCe(b'_\xff\xb87\xa8'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(111) + chr(0b1100100) + '\145')(chr(0b1001111 + 0o46) + chr(0b1110100) + '\146' + '\x2d' + chr(0b111000)))(reqGiMiVQ77y(xafqLlk3kkUe(EGyt1xfPT1P6, xafqLlk3kkUe(SXOLrMavuUCe(b'o\xb1\x90=\xa0\x88\x14\x05\xfb"\xa8\xb6'), chr(0b1110 + 0o126) + '\x65' + chr(0b1010111 + 0o14) + chr(0b1101111) + '\144' + '\x65')(chr(117) + chr(0b1011111 + 0o25) + '\146' + '\x2d' + chr(0b111000)))(), gC4CNOEOq9Vm, xafqLlk3kkUe(SXOLrMavuUCe(b'_\xff\xb87'), chr(0b1100100) + chr(6342 - 6241) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(0b1010 + 0o133))(chr(0b101111 + 0o106) + '\164' + '\146' + chr(0b101000 + 0o5) + chr(1792 - 1736))), P5kL4W7NFvvr, P5kL4W7NFvvr) else: jFWsnpHpAUWz(gC4CNOEOq9Vm) except jLmadlzMdunT as GlnVAPeT6CUe: if twLmjCg72jpu: raise xafqLlk3kkUe(fJoTPf8D_opC, xafqLlk3kkUe(SXOLrMavuUCe(b'T\xc3\x98:\xb9\xb8\x1d\x12\xfe\x05\xd1\x82'), '\x64' + chr(101) + chr(0b1011011 + 0o10) + '\x6f' + chr(100) + chr(0b1100011 + 0o2))(chr(117) + '\x74' + chr(0b1100110) + '\x2d' + chr(0b101 + 0o63)))(xafqLlk3kkUe(SXOLrMavuUCe(b"|\xe6\xb48\x92\x9e\\\x04\xd7k\xf6\x80\xa2\n\x8f*'\x1e3\xb9\x05\xe4\xeb\xe5\xb1\x90\xe6Wp\\\xe6"), '\144' + chr(0b1100101) + chr(99) + chr(111) + chr(0b1100100) + '\x65')(chr(6543 - 6426) + chr(116) + chr(0b1100110) + chr(0b101101) + chr(0b110011 + 0o5)) % (gC4CNOEOq9Vm, GlnVAPeT6CUe), stacklevel=ehT0Px3KOsy9(chr(0b110000) + chr(0b111 + 0o150) + chr(1093 - 1043), 0b1000)) else: xafqLlk3kkUe(TAAwSjnvmpCD, xafqLlk3kkUe(SXOLrMavuUCe(b'O\xcd\xed%\xce\x99;E\xe2\x04\xc8\xdc'), chr(100) + chr(0b101100 + 0o71) + '\143' + chr(0b111000 + 0o67) + '\144' + chr(0b10110 + 0o117))(chr(0b1110101) + chr(0b1000101 + 0o57) + chr(0b100101 + 0o101) + chr(0b101100 + 0o1) + chr(1778 - 1722)))(gC4CNOEOq9Vm)
quantopian/zipline
zipline/utils/run_algo.py
run_algorithm
def run_algorithm(start, end, initialize, capital_base, handle_data=None, before_trading_start=None, analyze=None, data_frequency='daily', bundle='quantopian-quandl', bundle_timestamp=None, trading_calendar=None, metrics_set='default', benchmark_returns=None, default_extension=True, extensions=(), strict_extensions=True, environ=os.environ, blotter='default'): """ Run a trading algorithm. Parameters ---------- start : datetime The start date of the backtest. end : datetime The end date of the backtest.. initialize : callable[context -> None] The initialize function to use for the algorithm. This is called once at the very begining of the backtest and should be used to set up any state needed by the algorithm. capital_base : float The starting capital for the backtest. handle_data : callable[(context, BarData) -> None], optional The handle_data function to use for the algorithm. This is called every minute when ``data_frequency == 'minute'`` or every day when ``data_frequency == 'daily'``. before_trading_start : callable[(context, BarData) -> None], optional The before_trading_start function for the algorithm. This is called once before each trading day (after initialize on the first day). analyze : callable[(context, pd.DataFrame) -> None], optional The analyze function to use for the algorithm. This function is called once at the end of the backtest and is passed the context and the performance data. data_frequency : {'daily', 'minute'}, optional The data frequency to run the algorithm at. bundle : str, optional The name of the data bundle to use to load the data to run the backtest with. This defaults to 'quantopian-quandl'. bundle_timestamp : datetime, optional The datetime to lookup the bundle data for. This defaults to the current time. trading_calendar : TradingCalendar, optional The trading calendar to use for your backtest. metrics_set : iterable[Metric] or str, optional The set of metrics to compute in the simulation. If a string is passed, resolve the set with :func:`zipline.finance.metrics.load`. default_extension : bool, optional Should the default zipline extension be loaded. This is found at ``$ZIPLINE_ROOT/extension.py`` extensions : iterable[str], optional The names of any other extensions to load. Each element may either be a dotted module path like ``a.b.c`` or a path to a python file ending in ``.py`` like ``a/b/c.py``. strict_extensions : bool, optional Should the run fail if any extensions fail to load. If this is false, a warning will be raised instead. environ : mapping[str -> str], optional The os environment to use. Many extensions use this to get parameters. This defaults to ``os.environ``. blotter : str or zipline.finance.blotter.Blotter, optional Blotter to use with this algorithm. If passed as a string, we look for a blotter construction function registered with ``zipline.extensions.register`` and call it with no parameters. Default is a :class:`zipline.finance.blotter.SimulationBlotter` that never cancels orders. Returns ------- perf : pd.DataFrame The daily performance of the algorithm. See Also -------- zipline.data.bundles.bundles : The available data bundles. """ load_extensions(default_extension, extensions, strict_extensions, environ) return _run( handle_data=handle_data, initialize=initialize, before_trading_start=before_trading_start, analyze=analyze, algofile=None, algotext=None, defines=(), data_frequency=data_frequency, capital_base=capital_base, bundle=bundle, bundle_timestamp=bundle_timestamp, start=start, end=end, output=os.devnull, trading_calendar=trading_calendar, print_algo=False, metrics_set=metrics_set, local_namespace=False, environ=environ, blotter=blotter, benchmark_returns=benchmark_returns, )
python
def run_algorithm(start, end, initialize, capital_base, handle_data=None, before_trading_start=None, analyze=None, data_frequency='daily', bundle='quantopian-quandl', bundle_timestamp=None, trading_calendar=None, metrics_set='default', benchmark_returns=None, default_extension=True, extensions=(), strict_extensions=True, environ=os.environ, blotter='default'): """ Run a trading algorithm. Parameters ---------- start : datetime The start date of the backtest. end : datetime The end date of the backtest.. initialize : callable[context -> None] The initialize function to use for the algorithm. This is called once at the very begining of the backtest and should be used to set up any state needed by the algorithm. capital_base : float The starting capital for the backtest. handle_data : callable[(context, BarData) -> None], optional The handle_data function to use for the algorithm. This is called every minute when ``data_frequency == 'minute'`` or every day when ``data_frequency == 'daily'``. before_trading_start : callable[(context, BarData) -> None], optional The before_trading_start function for the algorithm. This is called once before each trading day (after initialize on the first day). analyze : callable[(context, pd.DataFrame) -> None], optional The analyze function to use for the algorithm. This function is called once at the end of the backtest and is passed the context and the performance data. data_frequency : {'daily', 'minute'}, optional The data frequency to run the algorithm at. bundle : str, optional The name of the data bundle to use to load the data to run the backtest with. This defaults to 'quantopian-quandl'. bundle_timestamp : datetime, optional The datetime to lookup the bundle data for. This defaults to the current time. trading_calendar : TradingCalendar, optional The trading calendar to use for your backtest. metrics_set : iterable[Metric] or str, optional The set of metrics to compute in the simulation. If a string is passed, resolve the set with :func:`zipline.finance.metrics.load`. default_extension : bool, optional Should the default zipline extension be loaded. This is found at ``$ZIPLINE_ROOT/extension.py`` extensions : iterable[str], optional The names of any other extensions to load. Each element may either be a dotted module path like ``a.b.c`` or a path to a python file ending in ``.py`` like ``a/b/c.py``. strict_extensions : bool, optional Should the run fail if any extensions fail to load. If this is false, a warning will be raised instead. environ : mapping[str -> str], optional The os environment to use. Many extensions use this to get parameters. This defaults to ``os.environ``. blotter : str or zipline.finance.blotter.Blotter, optional Blotter to use with this algorithm. If passed as a string, we look for a blotter construction function registered with ``zipline.extensions.register`` and call it with no parameters. Default is a :class:`zipline.finance.blotter.SimulationBlotter` that never cancels orders. Returns ------- perf : pd.DataFrame The daily performance of the algorithm. See Also -------- zipline.data.bundles.bundles : The available data bundles. """ load_extensions(default_extension, extensions, strict_extensions, environ) return _run( handle_data=handle_data, initialize=initialize, before_trading_start=before_trading_start, analyze=analyze, algofile=None, algotext=None, defines=(), data_frequency=data_frequency, capital_base=capital_base, bundle=bundle, bundle_timestamp=bundle_timestamp, start=start, end=end, output=os.devnull, trading_calendar=trading_calendar, print_algo=False, metrics_set=metrics_set, local_namespace=False, environ=environ, blotter=blotter, benchmark_returns=benchmark_returns, )
[ "def", "run_algorithm", "(", "start", ",", "end", ",", "initialize", ",", "capital_base", ",", "handle_data", "=", "None", ",", "before_trading_start", "=", "None", ",", "analyze", "=", "None", ",", "data_frequency", "=", "'daily'", ",", "bundle", "=", "'quantopian-quandl'", ",", "bundle_timestamp", "=", "None", ",", "trading_calendar", "=", "None", ",", "metrics_set", "=", "'default'", ",", "benchmark_returns", "=", "None", ",", "default_extension", "=", "True", ",", "extensions", "=", "(", ")", ",", "strict_extensions", "=", "True", ",", "environ", "=", "os", ".", "environ", ",", "blotter", "=", "'default'", ")", ":", "load_extensions", "(", "default_extension", ",", "extensions", ",", "strict_extensions", ",", "environ", ")", "return", "_run", "(", "handle_data", "=", "handle_data", ",", "initialize", "=", "initialize", ",", "before_trading_start", "=", "before_trading_start", ",", "analyze", "=", "analyze", ",", "algofile", "=", "None", ",", "algotext", "=", "None", ",", "defines", "=", "(", ")", ",", "data_frequency", "=", "data_frequency", ",", "capital_base", "=", "capital_base", ",", "bundle", "=", "bundle", ",", "bundle_timestamp", "=", "bundle_timestamp", ",", "start", "=", "start", ",", "end", "=", "end", ",", "output", "=", "os", ".", "devnull", ",", "trading_calendar", "=", "trading_calendar", ",", "print_algo", "=", "False", ",", "metrics_set", "=", "metrics_set", ",", "local_namespace", "=", "False", ",", "environ", "=", "environ", ",", "blotter", "=", "blotter", ",", "benchmark_returns", "=", "benchmark_returns", ",", ")" ]
Run a trading algorithm. Parameters ---------- start : datetime The start date of the backtest. end : datetime The end date of the backtest.. initialize : callable[context -> None] The initialize function to use for the algorithm. This is called once at the very begining of the backtest and should be used to set up any state needed by the algorithm. capital_base : float The starting capital for the backtest. handle_data : callable[(context, BarData) -> None], optional The handle_data function to use for the algorithm. This is called every minute when ``data_frequency == 'minute'`` or every day when ``data_frequency == 'daily'``. before_trading_start : callable[(context, BarData) -> None], optional The before_trading_start function for the algorithm. This is called once before each trading day (after initialize on the first day). analyze : callable[(context, pd.DataFrame) -> None], optional The analyze function to use for the algorithm. This function is called once at the end of the backtest and is passed the context and the performance data. data_frequency : {'daily', 'minute'}, optional The data frequency to run the algorithm at. bundle : str, optional The name of the data bundle to use to load the data to run the backtest with. This defaults to 'quantopian-quandl'. bundle_timestamp : datetime, optional The datetime to lookup the bundle data for. This defaults to the current time. trading_calendar : TradingCalendar, optional The trading calendar to use for your backtest. metrics_set : iterable[Metric] or str, optional The set of metrics to compute in the simulation. If a string is passed, resolve the set with :func:`zipline.finance.metrics.load`. default_extension : bool, optional Should the default zipline extension be loaded. This is found at ``$ZIPLINE_ROOT/extension.py`` extensions : iterable[str], optional The names of any other extensions to load. Each element may either be a dotted module path like ``a.b.c`` or a path to a python file ending in ``.py`` like ``a/b/c.py``. strict_extensions : bool, optional Should the run fail if any extensions fail to load. If this is false, a warning will be raised instead. environ : mapping[str -> str], optional The os environment to use. Many extensions use this to get parameters. This defaults to ``os.environ``. blotter : str or zipline.finance.blotter.Blotter, optional Blotter to use with this algorithm. If passed as a string, we look for a blotter construction function registered with ``zipline.extensions.register`` and call it with no parameters. Default is a :class:`zipline.finance.blotter.SimulationBlotter` that never cancels orders. Returns ------- perf : pd.DataFrame The daily performance of the algorithm. See Also -------- zipline.data.bundles.bundles : The available data bundles.
[ "Run", "a", "trading", "algorithm", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/run_algo.py#L271-L381
train
This function runs a trading algorithm at the given dates.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikz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IaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100001 + 0o22) + chr(0b101010 + 0o14) + '\067', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10011 + 0o134) + chr(0b10001 + 0o40) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + '\063' + chr(0b110011) + chr(675 - 623), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\062' + chr(2403 - 2351) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11287 - 11176) + '\x33' + '\067' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\x30' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(923 - 875) + '\157' + chr(69 - 19) + '\060' + '\061', 12091 - 12083), ehT0Px3KOsy9(chr(281 - 233) + chr(111) + chr(1422 - 1371) + chr(55) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(4229 - 4118) + chr(0b100001 + 0o21) + chr(0b100110 + 0o13) + chr(0b101010 + 0o12), 0b1000), ehT0Px3KOsy9(chr(1858 - 1810) + chr(111) + chr(0b101101 + 0o6) + chr(0b110111) + '\060', 8), ehT0Px3KOsy9(chr(1719 - 1671) + chr(1540 - 1429) + chr(0b101101 + 0o5) + chr(423 - 371), ord("\x08")), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(11527 - 11416) + '\063' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(634 - 586) + '\157' + chr(49) + chr(726 - 672), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001001 + 0o46) + chr(0b110010 + 0o0) + chr(0b110001) + '\063', 0o10), ehT0Px3KOsy9(chr(249 - 201) + chr(5525 - 5414) + '\x33' + '\x36', 51683 - 51675), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + chr(0b101001 + 0o12) + chr(54), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(53) + chr(0b100100 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1000111 + 0o50) + chr(0b10 + 0o61) + chr(0b10000 + 0o46) + chr(48), 32440 - 32432), ehT0Px3KOsy9(chr(48) + chr(111) + chr(53) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + '\x30' + chr(471 - 417), 38146 - 38138), ehT0Px3KOsy9(chr(970 - 922) + chr(0b1001 + 0o146) + chr(0b110001) + chr(0b110111) + chr(0b101111 + 0o5), 0b1000), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101000 + 0o7) + chr(0b101010 + 0o7) + chr(1277 - 1227) + '\061', 0b1000), ehT0Px3KOsy9(chr(1676 - 1628) + chr(0b1000110 + 0o51) + '\061' + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(11737 - 11626) + chr(0b110011) + chr(0b0 + 0o65) + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + '\x33' + '\x34', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(0b110100) + chr(0b10100 + 0o37), 1972 - 1964), ehT0Px3KOsy9(chr(1332 - 1284) + chr(0b1000100 + 0o53) + chr(0b101110 + 0o3) + '\061' + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(1067 - 956) + chr(0b1111 + 0o43) + chr(0b11 + 0o57), 60503 - 60495), ehT0Px3KOsy9(chr(987 - 939) + chr(0b110000 + 0o77) + '\x33' + chr(0b100100 + 0o23) + chr(0b110011), 32208 - 32200), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(52), 0o10), ehT0Px3KOsy9(chr(1022 - 974) + chr(0b1101111) + chr(0b110011) + '\067' + '\060', 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + chr(0b110101) + chr(54), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(49) + chr(0b110110), 40273 - 40265), ehT0Px3KOsy9(chr(48) + chr(7072 - 6961) + '\x32' + '\x35' + '\063', 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\x32' + chr(0b110001) + chr(0b110101), 44736 - 44728), ehT0Px3KOsy9('\060' + chr(111) + '\x33' + chr(0b1111 + 0o41) + '\x32', 49599 - 49591), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110100) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(7427 - 7316) + chr(0b110001) + chr(0b100111 + 0o17) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(1897 - 1842) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(1023 - 975) + chr(0b1110 + 0o47), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(0b110000), 54428 - 54420)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9'), chr(5635 - 5535) + chr(2356 - 2255) + chr(0b1100011) + chr(0b111010 + 0o65) + '\144' + chr(7273 - 7172))(chr(117) + chr(0b101100 + 0o110) + chr(0b101111 + 0o67) + '\x2d' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def B4uIs1QwnOgb(avRbFsnfJxQj, whWDZq5_lP01, MuiHFrkYeUQ4, kbRhDi9e7qqO, PlnZOTvWE7g0=None, Gs6DaNzmND_d=None, fI_kFCmE76LC=None, bXS4MokNqKbm=xafqLlk3kkUe(SXOLrMavuUCe(b'\x93m\xb5\xcf\x81'), '\144' + chr(0b111 + 0o136) + chr(0b111101 + 0o46) + chr(111) + chr(100) + chr(0b1100101))('\165' + '\x74' + chr(10191 - 10089) + chr(45) + chr(0b111000)), BdOvlW9oyNT1=xafqLlk3kkUe(SXOLrMavuUCe(b'\x86y\xbd\xcd\x8c*\xf1\x97\xed\x969k{\xeapz\x80'), '\x64' + '\145' + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(0b1100001 + 0o4))('\x75' + chr(0b1110100) + '\x66' + chr(662 - 617) + chr(0b111000)), PgtClxoRs7TB=None, GUE1BY_7JDnn=None, UqUxZ3isRi_J=xafqLlk3kkUe(SXOLrMavuUCe(b'\x93i\xba\xc2\x8d)\xf5'), '\x64' + '\x65' + chr(99) + chr(0b1000111 + 0o50) + '\144' + chr(0b11011 + 0o112))(chr(11378 - 11261) + '\164' + chr(102) + chr(343 - 298) + '\070'), ie_gijH_06GP=None, NhaS4Fk8zOE0=ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101011 + 0o6), ord("\x08")), vYNPjcMEjAPo=(), ubHGDWPyHO0w=ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001), 8), rNK60KZ67nXB=xafqLlk3kkUe(oqhJDdMJfuwx, xafqLlk3kkUe(SXOLrMavuUCe(b'\x85B\x97\x95\xc8\x0e\xdb\xc8\xbb\x96LX'), chr(0b1100100) + chr(0b1100101) + chr(0b100001 + 0o102) + chr(0b1101111) + chr(100) + '\145')(chr(0b1110101) + '\x74' + '\x66' + chr(45) + '\x38')), WcJlIx2C2pWn=xafqLlk3kkUe(SXOLrMavuUCe(b'\x93i\xba\xc2\x8d)\xf5'), chr(4770 - 4670) + chr(101) + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1100101))(chr(11320 - 11203) + chr(116) + chr(102) + '\x2d' + chr(0b111000))): TuTSDgCxtKIN(NhaS4Fk8zOE0, vYNPjcMEjAPo, ubHGDWPyHO0w, rNK60KZ67nXB) return xnaCGCEHQH3F(handle_data=PlnZOTvWE7g0, initialize=MuiHFrkYeUQ4, before_trading_start=Gs6DaNzmND_d, analyze=fI_kFCmE76LC, algofile=None, algotext=None, defines=(), data_frequency=bXS4MokNqKbm, capital_base=kbRhDi9e7qqO, bundle=BdOvlW9oyNT1, bundle_timestamp=PgtClxoRs7TB, start=avRbFsnfJxQj, end=whWDZq5_lP01, output=xafqLlk3kkUe(oqhJDdMJfuwx, xafqLlk3kkUe(SXOLrMavuUCe(b'\x93i\xaa\xcd\x8d)\xed'), chr(3867 - 3767) + chr(0b1100101) + chr(99) + '\x6f' + '\144' + '\x65')(chr(117) + chr(0b1001010 + 0o52) + chr(0b1100101 + 0o1) + '\055' + chr(0b111000))), trading_calendar=GUE1BY_7JDnn, print_algo=ehT0Px3KOsy9('\060' + chr(0b11001 + 0o126) + chr(0b11110 + 0o22), 0o10), metrics_set=UqUxZ3isRi_J, local_namespace=ehT0Px3KOsy9('\x30' + chr(111) + chr(609 - 561), 8), environ=rNK60KZ67nXB, blotter=WcJlIx2C2pWn, benchmark_returns=ie_gijH_06GP)
quantopian/zipline
zipline/data/data_portal.py
DataPortal.handle_extra_source
def handle_extra_source(self, source_df, sim_params): """ Extra sources always have a sid column. We expand the given data (by forward filling) to the full range of the simulation dates, so that lookup is fast during simulation. """ if source_df is None: return # Normalize all the dates in the df source_df.index = source_df.index.normalize() # source_df's sid column can either consist of assets we know about # (such as sid(24)) or of assets we don't know about (such as # palladium). # # In both cases, we break up the dataframe into individual dfs # that only contain a single asset's information. ie, if source_df # has data for PALLADIUM and GOLD, we split source_df into two # dataframes, one for each. (same applies if source_df has data for # AAPL and IBM). # # We then take each child df and reindex it to the simulation's date # range by forward-filling missing values. this makes reads simpler. # # Finally, we store the data. For each column, we store a mapping in # self.augmented_sources_map from the column to a dictionary of # asset -> df. In other words, # self.augmented_sources_map['days_to_cover']['AAPL'] gives us the df # holding that data. source_date_index = self.trading_calendar.sessions_in_range( sim_params.start_session, sim_params.end_session ) # Break the source_df up into one dataframe per sid. This lets # us (more easily) calculate accurate start/end dates for each sid, # de-dup data, and expand the data to fit the backtest start/end date. grouped_by_sid = source_df.groupby(["sid"]) group_names = grouped_by_sid.groups.keys() group_dict = {} for group_name in group_names: group_dict[group_name] = grouped_by_sid.get_group(group_name) # This will be the dataframe which we query to get fetcher assets at # any given time. Get's overwritten every time there's a new fetcher # call extra_source_df = pd.DataFrame() for identifier, df in iteritems(group_dict): # Since we know this df only contains a single sid, we can safely # de-dupe by the index (dt). If minute granularity, will take the # last data point on any given day df = df.groupby(level=0).last() # Reindex the dataframe based on the backtest start/end date. # This makes reads easier during the backtest. df = self._reindex_extra_source(df, source_date_index) for col_name in df.columns.difference(['sid']): if col_name not in self._augmented_sources_map: self._augmented_sources_map[col_name] = {} self._augmented_sources_map[col_name][identifier] = df # Append to extra_source_df the reindexed dataframe for the single # sid extra_source_df = extra_source_df.append(df) self._extra_source_df = extra_source_df
python
def handle_extra_source(self, source_df, sim_params): """ Extra sources always have a sid column. We expand the given data (by forward filling) to the full range of the simulation dates, so that lookup is fast during simulation. """ if source_df is None: return # Normalize all the dates in the df source_df.index = source_df.index.normalize() # source_df's sid column can either consist of assets we know about # (such as sid(24)) or of assets we don't know about (such as # palladium). # # In both cases, we break up the dataframe into individual dfs # that only contain a single asset's information. ie, if source_df # has data for PALLADIUM and GOLD, we split source_df into two # dataframes, one for each. (same applies if source_df has data for # AAPL and IBM). # # We then take each child df and reindex it to the simulation's date # range by forward-filling missing values. this makes reads simpler. # # Finally, we store the data. For each column, we store a mapping in # self.augmented_sources_map from the column to a dictionary of # asset -> df. In other words, # self.augmented_sources_map['days_to_cover']['AAPL'] gives us the df # holding that data. source_date_index = self.trading_calendar.sessions_in_range( sim_params.start_session, sim_params.end_session ) # Break the source_df up into one dataframe per sid. This lets # us (more easily) calculate accurate start/end dates for each sid, # de-dup data, and expand the data to fit the backtest start/end date. grouped_by_sid = source_df.groupby(["sid"]) group_names = grouped_by_sid.groups.keys() group_dict = {} for group_name in group_names: group_dict[group_name] = grouped_by_sid.get_group(group_name) # This will be the dataframe which we query to get fetcher assets at # any given time. Get's overwritten every time there's a new fetcher # call extra_source_df = pd.DataFrame() for identifier, df in iteritems(group_dict): # Since we know this df only contains a single sid, we can safely # de-dupe by the index (dt). If minute granularity, will take the # last data point on any given day df = df.groupby(level=0).last() # Reindex the dataframe based on the backtest start/end date. # This makes reads easier during the backtest. df = self._reindex_extra_source(df, source_date_index) for col_name in df.columns.difference(['sid']): if col_name not in self._augmented_sources_map: self._augmented_sources_map[col_name] = {} self._augmented_sources_map[col_name][identifier] = df # Append to extra_source_df the reindexed dataframe for the single # sid extra_source_df = extra_source_df.append(df) self._extra_source_df = extra_source_df
[ "def", "handle_extra_source", "(", "self", ",", "source_df", ",", "sim_params", ")", ":", "if", "source_df", "is", "None", ":", "return", "# Normalize all the dates in the df", "source_df", ".", "index", "=", "source_df", ".", "index", ".", "normalize", "(", ")", "# source_df's sid column can either consist of assets we know about", "# (such as sid(24)) or of assets we don't know about (such as", "# palladium).", "#", "# In both cases, we break up the dataframe into individual dfs", "# that only contain a single asset's information. ie, if source_df", "# has data for PALLADIUM and GOLD, we split source_df into two", "# dataframes, one for each. (same applies if source_df has data for", "# AAPL and IBM).", "#", "# We then take each child df and reindex it to the simulation's date", "# range by forward-filling missing values. this makes reads simpler.", "#", "# Finally, we store the data. For each column, we store a mapping in", "# self.augmented_sources_map from the column to a dictionary of", "# asset -> df. In other words,", "# self.augmented_sources_map['days_to_cover']['AAPL'] gives us the df", "# holding that data.", "source_date_index", "=", "self", ".", "trading_calendar", ".", "sessions_in_range", "(", "sim_params", ".", "start_session", ",", "sim_params", ".", "end_session", ")", "# Break the source_df up into one dataframe per sid. This lets", "# us (more easily) calculate accurate start/end dates for each sid,", "# de-dup data, and expand the data to fit the backtest start/end date.", "grouped_by_sid", "=", "source_df", ".", "groupby", "(", "[", "\"sid\"", "]", ")", "group_names", "=", "grouped_by_sid", ".", "groups", ".", "keys", "(", ")", "group_dict", "=", "{", "}", "for", "group_name", "in", "group_names", ":", "group_dict", "[", "group_name", "]", "=", "grouped_by_sid", ".", "get_group", "(", "group_name", ")", "# This will be the dataframe which we query to get fetcher assets at", "# any given time. Get's overwritten every time there's a new fetcher", "# call", "extra_source_df", "=", "pd", ".", "DataFrame", "(", ")", "for", "identifier", ",", "df", "in", "iteritems", "(", "group_dict", ")", ":", "# Since we know this df only contains a single sid, we can safely", "# de-dupe by the index (dt). If minute granularity, will take the", "# last data point on any given day", "df", "=", "df", ".", "groupby", "(", "level", "=", "0", ")", ".", "last", "(", ")", "# Reindex the dataframe based on the backtest start/end date.", "# This makes reads easier during the backtest.", "df", "=", "self", ".", "_reindex_extra_source", "(", "df", ",", "source_date_index", ")", "for", "col_name", "in", "df", ".", "columns", ".", "difference", "(", "[", "'sid'", "]", ")", ":", "if", "col_name", "not", "in", "self", ".", "_augmented_sources_map", ":", "self", ".", "_augmented_sources_map", "[", "col_name", "]", "=", "{", "}", "self", ".", "_augmented_sources_map", "[", "col_name", "]", "[", "identifier", "]", "=", "df", "# Append to extra_source_df the reindexed dataframe for the single", "# sid", "extra_source_df", "=", "extra_source_df", ".", "append", "(", "df", ")", "self", ".", "_extra_source_df", "=", "extra_source_df" ]
Extra sources always have a sid column. We expand the given data (by forward filling) to the full range of the simulation dates, so that lookup is fast during simulation.
[ "Extra", "sources", "always", "have", "a", "sid", "column", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L324-L394
train
This function handles extra sources that are not in the same simulation as the original data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB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cessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110000 + 0o1) + chr(0b110000) + '\067', 22261 - 22253), ehT0Px3KOsy9(chr(2178 - 2130) + chr(0b1010001 + 0o36) + chr(50) + '\067' + '\060', 13813 - 13805), ehT0Px3KOsy9(chr(0b110000) + chr(0b100110 + 0o111) + chr(0b110101) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b1000 + 0o51) + chr(1680 - 1629) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(0b101101 + 0o5) + chr(57 - 9) + chr(0b10110 + 0o37), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b100 + 0o62) + chr(1639 - 1591), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110011) + chr(724 - 673) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\x6f' + chr(0b110110) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b10011 + 0o134) + '\064' + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + '\065' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(49) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101010 + 0o105) + chr(49) + chr(1583 - 1528) + chr(247 - 194), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(2009 - 1960) + '\x36' + chr(2290 - 2241), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(10618 - 10507) + chr(908 - 858), 7914 - 7906), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101010 + 0o13) + '\065', 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(140 - 91) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + '\x34' + '\063', 13159 - 13151), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110111) + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(49) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(1813 - 1702) + chr(0b110001) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2600 - 2489) + chr(54) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(7440 - 7329) + '\064' + chr(49), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + '\x31' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + '\x33' + chr(0b110001) + chr(0b100010 + 0o17), 0b1000), ehT0Px3KOsy9(chr(414 - 366) + '\157' + chr(2219 - 2166) + chr(933 - 885), 0o10), ehT0Px3KOsy9('\060' + chr(2427 - 2316) + chr(0b11 + 0o61) + '\x36', 51132 - 51124), ehT0Px3KOsy9(chr(1432 - 1384) + chr(0b1000111 + 0o50) + '\063' + chr(0b110001) + chr(0b10000 + 0o44), 0b1000), ehT0Px3KOsy9(chr(516 - 468) + chr(111) + chr(53) + '\063', ord("\x08")), ehT0Px3KOsy9('\060' + chr(3784 - 3673) + chr(0b101101 + 0o6) + chr(49) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x33' + '\066' + '\061', 0b1000), ehT0Px3KOsy9(chr(1454 - 1406) + chr(0b1101111) + chr(0b110011) + chr(0b110111) + chr(2252 - 2197), 5388 - 5380), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b10011 + 0o41) + '\066', 8), ehT0Px3KOsy9(chr(1358 - 1310) + chr(111) + chr(130 - 81) + '\064' + '\065', 9059 - 9051), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b1100 + 0o47), 16840 - 16832), ehT0Px3KOsy9('\060' + '\157' + chr(2324 - 2273) + chr(0b110010) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(53) + chr(0b1110 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1426 - 1377) + '\060' + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + '\x34' + chr(0b110010 + 0o1), 56790 - 56782), ehT0Px3KOsy9(chr(2174 - 2126) + '\157' + chr(51) + chr(0b0 + 0o62), 0o10), ehT0Px3KOsy9(chr(982 - 934) + '\x6f' + '\x31' + chr(1520 - 1470) + chr(2222 - 2171), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(718 - 665) + chr(0b110000), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'i'), chr(0b101111 + 0o65) + chr(0b1001001 + 0o34) + '\143' + chr(0b1101111) + '\x64' + chr(101))('\x75' + chr(0b1100011 + 0o21) + chr(102) + chr(0b100110 + 0o7) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def d6pzPUPpnS8I(oVre8I6UXc3b, iuQpo2LpMAEe, TydLOnIvfjrJ): if iuQpo2LpMAEe is None: return iuQpo2LpMAEe.XdowRbJKZWL9 = iuQpo2LpMAEe.index.IOBK62gJSlOh() rTshwZ7NpmfX = oVre8I6UXc3b.trading_calendar.sessions_in_range(TydLOnIvfjrJ.start_session, TydLOnIvfjrJ.qRfpaQSMkwXK) AkrVJX1ldwVG = iuQpo2LpMAEe.MRtOn47tdSTy([xafqLlk3kkUe(SXOLrMavuUCe(b'4\xd1M'), '\144' + '\145' + chr(8520 - 8421) + chr(0b1101111) + '\x64' + chr(0b110010 + 0o63))(chr(117) + chr(0b101101 + 0o107) + chr(0b1100110) + chr(914 - 869) + chr(0b111000))]) t0ldFBMG5o38 = AkrVJX1ldwVG.groups.keys() JA7HuIAh0okr = {} for HEe7CuRW2vqF in t0ldFBMG5o38: JA7HuIAh0okr[HEe7CuRW2vqF] = AkrVJX1ldwVG.get_group(HEe7CuRW2vqF) nVz6WGZ9iwVy = dubtF9GfzOdC.DataFrame() for (IndhTE9HSpWS, aVhM9WzaWXU5) in WYXqUHkBa2Bx(JA7HuIAh0okr): aVhM9WzaWXU5 = aVhM9WzaWXU5.groupby(level=ehT0Px3KOsy9(chr(263 - 215) + chr(0b1101111) + '\x30', 47350 - 47342)).Z6Ub1MQPX1kA() aVhM9WzaWXU5 = oVre8I6UXc3b._reindex_extra_source(aVhM9WzaWXU5, rTshwZ7NpmfX) for W93rymQCbozJ in xafqLlk3kkUe(aVhM9WzaWXU5.columns, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xd1O:\xe0\xc2\xbeXGH'), chr(9435 - 9335) + chr(8172 - 8071) + chr(0b1100011) + chr(0b111101 + 0o62) + chr(0b1100100) + chr(8655 - 8554))(chr(5715 - 5598) + chr(0b111 + 0o155) + chr(6425 - 6323) + '\055' + chr(0b10111 + 0o41)))([xafqLlk3kkUe(SXOLrMavuUCe(b'4\xd1M'), chr(100) + chr(0b10000 + 0o125) + '\143' + '\157' + chr(0b1000100 + 0o40) + '\145')('\x75' + '\x74' + '\x66' + '\x2d' + '\x38')]): if W93rymQCbozJ not in xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x18\xd9\\;\xe8\xd5\xb5BAI\x12\x0e\x1ew_)\x86HUfSQ'), chr(975 - 875) + chr(0b1100101) + chr(99) + '\x6f' + chr(0b10010 + 0o122) + '\145')(chr(0b110001 + 0o104) + chr(0b1110100) + '\146' + chr(0b10001 + 0o34) + '\x38')): oVre8I6UXc3b.A3WNfLcyzkQz[W93rymQCbozJ] = {} oVre8I6UXc3b.A3WNfLcyzkQz[W93rymQCbozJ][IndhTE9HSpWS] = aVhM9WzaWXU5 nVz6WGZ9iwVy = nVz6WGZ9iwVy.append(aVhM9WzaWXU5) oVre8I6UXc3b.S64CHfK1F6nj = nVz6WGZ9iwVy
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_last_traded_dt
def get_last_traded_dt(self, asset, dt, data_frequency): """ Given an asset and dt, returns the last traded dt from the viewpoint of the given dt. If there is a trade on the dt, the answer is dt provided. """ return self._get_pricing_reader(data_frequency).get_last_traded_dt( asset, dt)
python
def get_last_traded_dt(self, asset, dt, data_frequency): """ Given an asset and dt, returns the last traded dt from the viewpoint of the given dt. If there is a trade on the dt, the answer is dt provided. """ return self._get_pricing_reader(data_frequency).get_last_traded_dt( asset, dt)
[ "def", "get_last_traded_dt", "(", "self", ",", "asset", ",", "dt", ",", "data_frequency", ")", ":", "return", "self", ".", "_get_pricing_reader", "(", "data_frequency", ")", ".", "get_last_traded_dt", "(", "asset", ",", "dt", ")" ]
Given an asset and dt, returns the last traded dt from the viewpoint of the given dt. If there is a trade on the dt, the answer is dt provided.
[ "Given", "an", "asset", "and", "dt", "returns", "the", "last", "traded", "dt", "from", "the", "viewpoint", "of", "the", "given", "dt", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L399-L407
train
Returns the last traded dt for the given asset and dt.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,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,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10001 + 0o46) + chr(1652 - 1603), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(52) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(111) + chr(0b110111) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + chr(265 - 216) + chr(49) + '\060', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\067' + chr(49), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\063' + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\066' + '\x31', 0b1000), ehT0Px3KOsy9(chr(808 - 760) + chr(0b1101111) + chr(49) + '\x30' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(951 - 900) + '\061' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + '\x31' + chr(49) + chr(0b100 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100101 + 0o14) + chr(0b100000 + 0o22) + chr(1374 - 1319), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(5892 - 5781) + chr(0b110010) + chr(53) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100001 + 0o22) + '\x32' + chr(0b100000 + 0o21), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\x32' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(0b1000110 + 0o51) + chr(50) + chr(0b11011 + 0o25) + chr(0b100010 + 0o25), 0o10), ehT0Px3KOsy9(chr(878 - 830) + chr(0b1101111) + '\061' + chr(53) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(6375 - 6264) + '\x33' + '\x35' + '\x37', 43719 - 43711), ehT0Px3KOsy9(chr(48) + '\157' + chr(1051 - 1002) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(49) + '\066' + chr(49), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001) + '\061' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1010011 + 0o34) + chr(0b101010 + 0o10) + chr(468 - 414), 36807 - 36799), ehT0Px3KOsy9('\060' + chr(111) + chr(1730 - 1681) + chr(1578 - 1527) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b11010 + 0o27) + '\061' + '\060', 8), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b10100 + 0o34) + chr(2091 - 2037), 349 - 341), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + '\x31' + '\066' + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(1705 - 1657) + chr(9498 - 9387) + '\062' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1530 - 1482) + '\x6f' + chr(0b110001) + chr(52) + chr(0b110001), 6888 - 6880), ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + '\062' + '\x34' + chr(1058 - 1003), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x31' + chr(0b110110), 8), ehT0Px3KOsy9(chr(0b110000) + chr(6595 - 6484) + chr(0b110001) + chr(0b100 + 0o54) + chr(2221 - 2166), 8), ehT0Px3KOsy9(chr(48) + chr(0b10000 + 0o137) + '\x31' + '\062', 30146 - 30138), ehT0Px3KOsy9('\060' + '\x6f' + chr(1798 - 1749) + chr(963 - 910) + '\065', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\064' + chr(0b100011 + 0o16), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b1100 + 0o44) + chr(0b10111 + 0o32), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + '\x36' + chr(48), 44846 - 44838), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b10101 + 0o36) + chr(53) + chr(0b110111), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(0b11011 + 0o26) + '\x32' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(189 - 140) + chr(0b11111 + 0o23) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\x6f' + chr(51) + chr(0b111 + 0o52) + chr(50), 4989 - 4981)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + chr(53) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x17'), chr(0b1100100) + chr(9694 - 9593) + chr(99) + chr(111) + '\144' + chr(101))(chr(117) + chr(0b101011 + 0o111) + '\146' + chr(464 - 419) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def BL1jC1O5zgHB(oVre8I6UXc3b, tKJAwKiE1Zya, OmU3Un949MWT, bXS4MokNqKbm): return xafqLlk3kkUe(oVre8I6UXc3b._get_pricing_reader(bXS4MokNqKbm), xafqLlk3kkUe(SXOLrMavuUCe(b'^b\x13b$X\xe8\x05\x18\xba<6\xc8\xb4\xb2\xd8\n\x9b'), '\x64' + chr(0b1001100 + 0o31) + chr(1687 - 1588) + '\157' + '\x64' + chr(0b1100101))('\165' + chr(8751 - 8635) + '\x66' + chr(45) + chr(56)))(tKJAwKiE1Zya, OmU3Un949MWT)
quantopian/zipline
zipline/data/data_portal.py
DataPortal._is_extra_source
def _is_extra_source(asset, field, map): """ Internal method that determines if this asset/field combination represents a fetcher value or a regular OHLCVP lookup. """ # If we have an extra source with a column called "price", only look # at it if it's on something like palladium and not AAPL (since our # own price data always wins when dealing with assets). return not (field in BASE_FIELDS and (isinstance(asset, (Asset, ContinuousFuture))))
python
def _is_extra_source(asset, field, map): """ Internal method that determines if this asset/field combination represents a fetcher value or a regular OHLCVP lookup. """ # If we have an extra source with a column called "price", only look # at it if it's on something like palladium and not AAPL (since our # own price data always wins when dealing with assets). return not (field in BASE_FIELDS and (isinstance(asset, (Asset, ContinuousFuture))))
[ "def", "_is_extra_source", "(", "asset", ",", "field", ",", "map", ")", ":", "# If we have an extra source with a column called \"price\", only look", "# at it if it's on something like palladium and not AAPL (since our", "# own price data always wins when dealing with assets).", "return", "not", "(", "field", "in", "BASE_FIELDS", "and", "(", "isinstance", "(", "asset", ",", "(", "Asset", ",", "ContinuousFuture", ")", ")", ")", ")" ]
Internal method that determines if this asset/field combination represents a fetcher value or a regular OHLCVP lookup.
[ "Internal", "method", "that", "determines", "if", "this", "asset", "/", "field", "combination", "represents", "a", "fetcher", "value", "or", "a", "regular", "OHLCVP", "lookup", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L410-L420
train
Internal method that determines if this asset or field combination is an extra source.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,LgE_IO_tHXvM,Kk1hd194VKEC,OZYzwAeSQh7N,jFWsnpHpAUWz,RwRZi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7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1010101 + 0o32) + chr(1462 - 1413) + chr(0b110100) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b100001 + 0o22) + chr(48) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1880 - 1832) + chr(111) + '\061' + chr(0b110001) + chr(0b11111 + 0o23), ord("\x08")), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(0b1010110 + 0o31) + '\x35' + chr(0b100101 + 0o20), 0o10), ehT0Px3KOsy9(chr(561 - 513) + chr(111) + '\x33' + chr(140 - 86), 61266 - 61258), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(422 - 373) + '\060' + chr(1849 - 1798), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b110101) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1010000 + 0o37) + '\064' + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(0b110010), 45056 - 45048), ehT0Px3KOsy9(chr(48) + chr(0b11110 + 0o121) + chr(50) + chr(0b111 + 0o53) + chr(0b110000 + 0o0), ord("\x08")), ehT0Px3KOsy9(chr(1415 - 1367) + '\157' + chr(388 - 337) + chr(0b110111) + chr(1003 - 954), 57484 - 57476), ehT0Px3KOsy9(chr(567 - 519) + chr(111) + chr(0b1111 + 0o41), 20053 - 20045), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b100011 + 0o114) + '\x32' + chr(0b110111) + chr(0b110011 + 0o3), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b11 + 0o154) + chr(51) + chr(0b11000 + 0o34) + chr(55), 0o10), ehT0Px3KOsy9(chr(1394 - 1346) + '\157' + chr(49) + '\x30' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11101 + 0o25) + chr(764 - 713) + chr(0b11 + 0o63), 50343 - 50335), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + '\065' + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(54) + chr(978 - 926), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b101111 + 0o100) + chr(1054 - 1004) + chr(0b110011) + chr(0b110001), 26665 - 26657), ehT0Px3KOsy9('\060' + chr(0b1010110 + 0o31) + chr(53) + '\060', 0o10), ehT0Px3KOsy9(chr(274 - 226) + '\x6f' + chr(2757 - 2702) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + chr(0b110011) + chr(0b101001 + 0o11) + chr(0b110010 + 0o5), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111011 + 0o64) + '\x36' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(154 - 106) + chr(111) + chr(0b111 + 0o54) + chr(52), 0o10), ehT0Px3KOsy9(chr(1512 - 1464) + chr(0b1010010 + 0o35) + chr(433 - 382) + '\x35' + '\x34', 2092 - 2084), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\x35' + chr(2757 - 2704), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(0b10110 + 0o35) + chr(54), 8), ehT0Px3KOsy9(chr(834 - 786) + chr(0b1101111) + chr(0b110011) + '\066', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2451 - 2401) + chr(53) + chr(2485 - 2433), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(11920 - 11809) + '\x31' + '\x32' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110111) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(1928 - 1880) + '\x6f' + chr(1071 - 1021) + '\061' + chr(0b10101 + 0o33), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1591 - 1480) + '\x35' + chr(0b110100), 8), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\x31' + chr(1167 - 1112), 40992 - 40984), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b1100 + 0o47) + chr(0b110010) + chr(2452 - 2401), 12099 - 12091), ehT0Px3KOsy9('\060' + '\157' + chr(2173 - 2123) + chr(0b10110 + 0o32) + '\062', 50836 - 50828), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + chr(51) + '\060', 42310 - 42302), ehT0Px3KOsy9(chr(523 - 475) + chr(0b1101111) + '\062' + '\x31' + '\x34', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(0b11101 + 0o27) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(769 - 716), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b101001 + 0o106) + chr(0b110100 + 0o1) + chr(0b11001 + 0o27), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'N'), chr(9274 - 9174) + chr(0b110101 + 0o60) + '\x63' + '\157' + chr(6777 - 6677) + chr(0b1100101))(chr(117) + chr(0b1110100) + chr(102) + '\055' + chr(2383 - 2327)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def sDkSBDKkbprk(tKJAwKiE1Zya, fEcfxx4smAdS, abA97kOQKaLo): return not (fEcfxx4smAdS in IgIRilsDw83D and PlSM16l2KDPD(tKJAwKiE1Zya, (KFiLXGYtsK4j, LRSegj_MkOz7)))
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_spot_value
def get_spot_value(self, assets, field, dt, data_frequency): """ Public API method that returns a scalar value representing the value of the desired asset's field at either the given dt. Parameters ---------- assets : Asset, ContinuousFuture, or iterable of same. The asset or assets whose data is desired. field : {'open', 'high', 'low', 'close', 'volume', 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The spot value of ``field`` for ``asset`` The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp. """ assets_is_scalar = False if isinstance(assets, (AssetConvertible, PricingDataAssociable)): assets_is_scalar = True else: # If 'assets' was not one of the expected types then it should be # an iterable. try: iter(assets) except TypeError: raise TypeError( "Unexpected 'assets' value of type {}." .format(type(assets)) ) session_label = self.trading_calendar.minute_to_session_label(dt) if assets_is_scalar: return self._get_single_asset_value( session_label, assets, field, dt, data_frequency, ) else: get_single_asset_value = self._get_single_asset_value return [ get_single_asset_value( session_label, asset, field, dt, data_frequency, ) for asset in assets ]
python
def get_spot_value(self, assets, field, dt, data_frequency): """ Public API method that returns a scalar value representing the value of the desired asset's field at either the given dt. Parameters ---------- assets : Asset, ContinuousFuture, or iterable of same. The asset or assets whose data is desired. field : {'open', 'high', 'low', 'close', 'volume', 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The spot value of ``field`` for ``asset`` The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp. """ assets_is_scalar = False if isinstance(assets, (AssetConvertible, PricingDataAssociable)): assets_is_scalar = True else: # If 'assets' was not one of the expected types then it should be # an iterable. try: iter(assets) except TypeError: raise TypeError( "Unexpected 'assets' value of type {}." .format(type(assets)) ) session_label = self.trading_calendar.minute_to_session_label(dt) if assets_is_scalar: return self._get_single_asset_value( session_label, assets, field, dt, data_frequency, ) else: get_single_asset_value = self._get_single_asset_value return [ get_single_asset_value( session_label, asset, field, dt, data_frequency, ) for asset in assets ]
[ "def", "get_spot_value", "(", "self", ",", "assets", ",", "field", ",", "dt", ",", "data_frequency", ")", ":", "assets_is_scalar", "=", "False", "if", "isinstance", "(", "assets", ",", "(", "AssetConvertible", ",", "PricingDataAssociable", ")", ")", ":", "assets_is_scalar", "=", "True", "else", ":", "# If 'assets' was not one of the expected types then it should be", "# an iterable.", "try", ":", "iter", "(", "assets", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "\"Unexpected 'assets' value of type {}.\"", ".", "format", "(", "type", "(", "assets", ")", ")", ")", "session_label", "=", "self", ".", "trading_calendar", ".", "minute_to_session_label", "(", "dt", ")", "if", "assets_is_scalar", ":", "return", "self", ".", "_get_single_asset_value", "(", "session_label", ",", "assets", ",", "field", ",", "dt", ",", "data_frequency", ",", ")", "else", ":", "get_single_asset_value", "=", "self", ".", "_get_single_asset_value", "return", "[", "get_single_asset_value", "(", "session_label", ",", "asset", ",", "field", ",", "dt", ",", "data_frequency", ",", ")", "for", "asset", "in", "assets", "]" ]
Public API method that returns a scalar value representing the value of the desired asset's field at either the given dt. Parameters ---------- assets : Asset, ContinuousFuture, or iterable of same. The asset or assets whose data is desired. field : {'open', 'high', 'low', 'close', 'volume', 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The spot value of ``field`` for ``asset`` The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp.
[ "Public", "API", "method", "that", "returns", "a", "scalar", "value", "representing", "the", "value", "of", "the", "desired", "asset", "s", "field", "at", "either", "the", "given", "dt", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L475-L537
train
Private method that returns a scalar value representing the value of the asset s field at either the given dt or the last traded value.
Pu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,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(12252 - 12141) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(1316 - 1205) + chr(49) + '\065' + chr(0b11011 + 0o25), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(1693 - 1642) + '\063', 0o10), ehT0Px3KOsy9(chr(119 - 71) + '\x6f' + '\063' + chr(1485 - 1436) + chr(253 - 200), 0o10), ehT0Px3KOsy9('\x30' + chr(3294 - 3183) + chr(1222 - 1173) + '\x30' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + chr(50) + '\x36' + chr(53), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b11110 + 0o27) + chr(0b100000 + 0o22), 42258 - 42250), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b101100 + 0o7) + chr(53) + '\x37', 36480 - 36472), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x35' + '\x34', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11110 + 0o30) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b100111 + 0o110) + chr(0b110001 + 0o1) + '\x30' + chr(0b110010), 15255 - 15247), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110001) + chr(1828 - 1774) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\x31' + '\067' + chr(0b1000 + 0o52), 41541 - 41533), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(0b1 + 0o60) + '\x31' + chr(2546 - 2495), 35496 - 35488), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + '\x31' + '\x33', 8), ehT0Px3KOsy9(chr(259 - 211) + '\157' + chr(0b110010) + chr(0b110011) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1001 + 0o52) + chr(49) + chr(52), 0b1000), ehT0Px3KOsy9(chr(1048 - 1000) + chr(0b1101111) + '\x33' + chr(0b110000) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b100111 + 0o110) + chr(49) + '\x35' + chr(1525 - 1473), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101010 + 0o105) + chr(1685 - 1637), 63336 - 63328), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + chr(51) + chr(2438 - 2384), 25159 - 25151), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b110111) + chr(294 - 242), ord("\x08")), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(6857 - 6746) + chr(1994 - 1944) + chr(2955 - 2900) + chr(0b110001 + 0o1), ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + '\157' + '\x33' + chr(0b11011 + 0o32) + chr(2027 - 1974), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(101 - 50) + chr(757 - 705) + chr(0b110010), 57623 - 57615), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + '\065' + '\x37', 0b1000), ehT0Px3KOsy9(chr(979 - 931) + chr(111) + chr(55) + chr(2086 - 2032), ord("\x08")), ehT0Px3KOsy9(chr(806 - 758) + chr(6684 - 6573) + '\065' + '\065', 46470 - 46462), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(0b110101) + chr(524 - 474), 23874 - 23866), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + '\061' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\x33' + chr(1344 - 1295), 39898 - 39890), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110 + 0o53) + '\062' + chr(0b110100), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1110 + 0o50) + '\067', 63916 - 63908), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(6829 - 6718) + chr(2145 - 2096) + chr(0b1000 + 0o52) + chr(50), 4971 - 4963), ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(1049 - 998) + chr(0b11110 + 0o30) + chr(0b110100), 33368 - 33360), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10000 + 0o42) + chr(487 - 437) + '\x32', 50552 - 50544), ehT0Px3KOsy9(chr(0b110000) + chr(1460 - 1349) + '\x33' + '\064' + chr(639 - 590), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5298 - 5187) + '\x33' + '\x30' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7211 - 7100) + chr(49) + '\061', 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + chr(2435 - 2384) + '\067' + '\x30', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110101) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'+'), chr(0b1100100) + '\x65' + chr(99) + '\157' + '\x64' + chr(0b111111 + 0o46))(chr(0b110111 + 0o76) + chr(0b1110100) + chr(9264 - 9162) + chr(1489 - 1444) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def EDrwXmTFp0_u(oVre8I6UXc3b, YGFU3oxACPcg, fEcfxx4smAdS, OmU3Un949MWT, bXS4MokNqKbm): wF7oeVUs98kt = ehT0Px3KOsy9(chr(2201 - 2153) + chr(6388 - 6277) + chr(1162 - 1114), 8) if PlSM16l2KDPD(YGFU3oxACPcg, (hxIis8TkVx8U, E7sIR5HtuCi2)): wF7oeVUs98kt = ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1214 - 1165), 0b1000) else: try: ZdP978XkGspL(YGFU3oxACPcg) except sznFqDbNBHlx: raise sznFqDbNBHlx(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'P\x06>\xb55\xd0\t\x9bIP\xa2W\x1b88\xfc\xb8\xb5K (\x9d\xd6\x98\x87\x0fQK\xcay $Rr\x8f\xef\xcf'), '\144' + '\x65' + chr(0b100100 + 0o77) + chr(2102 - 1991) + '\144' + '\145')(chr(7057 - 6940) + chr(10813 - 10697) + '\146' + chr(0b101101) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'S\\)\xa2\r\xd49\xdc|D\xe7\x1a'), chr(6555 - 6455) + '\145' + '\143' + '\x6f' + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(2972 - 2856) + '\x66' + '\x2d' + '\x38'))(wmQmyeWBmUpv(YGFU3oxACPcg))) jHXBqk1Gbgoy = oVre8I6UXc3b.trading_calendar.minute_to_session_label(OmU3Un949MWT) if wF7oeVUs98kt: return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'Z\x0f>\xb9\x1a\xc6\x03\x81KX\xe7/\x1b88\xfc\xb8\x99\x1aa2\x89\xdf'), chr(0b1100100) + chr(101) + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\145')(chr(0b1110101) + chr(0b101000 + 0o114) + '\x66' + chr(0b101101) + chr(0b111 + 0o61)))(jHXBqk1Gbgoy, YGFU3oxACPcg, fEcfxx4smAdS, OmU3Un949MWT, bXS4MokNqKbm) else: N8mZ9Fq_PJ25 = oVre8I6UXc3b._get_single_asset_value return [N8mZ9Fq_PJ25(jHXBqk1Gbgoy, tKJAwKiE1Zya, fEcfxx4smAdS, OmU3Un949MWT, bXS4MokNqKbm) for tKJAwKiE1Zya in YGFU3oxACPcg]
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_scalar_asset_spot_value
def get_scalar_asset_spot_value(self, asset, field, dt, data_frequency): """ Public API method that returns a scalar value representing the value of the desired asset's field at either the given dt. Parameters ---------- assets : Asset The asset or assets whose data is desired. This cannot be an arbitrary AssetConvertible. field : {'open', 'high', 'low', 'close', 'volume', 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The spot value of ``field`` for ``asset`` The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp. """ return self._get_single_asset_value( self.trading_calendar.minute_to_session_label(dt), asset, field, dt, data_frequency, )
python
def get_scalar_asset_spot_value(self, asset, field, dt, data_frequency): """ Public API method that returns a scalar value representing the value of the desired asset's field at either the given dt. Parameters ---------- assets : Asset The asset or assets whose data is desired. This cannot be an arbitrary AssetConvertible. field : {'open', 'high', 'low', 'close', 'volume', 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The spot value of ``field`` for ``asset`` The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp. """ return self._get_single_asset_value( self.trading_calendar.minute_to_session_label(dt), asset, field, dt, data_frequency, )
[ "def", "get_scalar_asset_spot_value", "(", "self", ",", "asset", ",", "field", ",", "dt", ",", "data_frequency", ")", ":", "return", "self", ".", "_get_single_asset_value", "(", "self", ".", "trading_calendar", ".", "minute_to_session_label", "(", "dt", ")", ",", "asset", ",", "field", ",", "dt", ",", "data_frequency", ",", ")" ]
Public API method that returns a scalar value representing the value of the desired asset's field at either the given dt. Parameters ---------- assets : Asset The asset or assets whose data is desired. This cannot be an arbitrary AssetConvertible. field : {'open', 'high', 'low', 'close', 'volume', 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The spot value of ``field`` for ``asset`` The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp.
[ "Public", "API", "method", "that", "returns", "a", "scalar", "value", "representing", "the", "value", "of", "the", "desired", "asset", "s", "field", "at", "either", "the", "given", "dt", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L539-L573
train
Returns a scalar value representing the value of the asset s spot value at the given dt.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsW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Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(378 - 330) + chr(5710 - 5599) + chr(1983 - 1933) + '\x34' + chr(0b1001 + 0o54), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(116 - 65) + chr(55) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10100 + 0o35) + chr(0b110100) + '\062', 8795 - 8787), ehT0Px3KOsy9(chr(48) + chr(4417 - 4306) + chr(0b1010 + 0o50) + '\x30' + chr(0b11 + 0o62), 2290 - 2282), ehT0Px3KOsy9('\060' + chr(0b11110 + 0o121) + '\x37' + chr(0b100001 + 0o26), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110001) + chr(0b110100), 11076 - 11068), ehT0Px3KOsy9(chr(825 - 777) + chr(111) + chr(0b110001) + chr(0b110110) + chr(1331 - 1277), 26377 - 26369), ehT0Px3KOsy9(chr(1388 - 1340) + chr(0b1101111) + chr(50) + '\065' + chr(0b110000), 42195 - 42187), ehT0Px3KOsy9(chr(0b10101 + 0o33) + '\157' + chr(792 - 742) + '\061' + '\065', 0o10), ehT0Px3KOsy9(chr(2302 - 2254) + chr(0b1101111) + '\x33' + chr(1915 - 1860) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(0b101010 + 0o13) + chr(1708 - 1655), 0o10), ehT0Px3KOsy9('\x30' + chr(3901 - 3790) + chr(50), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + '\062', 0o10), ehT0Px3KOsy9(chr(48) + chr(3222 - 3111) + '\061' + chr(0b101110 + 0o4) + '\067', 44729 - 44721), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + '\x33' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110001) + chr(1710 - 1662) + '\x36', 0b1000), ehT0Px3KOsy9(chr(1776 - 1728) + chr(0b1100011 + 0o14) + chr(0b11010 + 0o35) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1181 - 1130) + '\x33' + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1236 - 1185) + chr(0b110010) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(51) + '\062', 0o10), ehT0Px3KOsy9('\060' + chr(0b1100111 + 0o10) + chr(1323 - 1274) + '\x37' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + '\x33' + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + chr(0b110011) + chr(0b11 + 0o56) + chr(786 - 731), 19113 - 19105), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(0b11011 + 0o124) + chr(0b101101 + 0o5) + chr(2010 - 1959) + chr(0b10011 + 0o37), 13195 - 13187), ehT0Px3KOsy9(chr(48) + chr(4485 - 4374) + chr(1000 - 946) + chr(1377 - 1329), 0b1000), ehT0Px3KOsy9(chr(2076 - 2028) + chr(111) + chr(1992 - 1942) + chr(439 - 385) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(383 - 335) + chr(0b1101111) + chr(0b1110 + 0o43) + chr(2093 - 2045) + chr(1689 - 1636), 10209 - 10201), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(449 - 338) + '\x32', 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + '\x31' + chr(2328 - 2276), 29603 - 29595), ehT0Px3KOsy9('\060' + chr(3959 - 3848) + chr(50) + chr(0b110100) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1 + 0o64) + chr(1860 - 1811), 0b1000), ehT0Px3KOsy9(chr(1671 - 1623) + chr(0b1100101 + 0o12) + chr(51) + '\x37' + '\x30', 0b1000), ehT0Px3KOsy9(chr(812 - 764) + '\x6f' + chr(0b110010) + '\x30' + chr(0b100110 + 0o16), 0o10), ehT0Px3KOsy9(chr(48) + chr(1294 - 1183) + chr(0b110011) + chr(289 - 236) + chr(0b100010 + 0o23), 8), ehT0Px3KOsy9(chr(0b110 + 0o52) + '\x6f' + '\061' + '\062' + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b11010 + 0o26) + chr(0b1101111) + chr(0b1100 + 0o50) + chr(0b110100), 24452 - 24444), ehT0Px3KOsy9(chr(48) + chr(0b1010101 + 0o32) + chr(126 - 75) + chr(50) + '\060', 0o10), ehT0Px3KOsy9('\x30' + chr(6965 - 6854) + '\x31' + chr(50) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(10983 - 10872) + chr(829 - 778) + '\x36' + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b101100 + 0o6) + chr(415 - 363), 2072 - 2064)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(321 - 268) + '\060', 58173 - 58165)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), '\144' + chr(7016 - 6915) + chr(0b1100011) + '\157' + chr(0b1100100) + '\x65')(chr(117) + chr(0b1110100) + chr(102) + '\055' + chr(72 - 16)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ZFVB5mfaz5fr(oVre8I6UXc3b, tKJAwKiE1Zya, fEcfxx4smAdS, OmU3Un949MWT, bXS4MokNqKbm): return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\x9c\x07\xf1`\x7f\x1f\xc6\xea\x91\x88]{$\xee#J\x84\xa0;\x11.\xaa'), chr(0b1100100) + chr(0b11100 + 0o111) + '\143' + chr(111) + chr(100) + chr(0b1100101))(chr(0b1110101) + '\164' + chr(0b100000 + 0o106) + '\055' + '\x38'))(xafqLlk3kkUe(oVre8I6UXc3b.trading_calendar, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc8\x92\x0c\xf0Ki)\xdc\xe2\xa2\x9egi$\xf4)P\x84\xba;\x1f>\xa3'), chr(4105 - 4005) + chr(8547 - 8446) + '\x63' + '\x6f' + '\144' + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b10001 + 0o34) + '\x38'))(OmU3Un949MWT), tKJAwKiE1Zya, fEcfxx4smAdS, OmU3Un949MWT, bXS4MokNqKbm)
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_adjustments
def get_adjustments(self, assets, field, dt, perspective_dt): """ Returns a list of adjustments between the dt and perspective_dt for the given field and list of assets Parameters ---------- assets : list of type Asset, or Asset The asset, or assets whose adjustments are desired. field : {'open', 'high', 'low', 'close', 'volume', \ 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. perspective_dt : pd.Timestamp The timestamp from which the data is being viewed back from. Returns ------- adjustments : list[Adjustment] The adjustments to that field. """ if isinstance(assets, Asset): assets = [assets] adjustment_ratios_per_asset = [] def split_adj_factor(x): return x if field != 'volume' else 1.0 / x for asset in assets: adjustments_for_asset = [] split_adjustments = self._get_adjustment_list( asset, self._splits_dict, "SPLITS" ) for adj_dt, adj in split_adjustments: if dt < adj_dt <= perspective_dt: adjustments_for_asset.append(split_adj_factor(adj)) elif adj_dt > perspective_dt: break if field != 'volume': merger_adjustments = self._get_adjustment_list( asset, self._mergers_dict, "MERGERS" ) for adj_dt, adj in merger_adjustments: if dt < adj_dt <= perspective_dt: adjustments_for_asset.append(adj) elif adj_dt > perspective_dt: break dividend_adjustments = self._get_adjustment_list( asset, self._dividends_dict, "DIVIDENDS", ) for adj_dt, adj in dividend_adjustments: if dt < adj_dt <= perspective_dt: adjustments_for_asset.append(adj) elif adj_dt > perspective_dt: break ratio = reduce(mul, adjustments_for_asset, 1.0) adjustment_ratios_per_asset.append(ratio) return adjustment_ratios_per_asset
python
def get_adjustments(self, assets, field, dt, perspective_dt): """ Returns a list of adjustments between the dt and perspective_dt for the given field and list of assets Parameters ---------- assets : list of type Asset, or Asset The asset, or assets whose adjustments are desired. field : {'open', 'high', 'low', 'close', 'volume', \ 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. perspective_dt : pd.Timestamp The timestamp from which the data is being viewed back from. Returns ------- adjustments : list[Adjustment] The adjustments to that field. """ if isinstance(assets, Asset): assets = [assets] adjustment_ratios_per_asset = [] def split_adj_factor(x): return x if field != 'volume' else 1.0 / x for asset in assets: adjustments_for_asset = [] split_adjustments = self._get_adjustment_list( asset, self._splits_dict, "SPLITS" ) for adj_dt, adj in split_adjustments: if dt < adj_dt <= perspective_dt: adjustments_for_asset.append(split_adj_factor(adj)) elif adj_dt > perspective_dt: break if field != 'volume': merger_adjustments = self._get_adjustment_list( asset, self._mergers_dict, "MERGERS" ) for adj_dt, adj in merger_adjustments: if dt < adj_dt <= perspective_dt: adjustments_for_asset.append(adj) elif adj_dt > perspective_dt: break dividend_adjustments = self._get_adjustment_list( asset, self._dividends_dict, "DIVIDENDS", ) for adj_dt, adj in dividend_adjustments: if dt < adj_dt <= perspective_dt: adjustments_for_asset.append(adj) elif adj_dt > perspective_dt: break ratio = reduce(mul, adjustments_for_asset, 1.0) adjustment_ratios_per_asset.append(ratio) return adjustment_ratios_per_asset
[ "def", "get_adjustments", "(", "self", ",", "assets", ",", "field", ",", "dt", ",", "perspective_dt", ")", ":", "if", "isinstance", "(", "assets", ",", "Asset", ")", ":", "assets", "=", "[", "assets", "]", "adjustment_ratios_per_asset", "=", "[", "]", "def", "split_adj_factor", "(", "x", ")", ":", "return", "x", "if", "field", "!=", "'volume'", "else", "1.0", "/", "x", "for", "asset", "in", "assets", ":", "adjustments_for_asset", "=", "[", "]", "split_adjustments", "=", "self", ".", "_get_adjustment_list", "(", "asset", ",", "self", ".", "_splits_dict", ",", "\"SPLITS\"", ")", "for", "adj_dt", ",", "adj", "in", "split_adjustments", ":", "if", "dt", "<", "adj_dt", "<=", "perspective_dt", ":", "adjustments_for_asset", ".", "append", "(", "split_adj_factor", "(", "adj", ")", ")", "elif", "adj_dt", ">", "perspective_dt", ":", "break", "if", "field", "!=", "'volume'", ":", "merger_adjustments", "=", "self", ".", "_get_adjustment_list", "(", "asset", ",", "self", ".", "_mergers_dict", ",", "\"MERGERS\"", ")", "for", "adj_dt", ",", "adj", "in", "merger_adjustments", ":", "if", "dt", "<", "adj_dt", "<=", "perspective_dt", ":", "adjustments_for_asset", ".", "append", "(", "adj", ")", "elif", "adj_dt", ">", "perspective_dt", ":", "break", "dividend_adjustments", "=", "self", ".", "_get_adjustment_list", "(", "asset", ",", "self", ".", "_dividends_dict", ",", "\"DIVIDENDS\"", ",", ")", "for", "adj_dt", ",", "adj", "in", "dividend_adjustments", ":", "if", "dt", "<", "adj_dt", "<=", "perspective_dt", ":", "adjustments_for_asset", ".", "append", "(", "adj", ")", "elif", "adj_dt", ">", "perspective_dt", ":", "break", "ratio", "=", "reduce", "(", "mul", ",", "adjustments_for_asset", ",", "1.0", ")", "adjustment_ratios_per_asset", ".", "append", "(", "ratio", ")", "return", "adjustment_ratios_per_asset" ]
Returns a list of adjustments between the dt and perspective_dt for the given field and list of assets Parameters ---------- assets : list of type Asset, or Asset The asset, or assets whose adjustments are desired. field : {'open', 'high', 'low', 'close', 'volume', \ 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. perspective_dt : pd.Timestamp The timestamp from which the data is being viewed back from. Returns ------- adjustments : list[Adjustment] The adjustments to that field.
[ "Returns", "a", "list", "of", "adjustments", "between", "the", "dt", "and", "perspective_dt", "for", "the", "given", "field", "and", "list", "of", "assets" ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L575-L638
train
Returns a list of adjustments between the dt and perspective_dt for the given field and list of assets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8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R,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(2380 - 2326) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(49) + chr(0b110110) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1161 - 1111) + '\x32' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b100110 + 0o20) + '\065', 0o10), ehT0Px3KOsy9(chr(1054 - 1006) + chr(0b1101000 + 0o7) + '\x31' + chr(54) + chr(0b1100 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\063' + chr(2020 - 1969) + chr(0b110001), 38326 - 38318), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31' + chr(1517 - 1469) + chr(2411 - 2360), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + chr(0b1100 + 0o46) + chr(829 - 777) + '\066', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + '\x35' + chr(49), 0b1000), ehT0Px3KOsy9(chr(1683 - 1635) + chr(111) + chr(827 - 775) + chr(1875 - 1825), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100101 + 0o16) + '\062', 7659 - 7651), ehT0Px3KOsy9(chr(48) + '\157' + chr(1592 - 1538) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(1689 - 1638) + '\065' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(781 - 733) + '\157' + chr(1974 - 1921) + chr(0b100110 + 0o21), 9803 - 9795), ehT0Px3KOsy9(chr(2197 - 2149) + chr(0b11001 + 0o126) + chr(632 - 581) + chr(0b110011) + '\067', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\065' + chr(830 - 781), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1008 - 959) + '\x35' + chr(2330 - 2279), 0b1000), ehT0Px3KOsy9('\060' + chr(10975 - 10864) + chr(853 - 804) + chr(466 - 415) + '\062', 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b10011 + 0o37) + chr(148 - 97) + chr(1898 - 1845), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6527 - 6416) + chr(50) + chr(0b10110 + 0o37) + chr(505 - 454), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\x30' + chr(0b101011 + 0o11), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + '\x36' + '\065', 8), ehT0Px3KOsy9(chr(48) + chr(9037 - 8926) + chr(49) + chr(0b110101) + '\060', 42171 - 42163), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\x6f' + chr(0b110001) + chr(2015 - 1962) + chr(1714 - 1665), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + chr(1012 - 960) + chr(2867 - 2812), 60314 - 60306), ehT0Px3KOsy9(chr(2133 - 2085) + chr(0b1101111) + chr(0b110001) + chr(0b10000 + 0o42) + chr(490 - 442), ord("\x08")), ehT0Px3KOsy9(chr(580 - 532) + chr(111) + chr(0b110011) + chr(0b1 + 0o61) + chr(514 - 462), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(0b110000 + 0o1) + chr(48), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(9490 - 9379) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11000 + 0o33) + chr(0b110000) + '\x34', 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1010001 + 0o36) + chr(1278 - 1228) + chr(0b110100) + chr(0b10 + 0o62), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2773 - 2662) + chr(49) + chr(0b110011 + 0o4) + '\060', 21796 - 21788), ehT0Px3KOsy9(chr(1489 - 1441) + chr(0b1101111) + chr(0b110010) + chr(0b110001) + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + chr(1098 - 987) + '\066' + chr(55), 17634 - 17626), ehT0Px3KOsy9('\060' + chr(0b111110 + 0o61) + chr(1921 - 1868) + chr(1355 - 1300), 8), ehT0Px3KOsy9(chr(2282 - 2234) + '\x6f' + chr(0b110010) + chr(0b110100) + chr(1752 - 1701), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(0b110001 + 0o1) + chr(1773 - 1725) + chr(1366 - 1313), 18621 - 18613), ehT0Px3KOsy9(chr(1093 - 1045) + '\x6f' + chr(49) + chr(49), 13040 - 13032), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b10110 + 0o41) + chr(0b110010 + 0o4), 0b1000), ehT0Px3KOsy9(chr(663 - 615) + '\x6f' + chr(0b1000 + 0o53) + chr(0b101001 + 0o7) + '\061', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2301 - 2253) + '\x6f' + chr(0b10101 + 0o40) + '\060', 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'X'), chr(0b1100100) + '\145' + '\x63' + chr(1478 - 1367) + '\144' + '\x65')(chr(0b1100110 + 0o17) + chr(8193 - 8077) + '\x66' + chr(45) + chr(0b100010 + 0o26)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) (RSYsB9TMxo_y,) = (xafqLlk3kkUe(NPPHb59961Bv(xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\x01\xf8\x16\x05\xb6,\xca\xda'), '\x64' + '\x65' + chr(5416 - 5317) + chr(111) + chr(100) + '\145')(chr(0b100000 + 0o125) + chr(4101 - 3985) + chr(102) + '\055' + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x11\xf2\x00\x12\xbc'), '\144' + '\x65' + chr(0b1100011) + '\x6f' + '\144' + chr(0b1010000 + 0o25))('\165' + '\164' + chr(0b1100110) + chr(0b1010 + 0o43) + chr(0b101110 + 0o12))), xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\x11\xf2\x00\x12\xbc'), chr(0b1100000 + 0o4) + chr(101) + '\x63' + '\x6f' + '\144' + chr(7761 - 7660))('\165' + chr(4769 - 4653) + chr(0b1100110) + chr(0b101101) + '\x38')),) def chEJiXVjs1OQ(oVre8I6UXc3b, YGFU3oxACPcg, fEcfxx4smAdS, OmU3Un949MWT, N7BkMaOXrFvk): if PlSM16l2KDPD(YGFU3oxACPcg, KFiLXGYtsK4j): YGFU3oxACPcg = [YGFU3oxACPcg] lC2r628pmqBe = [] def XBKPqdH3oboK(OeWW0F1dBPRQ): return OeWW0F1dBPRQ if fEcfxx4smAdS != xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\x1b\xfa\x00\x1c\xbc'), '\144' + chr(10109 - 10008) + chr(0b1100011) + chr(0b110000 + 0o77) + '\144' + chr(7129 - 7028))(chr(0b1110101) + '\x74' + '\x66' + '\055' + chr(56)) else 1.0 / OeWW0F1dBPRQ for tKJAwKiE1Zya in YGFU3oxACPcg: U47XHKehDibw = [] llEZKvQE6tjn = oVre8I6UXc3b._get_adjustment_list(tKJAwKiE1Zya, oVre8I6UXc3b._splits_dict, xafqLlk3kkUe(SXOLrMavuUCe(b'%$\xda<%\x8a'), chr(5486 - 5386) + chr(0b1000010 + 0o43) + chr(3841 - 3742) + chr(838 - 727) + chr(0b1100100) + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + chr(1024 - 979) + chr(0b111000))) for (OBZCiPxJwmPA, zY4j_kVEljQN) in llEZKvQE6tjn: if OmU3Un949MWT < OBZCiPxJwmPA <= N7BkMaOXrFvk: xafqLlk3kkUe(U47XHKehDibw, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\x04\xe6\x10\x1f\xbd'), chr(5028 - 4928) + chr(0b1100101) + chr(0b1001111 + 0o24) + chr(0b1001 + 0o146) + chr(0b111000 + 0o54) + chr(101))(chr(0b1110101) + chr(0b1110100) + '\146' + '\055' + chr(506 - 450)))(XBKPqdH3oboK(zY4j_kVEljQN)) elif OBZCiPxJwmPA > N7BkMaOXrFvk: break if fEcfxx4smAdS != xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\x1b\xfa\x00\x1c\xbc'), '\144' + chr(5243 - 5142) + chr(0b1100011) + chr(1626 - 1515) + chr(100) + '\145')(chr(0b1010100 + 0o41) + '\x74' + chr(7906 - 7804) + chr(45) + '\x38'): ubVzkPcoSJBj = oVre8I6UXc3b._get_adjustment_list(tKJAwKiE1Zya, oVre8I6UXc3b._mergers_dict, xafqLlk3kkUe(SXOLrMavuUCe(b';1\xc424\x8b\x10'), '\144' + '\x65' + chr(99) + chr(719 - 608) + chr(9451 - 9351) + chr(0b1100101))('\165' + chr(2222 - 2106) + chr(0b1100110) + chr(1828 - 1783) + chr(2591 - 2535))) for (OBZCiPxJwmPA, zY4j_kVEljQN) in ubVzkPcoSJBj: if OmU3Un949MWT < OBZCiPxJwmPA <= N7BkMaOXrFvk: xafqLlk3kkUe(U47XHKehDibw, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\x04\xe6\x10\x1f\xbd'), '\x64' + chr(0b1100101) + chr(99) + chr(0b1101111) + chr(0b1011111 + 0o5) + '\145')('\x75' + '\x74' + '\146' + '\055' + chr(0b110101 + 0o3)))(zY4j_kVEljQN) elif OBZCiPxJwmPA > N7BkMaOXrFvk: break H3a6DBEWtpd9 = oVre8I6UXc3b._get_adjustment_list(tKJAwKiE1Zya, oVre8I6UXc3b._dividends_dict, xafqLlk3kkUe(SXOLrMavuUCe(b'2=\xc0<5\x9c\r\xe2\xfa'), '\x64' + chr(0b110110 + 0o57) + chr(4732 - 4633) + chr(111) + chr(100) + '\x65')(chr(117) + chr(116) + chr(8993 - 8891) + chr(0b100110 + 0o7) + chr(0b100101 + 0o23))) for (OBZCiPxJwmPA, zY4j_kVEljQN) in H3a6DBEWtpd9: if OmU3Un949MWT < OBZCiPxJwmPA <= N7BkMaOXrFvk: xafqLlk3kkUe(U47XHKehDibw, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\x04\xe6\x10\x1f\xbd'), '\144' + '\x65' + chr(0b1100011) + chr(0b1101111) + chr(0b100111 + 0o75) + chr(8780 - 8679))('\x75' + chr(0b101001 + 0o113) + chr(0b0 + 0o146) + chr(0b101101) + '\x38'))(zY4j_kVEljQN) elif OBZCiPxJwmPA > N7BkMaOXrFvk: break pyiPBPsXZj35 = RSYsB9TMxo_y(lvSCgY7ZhGFB, U47XHKehDibw, 1.0) xafqLlk3kkUe(lC2r628pmqBe, xafqLlk3kkUe(SXOLrMavuUCe(b'\x17\x04\xe6\x10\x1f\xbd'), '\x64' + '\x65' + '\x63' + chr(0b1101111) + chr(4970 - 4870) + '\x65')(chr(0b1110101) + chr(0b1000010 + 0o62) + '\146' + '\055' + '\070'))(pyiPBPsXZj35) return lC2r628pmqBe
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_adjusted_value
def get_adjusted_value(self, asset, field, dt, perspective_dt, data_frequency, spot_value=None): """ Returns a scalar value representing the value of the desired asset's field at the given dt with adjustments applied. Parameters ---------- asset : Asset The asset whose data is desired. field : {'open', 'high', 'low', 'close', 'volume', \ 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. perspective_dt : pd.Timestamp The timestamp from which the data is being viewed back from. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The value of the given ``field`` for ``asset`` at ``dt`` with any adjustments known by ``perspective_dt`` applied. The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp. """ if spot_value is None: # if this a fetcher field, we want to use perspective_dt (not dt) # because we want the new value as of midnight (fetcher only works # on a daily basis, all timestamps are on midnight) if self._is_extra_source(asset, field, self._augmented_sources_map): spot_value = self.get_spot_value(asset, field, perspective_dt, data_frequency) else: spot_value = self.get_spot_value(asset, field, dt, data_frequency) if isinstance(asset, Equity): ratio = self.get_adjustments(asset, field, dt, perspective_dt)[0] spot_value *= ratio return spot_value
python
def get_adjusted_value(self, asset, field, dt, perspective_dt, data_frequency, spot_value=None): """ Returns a scalar value representing the value of the desired asset's field at the given dt with adjustments applied. Parameters ---------- asset : Asset The asset whose data is desired. field : {'open', 'high', 'low', 'close', 'volume', \ 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. perspective_dt : pd.Timestamp The timestamp from which the data is being viewed back from. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The value of the given ``field`` for ``asset`` at ``dt`` with any adjustments known by ``perspective_dt`` applied. The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp. """ if spot_value is None: # if this a fetcher field, we want to use perspective_dt (not dt) # because we want the new value as of midnight (fetcher only works # on a daily basis, all timestamps are on midnight) if self._is_extra_source(asset, field, self._augmented_sources_map): spot_value = self.get_spot_value(asset, field, perspective_dt, data_frequency) else: spot_value = self.get_spot_value(asset, field, dt, data_frequency) if isinstance(asset, Equity): ratio = self.get_adjustments(asset, field, dt, perspective_dt)[0] spot_value *= ratio return spot_value
[ "def", "get_adjusted_value", "(", "self", ",", "asset", ",", "field", ",", "dt", ",", "perspective_dt", ",", "data_frequency", ",", "spot_value", "=", "None", ")", ":", "if", "spot_value", "is", "None", ":", "# if this a fetcher field, we want to use perspective_dt (not dt)", "# because we want the new value as of midnight (fetcher only works", "# on a daily basis, all timestamps are on midnight)", "if", "self", ".", "_is_extra_source", "(", "asset", ",", "field", ",", "self", ".", "_augmented_sources_map", ")", ":", "spot_value", "=", "self", ".", "get_spot_value", "(", "asset", ",", "field", ",", "perspective_dt", ",", "data_frequency", ")", "else", ":", "spot_value", "=", "self", ".", "get_spot_value", "(", "asset", ",", "field", ",", "dt", ",", "data_frequency", ")", "if", "isinstance", "(", "asset", ",", "Equity", ")", ":", "ratio", "=", "self", ".", "get_adjustments", "(", "asset", ",", "field", ",", "dt", ",", "perspective_dt", ")", "[", "0", "]", "spot_value", "*=", "ratio", "return", "spot_value" ]
Returns a scalar value representing the value of the desired asset's field at the given dt with adjustments applied. Parameters ---------- asset : Asset The asset whose data is desired. field : {'open', 'high', 'low', 'close', 'volume', \ 'price', 'last_traded'} The desired field of the asset. dt : pd.Timestamp The timestamp for the desired value. perspective_dt : pd.Timestamp The timestamp from which the data is being viewed back from. data_frequency : str The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars Returns ------- value : float, int, or pd.Timestamp The value of the given ``field`` for ``asset`` at ``dt`` with any adjustments known by ``perspective_dt`` applied. The return type is based on the ``field`` requested. If the field is one of 'open', 'high', 'low', 'close', or 'price', the value will be a float. If the ``field`` is 'volume' the value will be a int. If the ``field`` is 'last_traded' the value will be a Timestamp.
[ "Returns", "a", "scalar", "value", "representing", "the", "value", "of", "the", "desired", "asset", "s", "field", "at", "the", "given", "dt", "with", "adjustments", "applied", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L640-L689
train
Returns the value of the asset s field at the given dt with adjustments applied.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu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pS8s,QOfmzcVJsrp8,tzcpInYwBvYW,iDQ_gSK8V7h0,Rurm1zTRfSmY,reqGiMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b0 + 0o64) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + chr(0b110001) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x34' + '\065', 48744 - 48736), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110101) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(298 - 250) + chr(0b111111 + 0o60) + chr(0b11000 + 0o31) + chr(1713 - 1663) + chr(0b100111 + 0o13), ord("\x08")), ehT0Px3KOsy9(chr(1797 - 1749) + '\x6f' + chr(0b110001) + '\062' + chr(55), 41643 - 41635), ehT0Px3KOsy9(chr(1508 - 1460) + chr(0b1101111) + '\061' + chr(0b110000) + chr(509 - 454), 34193 - 34185), ehT0Px3KOsy9(chr(785 - 737) + '\x6f' + chr(0b110011) + '\x31' + chr(771 - 718), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2105 - 1994) + chr(0b101 + 0o61) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1270 - 1222) + '\157' + chr(0b110010) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\066' + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10101 + 0o35) + chr(457 - 403) + '\060', 0b1000), ehT0Px3KOsy9(chr(1963 - 1915) + chr(0b1101111) + '\061' + '\x33' + '\063', 33426 - 33418), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(1310 - 1199) + '\061' + chr(50), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b1101 + 0o45), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(51) + '\060' + chr(0b101001 + 0o14), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1489 - 1378) + '\x32' + chr(0b110000) + chr(1690 - 1637), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x32' + '\x31', 16397 - 16389), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(54) + chr(0b110100), 12773 - 12765), ehT0Px3KOsy9(chr(1586 - 1538) + chr(111) + chr(0b101 + 0o55) + '\x33' + chr(531 - 477), 22582 - 22574), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\x34' + chr(328 - 277), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + '\062' + '\x33' + '\x36', 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + '\x36' + chr(0b100001 + 0o24), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100000 + 0o23) + chr(1113 - 1060) + chr(1983 - 1932), 0o10), ehT0Px3KOsy9('\060' + chr(0b100101 + 0o112) + chr(0b1 + 0o62) + '\061' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11100 + 0o27) + chr(54) + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(2219 - 2164), 48046 - 48038), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + '\x33' + chr(0b1001 + 0o55), 8), ehT0Px3KOsy9('\x30' + '\157' + '\x30', 23230 - 23222), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010 + 0o1) + chr(0b10111 + 0o32) + chr(786 - 733), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(1607 - 1555) + '\062', 47105 - 47097), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + chr(50) + '\x34' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b11011 + 0o27) + chr(0b11011 + 0o33), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b10110 + 0o131) + chr(49) + chr(651 - 603) + '\x30', 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + '\061' + chr(50) + chr(50), 8), ehT0Px3KOsy9('\x30' + chr(0b111111 + 0o60) + '\x35' + chr(0b1110 + 0o50), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(2288 - 2240) + '\157' + chr(0b100101 + 0o16) + chr(0b110000) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(0b110010 + 0o1), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(0b1100 + 0o51) + '\x35', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(2388 - 2335) + '\x30', 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8b'), chr(2958 - 2858) + '\x65' + '\x63' + chr(111) + '\144' + chr(356 - 255))(chr(0b1110101) + '\164' + '\x66' + chr(45) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def jtlCJazwp9_T(oVre8I6UXc3b, tKJAwKiE1Zya, fEcfxx4smAdS, OmU3Un949MWT, N7BkMaOXrFvk, bXS4MokNqKbm, AToFvwTFAQQ0=None): if AToFvwTFAQQ0 is None: if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa\xa0Vv7/3\xbfTL\xc5\xdf.xy\xa0'), '\144' + '\x65' + '\143' + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(0b1110100) + '\146' + '\x2d' + '\070'))(tKJAwKiE1Zya, fEcfxx4smAdS, xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe4\xfarg4\x1b$\xb4Ox\xe7\xca'), chr(100) + chr(0b100010 + 0o103) + chr(1212 - 1113) + chr(0b1101111) + '\x64' + chr(101))(chr(9510 - 9393) + chr(116) + '\x66' + chr(0b100110 + 0o7) + '\x38'))): AToFvwTFAQQ0 = oVre8I6UXc3b.get_spot_value(tKJAwKiE1Zya, fEcfxx4smAdS, N7BkMaOXrFvk, bXS4MokNqKbm) else: AToFvwTFAQQ0 = oVre8I6UXc3b.get_spot_value(tKJAwKiE1Zya, fEcfxx4smAdS, OmU3Un949MWT, bXS4MokNqKbm) if PlSM16l2KDPD(tKJAwKiE1Zya, ueYECkefpN2O): pyiPBPsXZj35 = oVre8I6UXc3b.get_adjustments(tKJAwKiE1Zya, fEcfxx4smAdS, OmU3Un949MWT, N7BkMaOXrFvk)[ehT0Px3KOsy9(chr(604 - 556) + chr(0b1000101 + 0o52) + chr(48), 8)] AToFvwTFAQQ0 *= pyiPBPsXZj35 return AToFvwTFAQQ0
quantopian/zipline
zipline/data/data_portal.py
DataPortal._get_history_daily_window
def _get_history_daily_window(self, assets, end_dt, bar_count, field_to_use, data_frequency): """ Internal method that returns a dataframe containing history bars of daily frequency for the given sids. """ session = self.trading_calendar.minute_to_session_label(end_dt) days_for_window = self._get_days_for_window(session, bar_count) if len(assets) == 0: return pd.DataFrame(None, index=days_for_window, columns=None) data = self._get_history_daily_window_data( assets, days_for_window, end_dt, field_to_use, data_frequency ) return pd.DataFrame( data, index=days_for_window, columns=assets )
python
def _get_history_daily_window(self, assets, end_dt, bar_count, field_to_use, data_frequency): """ Internal method that returns a dataframe containing history bars of daily frequency for the given sids. """ session = self.trading_calendar.minute_to_session_label(end_dt) days_for_window = self._get_days_for_window(session, bar_count) if len(assets) == 0: return pd.DataFrame(None, index=days_for_window, columns=None) data = self._get_history_daily_window_data( assets, days_for_window, end_dt, field_to_use, data_frequency ) return pd.DataFrame( data, index=days_for_window, columns=assets )
[ "def", "_get_history_daily_window", "(", "self", ",", "assets", ",", "end_dt", ",", "bar_count", ",", "field_to_use", ",", "data_frequency", ")", ":", "session", "=", "self", ".", "trading_calendar", ".", "minute_to_session_label", "(", "end_dt", ")", "days_for_window", "=", "self", ".", "_get_days_for_window", "(", "session", ",", "bar_count", ")", "if", "len", "(", "assets", ")", "==", "0", ":", "return", "pd", ".", "DataFrame", "(", "None", ",", "index", "=", "days_for_window", ",", "columns", "=", "None", ")", "data", "=", "self", ".", "_get_history_daily_window_data", "(", "assets", ",", "days_for_window", ",", "end_dt", ",", "field_to_use", ",", "data_frequency", ")", "return", "pd", ".", "DataFrame", "(", "data", ",", "index", "=", "days_for_window", ",", "columns", "=", "assets", ")" ]
Internal method that returns a dataframe containing history bars of daily frequency for the given sids.
[ "Internal", "method", "that", "returns", "a", "dataframe", "containing", "history", "bars", "of", "daily", "frequency", "for", "the", "given", "sids", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L787-L812
train
Internal method that returns a dataframe containing history bars for the given sids and daily frequency.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbc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Qr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b11 + 0o63), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b100000 + 0o117) + chr(0b110001) + '\067' + '\060', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011000 + 0o27) + '\061' + chr(53) + chr(50), 33516 - 33508), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101001 + 0o12) + chr(55) + chr(0b100011 + 0o20), 0b1000), ehT0Px3KOsy9(chr(1071 - 1023) + '\157' + chr(0b110001) + chr(128 - 75) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + '\x33' + chr(48), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2308 - 2258) + chr(0b10100 + 0o42), 63518 - 63510), ehT0Px3KOsy9('\060' + chr(10578 - 10467) + chr(1650 - 1599) + chr(2133 - 2085) + '\060', 59737 - 59729), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b0 + 0o63) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(4817 - 4706) + chr(262 - 212) + chr(0b110001) + chr(0b11111 + 0o21), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(0b110100) + chr(1894 - 1844), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b100011 + 0o20) + '\065' + chr(49), 54095 - 54087), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + chr(864 - 815) + chr(0b100 + 0o57) + chr(50), 0b1000), ehT0Px3KOsy9(chr(918 - 870) + '\157' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001 + 0o2) + chr(0b110110 + 0o1) + chr(1576 - 1527), 42022 - 42014), ehT0Px3KOsy9(chr(48) + chr(3311 - 3200) + chr(1843 - 1790) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(459 - 348) + '\x31' + '\x37' + chr(2482 - 2432), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + '\x31' + chr(1600 - 1548) + chr(0b1100 + 0o52), 0b1000), ehT0Px3KOsy9('\060' + chr(2402 - 2291) + '\065' + chr(52), 23521 - 23513), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\062' + chr(0b100110 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100001 + 0o21) + chr(52) + chr(1727 - 1673), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(121 - 72) + '\x36' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(1078 - 1030) + '\157' + chr(53) + chr(0b10 + 0o64), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x36' + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1001001 + 0o46) + '\x33' + '\x37', 9691 - 9683), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\x6f' + chr(0b1000 + 0o54) + chr(0b11111 + 0o21), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101 + 0o142) + chr(1252 - 1203) + chr(705 - 650) + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x34' + '\x37', 57314 - 57306), ehT0Px3KOsy9('\x30' + '\157' + chr(55) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b110111) + chr(0b1000 + 0o50), 8), ehT0Px3KOsy9(chr(48) + chr(6027 - 5916) + chr(50) + chr(0b110000), 62923 - 62915), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(290 - 239) + chr(0b10111 + 0o34) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(690 - 642) + '\x6f' + chr(289 - 239) + '\x33' + '\x33', 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(111) + '\063' + chr(0b101000 + 0o12) + chr(0b101010 + 0o13), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x33' + '\061', 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\067' + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1001 + 0o50), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10000 + 0o43) + '\x36' + '\065', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(8919 - 8808) + '\x35' + chr(0b10110 + 0o32), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'('), '\x64' + chr(9700 - 9599) + chr(7751 - 7652) + '\x6f' + chr(100) + chr(0b10000 + 0o125))('\x75' + '\x74' + chr(4056 - 3954) + chr(0b101101) + chr(3084 - 3028)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TEzTgH6ZhWFl(oVre8I6UXc3b, YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, VLvcJ7GMO57L, bXS4MokNqKbm): Q4vuWJRZ65bC = oVre8I6UXc3b.trading_calendar.minute_to_session_label(H53hAzPUC6Rt) UhDluDjruqjt = oVre8I6UXc3b._get_days_for_window(Q4vuWJRZ65bC, g2GEhO4QQANY) if c2A0yzQpDQB3(YGFU3oxACPcg) == ehT0Px3KOsy9(chr(896 - 848) + chr(3607 - 3496) + chr(2167 - 2119), ord("\x08")): return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'B\x19\x1e\x9a/\xeaw\xad\xfe'), chr(9043 - 8943) + chr(0b1001000 + 0o35) + chr(0b1100011) + '\157' + chr(7237 - 7137) + '\145')(chr(0b1110001 + 0o4) + chr(2057 - 1941) + chr(0b1 + 0o145) + chr(0b10 + 0o53) + chr(0b111000)))(None, index=UhDluDjruqjt, columns=None) ULnjp6D6efFH = oVre8I6UXc3b._get_history_daily_window_data(YGFU3oxACPcg, UhDluDjruqjt, H53hAzPUC6Rt, VLvcJ7GMO57L, bXS4MokNqKbm) return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'B\x19\x1e\x9a/\xeaw\xad\xfe'), chr(0b111011 + 0o51) + chr(9698 - 9597) + '\x63' + chr(0b11001 + 0o126) + chr(100) + chr(6845 - 6744))(chr(117) + chr(13164 - 13048) + chr(0b1100110) + '\055' + chr(95 - 39)))(ULnjp6D6efFH, index=UhDluDjruqjt, columns=YGFU3oxACPcg)
quantopian/zipline
zipline/data/data_portal.py
DataPortal._get_history_minute_window
def _get_history_minute_window(self, assets, end_dt, bar_count, field_to_use): """ Internal method that returns a dataframe containing history bars of minute frequency for the given sids. """ # get all the minutes for this window try: minutes_for_window = self.trading_calendar.minutes_window( end_dt, -bar_count ) except KeyError: self._handle_minute_history_out_of_bounds(bar_count) if minutes_for_window[0] < self._first_trading_minute: self._handle_minute_history_out_of_bounds(bar_count) asset_minute_data = self._get_minute_window_data( assets, field_to_use, minutes_for_window, ) return pd.DataFrame( asset_minute_data, index=minutes_for_window, columns=assets )
python
def _get_history_minute_window(self, assets, end_dt, bar_count, field_to_use): """ Internal method that returns a dataframe containing history bars of minute frequency for the given sids. """ # get all the minutes for this window try: minutes_for_window = self.trading_calendar.minutes_window( end_dt, -bar_count ) except KeyError: self._handle_minute_history_out_of_bounds(bar_count) if minutes_for_window[0] < self._first_trading_minute: self._handle_minute_history_out_of_bounds(bar_count) asset_minute_data = self._get_minute_window_data( assets, field_to_use, minutes_for_window, ) return pd.DataFrame( asset_minute_data, index=minutes_for_window, columns=assets )
[ "def", "_get_history_minute_window", "(", "self", ",", "assets", ",", "end_dt", ",", "bar_count", ",", "field_to_use", ")", ":", "# get all the minutes for this window", "try", ":", "minutes_for_window", "=", "self", ".", "trading_calendar", ".", "minutes_window", "(", "end_dt", ",", "-", "bar_count", ")", "except", "KeyError", ":", "self", ".", "_handle_minute_history_out_of_bounds", "(", "bar_count", ")", "if", "minutes_for_window", "[", "0", "]", "<", "self", ".", "_first_trading_minute", ":", "self", ".", "_handle_minute_history_out_of_bounds", "(", "bar_count", ")", "asset_minute_data", "=", "self", ".", "_get_minute_window_data", "(", "assets", ",", "field_to_use", ",", "minutes_for_window", ",", ")", "return", "pd", ".", "DataFrame", "(", "asset_minute_data", ",", "index", "=", "minutes_for_window", ",", "columns", "=", "assets", ")" ]
Internal method that returns a dataframe containing history bars of minute frequency for the given sids.
[ "Internal", "method", "that", "returns", "a", "dataframe", "containing", "history", "bars", "of", "minute", "frequency", "for", "the", "given", "sids", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L886-L913
train
Internal method that returns a dataframe containing history bars for the given sids and the given field_to_use.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0U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m,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(111) + chr(0b110011 + 0o4) + chr(0b10100 + 0o34), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1 + 0o156) + chr(0b110011) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(2147 - 2099) + chr(0b1100110 + 0o11) + chr(1471 - 1420) + chr(0b110110) + chr(0b11100 + 0o30), 0o10), ehT0Px3KOsy9(chr(2038 - 1990) + '\x6f' + '\x31' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(2067 - 2019) + '\157' + chr(1044 - 990) + chr(365 - 314), 0o10), ehT0Px3KOsy9(chr(1880 - 1832) + '\x6f' + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b101010 + 0o7) + '\060' + chr(1150 - 1097), 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(10644 - 10533) + '\061' + chr(50), 3275 - 3267), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(111) + '\062' + chr(0b101000 + 0o11), 0b1000), ehT0Px3KOsy9(chr(1588 - 1540) + chr(0b1101 + 0o142) + chr(0b110000 + 0o3) + chr(0b110110) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11475 - 11364) + chr(51) + chr(0b100101 + 0o17) + '\x30', 0b1000), ehT0Px3KOsy9(chr(712 - 664) + chr(10272 - 10161) + chr(50) + chr(0b110011) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(0b1000101 + 0o52) + chr(688 - 639) + '\x32' + chr(1744 - 1692), 3625 - 3617), ehT0Px3KOsy9(chr(48) + chr(6032 - 5921) + '\063' + '\x37' + '\062', 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1101111) + chr(0b1101 + 0o44) + chr(53) + chr(0b1000 + 0o56), 0o10), ehT0Px3KOsy9('\060' + chr(3717 - 3606) + chr(50) + '\060' + chr(0b11101 + 0o30), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(0b110010) + chr(1927 - 1872), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(52) + chr(2299 - 2251), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2887 - 2776) + chr(0b110001) + chr(962 - 912) + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b100011 + 0o114) + chr(76 - 27) + chr(51) + chr(0b100101 + 0o17), 0o10), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(0b110001) + chr(0b110000) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1001010 + 0o45) + '\067' + chr(2349 - 2298), 3223 - 3215), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(3975 - 3864) + chr(49) + chr(53) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b111110 + 0o61) + chr(0b1110 + 0o45) + chr(49) + chr(0b110110 + 0o1), 0o10), ehT0Px3KOsy9(chr(1980 - 1932) + chr(0b1101 + 0o142) + '\x34' + '\x36', 39528 - 39520), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + '\061' + chr(49) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b110100) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(6828 - 6717) + '\x31' + chr(50), 8), ehT0Px3KOsy9('\x30' + chr(12092 - 11981) + chr(0b110011 + 0o0) + '\x37' + chr(2141 - 2092), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(0b1001 + 0o52) + '\x36', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101010 + 0o7) + '\x30' + chr(1891 - 1836), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(51) + '\061' + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(0b110001), 48661 - 48653), ehT0Px3KOsy9(chr(0b110000) + chr(718 - 607) + chr(1911 - 1861) + chr(50) + chr(50), 5509 - 5501), ehT0Px3KOsy9('\x30' + chr(4027 - 3916) + '\062' + chr(51) + chr(0b10101 + 0o33), 0o10), ehT0Px3KOsy9(chr(48) + chr(10364 - 10253) + '\x32' + chr(0b11100 + 0o25) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(2207 - 2096) + chr(1161 - 1110) + chr(53) + '\x36', 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b100000 + 0o117) + chr(0b0 + 0o62) + '\065' + chr(0b10001 + 0o42), 0b1000), ehT0Px3KOsy9(chr(1618 - 1570) + chr(0b110100 + 0o73) + chr(1348 - 1298) + chr(718 - 663) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + '\063' + chr(0b110110), 37542 - 37534)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\065' + chr(75 - 27), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x16'), chr(100) + chr(2547 - 2446) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(3611 - 3510))(chr(12561 - 12444) + chr(0b1110100) + chr(0b1100110) + chr(0b10010 + 0o33) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def i0KyWj_CCoSU(oVre8I6UXc3b, YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, VLvcJ7GMO57L): try: DHj5qrh9UrLE = oVre8I6UXc3b.trading_calendar.minutes_window(H53hAzPUC6Rt, -g2GEhO4QQANY) except RQ6CSRrFArYB: xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'gv\x95cWB U|\x9e\x8e\xee \x9f1\xed\xfeS"30B7\xa0S?8e\x9f\xc1%\xa5l\xfc\xfc\xfd'), chr(4156 - 4056) + chr(5918 - 5817) + '\x63' + chr(6068 - 5957) + '\144' + chr(101))(chr(10794 - 10677) + chr(116) + chr(10182 - 10080) + '\055' + '\x38'))(g2GEhO4QQANY) if DHj5qrh9UrLE[ehT0Px3KOsy9(chr(48) + chr(8710 - 8599) + chr(48), 4505 - 4497)] < xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"gx\x9d\x7f@Z\x1a~c\x96\x84\xf2:\x9d1\xe8\xfeN#('"), chr(0b1100100) + chr(9128 - 9027) + chr(0b10001 + 0o122) + '\157' + '\144' + chr(7310 - 7209))(chr(0b1110101) + '\164' + chr(5221 - 5119) + '\055' + chr(56))): xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'gv\x95cWB U|\x9e\x8e\xee \x9f1\xed\xfeS"30B7\xa0S?8e\x9f\xc1%\xa5l\xfc\xfc\xfd'), chr(100) + chr(101) + chr(0b1100011) + '\157' + chr(0b1100100) + chr(0b1011111 + 0o6))(chr(10256 - 10139) + '\164' + chr(102) + chr(0b101101) + chr(3079 - 3023)))(g2GEhO4QQANY) ULi2JQpZUAwC = oVre8I6UXc3b._get_minute_window_data(YGFU3oxACPcg, VLvcJ7GMO57L, DHj5qrh9UrLE) return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'|\x7f\x80lu\\$gt'), '\144' + chr(0b11000 + 0o115) + chr(0b1010001 + 0o22) + '\x6f' + '\144' + chr(422 - 321))(chr(117) + '\x74' + chr(3419 - 3317) + chr(45) + chr(2323 - 2267)))(ULi2JQpZUAwC, index=DHj5qrh9UrLE, columns=YGFU3oxACPcg)
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_history_window
def get_history_window(self, assets, end_dt, bar_count, frequency, field, data_frequency, ffill=True): """ Public API method that returns a dataframe containing the requested history window. Data is fully adjusted. Parameters ---------- assets : list of zipline.data.Asset objects The assets whose data is desired. bar_count: int The number of bars desired. frequency: string "1d" or "1m" field: string The desired field of the asset. data_frequency: string The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars. ffill: boolean Forward-fill missing values. Only has effect if field is 'price'. Returns ------- A dataframe containing the requested data. """ if field not in OHLCVP_FIELDS and field != 'sid': raise ValueError("Invalid field: {0}".format(field)) if bar_count < 1: raise ValueError( "bar_count must be >= 1, but got {}".format(bar_count) ) if frequency == "1d": if field == "price": df = self._get_history_daily_window(assets, end_dt, bar_count, "close", data_frequency) else: df = self._get_history_daily_window(assets, end_dt, bar_count, field, data_frequency) elif frequency == "1m": if field == "price": df = self._get_history_minute_window(assets, end_dt, bar_count, "close") else: df = self._get_history_minute_window(assets, end_dt, bar_count, field) else: raise ValueError("Invalid frequency: {0}".format(frequency)) # forward-fill price if field == "price": if frequency == "1m": ffill_data_frequency = 'minute' elif frequency == "1d": ffill_data_frequency = 'daily' else: raise Exception( "Only 1d and 1m are supported for forward-filling.") assets_with_leading_nan = np.where(isnull(df.iloc[0]))[0] history_start, history_end = df.index[[0, -1]] if ffill_data_frequency == 'daily' and data_frequency == 'minute': # When we're looking for a daily value, but we haven't seen any # volume in today's minute bars yet, we need to use the # previous day's ffilled daily price. Using today's daily price # could yield a value from later today. history_start -= self.trading_calendar.day initial_values = [] for asset in df.columns[assets_with_leading_nan]: last_traded = self.get_last_traded_dt( asset, history_start, ffill_data_frequency, ) if isnull(last_traded): initial_values.append(nan) else: initial_values.append( self.get_adjusted_value( asset, field, dt=last_traded, perspective_dt=history_end, data_frequency=ffill_data_frequency, ) ) # Set leading values for assets that were missing data, then ffill. df.ix[0, assets_with_leading_nan] = np.array( initial_values, dtype=np.float64 ) df.fillna(method='ffill', inplace=True) # forward-filling will incorrectly produce values after the end of # an asset's lifetime, so write NaNs back over the asset's # end_date. normed_index = df.index.normalize() for asset in df.columns: if history_end >= asset.end_date: # if the window extends past the asset's end date, set # all post-end-date values to NaN in that asset's series df.loc[normed_index > asset.end_date, asset] = nan return df
python
def get_history_window(self, assets, end_dt, bar_count, frequency, field, data_frequency, ffill=True): """ Public API method that returns a dataframe containing the requested history window. Data is fully adjusted. Parameters ---------- assets : list of zipline.data.Asset objects The assets whose data is desired. bar_count: int The number of bars desired. frequency: string "1d" or "1m" field: string The desired field of the asset. data_frequency: string The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars. ffill: boolean Forward-fill missing values. Only has effect if field is 'price'. Returns ------- A dataframe containing the requested data. """ if field not in OHLCVP_FIELDS and field != 'sid': raise ValueError("Invalid field: {0}".format(field)) if bar_count < 1: raise ValueError( "bar_count must be >= 1, but got {}".format(bar_count) ) if frequency == "1d": if field == "price": df = self._get_history_daily_window(assets, end_dt, bar_count, "close", data_frequency) else: df = self._get_history_daily_window(assets, end_dt, bar_count, field, data_frequency) elif frequency == "1m": if field == "price": df = self._get_history_minute_window(assets, end_dt, bar_count, "close") else: df = self._get_history_minute_window(assets, end_dt, bar_count, field) else: raise ValueError("Invalid frequency: {0}".format(frequency)) # forward-fill price if field == "price": if frequency == "1m": ffill_data_frequency = 'minute' elif frequency == "1d": ffill_data_frequency = 'daily' else: raise Exception( "Only 1d and 1m are supported for forward-filling.") assets_with_leading_nan = np.where(isnull(df.iloc[0]))[0] history_start, history_end = df.index[[0, -1]] if ffill_data_frequency == 'daily' and data_frequency == 'minute': # When we're looking for a daily value, but we haven't seen any # volume in today's minute bars yet, we need to use the # previous day's ffilled daily price. Using today's daily price # could yield a value from later today. history_start -= self.trading_calendar.day initial_values = [] for asset in df.columns[assets_with_leading_nan]: last_traded = self.get_last_traded_dt( asset, history_start, ffill_data_frequency, ) if isnull(last_traded): initial_values.append(nan) else: initial_values.append( self.get_adjusted_value( asset, field, dt=last_traded, perspective_dt=history_end, data_frequency=ffill_data_frequency, ) ) # Set leading values for assets that were missing data, then ffill. df.ix[0, assets_with_leading_nan] = np.array( initial_values, dtype=np.float64 ) df.fillna(method='ffill', inplace=True) # forward-filling will incorrectly produce values after the end of # an asset's lifetime, so write NaNs back over the asset's # end_date. normed_index = df.index.normalize() for asset in df.columns: if history_end >= asset.end_date: # if the window extends past the asset's end date, set # all post-end-date values to NaN in that asset's series df.loc[normed_index > asset.end_date, asset] = nan return df
[ "def", "get_history_window", "(", "self", ",", "assets", ",", "end_dt", ",", "bar_count", ",", "frequency", ",", "field", ",", "data_frequency", ",", "ffill", "=", "True", ")", ":", "if", "field", "not", "in", "OHLCVP_FIELDS", "and", "field", "!=", "'sid'", ":", "raise", "ValueError", "(", "\"Invalid field: {0}\"", ".", "format", "(", "field", ")", ")", "if", "bar_count", "<", "1", ":", "raise", "ValueError", "(", "\"bar_count must be >= 1, but got {}\"", ".", "format", "(", "bar_count", ")", ")", "if", "frequency", "==", "\"1d\"", ":", "if", "field", "==", "\"price\"", ":", "df", "=", "self", ".", "_get_history_daily_window", "(", "assets", ",", "end_dt", ",", "bar_count", ",", "\"close\"", ",", "data_frequency", ")", "else", ":", "df", "=", "self", ".", "_get_history_daily_window", "(", "assets", ",", "end_dt", ",", "bar_count", ",", "field", ",", "data_frequency", ")", "elif", "frequency", "==", "\"1m\"", ":", "if", "field", "==", "\"price\"", ":", "df", "=", "self", ".", "_get_history_minute_window", "(", "assets", ",", "end_dt", ",", "bar_count", ",", "\"close\"", ")", "else", ":", "df", "=", "self", ".", "_get_history_minute_window", "(", "assets", ",", "end_dt", ",", "bar_count", ",", "field", ")", "else", ":", "raise", "ValueError", "(", "\"Invalid frequency: {0}\"", ".", "format", "(", "frequency", ")", ")", "# forward-fill price", "if", "field", "==", "\"price\"", ":", "if", "frequency", "==", "\"1m\"", ":", "ffill_data_frequency", "=", "'minute'", "elif", "frequency", "==", "\"1d\"", ":", "ffill_data_frequency", "=", "'daily'", "else", ":", "raise", "Exception", "(", "\"Only 1d and 1m are supported for forward-filling.\"", ")", "assets_with_leading_nan", "=", "np", ".", "where", "(", "isnull", "(", "df", ".", "iloc", "[", "0", "]", ")", ")", "[", "0", "]", "history_start", ",", "history_end", "=", "df", ".", "index", "[", "[", "0", ",", "-", "1", "]", "]", "if", "ffill_data_frequency", "==", "'daily'", "and", "data_frequency", "==", "'minute'", ":", "# When we're looking for a daily value, but we haven't seen any", "# volume in today's minute bars yet, we need to use the", "# previous day's ffilled daily price. Using today's daily price", "# could yield a value from later today.", "history_start", "-=", "self", ".", "trading_calendar", ".", "day", "initial_values", "=", "[", "]", "for", "asset", "in", "df", ".", "columns", "[", "assets_with_leading_nan", "]", ":", "last_traded", "=", "self", ".", "get_last_traded_dt", "(", "asset", ",", "history_start", ",", "ffill_data_frequency", ",", ")", "if", "isnull", "(", "last_traded", ")", ":", "initial_values", ".", "append", "(", "nan", ")", "else", ":", "initial_values", ".", "append", "(", "self", ".", "get_adjusted_value", "(", "asset", ",", "field", ",", "dt", "=", "last_traded", ",", "perspective_dt", "=", "history_end", ",", "data_frequency", "=", "ffill_data_frequency", ",", ")", ")", "# Set leading values for assets that were missing data, then ffill.", "df", ".", "ix", "[", "0", ",", "assets_with_leading_nan", "]", "=", "np", ".", "array", "(", "initial_values", ",", "dtype", "=", "np", ".", "float64", ")", "df", ".", "fillna", "(", "method", "=", "'ffill'", ",", "inplace", "=", "True", ")", "# forward-filling will incorrectly produce values after the end of", "# an asset's lifetime, so write NaNs back over the asset's", "# end_date.", "normed_index", "=", "df", ".", "index", ".", "normalize", "(", ")", "for", "asset", "in", "df", ".", "columns", ":", "if", "history_end", ">=", "asset", ".", "end_date", ":", "# if the window extends past the asset's end date, set", "# all post-end-date values to NaN in that asset's series", "df", ".", "loc", "[", "normed_index", ">", "asset", ".", "end_date", ",", "asset", "]", "=", "nan", "return", "df" ]
Public API method that returns a dataframe containing the requested history window. Data is fully adjusted. Parameters ---------- assets : list of zipline.data.Asset objects The assets whose data is desired. bar_count: int The number of bars desired. frequency: string "1d" or "1m" field: string The desired field of the asset. data_frequency: string The frequency of the data to query; i.e. whether the data is 'daily' or 'minute' bars. ffill: boolean Forward-fill missing values. Only has effect if field is 'price'. Returns ------- A dataframe containing the requested data.
[ "Public", "API", "method", "that", "returns", "a", "dataframe", "containing", "the", "requested", "history", "window", ".", "Data", "is", "fully", "adjusted", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L915-L1034
train
Returns a dataframe containing the requested data for the specified assets and bar count and frequency.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF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rokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(0b110111 + 0o70) + '\061' + chr(0b110001) + chr(54), 0o10), ehT0Px3KOsy9('\060' + chr(0b1100100 + 0o13) + chr(0b11000 + 0o31) + '\x37' + '\066', 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(54) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1101111) + chr(0b110001) + chr(53) + '\060', 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(0b110001) + chr(0b101 + 0o61) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(3241 - 3130) + chr(52) + '\x31', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111 + 0o0) + '\063' + chr(0b110001 + 0o6) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(1831 - 1783) + '\x6f' + chr(0b1100 + 0o51) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110000) + chr(1023 - 972), 39730 - 39722), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1001101 + 0o42) + '\x33' + chr(0b100000 + 0o20) + chr(0b110011), 29183 - 29175), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + '\x31' + chr(1717 - 1663) + '\060', 13479 - 13471), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101001 + 0o12) + chr(0b11011 + 0o27) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1349 - 1299) + chr(419 - 365) + chr(1154 - 1105), 0b1000), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + '\063' + '\x30' + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2222 - 2173) + chr(0b110110) + chr(0b10011 + 0o36), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(149 - 97), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\064' + chr(0b10000 + 0o43), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11000 + 0o33) + '\067' + chr(485 - 433), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(111) + chr(0b110001) + chr(0b11101 + 0o32) + chr(221 - 168), 23071 - 23063), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(526 - 474) + chr(52), 40599 - 40591), ehT0Px3KOsy9(chr(48) + chr(0b110011 + 0o74) + chr(0b110001) + chr(0b110110), 23503 - 23495), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\063' + chr(50) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(9183 - 9072) + '\061' + '\x30' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(2205 - 2157) + chr(0b1101111) + chr(50) + chr(52) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b110001 + 0o76) + '\066', 1021 - 1013), ehT0Px3KOsy9(chr(48) + chr(0b1100001 + 0o16) + chr(2545 - 2494) + chr(54) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(52) + '\x34', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(0b10101 + 0o33) + chr(0b110101), 45353 - 45345), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(963 - 912) + '\060' + chr(718 - 670), 48970 - 48962), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x37' + chr(0b101001 + 0o14), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10001 + 0o45) + chr(534 - 480), 0o10), ehT0Px3KOsy9(chr(780 - 732) + chr(111) + '\x33' + '\x35' + chr(0b110100), 44439 - 44431), ehT0Px3KOsy9('\x30' + chr(0b1001111 + 0o40) + '\x32' + chr(48) + '\x30', 18984 - 18976), ehT0Px3KOsy9('\060' + chr(111) + '\062' + chr(1326 - 1273) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + '\x33' + '\064' + '\062', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(2266 - 2216) + chr(2770 - 2717) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(50) + '\066' + chr(52), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(0b1000 + 0o52), 29210 - 29202), ehT0Px3KOsy9('\x30' + chr(0b1010110 + 0o31) + '\063' + chr(755 - 707) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1 + 0o60) + '\066' + '\x37', 13640 - 13632)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(7432 - 7321) + chr(53) + chr(1583 - 1535), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'`'), chr(9826 - 9726) + '\145' + '\143' + '\157' + chr(4592 - 4492) + chr(1988 - 1887))(chr(0b100100 + 0o121) + chr(0b1110011 + 0o1) + chr(102) + '\055' + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def wuseQxaJ5aj7(oVre8I6UXc3b, YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, pOUplog6yHx6, fEcfxx4smAdS, bXS4MokNqKbm, EtZxbtRXEm8n=ehT0Px3KOsy9(chr(1852 - 1804) + chr(0b1101111) + chr(49), 0o10)): if fEcfxx4smAdS not in dyNUaosrdetd and fEcfxx4smAdS != xafqLlk3kkUe(SXOLrMavuUCe(b'=\x17V'), chr(0b1100100) + chr(1394 - 1293) + '\143' + '\x6f' + chr(9745 - 9645) + '\x65')(chr(0b1110101) + chr(0b10 + 0o162) + chr(102) + chr(0b101101) + chr(56)): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x10D\t\x1eH\x99\x0f%\xaa\x15\xbe\xd5\xffQoS\x81'), chr(0b10100 + 0o120) + '\x65' + '\x63' + chr(0b1101111) + '\x64' + chr(101))(chr(9027 - 8910) + chr(0b1110100) + chr(0b1100000 + 0o6) + chr(0b11000 + 0o25) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x18J@\x07:@\xae\x1c\x13\xb3\x15\xb8'), chr(100) + chr(101) + chr(0b1100011) + chr(6604 - 6493) + '\144' + '\x65')(chr(0b1110101) + chr(0b111011 + 0o71) + chr(0b100111 + 0o77) + chr(45) + chr(0b10 + 0o66)))(fEcfxx4smAdS)) if g2GEhO4QQANY < ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + '\x31', 8): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b',\x1f@7\x11N\x88A7\xe3\x1d\xa7\xc2\xb1Qv\x06\xdcC\x99.\xe1h\x86d\x80\x10e\xa7RB\xcc\xfb\xd0'), '\144' + chr(0b100011 + 0o102) + chr(2944 - 2845) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(0b1001010 + 0o53) + chr(116) + chr(8770 - 8668) + chr(45) + chr(0b10010 + 0o46)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x18J@\x07:@\xae\x1c\x13\xb3\x15\xb8'), chr(100) + '\x65' + '\x63' + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b110100 + 0o101) + '\164' + '\x66' + chr(0b101101) + chr(0b110000 + 0o10)))(g2GEhO4QQANY)) if pOUplog6yHx6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\x1a'), chr(0b1100100) + chr(101) + chr(99) + chr(0b1101111) + chr(100) + chr(5878 - 5777))(chr(0b1110101) + chr(116) + chr(0b1100110) + '\x2d' + chr(56)): if fEcfxx4smAdS == xafqLlk3kkUe(SXOLrMavuUCe(b'>\x0c[\x0b\x17'), '\144' + chr(0b111000 + 0o55) + chr(0b11000 + 0o113) + chr(0b1101111) + chr(0b1100100) + chr(0b1100101))(chr(0b100000 + 0o125) + chr(0b101100 + 0o110) + chr(0b1100110) + chr(0b0 + 0o55) + '\070'): aVhM9WzaWXU5 = oVre8I6UXc3b._get_history_daily_window(YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, xafqLlk3kkUe(SXOLrMavuUCe(b'-\x12]\x1b\x17'), chr(0b1100100 + 0o0) + chr(101) + chr(0b111100 + 0o47) + chr(0b101 + 0o152) + '\x64' + chr(101))(chr(117) + chr(8261 - 8145) + '\x66' + '\055' + chr(0b111000)), bXS4MokNqKbm) else: aVhM9WzaWXU5 = oVre8I6UXc3b._get_history_daily_window(YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, fEcfxx4smAdS, bXS4MokNqKbm) elif pOUplog6yHx6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\x13'), chr(100) + chr(2646 - 2545) + '\x63' + chr(111) + chr(0b1100100) + '\145')('\x75' + '\164' + chr(8104 - 8002) + chr(1076 - 1031) + chr(56)): if fEcfxx4smAdS == xafqLlk3kkUe(SXOLrMavuUCe(b'>\x0c[\x0b\x17'), chr(7090 - 6990) + chr(7232 - 7131) + '\143' + chr(0b1101111) + chr(100) + chr(0b110000 + 0o65))(chr(0b111 + 0o156) + '\164' + '\x66' + '\x2d' + chr(1670 - 1614)): aVhM9WzaWXU5 = oVre8I6UXc3b._get_history_minute_window(YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, xafqLlk3kkUe(SXOLrMavuUCe(b'-\x12]\x1b\x17'), chr(100) + '\x65' + chr(0b1100011) + '\157' + '\x64' + '\x65')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(0b1110 + 0o37) + chr(56))) else: aVhM9WzaWXU5 = oVre8I6UXc3b._get_history_minute_window(YGFU3oxACPcg, H53hAzPUC6Rt, g2GEhO4QQANY, fEcfxx4smAdS) else: raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\x10D\t\x1eH\x99\x0f%\xb1\x15\xa3\xc4\xa0\x1fw\x1a\xc6]\xdf>\xad'), '\144' + chr(101) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(0b110000 + 0o65))(chr(0b110101 + 0o100) + '\x74' + chr(0b110001 + 0o65) + chr(972 - 927) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x18J@\x07:@\xae\x1c\x13\xb3\x15\xb8'), chr(100) + '\145' + chr(99) + chr(111) + chr(3780 - 3680) + '\x65')(chr(0b1011001 + 0o34) + chr(116) + chr(0b1100110) + chr(45) + chr(0b111000)))(pOUplog6yHx6)) if fEcfxx4smAdS == xafqLlk3kkUe(SXOLrMavuUCe(b'>\x0c[\x0b\x17'), chr(0b1100100) + chr(949 - 848) + '\x63' + '\x6f' + '\x64' + chr(101))(chr(0b1110101) + '\164' + '\146' + '\x2d' + chr(56)): if pOUplog6yHx6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\x13'), '\144' + '\x65' + '\x63' + chr(111) + '\x64' + chr(0b1011111 + 0o6))(chr(117) + '\x74' + chr(0b1100110) + chr(1805 - 1760) + '\070'): SnXPDe6qZvUl = xafqLlk3kkUe(SXOLrMavuUCe(b'#\x17\\\x1d\x06D'), chr(0b11110 + 0o106) + chr(101) + chr(0b1100011) + '\x6f' + chr(0b100110 + 0o76) + chr(101))(chr(8907 - 8790) + chr(0b1110100) + chr(0b1100110) + '\x2d' + '\x38') elif pOUplog6yHx6 == xafqLlk3kkUe(SXOLrMavuUCe(b'\x7f\x1a'), chr(0b1100100) + chr(101) + chr(0b111111 + 0o44) + chr(6643 - 6532) + chr(0b1100100) + '\x65')(chr(117) + chr(0b1000000 + 0o64) + chr(0b1100110) + '\x2d' + '\x38'): SnXPDe6qZvUl = xafqLlk3kkUe(SXOLrMavuUCe(b'*\x1f[\x04\x0b'), chr(0b10101 + 0o117) + chr(0b1000011 + 0o42) + chr(2310 - 2211) + chr(0b110 + 0o151) + '\x64' + chr(0b1010001 + 0o24))(chr(6693 - 6576) + '\x74' + chr(0b1010010 + 0o24) + chr(0b100010 + 0o13) + '\070') else: raise jLmadlzMdunT(xafqLlk3kkUe(SXOLrMavuUCe(b'\x01\x10^\x11R\x10\x99\x0f"\xad\x14\xf2\x80\xa8Qu\x11\x99]\xd7{\xa04\xc9t\x81\x01!\xe0[Y\x9e\xa0\xcb\x8d\xdb\xc3{\xb0\x13c\x18[\x04\x1eH\x93Hm'), '\144' + '\145' + chr(99) + '\157' + chr(0b101100 + 0o70) + '\x65')(chr(0b1110101) + '\x74' + '\146' + '\055' + chr(56))) AGBmP0sY_gRT = WqUC3KWvYVup.dRFAC59yQBm_(R4EGdzBGz77Q(aVhM9WzaWXU5.j91vOdIHACRC[ehT0Px3KOsy9(chr(48) + chr(0b100010 + 0o115) + chr(0b10101 + 0o33), ord("\x08"))]))[ehT0Px3KOsy9(chr(2181 - 2133) + chr(6960 - 6849) + '\x30', 8)] (P5ze0RkKB8P_, QW0C5MAsWCOR) = aVhM9WzaWXU5.XdowRbJKZWL9[[ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\x6f' + chr(48), 8), -ehT0Px3KOsy9(chr(48) + chr(0b1011011 + 0o24) + '\x31', 8)]] if SnXPDe6qZvUl == xafqLlk3kkUe(SXOLrMavuUCe(b'*\x1f[\x04\x0b'), chr(100) + chr(0b101110 + 0o67) + chr(99) + chr(111) + chr(0b1100100) + chr(0b1100101))(chr(117) + chr(12463 - 12347) + chr(2295 - 2193) + chr(394 - 349) + chr(1064 - 1008)) and bXS4MokNqKbm == xafqLlk3kkUe(SXOLrMavuUCe(b'#\x17\\\x1d\x06D'), chr(7327 - 7227) + chr(101) + '\x63' + chr(10181 - 10070) + chr(0b10110 + 0o116) + '\145')(chr(2162 - 2045) + chr(0b101001 + 0o113) + '\146' + '\055' + chr(0b10010 + 0o46)): P5ze0RkKB8P_ -= oVre8I6UXc3b.trading_calendar.day RHT7xkD9A1Bo = [] for tKJAwKiE1Zya in xafqLlk3kkUe(aVhM9WzaWXU5, xafqLlk3kkUe(SXOLrMavuUCe(b'?5^00U\x93\x1c\x13\x88\t\xe6'), chr(100) + chr(0b1100101) + chr(7259 - 7160) + chr(0b111100 + 0o63) + chr(100) + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + chr(0b10 + 0o53) + chr(0b111000)))[AGBmP0sY_gRT]: GvIc_qcyrsD6 = oVre8I6UXc3b.get_last_traded_dt(tKJAwKiE1Zya, P5ze0RkKB8P_, SnXPDe6qZvUl) if R4EGdzBGz77Q(GvIc_qcyrsD6): xafqLlk3kkUe(RHT7xkD9A1Bo, xafqLlk3kkUe(SXOLrMavuUCe(b'/\x0eB\r\x1cE'), '\144' + chr(101) + '\143' + '\157' + '\144' + chr(0b1000000 + 0o45))(chr(0b1110101) + chr(0b1110100) + chr(6357 - 6255) + chr(45) + '\070'))(wL5W1xj47aOd) else: xafqLlk3kkUe(RHT7xkD9A1Bo, xafqLlk3kkUe(SXOLrMavuUCe(b'/\x0eB\r\x1cE'), '\144' + chr(0b1100101) + chr(0b1011010 + 0o11) + chr(0b1101111) + chr(100) + '\145')('\x75' + '\x74' + chr(0b1001010 + 0o34) + chr(0b101101) + chr(59 - 3)))(xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b')\x1bF7\x13E\x97Z0\xb7\x15\xb6\xee\xb3\x10x\x16\x99'), chr(0b1010111 + 0o15) + chr(4999 - 4898) + chr(6386 - 6287) + chr(111) + chr(0b1100100) + chr(7203 - 7102))(chr(0b1110101) + chr(2630 - 2514) + chr(2686 - 2584) + chr(0b1111 + 0o36) + chr(56)))(tKJAwKiE1Zya, fEcfxx4smAdS, dt=GvIc_qcyrsD6, perspective_dt=QW0C5MAsWCOR, data_frequency=SnXPDe6qZvUl)) aVhM9WzaWXU5.NhWUxmSUCcoW[ehT0Px3KOsy9('\x30' + chr(111) + '\x30', 8), AGBmP0sY_gRT] = WqUC3KWvYVup.B0ePDhpqxN5n(RHT7xkD9A1Bo, dtype=WqUC3KWvYVup.float64) xafqLlk3kkUe(aVhM9WzaWXU5, xafqLlk3kkUe(SXOLrMavuUCe(b'(\x17^\x04\x1c@'), chr(100) + chr(0b1100101) + chr(0b11000 + 0o113) + chr(0b1000000 + 0o57) + chr(0b1100100) + chr(0b1100101))('\x75' + chr(116) + chr(102) + chr(0b101101) + chr(0b111000)))(method=xafqLlk3kkUe(SXOLrMavuUCe(b'(\x18[\x04\x1e'), chr(7096 - 6996) + '\x65' + chr(0b1100011) + '\157' + '\144' + '\x65')(chr(0b11010 + 0o133) + '\164' + chr(0b10111 + 0o117) + chr(1033 - 988) + chr(2259 - 2203)), inplace=ehT0Px3KOsy9(chr(2215 - 2167) + chr(2242 - 2131) + chr(0b11111 + 0o22), 8)) ln5PhSj0tNW8 = aVhM9WzaWXU5.index.IOBK62gJSlOh() for tKJAwKiE1Zya in xafqLlk3kkUe(aVhM9WzaWXU5, xafqLlk3kkUe(SXOLrMavuUCe(b'?5^00U\x93\x1c\x13\x88\t\xe6'), chr(0b1100100 + 0o0) + '\145' + '\x63' + '\157' + '\x64' + chr(0b1100101))(chr(7140 - 7023) + chr(6102 - 5986) + chr(0b1100110) + chr(45) + chr(56))): if QW0C5MAsWCOR >= xafqLlk3kkUe(tKJAwKiE1Zya, xafqLlk3kkUe(SXOLrMavuUCe(b'+\x10V7\x16@\x89J'), chr(8249 - 8149) + chr(7648 - 7547) + chr(0b1010010 + 0o21) + chr(0b11010 + 0o125) + chr(100) + chr(101))(chr(117) + chr(10853 - 10737) + chr(0b1000 + 0o136) + '\x2d' + chr(56))): aVhM9WzaWXU5.MmVY7Id_ODNA[ln5PhSj0tNW8 > tKJAwKiE1Zya.joOGoPpJ_sck, tKJAwKiE1Zya] = wL5W1xj47aOd return aVhM9WzaWXU5
quantopian/zipline
zipline/data/data_portal.py
DataPortal._get_minute_window_data
def _get_minute_window_data(self, assets, field, minutes_for_window): """ Internal method that gets a window of adjusted minute data for an asset and specified date range. Used to support the history API method for minute bars. Missing bars are filled with NaN. Parameters ---------- assets : iterable[Asset] The assets whose data is desired. field: string The specific field to return. "open", "high", "close_price", etc. minutes_for_window: pd.DateTimeIndex The list of minutes representing the desired window. Each minute is a pd.Timestamp. Returns ------- A numpy array with requested values. """ return self._minute_history_loader.history(assets, minutes_for_window, field, False)
python
def _get_minute_window_data(self, assets, field, minutes_for_window): """ Internal method that gets a window of adjusted minute data for an asset and specified date range. Used to support the history API method for minute bars. Missing bars are filled with NaN. Parameters ---------- assets : iterable[Asset] The assets whose data is desired. field: string The specific field to return. "open", "high", "close_price", etc. minutes_for_window: pd.DateTimeIndex The list of minutes representing the desired window. Each minute is a pd.Timestamp. Returns ------- A numpy array with requested values. """ return self._minute_history_loader.history(assets, minutes_for_window, field, False)
[ "def", "_get_minute_window_data", "(", "self", ",", "assets", ",", "field", ",", "minutes_for_window", ")", ":", "return", "self", ".", "_minute_history_loader", ".", "history", "(", "assets", ",", "minutes_for_window", ",", "field", ",", "False", ")" ]
Internal method that gets a window of adjusted minute data for an asset and specified date range. Used to support the history API method for minute bars. Missing bars are filled with NaN. Parameters ---------- assets : iterable[Asset] The assets whose data is desired. field: string The specific field to return. "open", "high", "close_price", etc. minutes_for_window: pd.DateTimeIndex The list of minutes representing the desired window. Each minute is a pd.Timestamp. Returns ------- A numpy array with requested values.
[ "Internal", "method", "that", "gets", "a", "window", "of", "adjusted", "minute", "data", "for", "an", "asset", "and", "specified", "date", "range", ".", "Used", "to", "support", "the", "history", "API", "method", "for", "minute", "bars", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L1036-L1063
train
Internal method that returns a window of adjusted minute data for an asset and a specific field.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ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iMiVQ77y,bsS9P6_LpdIe,sbGAZlkZOtyh,Cf_Qef15s3_F,eX02hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b10110 + 0o33) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100000 + 0o23) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b10101 + 0o37) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\157' + chr(0b101000 + 0o13) + '\x30', 0b1000), ehT0Px3KOsy9(chr(305 - 257) + chr(111) + '\x33' + '\066' + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(541 - 492) + chr(0b110100) + '\063', 0o10), ehT0Px3KOsy9('\060' + chr(0b110101 + 0o72) + '\062' + '\063' + chr(1740 - 1691), 0o10), ehT0Px3KOsy9(chr(48) + chr(1523 - 1412) + chr(51) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\x6f' + '\061' + chr(0b110110), 8), ehT0Px3KOsy9(chr(48) + chr(5564 - 5453) + chr(50) + '\x30' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101111) + chr(0b110010) + '\060', 0o10), ehT0Px3KOsy9('\060' + '\157' + '\061' + chr(1459 - 1409) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10 + 0o60) + chr(0b111 + 0o52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110110 + 0o71) + '\x31' + chr(49) + chr(2148 - 2098), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(7174 - 7063) + chr(53) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b110010) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(925 - 874) + chr(2057 - 2003) + chr(0b1110 + 0o47), 14157 - 14149), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(347 - 236) + '\x32' + chr(815 - 765) + '\x35', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + chr(0b1001 + 0o50) + chr(0b110110) + chr(0b1 + 0o61), 55953 - 55945), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110011) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(4139 - 4028) + chr(53), 10920 - 10912), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(50) + chr(53), 23139 - 23131), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(740 - 692) + chr(111) + '\x31' + chr(0b110001) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + '\x31' + chr(0b110101) + chr(586 - 535), 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b110000), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b110101) + chr(0b110111), 23363 - 23355), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(51) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(6547 - 6436) + '\061' + chr(49) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(163 - 115) + chr(111) + chr(0b101100 + 0o7) + chr(54) + '\066', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + '\x33' + chr(0b1110 + 0o46), 34927 - 34919), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(111) + chr(51) + chr(0b10001 + 0o40) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b100110 + 0o111) + chr(0b110001) + chr(48) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7772 - 7661) + chr(1781 - 1732) + '\x31' + chr(0b110000 + 0o0), 33823 - 33815), ehT0Px3KOsy9(chr(48) + chr(0b1100100 + 0o13) + '\x31' + chr(50) + chr(53), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(50) + chr(53) + '\066', 0b1000), ehT0Px3KOsy9(chr(2096 - 2048) + chr(111) + chr(735 - 686) + chr(1617 - 1564) + chr(0b10101 + 0o42), 8), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(0b101110 + 0o101) + '\067' + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(54) + chr(0b100000 + 0o27), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(943 - 892) + '\066', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\157' + chr(0b111 + 0o56) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b' '), '\x64' + chr(0b1100101 + 0o0) + chr(0b1100010 + 0o1) + chr(2144 - 2033) + chr(100) + chr(101))('\x75' + chr(0b1110000 + 0o4) + chr(0b1100110) + chr(0b101101) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def _FesL0MYz33t(oVre8I6UXc3b, YGFU3oxACPcg, fEcfxx4smAdS, DHj5qrh9UrLE): return xafqLlk3kkUe(oVre8I6UXc3b._minute_history_loader, xafqLlk3kkUe(SXOLrMavuUCe(b'}^\x90S\xc00\xd5x^\xeeT\x16'), chr(0b1001111 + 0o25) + chr(0b1100101) + chr(99) + chr(3388 - 3277) + chr(0b1100100) + '\x65')(chr(117) + chr(6928 - 6812) + chr(0b110000 + 0o66) + '\x2d' + chr(0b10001 + 0o47)))(YGFU3oxACPcg, DHj5qrh9UrLE, fEcfxx4smAdS, ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x30', 8))
quantopian/zipline
zipline/data/data_portal.py
DataPortal._get_daily_window_data
def _get_daily_window_data(self, assets, field, days_in_window, extra_slot=True): """ Internal method that gets a window of adjusted daily data for a sid and specified date range. Used to support the history API method for daily bars. Parameters ---------- asset : Asset The asset whose data is desired. start_dt: pandas.Timestamp The start of the desired window of data. bar_count: int The number of days of data to return. field: string The specific field to return. "open", "high", "close_price", etc. extra_slot: boolean Whether to allocate an extra slot in the returned numpy array. This extra slot will hold the data for the last partial day. It's much better to create it here than to create a copy of the array later just to add a slot. Returns ------- A numpy array with requested values. Any missing slots filled with nan. """ bar_count = len(days_in_window) # create an np.array of size bar_count dtype = float64 if field != 'sid' else int64 if extra_slot: return_array = np.zeros((bar_count + 1, len(assets)), dtype=dtype) else: return_array = np.zeros((bar_count, len(assets)), dtype=dtype) if field != "volume": # volumes default to 0, so we don't need to put NaNs in the array return_array[:] = np.NAN if bar_count != 0: data = self._history_loader.history(assets, days_in_window, field, extra_slot) if extra_slot: return_array[:len(return_array) - 1, :] = data else: return_array[:len(data)] = data return return_array
python
def _get_daily_window_data(self, assets, field, days_in_window, extra_slot=True): """ Internal method that gets a window of adjusted daily data for a sid and specified date range. Used to support the history API method for daily bars. Parameters ---------- asset : Asset The asset whose data is desired. start_dt: pandas.Timestamp The start of the desired window of data. bar_count: int The number of days of data to return. field: string The specific field to return. "open", "high", "close_price", etc. extra_slot: boolean Whether to allocate an extra slot in the returned numpy array. This extra slot will hold the data for the last partial day. It's much better to create it here than to create a copy of the array later just to add a slot. Returns ------- A numpy array with requested values. Any missing slots filled with nan. """ bar_count = len(days_in_window) # create an np.array of size bar_count dtype = float64 if field != 'sid' else int64 if extra_slot: return_array = np.zeros((bar_count + 1, len(assets)), dtype=dtype) else: return_array = np.zeros((bar_count, len(assets)), dtype=dtype) if field != "volume": # volumes default to 0, so we don't need to put NaNs in the array return_array[:] = np.NAN if bar_count != 0: data = self._history_loader.history(assets, days_in_window, field, extra_slot) if extra_slot: return_array[:len(return_array) - 1, :] = data else: return_array[:len(data)] = data return return_array
[ "def", "_get_daily_window_data", "(", "self", ",", "assets", ",", "field", ",", "days_in_window", ",", "extra_slot", "=", "True", ")", ":", "bar_count", "=", "len", "(", "days_in_window", ")", "# create an np.array of size bar_count", "dtype", "=", "float64", "if", "field", "!=", "'sid'", "else", "int64", "if", "extra_slot", ":", "return_array", "=", "np", ".", "zeros", "(", "(", "bar_count", "+", "1", ",", "len", "(", "assets", ")", ")", ",", "dtype", "=", "dtype", ")", "else", ":", "return_array", "=", "np", ".", "zeros", "(", "(", "bar_count", ",", "len", "(", "assets", ")", ")", ",", "dtype", "=", "dtype", ")", "if", "field", "!=", "\"volume\"", ":", "# volumes default to 0, so we don't need to put NaNs in the array", "return_array", "[", ":", "]", "=", "np", ".", "NAN", "if", "bar_count", "!=", "0", ":", "data", "=", "self", ".", "_history_loader", ".", "history", "(", "assets", ",", "days_in_window", ",", "field", ",", "extra_slot", ")", "if", "extra_slot", ":", "return_array", "[", ":", "len", "(", "return_array", ")", "-", "1", ",", ":", "]", "=", "data", "else", ":", "return_array", "[", ":", "len", "(", "data", ")", "]", "=", "data", "return", "return_array" ]
Internal method that gets a window of adjusted daily data for a sid and specified date range. Used to support the history API method for daily bars. Parameters ---------- asset : Asset The asset whose data is desired. start_dt: pandas.Timestamp The start of the desired window of data. bar_count: int The number of days of data to return. field: string The specific field to return. "open", "high", "close_price", etc. extra_slot: boolean Whether to allocate an extra slot in the returned numpy array. This extra slot will hold the data for the last partial day. It's much better to create it here than to create a copy of the array later just to add a slot. Returns ------- A numpy array with requested values. Any missing slots filled with nan.
[ "Internal", "method", "that", "gets", "a", "window", "of", "adjusted", "daily", "data", "for", "a", "sid", "and", "specified", "date", "range", ".", "Used", "to", "support", "the", "history", "API", "method", "for", "daily", "bars", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L1065-L1122
train
Internal method that returns a daily window of data for a specific asset and a specific date range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,s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pgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\157' + chr(0b0 + 0o62) + '\067' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(53 - 4) + chr(0b110111) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101111) + chr(246 - 197) + '\x36' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(980 - 929) + chr(0b101001 + 0o7) + chr(0b110010), 29675 - 29667), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(111) + '\x31' + chr(2415 - 2361) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x32' + chr(0b0 + 0o61) + chr(1786 - 1732), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(1404 - 1354) + chr(0b11110 + 0o26), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110001) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(54) + chr(1704 - 1656), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101010 + 0o5) + chr(0b1011 + 0o50) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(2318 - 2268) + chr(1964 - 1916) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b101100 + 0o4) + '\157' + chr(50) + '\063' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(1988 - 1940) + '\157' + chr(1999 - 1950) + chr(0b100111 + 0o16) + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(7861 - 7750) + chr(0b110001) + '\x37', 0o10), ehT0Px3KOsy9(chr(1323 - 1275) + chr(10456 - 10345) + '\x31' + '\063' + chr(569 - 515), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b11 + 0o62) + '\060', 60995 - 60987), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(971 - 918) + chr(0b100 + 0o62), 3823 - 3815), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + '\x35' + chr(211 - 157), 44855 - 44847), ehT0Px3KOsy9('\x30' + chr(111) + chr(2273 - 2224) + chr(0b110101), 3651 - 3643), ehT0Px3KOsy9(chr(0b101100 + 0o4) + chr(0b1101111) + chr(2540 - 2487) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(251 - 203) + chr(9524 - 9413) + '\x31' + chr(0b11 + 0o55) + chr(0b1001 + 0o56), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11101 + 0o25) + chr(0b11100 + 0o26) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + chr(53) + chr(0b101111 + 0o7), 0o10), ehT0Px3KOsy9(chr(472 - 424) + chr(111) + chr(0b10000 + 0o45) + chr(0b10100 + 0o41), 8), ehT0Px3KOsy9(chr(48) + chr(0b1000011 + 0o54) + '\x35' + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(51) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(6500 - 6389) + '\x32' + chr(1174 - 1123) + '\x30', 3931 - 3923), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\065' + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1748 - 1697) + chr(50) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(0b110110) + chr(1241 - 1187), 41960 - 41952), ehT0Px3KOsy9(chr(1491 - 1443) + chr(0b1101111) + chr(0b10010 + 0o41) + chr(2131 - 2078), 41758 - 41750), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(1380 - 1332) + chr(0b100110 + 0o17), ord("\x08")), ehT0Px3KOsy9(chr(763 - 715) + chr(2211 - 2100) + chr(2768 - 2714) + chr(0b101010 + 0o10), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b111100 + 0o63) + '\x31' + chr(0b110111) + chr(53), 36493 - 36485), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b10011 + 0o134) + chr(0b110010) + chr(0b10101 + 0o35) + '\x35', 54304 - 54296), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(51) + chr(0b110100) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b101011 + 0o7) + chr(1185 - 1137) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1011010 + 0o25) + chr(1511 - 1461) + '\064' + chr(850 - 802), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2465 - 2415) + chr(2220 - 2171) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(0b100110 + 0o14) + chr(1977 - 1922) + chr(0b100001 + 0o21), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(3841 - 3730) + '\065' + chr(470 - 422), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x92'), '\144' + chr(101) + '\143' + chr(111) + chr(0b100010 + 0o102) + chr(0b1010010 + 0o23))(chr(117) + '\x74' + chr(0b1100110) + chr(45) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def KJDHH1IlAfRm(oVre8I6UXc3b, YGFU3oxACPcg, fEcfxx4smAdS, Dwu5Fs9jeB8X, rXADoMJAxDIu=ehT0Px3KOsy9(chr(0b110000) + chr(5454 - 5343) + chr(0b11000 + 0o31), 15808 - 15800)): g2GEhO4QQANY = c2A0yzQpDQB3(Dwu5Fs9jeB8X) jSV9IKnemH7K = UDFMTvC8EtwJ if fEcfxx4smAdS != xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf\x12\x12'), chr(0b111010 + 0o52) + chr(0b1000111 + 0o36) + chr(0b101000 + 0o73) + '\157' + chr(0b1100100) + chr(0b10 + 0o143))(chr(4817 - 4700) + '\164' + chr(102) + '\x2d' + chr(0b111000)) else RiF2m1w6Ige4 if rXADoMJAxDIu: pVWtcVpgJuJY = WqUC3KWvYVup.zeros((g2GEhO4QQANY + ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(2283 - 2234), 8), c2A0yzQpDQB3(YGFU3oxACPcg)), dtype=jSV9IKnemH7K) else: pVWtcVpgJuJY = WqUC3KWvYVup.zeros((g2GEhO4QQANY, c2A0yzQpDQB3(YGFU3oxACPcg)), dtype=jSV9IKnemH7K) if fEcfxx4smAdS != xafqLlk3kkUe(SXOLrMavuUCe(b'\xca\x14\x1a\xb7\x1e\xeb'), chr(0b1100100) + chr(101) + '\143' + '\x6f' + chr(100) + chr(101))(chr(0b100011 + 0o122) + chr(0b11110 + 0o126) + chr(0b1100110) + '\x2d' + chr(1491 - 1435)): pVWtcVpgJuJY[:] = WqUC3KWvYVup.NAN if g2GEhO4QQANY != ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110000), ord("\x08")): ULnjp6D6efFH = oVre8I6UXc3b._history_loader.sD1K7SLfPnDB(YGFU3oxACPcg, Dwu5Fs9jeB8X, fEcfxx4smAdS, rXADoMJAxDIu) if rXADoMJAxDIu: pVWtcVpgJuJY[:c2A0yzQpDQB3(pVWtcVpgJuJY) - ehT0Px3KOsy9('\x30' + chr(0b101000 + 0o107) + chr(0b1101 + 0o44), 8), :] = ULnjp6D6efFH else: pVWtcVpgJuJY[:c2A0yzQpDQB3(ULnjp6D6efFH)] = ULnjp6D6efFH return pVWtcVpgJuJY
quantopian/zipline
zipline/data/data_portal.py
DataPortal._get_adjustment_list
def _get_adjustment_list(self, asset, adjustments_dict, table_name): """ Internal method that returns a list of adjustments for the given sid. Parameters ---------- asset : Asset The asset for which to return adjustments. adjustments_dict: dict A dictionary of sid -> list that is used as a cache. table_name: string The table that contains this data in the adjustments db. Returns ------- adjustments: list A list of [multiplier, pd.Timestamp], earliest first """ if self._adjustment_reader is None: return [] sid = int(asset) try: adjustments = adjustments_dict[sid] except KeyError: adjustments = adjustments_dict[sid] = self._adjustment_reader.\ get_adjustments_for_sid(table_name, sid) return adjustments
python
def _get_adjustment_list(self, asset, adjustments_dict, table_name): """ Internal method that returns a list of adjustments for the given sid. Parameters ---------- asset : Asset The asset for which to return adjustments. adjustments_dict: dict A dictionary of sid -> list that is used as a cache. table_name: string The table that contains this data in the adjustments db. Returns ------- adjustments: list A list of [multiplier, pd.Timestamp], earliest first """ if self._adjustment_reader is None: return [] sid = int(asset) try: adjustments = adjustments_dict[sid] except KeyError: adjustments = adjustments_dict[sid] = self._adjustment_reader.\ get_adjustments_for_sid(table_name, sid) return adjustments
[ "def", "_get_adjustment_list", "(", "self", ",", "asset", ",", "adjustments_dict", ",", "table_name", ")", ":", "if", "self", ".", "_adjustment_reader", "is", "None", ":", "return", "[", "]", "sid", "=", "int", "(", "asset", ")", "try", ":", "adjustments", "=", "adjustments_dict", "[", "sid", "]", "except", "KeyError", ":", "adjustments", "=", "adjustments_dict", "[", "sid", "]", "=", "self", ".", "_adjustment_reader", ".", "get_adjustments_for_sid", "(", "table_name", ",", "sid", ")", "return", "adjustments" ]
Internal method that returns a list of adjustments for the given sid. Parameters ---------- asset : Asset The asset for which to return adjustments. adjustments_dict: dict A dictionary of sid -> list that is used as a cache. table_name: string The table that contains this data in the adjustments db. Returns ------- adjustments: list A list of [multiplier, pd.Timestamp], earliest first
[ "Internal", "method", "that", "returns", "a", "list", "of", "adjustments", "for", "the", "given", "sid", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L1124-L1156
train
Internal method that returns a list of adjustments for the given sid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFAr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,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + chr(0b11111 + 0o22) + chr(0b110111) + chr(0b101 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(10574 - 10463) + chr(0b10010 + 0o37) + chr(189 - 139), 42862 - 42854), ehT0Px3KOsy9(chr(0b110000) + chr(0b1000011 + 0o54) + '\062' + '\066' + '\x34', 59398 - 59390), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11100 + 0o26) + chr(49) + chr(2305 - 2254), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1902 - 1853) + chr(53) + chr(0b110010), 15416 - 15408), ehT0Px3KOsy9(chr(1562 - 1514) + '\157' + '\x33' + chr(2653 - 2599) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b100111 + 0o13) + chr(0b110011) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\066', 0o10), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + '\x31' + chr(48) + '\062', 51990 - 51982), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(111) + chr(49) + chr(53) + '\x30', 26793 - 26785), ehT0Px3KOsy9('\x30' + '\x6f' + '\063' + chr(0b110101) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\x31' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b101101 + 0o4) + '\x34', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b10110 + 0o35) + chr(0b101001 + 0o7) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(726 - 678) + chr(0b1001000 + 0o47) + '\063' + chr(305 - 251) + chr(2076 - 2028), 62750 - 62742), ehT0Px3KOsy9(chr(0b110000) + chr(8287 - 8176) + '\062' + '\x33' + chr(2172 - 2122), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110111) + chr(0b11000 + 0o33), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\063' + chr(50) + chr(0b101 + 0o54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b101 + 0o152) + chr(0b110001) + chr(55) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(1093 - 1045) + '\x6f' + chr(131 - 81) + chr(0b11100 + 0o24) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(198 - 150) + chr(0b10001 + 0o136) + chr(0b1011 + 0o50) + chr(0b110101 + 0o1) + '\x33', 6604 - 6596), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(54) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001010 + 0o45) + chr(1974 - 1920) + chr(970 - 917), 0b1000), ehT0Px3KOsy9('\x30' + chr(5176 - 5065) + '\x31' + chr(544 - 495) + chr(55), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(0b110110) + chr(0b110101), 8), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\066' + '\063', 8), ehT0Px3KOsy9(chr(906 - 858) + chr(0b1101111) + chr(0b110011) + chr(0b100101 + 0o20) + chr(922 - 867), 11987 - 11979), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(454 - 403) + chr(55) + '\062', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(0b11111 + 0o27), 8612 - 8604), ehT0Px3KOsy9(chr(2150 - 2102) + chr(111) + '\x31' + '\x32' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(8733 - 8622) + chr(0b110100) + '\061', 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(111) + chr(0b110001) + chr(0b1000 + 0o52), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(1604 - 1554) + chr(0b0 + 0o65) + chr(1281 - 1230), 57341 - 57333), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(111) + chr(0b110001) + chr(53) + '\066', 64130 - 64122), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b10010 + 0o135) + chr(0b101101 + 0o5) + chr(539 - 489) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\157' + chr(0b100010 + 0o20) + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + '\x33' + chr(0b11001 + 0o34), 0o10), ehT0Px3KOsy9('\x30' + chr(9362 - 9251) + '\x33' + chr(1477 - 1428), 19444 - 19436), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(2503 - 2452) + '\x30' + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101011 + 0o4) + chr(1661 - 1612) + '\064' + chr(2121 - 2068), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + '\x35' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'P'), '\144' + '\x65' + '\x63' + chr(5106 - 4995) + chr(6753 - 6653) + chr(6057 - 5956))(chr(325 - 208) + '\x74' + chr(0b1100110) + '\x2d' + chr(0b10111 + 0o41)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def YpaKgYx7pVcO(oVre8I6UXc3b, tKJAwKiE1Zya, LAJpdOSgNYIY, NKKFbr2Z4sr1): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b"!k\xd0\xe1\x1f\x85\xees'\x06\x9c\x95~\xa2\x91\xfe^\xa3"), chr(4851 - 4751) + chr(0b1010011 + 0o22) + chr(99) + chr(111) + chr(593 - 493) + chr(0b1100101))('\165' + chr(0b1110100) + chr(0b1100110) + chr(174 - 129) + '\070')) is None: return [] Cli4Sf5HnGOS = ehT0Px3KOsy9(tKJAwKiE1Zya) try: KdhBARPBiGt5 = LAJpdOSgNYIY[Cli4Sf5HnGOS] except RQ6CSRrFArYB: KdhBARPBiGt5 = LAJpdOSgNYIY[Cli4Sf5HnGOS] = oVre8I6UXc3b._adjustment_reader.get_adjustments_for_sid(NKKFbr2Z4sr1, Cli4Sf5HnGOS) return KdhBARPBiGt5
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_splits
def get_splits(self, assets, dt): """ Returns any splits for the given sids and the given dt. Parameters ---------- assets : container Assets for which we want splits. dt : pd.Timestamp The date for which we are checking for splits. Note: this is expected to be midnight UTC. Returns ------- splits : list[(asset, float)] List of splits, where each split is a (asset, ratio) tuple. """ if self._adjustment_reader is None or not assets: return [] # convert dt to # of seconds since epoch, because that's what we use # in the adjustments db seconds = int(dt.value / 1e9) splits = self._adjustment_reader.conn.execute( "SELECT sid, ratio FROM SPLITS WHERE effective_date = ?", (seconds,)).fetchall() splits = [split for split in splits if split[0] in assets] splits = [(self.asset_finder.retrieve_asset(split[0]), split[1]) for split in splits] return splits
python
def get_splits(self, assets, dt): """ Returns any splits for the given sids and the given dt. Parameters ---------- assets : container Assets for which we want splits. dt : pd.Timestamp The date for which we are checking for splits. Note: this is expected to be midnight UTC. Returns ------- splits : list[(asset, float)] List of splits, where each split is a (asset, ratio) tuple. """ if self._adjustment_reader is None or not assets: return [] # convert dt to # of seconds since epoch, because that's what we use # in the adjustments db seconds = int(dt.value / 1e9) splits = self._adjustment_reader.conn.execute( "SELECT sid, ratio FROM SPLITS WHERE effective_date = ?", (seconds,)).fetchall() splits = [split for split in splits if split[0] in assets] splits = [(self.asset_finder.retrieve_asset(split[0]), split[1]) for split in splits] return splits
[ "def", "get_splits", "(", "self", ",", "assets", ",", "dt", ")", ":", "if", "self", ".", "_adjustment_reader", "is", "None", "or", "not", "assets", ":", "return", "[", "]", "# convert dt to # of seconds since epoch, because that's what we use", "# in the adjustments db", "seconds", "=", "int", "(", "dt", ".", "value", "/", "1e9", ")", "splits", "=", "self", ".", "_adjustment_reader", ".", "conn", ".", "execute", "(", "\"SELECT sid, ratio FROM SPLITS WHERE effective_date = ?\"", ",", "(", "seconds", ",", ")", ")", ".", "fetchall", "(", ")", "splits", "=", "[", "split", "for", "split", "in", "splits", "if", "split", "[", "0", "]", "in", "assets", "]", "splits", "=", "[", "(", "self", ".", "asset_finder", ".", "retrieve_asset", "(", "split", "[", "0", "]", ")", ",", "split", "[", "1", "]", ")", "for", "split", "in", "splits", "]", "return", "splits" ]
Returns any splits for the given sids and the given dt. Parameters ---------- assets : container Assets for which we want splits. dt : pd.Timestamp The date for which we are checking for splits. Note: this is expected to be midnight UTC. Returns ------- splits : list[(asset, float)] List of splits, where each split is a (asset, ratio) tuple.
[ "Returns", "any", "splits", "for", "the", "given", "sids", "and", "the", "given", "dt", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/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7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(0b1000 + 0o147) + '\063' + '\066' + chr(0b101000 + 0o10), 0o10), ehT0Px3KOsy9('\x30' + chr(0b110001 + 0o76) + chr(0b110110) + '\067', ord("\x08")), ehT0Px3KOsy9('\060' + chr(4375 - 4264) + chr(2346 - 2297) + '\x33' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b101111 + 0o100) + chr(596 - 547) + chr(49) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\067' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(52) + chr(0b1100 + 0o45), 0b1000), ehT0Px3KOsy9(chr(48) + chr(12065 - 11954) + '\x31' + chr(2683 - 2631) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b110011 + 0o74) + chr(49) + chr(0b11011 + 0o30) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10110 + 0o41) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(1547 - 1495) + chr(0b10011 + 0o41), 0o10), ehT0Px3KOsy9(chr(2269 - 2221) + chr(111) + chr(50) + chr(55) + chr(0b11110 + 0o30), 11033 - 11025), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101000 + 0o13) + '\066', 0b1000), ehT0Px3KOsy9('\060' + chr(9429 - 9318) + '\x33' + chr(0b110011 + 0o1) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(2296 - 2248) + '\x6f' + '\063' + chr(0b110010) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\067' + chr(0b10011 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + chr(2285 - 2233) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(4552 - 4441) + chr(0b110001) + '\x37' + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(1337 - 1289) + '\x6f' + chr(0b100010 + 0o21) + '\067' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101 + 0o53) + '\x6f' + chr(0b110011) + chr(0b110001 + 0o0) + chr(49), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101100 + 0o103) + chr(0b110010) + chr(0b110101) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1570 - 1522) + chr(0b11111 + 0o120) + chr(0b110001) + chr(51) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2169 - 2119) + chr(0b1001 + 0o50) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4611 - 4500) + chr(51) + '\060' + chr(750 - 698), 52510 - 52502), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100000 + 0o17) + '\x35' + chr(50), 0o10), ehT0Px3KOsy9(chr(767 - 719) + chr(6202 - 6091) + chr(152 - 102) + chr(55) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\065' + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(1779 - 1731) + '\x6f' + chr(2640 - 2588) + '\063', 0o10), ehT0Px3KOsy9(chr(0b100100 + 0o14) + '\x6f' + chr(52) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + '\x32' + '\x35' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(9578 - 9467) + chr(1756 - 1703) + '\064', 0b1000), ehT0Px3KOsy9(chr(207 - 159) + chr(0b1101111) + '\x31' + chr(52) + '\x35', 35483 - 35475), ehT0Px3KOsy9('\060' + chr(0b111001 + 0o66) + '\066' + chr(0b101101 + 0o6), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b100101 + 0o22) + '\062', 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1011000 + 0o27) + chr(2061 - 2011) + '\065', 0o10), ehT0Px3KOsy9(chr(957 - 909) + chr(0b1101111) + chr(0b101010 + 0o11) + '\x37' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101101 + 0o2) + chr(55) + '\x30', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(405 - 356) + chr(0b110011), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b0 + 0o63) + chr(0b110111) + chr(139 - 88), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + chr(0b110100) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(6085 - 5974) + chr(0b11000 + 0o32) + chr(0b100 + 0o57) + chr(1098 - 1049), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1901 - 1853) + chr(0b10110 + 0o131) + '\x35' + chr(961 - 913), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xde'), chr(1357 - 1257) + '\x65' + chr(99) + chr(8506 - 8395) + '\144' + chr(101))('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b101100 + 0o1) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def uDSoZgrMSy1q(oVre8I6UXc3b, YGFU3oxACPcg, OmU3Un949MWT): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xafV<&K\x12\x170^\n\xcaA\x95\xb4X\x06\x1a\x8d'), chr(0b1100100) + chr(6670 - 6569) + '\143' + chr(0b1101111) + chr(100) + '\x65')('\x75' + chr(5900 - 5784) + '\x66' + '\x2d' + '\070')) is None or not YGFU3oxACPcg: return [] n8shiI_5pCL9 = ehT0Px3KOsy9(OmU3Un949MWT.QmmgWUB13VCJ / 1000000000.0) uSBCRSw0LUmo = oVre8I6UXc3b._adjustment_reader.conn.execute(xafqLlk3kkUe(SXOLrMavuUCe(b'\xa3r\x14\t}5C.R\x00\x92>\x95\xb0M\x0b\x10\xdf\x8f\xfe\x14\xc3\xe4y\xefbju\xf9\x0c2{?G\xb8\x18n\x9d\x84\xfc\x93C1:[>\x07<O\x01\x9e#\xc7\xee'), chr(0b1000 + 0o134) + '\145' + chr(99) + chr(111) + chr(0b111000 + 0o54) + chr(101))(chr(6248 - 6131) + chr(9848 - 9732) + '\146' + '\x2d' + chr(0b1111 + 0o51)), (n8shiI_5pCL9,)).fetchall() uSBCRSw0LUmo = [vsJU7GhuEuh6 for vsJU7GhuEuh6 in uSBCRSw0LUmo if vsJU7GhuEuh6[ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b101001 + 0o7), 0b1000)] in YGFU3oxACPcg] uSBCRSw0LUmo = [(oVre8I6UXc3b.asset_finder.retrieve_asset(vsJU7GhuEuh6[ehT0Px3KOsy9('\060' + '\157' + chr(0b110000), 8)]), vsJU7GhuEuh6[ehT0Px3KOsy9(chr(48) + '\157' + chr(0b1101 + 0o44), 0o10)]) for vsJU7GhuEuh6 in uSBCRSw0LUmo] return uSBCRSw0LUmo
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_stock_dividends
def get_stock_dividends(self, sid, trading_days): """ Returns all the stock dividends for a specific sid that occur in the given trading range. Parameters ---------- sid: int The asset whose stock dividends should be returned. trading_days: pd.DatetimeIndex The trading range. Returns ------- list: A list of objects with all relevant attributes populated. All timestamp fields are converted to pd.Timestamps. """ if self._adjustment_reader is None: return [] if len(trading_days) == 0: return [] start_dt = trading_days[0].value / 1e9 end_dt = trading_days[-1].value / 1e9 dividends = self._adjustment_reader.conn.execute( "SELECT * FROM stock_dividend_payouts WHERE sid = ? AND " "ex_date > ? AND pay_date < ?", (int(sid), start_dt, end_dt,)).\ fetchall() dividend_info = [] for dividend_tuple in dividends: dividend_info.append({ "declared_date": dividend_tuple[1], "ex_date": pd.Timestamp(dividend_tuple[2], unit="s"), "pay_date": pd.Timestamp(dividend_tuple[3], unit="s"), "payment_sid": dividend_tuple[4], "ratio": dividend_tuple[5], "record_date": pd.Timestamp(dividend_tuple[6], unit="s"), "sid": dividend_tuple[7] }) return dividend_info
python
def get_stock_dividends(self, sid, trading_days): """ Returns all the stock dividends for a specific sid that occur in the given trading range. Parameters ---------- sid: int The asset whose stock dividends should be returned. trading_days: pd.DatetimeIndex The trading range. Returns ------- list: A list of objects with all relevant attributes populated. All timestamp fields are converted to pd.Timestamps. """ if self._adjustment_reader is None: return [] if len(trading_days) == 0: return [] start_dt = trading_days[0].value / 1e9 end_dt = trading_days[-1].value / 1e9 dividends = self._adjustment_reader.conn.execute( "SELECT * FROM stock_dividend_payouts WHERE sid = ? AND " "ex_date > ? AND pay_date < ?", (int(sid), start_dt, end_dt,)).\ fetchall() dividend_info = [] for dividend_tuple in dividends: dividend_info.append({ "declared_date": dividend_tuple[1], "ex_date": pd.Timestamp(dividend_tuple[2], unit="s"), "pay_date": pd.Timestamp(dividend_tuple[3], unit="s"), "payment_sid": dividend_tuple[4], "ratio": dividend_tuple[5], "record_date": pd.Timestamp(dividend_tuple[6], unit="s"), "sid": dividend_tuple[7] }) return dividend_info
[ "def", "get_stock_dividends", "(", "self", ",", "sid", ",", "trading_days", ")", ":", "if", "self", ".", "_adjustment_reader", "is", "None", ":", "return", "[", "]", "if", "len", "(", "trading_days", ")", "==", "0", ":", "return", "[", "]", "start_dt", "=", "trading_days", "[", "0", "]", ".", "value", "/", "1e9", "end_dt", "=", "trading_days", "[", "-", "1", "]", ".", "value", "/", "1e9", "dividends", "=", "self", ".", "_adjustment_reader", ".", "conn", ".", "execute", "(", "\"SELECT * FROM stock_dividend_payouts WHERE sid = ? AND \"", "\"ex_date > ? AND pay_date < ?\"", ",", "(", "int", "(", "sid", ")", ",", "start_dt", ",", "end_dt", ",", ")", ")", ".", "fetchall", "(", ")", "dividend_info", "=", "[", "]", "for", "dividend_tuple", "in", "dividends", ":", "dividend_info", ".", "append", "(", "{", "\"declared_date\"", ":", "dividend_tuple", "[", "1", "]", ",", "\"ex_date\"", ":", "pd", ".", "Timestamp", "(", "dividend_tuple", "[", "2", "]", ",", "unit", "=", "\"s\"", ")", ",", "\"pay_date\"", ":", "pd", ".", "Timestamp", "(", "dividend_tuple", "[", "3", "]", ",", "unit", "=", "\"s\"", ")", ",", "\"payment_sid\"", ":", "dividend_tuple", "[", "4", "]", ",", "\"ratio\"", ":", "dividend_tuple", "[", "5", "]", ",", "\"record_date\"", ":", "pd", ".", "Timestamp", "(", "dividend_tuple", "[", "6", "]", ",", "unit", "=", "\"s\"", ")", ",", "\"sid\"", ":", "dividend_tuple", "[", "7", "]", "}", ")", "return", "dividend_info" ]
Returns all the stock dividends for a specific sid that occur in the given trading range. Parameters ---------- sid: int The asset whose stock dividends should be returned. trading_days: pd.DatetimeIndex The trading range. Returns ------- list: A list of objects with all relevant attributes populated. All timestamp fields are converted to pd.Timestamps.
[ "Returns", "all", "the", "stock", "dividends", "for", "a", "specific", "sid", "that", "occur", "in", "the", "given", "trading", "range", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L1192-L1237
train
Returns all stock dividends for a specific sid that occur in the given trading range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc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i1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(111) + '\061' + chr(0b1101 + 0o44) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + '\x33' + chr(0b11011 + 0o33) + chr(0b101101 + 0o6), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x35' + '\062', 41649 - 41641), ehT0Px3KOsy9(chr(366 - 318) + chr(111) + chr(0b10011 + 0o40) + chr(54) + '\065', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(1603 - 1554) + chr(0b10001 + 0o45), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11000 + 0o33) + chr(1865 - 1813) + '\x37', 0o10), ehT0Px3KOsy9('\x30' + chr(1028 - 917) + chr(0b110 + 0o53) + chr(1711 - 1659) + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9(chr(800 - 752) + chr(0b10000 + 0o137) + '\x31' + '\062' + chr(1943 - 1889), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(0b110010) + chr(0b110100) + chr(0b111 + 0o57), 27115 - 27107), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(356 - 302), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2032 - 1983) + chr(93 - 40) + chr(49), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x36', 40554 - 40546), ehT0Px3KOsy9('\060' + '\157' + chr(470 - 415) + chr(2800 - 2747), 19022 - 19014), ehT0Px3KOsy9('\060' + chr(0b1010000 + 0o37) + chr(65 - 15) + chr(2434 - 2384) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9728 - 9617) + chr(50) + chr(0b0 + 0o64) + chr(0b1010 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + '\157' + chr(0b110100) + '\060', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b111011 + 0o64) + chr(1831 - 1778) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(2155 - 2107) + chr(666 - 555) + '\x31' + chr(48) + chr(0b101010 + 0o12), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101010 + 0o11) + chr(49), 0b1000), ehT0Px3KOsy9(chr(1742 - 1694) + chr(0b110011 + 0o74) + chr(87 - 36) + '\067' + chr(52), 7727 - 7719), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(2281 - 2232) + chr(728 - 680), ord("\x08")), ehT0Px3KOsy9('\060' + chr(10573 - 10462) + '\063' + '\x30' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(3377 - 3266) + chr(0b110100) + '\062', 18305 - 18297), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(111) + chr(49) + chr(0b110100) + '\x32', 44919 - 44911), ehT0Px3KOsy9(chr(431 - 383) + chr(3651 - 3540) + chr(50) + chr(0b110010 + 0o2) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + chr(50), 54637 - 54629), ehT0Px3KOsy9(chr(549 - 501) + chr(0b1100111 + 0o10) + chr(899 - 850) + chr(0b1000 + 0o56) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2840 - 2786), 8), ehT0Px3KOsy9('\060' + chr(8062 - 7951) + chr(186 - 136) + '\066' + '\x31', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x32' + chr(48) + '\066', 39742 - 39734), ehT0Px3KOsy9(chr(385 - 337) + chr(111) + chr(50) + chr(875 - 826) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b111 + 0o150) + '\063' + chr(0b100001 + 0o25) + chr(185 - 132), 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + '\x32' + chr(0b11101 + 0o27) + chr(0b110011), 31657 - 31649), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b10011 + 0o37) + chr(48), 60088 - 60080), ehT0Px3KOsy9('\x30' + '\157' + chr(1040 - 986) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\061' + chr(2825 - 2770) + chr(48), 0o10), ehT0Px3KOsy9(chr(48) + chr(11012 - 10901) + chr(0b1100 + 0o46) + '\x36' + chr(0b1010 + 0o55), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(51) + '\064' + chr(0b10111 + 0o37), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(4231 - 4120) + chr(0b101 + 0o55) + '\063' + chr(55), 12396 - 12388), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(111) + '\x31', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + chr(0b1001110 + 0o41) + chr(0b0 + 0o65) + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'e'), chr(2144 - 2044) + '\x65' + '\x63' + '\157' + '\x64' + chr(0b1010000 + 0o25))(chr(0b1110101) + chr(0b110011 + 0o101) + chr(0b1100110) + chr(0b101101) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def S_Ama8vzauS2(oVre8I6UXc3b, Cli4Sf5HnGOS, YlNBidr8uuv4): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x14\x92\x8e\x9f{\x94\x14;\xc3`\x1dYO\xf3\xc5DK6'), chr(100) + chr(4038 - 3937) + '\143' + chr(0b1101111) + chr(0b1011000 + 0o14) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(0b1 + 0o54) + '\070')) is None: return [] if c2A0yzQpDQB3(YlNBidr8uuv4) == ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110000), 32285 - 32277): return [] Rp7gZ6knJjRy = YlNBidr8uuv4[ehT0Px3KOsy9('\x30' + chr(10870 - 10759) + chr(48), 8)].QmmgWUB13VCJ / 1000000000.0 H53hAzPUC6Rt = YlNBidr8uuv4[-ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2225 - 2176), 8)].QmmgWUB13VCJ / 1000000000.0 cFAyuTNKZHE5 = oVre8I6UXc3b._adjustment_reader.conn.execute(xafqLlk3kkUe(SXOLrMavuUCe(b"\x18\xb6\xa6\xb0M\xb3@|\x86H;Ip\xb6\xd7TA'r\xa3l\xaeT\x0b\xc3o\x1cb\xee\xf6\xe8\x8c\xcc\xa5F\x0b\x97\xb1\xd7D\x19\xb6\xca\x86g\x83@k\x861IGs\xd2\x84EV\x1b}\x9d|\xa2\x02\\\x875RG\xff\xc2\xa9\x85\xc2\xa9m\x1c\xd6\x92\xfa!w\xd3\xd5"), '\x64' + '\x65' + chr(1569 - 1470) + '\157' + chr(0b1100100) + chr(0b10101 + 0o120))('\x75' + chr(116) + chr(0b1100110) + '\x2d' + chr(56)), (ehT0Px3KOsy9(Cli4Sf5HnGOS), Rp7gZ6knJjRy, H53hAzPUC6Rt)).fetchall() dXVTgRqa7rSP = [] for IhFHV3_XRF58 in cFAyuTNKZHE5: xafqLlk3kkUe(dXVTgRqa7rSP, xafqLlk3kkUe(SXOLrMavuUCe(b'*\x83\x9a\x90`\x83'), '\x64' + chr(0b110 + 0o137) + chr(0b1100011) + chr(7147 - 7036) + chr(0b1100100) + '\145')(chr(0b10001 + 0o144) + '\164' + chr(102) + '\055' + '\070'))({xafqLlk3kkUe(SXOLrMavuUCe(b'/\x96\x89\x99o\x95\x052\xf9j\x08rX'), chr(4327 - 4227) + chr(0b1100101) + '\143' + '\x6f' + '\144' + '\x65')('\165' + '\164' + chr(102) + chr(0b10011 + 0o32) + '\x38'): IhFHV3_XRF58[ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100 + 0o55), 8)], xafqLlk3kkUe(SXOLrMavuUCe(b'.\x8b\xb5\x91o\x93\x05'), chr(0b1100100) + '\x65' + '\x63' + chr(11479 - 11368) + chr(0b1010101 + 0o17) + chr(101))(chr(117) + chr(0b111110 + 0o66) + chr(547 - 445) + '\055' + chr(56)): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x9a\x87\x90}\x93\x01;\xd6'), '\x64' + '\145' + chr(99) + chr(0b11101 + 0o122) + chr(1850 - 1750) + '\145')(chr(117) + '\x74' + chr(102) + '\x2d' + chr(0b111000)))(IhFHV3_XRF58[ehT0Px3KOsy9(chr(1812 - 1764) + chr(0b110 + 0o151) + chr(0b11001 + 0o31), 0b1000)], unit=xafqLlk3kkUe(SXOLrMavuUCe(b'8'), chr(0b11100 + 0o110) + '\145' + chr(99) + chr(0b11001 + 0o126) + chr(2627 - 2527) + '\145')(chr(0b1100000 + 0o25) + '\164' + chr(0b1100110) + chr(647 - 602) + chr(0b11000 + 0o40))), xafqLlk3kkUe(SXOLrMavuUCe(b';\x92\x93\xaaj\x86\x143'), chr(0b1001101 + 0o27) + chr(0b110010 + 0o63) + chr(0b1100011) + chr(7122 - 7011) + chr(0b1000000 + 0o44) + chr(0b1100101))('\165' + chr(0b0 + 0o164) + chr(0b1100110) + '\x2d' + '\070'): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x9a\x87\x90}\x93\x01;\xd6'), '\x64' + chr(101) + chr(0b1100011) + chr(1650 - 1539) + chr(100) + chr(10100 - 9999))(chr(0b1000000 + 0o65) + '\x74' + '\x66' + '\055' + chr(0b111000)))(IhFHV3_XRF58[ehT0Px3KOsy9('\060' + '\157' + chr(0b110011), 0b1000)], unit=xafqLlk3kkUe(SXOLrMavuUCe(b'8'), '\144' + chr(101) + chr(8847 - 8748) + chr(0b1101111) + chr(0b1100100) + chr(101))(chr(9650 - 9533) + chr(0b100010 + 0o122) + chr(102) + chr(45) + '\070')), xafqLlk3kkUe(SXOLrMavuUCe(b';\x92\x93\x98k\x89\x14\t\xd5g\r'), chr(0b1100100) + chr(0b1100101) + '\143' + chr(3147 - 3036) + chr(0b1010010 + 0o22) + chr(9181 - 9080))(chr(0b100011 + 0o122) + chr(0b1 + 0o163) + '\146' + chr(1135 - 1090) + chr(56)): IhFHV3_XRF58[ehT0Px3KOsy9(chr(1276 - 1228) + chr(111) + chr(943 - 891), 19061 - 19053)], xafqLlk3kkUe(SXOLrMavuUCe(b'9\x92\x9e\x9ca'), '\x64' + chr(0b1100101) + chr(0b1100011) + '\x6f' + chr(5533 - 5433) + chr(101))('\165' + chr(0b1100100 + 0o20) + '\146' + chr(0b10100 + 0o31) + '\070'): IhFHV3_XRF58[ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101101 + 0o10), 15224 - 15216)], xafqLlk3kkUe(SXOLrMavuUCe(b'9\x96\x89\x9a|\x83?2\xc7z\x0c'), chr(0b110110 + 0o56) + chr(101) + '\143' + chr(111) + chr(100) + chr(0b1100101))('\165' + chr(0b1110100) + '\x66' + '\x2d' + chr(0b11101 + 0o33)): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1f\x9a\x87\x90}\x93\x01;\xd6'), chr(0b1100011 + 0o1) + chr(101) + '\x63' + chr(111) + '\144' + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + chr(45) + chr(1321 - 1265)))(IhFHV3_XRF58[ehT0Px3KOsy9(chr(756 - 708) + chr(111) + chr(54), 8)], unit=xafqLlk3kkUe(SXOLrMavuUCe(b'8'), chr(0b10 + 0o142) + '\x65' + chr(0b1100011) + '\157' + '\144' + '\145')(chr(0b1110101) + chr(116) + '\x66' + chr(96 - 51) + '\070')), xafqLlk3kkUe(SXOLrMavuUCe(b'8\x9a\x8e'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(111) + chr(100) + chr(101))('\165' + '\x74' + '\146' + '\055' + '\070'): IhFHV3_XRF58[ehT0Px3KOsy9(chr(0b110000) + '\157' + '\067', 0o10)]}) return dXVTgRqa7rSP
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_fetcher_assets
def get_fetcher_assets(self, dt): """ Returns a list of assets for the current date, as defined by the fetcher data. Returns ------- list: a list of Asset objects. """ # return a list of assets for the current date, as defined by the # fetcher source if self._extra_source_df is None: return [] day = normalize_date(dt) if day in self._extra_source_df.index: assets = self._extra_source_df.loc[day]['sid'] else: return [] if isinstance(assets, pd.Series): return [x for x in assets if isinstance(x, Asset)] else: return [assets] if isinstance(assets, Asset) else []
python
def get_fetcher_assets(self, dt): """ Returns a list of assets for the current date, as defined by the fetcher data. Returns ------- list: a list of Asset objects. """ # return a list of assets for the current date, as defined by the # fetcher source if self._extra_source_df is None: return [] day = normalize_date(dt) if day in self._extra_source_df.index: assets = self._extra_source_df.loc[day]['sid'] else: return [] if isinstance(assets, pd.Series): return [x for x in assets if isinstance(x, Asset)] else: return [assets] if isinstance(assets, Asset) else []
[ "def", "get_fetcher_assets", "(", "self", ",", "dt", ")", ":", "# return a list of assets for the current date, as defined by the", "# fetcher source", "if", "self", ".", "_extra_source_df", "is", "None", ":", "return", "[", "]", "day", "=", "normalize_date", "(", "dt", ")", "if", "day", "in", "self", ".", "_extra_source_df", ".", "index", ":", "assets", "=", "self", ".", "_extra_source_df", ".", "loc", "[", "day", "]", "[", "'sid'", "]", "else", ":", "return", "[", "]", "if", "isinstance", "(", "assets", ",", "pd", ".", "Series", ")", ":", "return", "[", "x", "for", "x", "in", "assets", "if", "isinstance", "(", "x", ",", "Asset", ")", "]", "else", ":", "return", "[", "assets", "]", "if", "isinstance", "(", "assets", ",", "Asset", ")", "else", "[", "]" ]
Returns a list of assets for the current date, as defined by the fetcher data. Returns ------- list: a list of Asset objects.
[ "Returns", "a", "list", "of", "assets", "for", "the", "current", "date", "as", "defined", "by", "the", "fetcher", "data", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L1244-L1268
train
Returns a list of assets for the current date.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j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V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1011111 + 0o20) + chr(0b110011) + chr(53) + chr(0b110000), 30270 - 30262), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + '\066' + chr(0b110111), 55274 - 55266), ehT0Px3KOsy9(chr(1080 - 1032) + chr(1698 - 1587) + chr(0b110011) + '\x35' + chr(1511 - 1459), 25654 - 25646), ehT0Px3KOsy9(chr(96 - 48) + chr(0b1101111) + '\061' + '\x31' + '\x37', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + '\063', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(150 - 99) + chr(49) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101001 + 0o106) + chr(51) + chr(2267 - 2215) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\060' + chr(8462 - 8351) + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(1764 - 1716) + chr(111) + chr(0b110011) + chr(2700 - 2645), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110101) + chr(901 - 851), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\063' + '\065' + '\064', 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x31' + chr(780 - 732), 0o10), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + '\062' + chr(0b11101 + 0o30) + chr(0b10010 + 0o41), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(52) + chr(2545 - 2492), 16098 - 16090), ehT0Px3KOsy9(chr(48) + '\157' + '\x33' + chr(1279 - 1230) + '\x30', 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(49) + chr(52) + '\x32', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(51) + chr(0b1 + 0o66), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110010) + chr(1308 - 1255) + '\064', 56950 - 56942), ehT0Px3KOsy9(chr(48) + chr(111) + '\x32' + chr(0b110101) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(1231 - 1182) + '\x32' + chr(0b100010 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(1202 - 1154) + chr(6125 - 6014) + chr(0b110001) + chr(2099 - 2049) + chr(0b100110 + 0o16), 57705 - 57697), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(0b110010) + chr(0b110011), 13679 - 13671), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(2627 - 2516) + chr(909 - 858) + chr(0b110010) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(600 - 550) + '\x31' + chr(50), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1100 + 0o143) + '\x32' + '\063', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100011 + 0o16) + chr(0b110101) + chr(0b110101), 6804 - 6796), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + '\064' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011 + 0o144) + '\x37' + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10874 - 10763) + chr(0b110011) + chr(0b110000) + chr(51), 0b1000), ehT0Px3KOsy9(chr(1830 - 1782) + chr(9849 - 9738) + chr(50) + '\x33', 8), ehT0Px3KOsy9(chr(219 - 171) + '\157' + '\062' + chr(1269 - 1217) + chr(0b110001), 61096 - 61088), ehT0Px3KOsy9(chr(1851 - 1803) + chr(5732 - 5621) + chr(50) + chr(0b110100) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(111) + '\063' + chr(0b1100 + 0o45) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100100 + 0o17) + '\x36' + chr(0b11110 + 0o24), 11789 - 11781), ehT0Px3KOsy9(chr(1504 - 1456) + chr(0b1101111) + '\x33' + chr(1730 - 1682) + chr(1984 - 1935), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b10010 + 0o45) + '\x37', 55828 - 55820), ehT0Px3KOsy9(chr(1346 - 1298) + '\157' + chr(49) + chr(0b110010 + 0o3) + chr(0b101000 + 0o17), 45729 - 45721), ehT0Px3KOsy9(chr(0b110000) + chr(3951 - 3840) + chr(0b110010) + chr(0b11100 + 0o31) + '\x34', 8), ehT0Px3KOsy9('\060' + '\157' + chr(52) + '\063', 0o10), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\x6f' + '\x31' + chr(50) + '\x36', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x35' + chr(48), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc6'), chr(6586 - 6486) + '\145' + chr(0b1100011) + chr(111) + chr(100) + '\x65')(chr(0b1011000 + 0o35) + chr(116) + '\x66' + chr(0b11111 + 0o16) + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def rnpxK6Bhxkfx(oVre8I6UXc3b, OmU3Un949MWT): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb\x81\xd8\x0cc\xae\xad%Y\x1c\x82\xe2'), chr(0b1100100) + '\145' + '\143' + chr(5370 - 5259) + chr(0b1100100) + '\x65')(chr(0b1110101) + chr(116) + '\x66' + '\x2d' + chr(0b101110 + 0o12))) is None: return [] Y8Mo1TTYaa7l = _F0ikw07R1Id(OmU3Un949MWT) if Y8Mo1TTYaa7l in xafqLlk3kkUe(oVre8I6UXc3b._extra_source_df, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\xd3\x838y\xaa\xac_E}\xa0\xb1'), chr(7985 - 7885) + chr(0b100100 + 0o101) + '\143' + chr(0b1101111) + chr(100) + '\x65')(chr(10996 - 10879) + chr(116) + '\146' + chr(50 - 5) + chr(868 - 812))): YGFU3oxACPcg = oVre8I6UXc3b._extra_source_df.MmVY7Id_ODNA[Y8Mo1TTYaa7l][xafqLlk3kkUe(SXOLrMavuUCe(b'\x9b\xde\x88'), chr(7644 - 7544) + chr(0b111100 + 0o51) + '\x63' + '\x6f' + chr(0b101 + 0o137) + '\x65')('\165' + '\164' + '\x66' + chr(0b10011 + 0o32) + chr(0b110101 + 0o3))] else: return [] if PlSM16l2KDPD(YGFU3oxACPcg, xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\xbb\xd2\x9e&N\xbb'), '\x64' + chr(0b1010010 + 0o23) + chr(0b1100011) + chr(0b1101111) + chr(100) + chr(101))('\x75' + '\164' + chr(0b1011111 + 0o7) + chr(45) + chr(0b100 + 0o64)))): return [OeWW0F1dBPRQ for OeWW0F1dBPRQ in YGFU3oxACPcg if PlSM16l2KDPD(OeWW0F1dBPRQ, KFiLXGYtsK4j)] else: return [YGFU3oxACPcg] if PlSM16l2KDPD(YGFU3oxACPcg, KFiLXGYtsK4j) else []
quantopian/zipline
zipline/data/data_portal.py
DataPortal.get_current_future_chain
def get_current_future_chain(self, continuous_future, dt): """ Retrieves the future chain for the contract at the given `dt` according the `continuous_future` specification. Returns ------- future_chain : list[Future] A list of active futures, where the first index is the current contract specified by the continuous future definition, the second is the next upcoming contract and so on. """ rf = self._roll_finders[continuous_future.roll_style] session = self.trading_calendar.minute_to_session_label(dt) contract_center = rf.get_contract_center( continuous_future.root_symbol, session, continuous_future.offset) oc = self.asset_finder.get_ordered_contracts( continuous_future.root_symbol) chain = oc.active_chain(contract_center, session.value) return self.asset_finder.retrieve_all(chain)
python
def get_current_future_chain(self, continuous_future, dt): """ Retrieves the future chain for the contract at the given `dt` according the `continuous_future` specification. Returns ------- future_chain : list[Future] A list of active futures, where the first index is the current contract specified by the continuous future definition, the second is the next upcoming contract and so on. """ rf = self._roll_finders[continuous_future.roll_style] session = self.trading_calendar.minute_to_session_label(dt) contract_center = rf.get_contract_center( continuous_future.root_symbol, session, continuous_future.offset) oc = self.asset_finder.get_ordered_contracts( continuous_future.root_symbol) chain = oc.active_chain(contract_center, session.value) return self.asset_finder.retrieve_all(chain)
[ "def", "get_current_future_chain", "(", "self", ",", "continuous_future", ",", "dt", ")", ":", "rf", "=", "self", ".", "_roll_finders", "[", "continuous_future", ".", "roll_style", "]", "session", "=", "self", ".", "trading_calendar", ".", "minute_to_session_label", "(", "dt", ")", "contract_center", "=", "rf", ".", "get_contract_center", "(", "continuous_future", ".", "root_symbol", ",", "session", ",", "continuous_future", ".", "offset", ")", "oc", "=", "self", ".", "asset_finder", ".", "get_ordered_contracts", "(", "continuous_future", ".", "root_symbol", ")", "chain", "=", "oc", ".", "active_chain", "(", "contract_center", ",", "session", ".", "value", ")", "return", "self", ".", "asset_finder", ".", "retrieve_all", "(", "chain", ")" ]
Retrieves the future chain for the contract at the given `dt` according the `continuous_future` specification. Returns ------- future_chain : list[Future] A list of active futures, where the first index is the current contract specified by the continuous future definition, the second is the next upcoming contract and so on.
[ "Retrieves", "the", "future", "chain", "for", "the", "contract", "at", "the", "given", "dt", "according", "the", "continuous_future", "specification", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/data_portal.py#L1391-L1412
train
Retrieves the future chain for the current contracts at the given dt according to the continuous future specification.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO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,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1011000 + 0o27) + chr(0b110010) + chr(51) + chr(51), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(647 - 596) + '\x36' + '\x31', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(7286 - 7175) + '\067' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(443 - 393) + chr(55) + '\x33', 44357 - 44349), ehT0Px3KOsy9(chr(114 - 66) + chr(111) + '\063' + chr(49) + chr(1176 - 1126), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101011 + 0o13), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(0b10101 + 0o34) + chr(0b100 + 0o60), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + '\x36' + chr(1669 - 1615), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001111 + 0o40) + chr(51) + '\060' + chr(53), 14122 - 14114), ehT0Px3KOsy9(chr(518 - 470) + chr(1894 - 1783) + chr(0b101101 + 0o4) + chr(471 - 419), ord("\x08")), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(0b1101111) + '\x33' + '\062' + chr(2607 - 2553), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110011) + chr(0b110100) + chr(0b110010 + 0o3), 0o10), ehT0Px3KOsy9('\060' + chr(7469 - 7358) + '\x32' + chr(2242 - 2194), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x31' + chr(51) + '\067', 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(49) + chr(53) + chr(0b110000), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b1110 + 0o43) + chr(0b11010 + 0o33) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(2090 - 2041) + chr(0b110110) + chr(2098 - 2050), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b110110) + chr(2756 - 2703), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110010) + chr(51) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(1485 - 1437) + chr(0b1101111) + chr(49) + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100101 + 0o15) + chr(0b11011 + 0o32), 49090 - 49082), ehT0Px3KOsy9(chr(625 - 577) + '\x6f' + '\x32' + '\064' + chr(2114 - 2066), 0b1000), ehT0Px3KOsy9('\060' + chr(0b100010 + 0o115) + '\x31' + chr(0b110000) + chr(0b1000 + 0o51), 20815 - 20807), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + chr(0b111 + 0o53) + chr(0b10 + 0o56) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11001 + 0o126) + '\061' + chr(313 - 262) + chr(0b10011 + 0o44), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\063' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1110 + 0o141) + chr(51) + '\066' + '\066', 59117 - 59109), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\064' + chr(0b110000), 30705 - 30697), ehT0Px3KOsy9(chr(1122 - 1074) + chr(0b1101111) + chr(0b110111) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(82 - 34) + chr(111) + '\061' + chr(1803 - 1753), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + chr(999 - 949) + chr(0b100011 + 0o22) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(241 - 130) + '\061' + chr(0b110000) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(935 - 887) + '\157' + chr(0b101011 + 0o6) + chr(0b110111) + '\067', 0b1000), ehT0Px3KOsy9('\060' + chr(4670 - 4559) + '\x31' + '\061' + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(811 - 761) + chr(0b110100) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + chr(6823 - 6712) + '\x32' + '\067' + chr(0b11010 + 0o32), 51597 - 51589), ehT0Px3KOsy9(chr(48) + chr(0b1010010 + 0o35) + chr(0b11100 + 0o27) + chr(0b100101 + 0o14) + '\x33', 63195 - 63187), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(840 - 789) + chr(0b11001 + 0o32) + chr(548 - 497), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110001) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(1057 - 1009) + chr(7934 - 7823) + chr(1384 - 1333) + '\067' + '\062', 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(111) + chr(2800 - 2747) + chr(1026 - 978), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5'), '\144' + '\145' + '\x63' + '\x6f' + chr(0b1011111 + 0o5) + '\145')(chr(3083 - 2966) + '\164' + chr(0b1011110 + 0o10) + chr(0b1111 + 0o36) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def V1MiL9B3G2P9(oVre8I6UXc3b, B2pbHTHbM6Ny, OmU3Un949MWT): NvXF5626RbWw = oVre8I6UXc3b._roll_finders[B2pbHTHbM6Ny.roll_style] Q4vuWJRZ65bC = oVre8I6UXc3b.trading_calendar.minute_to_session_label(OmU3Un949MWT) kxoKQHeZOKN9 = NvXF5626RbWw.get_contract_center(B2pbHTHbM6Ny.root_symbol, Q4vuWJRZ65bC, B2pbHTHbM6Ny.VRaYxwVeIO1g) Od4cignaOsiQ = oVre8I6UXc3b.asset_finder.get_ordered_contracts(B2pbHTHbM6Ny.root_symbol) bmb33Pw6erRd = Od4cignaOsiQ.active_chain(kxoKQHeZOKN9, Q4vuWJRZ65bC.QmmgWUB13VCJ) return xafqLlk3kkUe(oVre8I6UXc3b.asset_finder, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe9\x94O\xc9\xa3c\xfaS\x9am\xba\x89'), chr(0b1001100 + 0o30) + '\x65' + chr(4576 - 4477) + chr(0b1000000 + 0o57) + chr(2581 - 2481) + chr(0b1100101))('\165' + chr(116) + '\146' + '\055' + chr(56)))(bmb33Pw6erRd)
quantopian/zipline
zipline/utils/numpy_utils.py
make_kind_check
def make_kind_check(python_types, numpy_kind): """ Make a function that checks whether a scalar or array is of a given kind (e.g. float, int, datetime, timedelta). """ def check(value): if hasattr(value, 'dtype'): return value.dtype.kind == numpy_kind return isinstance(value, python_types) return check
python
def make_kind_check(python_types, numpy_kind): """ Make a function that checks whether a scalar or array is of a given kind (e.g. float, int, datetime, timedelta). """ def check(value): if hasattr(value, 'dtype'): return value.dtype.kind == numpy_kind return isinstance(value, python_types) return check
[ "def", "make_kind_check", "(", "python_types", ",", "numpy_kind", ")", ":", "def", "check", "(", "value", ")", ":", "if", "hasattr", "(", "value", ",", "'dtype'", ")", ":", "return", "value", ".", "dtype", ".", "kind", "==", "numpy_kind", "return", "isinstance", "(", "value", ",", "python_types", ")", "return", "check" ]
Make a function that checks whether a scalar or array is of a given kind (e.g. float, int, datetime, timedelta).
[ "Make", "a", "function", "that", "checks", "whether", "a", "scalar", "or", "array", "is", "of", "a", "given", "kind", "(", "e", ".", "g", ".", "float", "int", "datetime", "timedelta", ")", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L124-L133
train
Make a function that checks whether a scalar or array is of a given kind .
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_b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KaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + chr(53) + chr(0b11101 + 0o32), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + chr(0b110010) + '\061' + '\067', 61847 - 61839), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1101 + 0o47) + chr(0b1011 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110001) + '\x33', 33166 - 33158), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(8951 - 8840) + '\062' + chr(52) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(1309 - 1261) + chr(0b1011 + 0o144) + chr(1487 - 1436) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b100 + 0o57) + '\x37', 47913 - 47905), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b101000 + 0o11) + chr(0b1 + 0o63) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + '\061' + '\x33' + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(49) + chr(49) + chr(0b110001), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1798 - 1747) + chr(1266 - 1212) + '\065', 7305 - 7297), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110001) + '\066' + '\062', 0o10), ehT0Px3KOsy9(chr(2123 - 2075) + chr(111) + '\062' + chr(0b100010 + 0o23) + '\x37', 8), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + chr(50) + chr(54), 5108 - 5100), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(0b11 + 0o56) + chr(54), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b1 + 0o61) + chr(0b110010) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(1743 - 1632) + chr(0b110010) + chr(2036 - 1987) + chr(0b11010 + 0o33), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101001 + 0o11) + chr(0b110000 + 0o3) + '\066', 6305 - 6297), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b10 + 0o57) + chr(0b10100 + 0o42) + '\x37', 63391 - 63383), ehT0Px3KOsy9('\x30' + '\157' + '\067' + chr(759 - 704), 1638 - 1630), ehT0Px3KOsy9(chr(1973 - 1925) + chr(0b1101111) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1212 - 1164) + '\157' + chr(54) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1101111) + chr(0b110000 + 0o2) + chr(0b1001 + 0o54) + chr(55), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110010) + '\061' + '\x33', ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1010 + 0o50) + chr(0b110000) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110010 + 0o4) + '\x31', 8), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1101111) + chr(50) + chr(0b110001) + chr(0b110101), 8), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\x6f' + chr(0b110010) + '\060' + chr(2054 - 2005), ord("\x08")), ehT0Px3KOsy9(chr(629 - 581) + '\x6f' + chr(0b10 + 0o61) + chr(2020 - 1970) + chr(2287 - 2238), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b11100 + 0o24), 52566 - 52558), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53) + chr(49), 0o10), ehT0Px3KOsy9('\060' + chr(6115 - 6004) + chr(2095 - 2044) + chr(0b1010 + 0o53) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(0b1011 + 0o53) + chr(51), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b100111 + 0o13) + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\x30' + chr(0b110100), 51368 - 51360), ehT0Px3KOsy9('\x30' + '\157' + '\063' + chr(50) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + '\x37' + '\x30', 0o10), ehT0Px3KOsy9('\060' + chr(0b1011011 + 0o24) + chr(0b1011 + 0o46) + chr(0b110000) + chr(2187 - 2135), 0o10), ehT0Px3KOsy9(chr(1404 - 1356) + '\157' + chr(0b100000 + 0o23) + chr(0b110001) + '\065', 40297 - 40289), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(10661 - 10550) + '\062' + '\x35' + chr(52), 59199 - 59191)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(2182 - 2134) + chr(111) + chr(0b11011 + 0o32) + chr(0b100101 + 0o13), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x81'), chr(100) + chr(6149 - 6048) + chr(0b1100011) + '\x6f' + chr(0b1100100) + '\x65')(chr(117) + '\164' + '\x66' + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def zStuR1UEXOhu(Ysenbr4MbiEf, Hs9FyboG9Zcl): def nFD5oT4Ev_ni(QmmgWUB13VCJ): if lot1PSoAwYhj(QmmgWUB13VCJ, xafqLlk3kkUe(SXOLrMavuUCe(b'\xcb\xfb]{\xc0'), '\144' + chr(7237 - 7136) + '\143' + chr(111) + chr(0b1100100) + '\145')(chr(0b1110101) + chr(116) + '\x66' + chr(0b1000 + 0o45) + chr(0b11 + 0o65))): return xafqLlk3kkUe(QmmgWUB13VCJ.dtype, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc4\xe6Jo'), chr(7606 - 7506) + chr(8504 - 8403) + chr(0b110101 + 0o56) + chr(111) + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(0b11111 + 0o125) + chr(0b100000 + 0o106) + chr(45) + '\070')) == Hs9FyboG9Zcl return PlSM16l2KDPD(QmmgWUB13VCJ, Ysenbr4MbiEf) return nFD5oT4Ev_ni
quantopian/zipline
zipline/utils/numpy_utils.py
coerce_to_dtype
def coerce_to_dtype(dtype, value): """ Make a value with the specified numpy dtype. Only datetime64[ns] and datetime64[D] are supported for datetime dtypes. """ name = dtype.name if name.startswith('datetime64'): if name == 'datetime64[D]': return make_datetime64D(value) elif name == 'datetime64[ns]': return make_datetime64ns(value) else: raise TypeError( "Don't know how to coerce values of dtype %s" % dtype ) return dtype.type(value)
python
def coerce_to_dtype(dtype, value): """ Make a value with the specified numpy dtype. Only datetime64[ns] and datetime64[D] are supported for datetime dtypes. """ name = dtype.name if name.startswith('datetime64'): if name == 'datetime64[D]': return make_datetime64D(value) elif name == 'datetime64[ns]': return make_datetime64ns(value) else: raise TypeError( "Don't know how to coerce values of dtype %s" % dtype ) return dtype.type(value)
[ "def", "coerce_to_dtype", "(", "dtype", ",", "value", ")", ":", "name", "=", "dtype", ".", "name", "if", "name", ".", "startswith", "(", "'datetime64'", ")", ":", "if", "name", "==", "'datetime64[D]'", ":", "return", "make_datetime64D", "(", "value", ")", "elif", "name", "==", "'datetime64[ns]'", ":", "return", "make_datetime64ns", "(", "value", ")", "else", ":", "raise", "TypeError", "(", "\"Don't know how to coerce values of dtype %s\"", "%", "dtype", ")", "return", "dtype", ".", "type", "(", "value", ")" ]
Make a value with the specified numpy dtype. Only datetime64[ns] and datetime64[D] are supported for datetime dtypes.
[ "Make", "a", "value", "with", "the", "specified", "numpy", "dtype", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L142-L158
train
Coerce a value with the specified numpy dtype.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZf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_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b101100 + 0o5) + chr(50), 0o10), ehT0Px3KOsy9(chr(1470 - 1422) + chr(12308 - 12197) + chr(49) + chr(51) + chr(0b100 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(1914 - 1859) + '\064', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(50) + '\x35' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + chr(668 - 618) + '\067', 55160 - 55152), ehT0Px3KOsy9(chr(1262 - 1214) + chr(11775 - 11664) + chr(49) + chr(155 - 104) + chr(2092 - 2044), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1722 - 1670) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(6412 - 6301) + chr(0b110001) + chr(0b110001) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + chr(4003 - 3892) + chr(0b100001 + 0o22) + '\063' + '\064', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(849 - 800), 51614 - 51606), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(0b101011 + 0o14) + '\065', 40928 - 40920), ehT0Px3KOsy9('\x30' + chr(0b11011 + 0o124) + chr(675 - 624) + chr(1442 - 1390) + chr(2480 - 2426), 0b1000), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(3317 - 3206) + chr(0b110001) + chr(0b110101) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + chr(1983 - 1929) + chr(0b101001 + 0o7), 47811 - 47803), ehT0Px3KOsy9(chr(1514 - 1466) + chr(0b100110 + 0o111) + chr(0b110011) + chr(1348 - 1300) + chr(0b101000 + 0o14), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51) + chr(0b110001) + '\064', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11100 + 0o123) + '\x31' + chr(0b100001 + 0o17) + chr(0b110000 + 0o7), 0o10), ehT0Px3KOsy9('\x30' + chr(0b11001 + 0o126) + chr(50) + chr(50) + '\x33', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(1290 - 1179) + chr(0b110010), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(55) + chr(54), 22096 - 22088), ehT0Px3KOsy9('\x30' + chr(111) + chr(2614 - 2561) + chr(48), 35110 - 35102), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\157' + '\x32' + chr(493 - 443) + chr(1530 - 1481), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(0b110001) + chr(0b100100 + 0o14), 0b1000), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\062' + chr(1286 - 1235) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + chr(0b110000) + chr(0b100100 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(242 - 194), 0b1000), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(11306 - 11195) + chr(2194 - 2140) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11744 - 11633) + chr(49) + chr(51) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(403 - 292) + '\x31' + chr(550 - 498) + '\060', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6762 - 6651) + '\x33' + chr(54) + '\063', 60674 - 60666), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(2687 - 2634) + chr(49), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110001) + chr(0b110010) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(206 - 158), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100011 + 0o15), 8), ehT0Px3KOsy9('\060' + '\x6f' + '\062' + chr(48) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(1593 - 1538), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10001 + 0o40), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(505 - 456) + chr(49), 54504 - 54496), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + chr(52) + '\061', 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(49) + '\x37', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(1025 - 977) + '\157' + chr(0b110101) + chr(0b1011 + 0o45), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'd'), '\144' + '\x65' + chr(0b1 + 0o142) + '\x6f' + chr(100) + chr(0b11110 + 0o107))(chr(0b1110101) + chr(0b0 + 0o164) + '\x66' + '\x2d' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def V4P6ACojlUhD(jSV9IKnemH7K, QmmgWUB13VCJ): AIvJRzLdDfgF = jSV9IKnemH7K.AIvJRzLdDfgF if xafqLlk3kkUe(AIvJRzLdDfgF, xafqLlk3kkUe(SXOLrMavuUCe(b"9/]\xdcc+V'\xa8i"), chr(0b101101 + 0o67) + chr(0b10000 + 0o125) + chr(0b1100011 + 0o0) + chr(0b1101111) + chr(100) + chr(7642 - 7541))(chr(3636 - 3519) + chr(116) + '\x66' + '\055' + chr(0b11110 + 0o32)))(xafqLlk3kkUe(SXOLrMavuUCe(b'.:H\xcbc1L+\xea5'), chr(0b1100100) + chr(5902 - 5801) + '\143' + chr(111) + chr(334 - 234) + chr(8570 - 8469))(chr(117) + chr(0b1110100) + chr(0b101010 + 0o74) + chr(0b101101) + '\070')): if AIvJRzLdDfgF == xafqLlk3kkUe(SXOLrMavuUCe(b'.:H\xcbc1L+\xea5&\xa26'), '\x64' + chr(0b1001000 + 0o35) + chr(8820 - 8721) + '\x6f' + chr(3733 - 3633) + chr(101))(chr(0b1110101) + chr(0b1110100) + chr(102) + chr(0b11010 + 0o23) + chr(0b111000)): return oxdsTCpuS4QX(QmmgWUB13VCJ) elif AIvJRzLdDfgF == xafqLlk3kkUe(SXOLrMavuUCe(b'.:H\xcbc1L+\xea5&\x88\x18\xad'), chr(100) + '\x65' + '\x63' + chr(0b1101111) + chr(0b1100100) + '\145')('\165' + chr(0b101011 + 0o111) + chr(0b100111 + 0o77) + chr(0b1000 + 0o45) + chr(0b111000)): return PtBum4gSCvyn(QmmgWUB13VCJ) else: raise sznFqDbNBHlx(xafqLlk3kkUe(SXOLrMavuUCe(b'\x0e4R\x89cxJ \xb3v]\x8e\x04\x87\xe4\xb8(\xb3a\xd1M\xe3+\xfa\xa0vT2\x15\x96\x1apwf\xa3ku\xb0\x11\xaaj~O'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(11672 - 11561) + '\x64' + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(102) + chr(0b11110 + 0o17) + '\x38') % jSV9IKnemH7K) return xafqLlk3kkUe(jSV9IKnemH7K, xafqLlk3kkUe(SXOLrMavuUCe(b'=6m\xc3n=v\x0c\xb1T\r\x90'), '\144' + chr(0b101111 + 0o66) + chr(99) + chr(1187 - 1076) + chr(100) + chr(9992 - 9891))(chr(3520 - 3403) + chr(116) + chr(7009 - 6907) + '\x2d' + chr(56)))(QmmgWUB13VCJ)
quantopian/zipline
zipline/utils/numpy_utils.py
repeat_first_axis
def repeat_first_axis(array, count): """ Restride `array` to repeat `count` times along the first axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape (count,) + array.shape, composed of `array` repeated `count` times along the first axis. Example ------- >>> from numpy import arange >>> a = arange(3); a array([0, 1, 2]) >>> repeat_first_axis(a, 2) array([[0, 1, 2], [0, 1, 2]]) >>> repeat_first_axis(a, 4) array([[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy first. See Also -------- repeat_last_axis """ return as_strided(array, (count,) + array.shape, (0,) + array.strides)
python
def repeat_first_axis(array, count): """ Restride `array` to repeat `count` times along the first axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape (count,) + array.shape, composed of `array` repeated `count` times along the first axis. Example ------- >>> from numpy import arange >>> a = arange(3); a array([0, 1, 2]) >>> repeat_first_axis(a, 2) array([[0, 1, 2], [0, 1, 2]]) >>> repeat_first_axis(a, 4) array([[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy first. See Also -------- repeat_last_axis """ return as_strided(array, (count,) + array.shape, (0,) + array.strides)
[ "def", "repeat_first_axis", "(", "array", ",", "count", ")", ":", "return", "as_strided", "(", "array", ",", "(", "count", ",", ")", "+", "array", ".", "shape", ",", "(", "0", ",", ")", "+", "array", ".", "strides", ")" ]
Restride `array` to repeat `count` times along the first axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape (count,) + array.shape, composed of `array` repeated `count` times along the first axis. Example ------- >>> from numpy import arange >>> a = arange(3); a array([0, 1, 2]) >>> repeat_first_axis(a, 2) array([[0, 1, 2], [0, 1, 2]]) >>> repeat_first_axis(a, 4) array([[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy first. See Also -------- repeat_last_axis
[ "Restride", "array", "to", "repeat", "count", "times", "along", "the", "first", "axis", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L173-L213
train
Restrides array along the first axis and returns the resulting array.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,Lg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WBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1201 - 1153) + '\x6f' + chr(51) + '\x35' + chr(53), 40336 - 40328), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(48) + chr(0b110001), 47931 - 47923), ehT0Px3KOsy9(chr(675 - 627) + '\157' + '\x33' + chr(618 - 565) + chr(0b11000 + 0o32), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b10000 + 0o43) + chr(50) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + chr(0b110111) + chr(283 - 230), 0o10), ehT0Px3KOsy9('\x30' + chr(0b10101 + 0o132) + chr(0b110011) + chr(422 - 370) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1100110 + 0o11) + chr(51) + chr(0b10000 + 0o40) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b110100 + 0o73) + '\x32' + '\063' + chr(2378 - 2326), 0o10), ehT0Px3KOsy9(chr(837 - 789) + '\x6f' + '\061' + chr(0b100000 + 0o22) + '\x32', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1449 - 1400), 38851 - 38843), ehT0Px3KOsy9(chr(48) + chr(4597 - 4486) + chr(0b11001 + 0o30) + chr(0b11101 + 0o32) + '\063', 8396 - 8388), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(54) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\062' + chr(0b110000) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\062', ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(111) + chr(0b110010), 8), ehT0Px3KOsy9(chr(0b1 + 0o57) + '\157' + chr(0b110010) + chr(0b110010), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(1683 - 1632) + chr(476 - 423) + chr(0b110011), 17905 - 17897), ehT0Px3KOsy9(chr(1540 - 1492) + chr(0b1101111) + chr(1838 - 1787) + chr(1744 - 1690) + chr(2005 - 1952), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b110101 + 0o72) + chr(49) + chr(48) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1834 - 1779) + chr(49), 14484 - 14476), ehT0Px3KOsy9(chr(1517 - 1469) + chr(0b1000100 + 0o53) + chr(0b110111) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1111 + 0o140) + chr(0b110001) + chr(0b1011 + 0o50) + chr(0b110101), 33443 - 33435), ehT0Px3KOsy9(chr(48) + chr(0b1100101 + 0o12) + '\062' + '\062' + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(50) + '\x33' + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110011) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + '\157' + chr(49) + chr(0b11110 + 0o30) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b101111 + 0o100) + chr(51) + '\064' + chr(1087 - 1039), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\x6f' + chr(0b110010) + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1000110 + 0o51) + chr(0b1111 + 0o44) + chr(50) + chr(1274 - 1220), 8), ehT0Px3KOsy9(chr(246 - 198) + chr(0b0 + 0o157) + chr(1087 - 1037) + chr(971 - 922) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + chr(7886 - 7775) + '\063' + '\066' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + chr(0b100101 + 0o22), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\063', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(51), 8), ehT0Px3KOsy9(chr(438 - 390) + '\157' + '\x33' + '\065' + '\061', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b1101111) + chr(50) + '\067' + chr(0b10101 + 0o34), 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(2928 - 2817) + chr(0b110111) + chr(0b10010 + 0o45), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b110011) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(111) + '\x31' + chr(0b100000 + 0o24), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + '\x35' + '\x30', 58174 - 58166)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xc3'), '\x64' + chr(0b1001100 + 0o31) + '\143' + chr(111) + '\144' + chr(6030 - 5929))(chr(117) + chr(0b101101 + 0o107) + chr(0b1100110) + '\055' + chr(2586 - 2530)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ahH60iEANaPk(B0ePDhpqxN5n, ualWdDeXJEGO): return RUxSkgpoKNmv(B0ePDhpqxN5n, (ualWdDeXJEGO,) + xafqLlk3kkUe(B0ePDhpqxN5n, xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\xe0\x9f\x8f[\xad\xa7\xf0\x06q\x18T'), chr(7548 - 7448) + '\x65' + '\x63' + chr(0b10010 + 0o135) + chr(4050 - 3950) + chr(0b1100101))(chr(117) + '\x74' + '\x66' + chr(0b101101) + chr(56))), (ehT0Px3KOsy9(chr(48) + '\x6f' + chr(48), ord("\x08")),) + xafqLlk3kkUe(B0ePDhpqxN5n, xafqLlk3kkUe(SXOLrMavuUCe(b'\x9f\xb9\x81\xb8w\x8c\x8d\xc8\x06J\x0c@'), chr(0b1100100) + chr(9640 - 9539) + chr(0b1000111 + 0o34) + chr(0b100000 + 0o117) + chr(5663 - 5563) + chr(0b1100101))('\165' + chr(9708 - 9592) + '\x66' + chr(0b101101) + '\x38')))
quantopian/zipline
zipline/utils/numpy_utils.py
repeat_last_axis
def repeat_last_axis(array, count): """ Restride `array` to repeat `count` times along the last axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape array.shape + (count,) composed of `array` repeated `count` times along the last axis. Example ------- >>> from numpy import arange >>> a = arange(3); a array([0, 1, 2]) >>> repeat_last_axis(a, 2) array([[0, 0], [1, 1], [2, 2]]) >>> repeat_last_axis(a, 4) array([[0, 0, 0, 0], [1, 1, 1, 1], [2, 2, 2, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy first. See Also -------- repeat_last_axis """ return as_strided(array, array.shape + (count,), array.strides + (0,))
python
def repeat_last_axis(array, count): """ Restride `array` to repeat `count` times along the last axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape array.shape + (count,) composed of `array` repeated `count` times along the last axis. Example ------- >>> from numpy import arange >>> a = arange(3); a array([0, 1, 2]) >>> repeat_last_axis(a, 2) array([[0, 0], [1, 1], [2, 2]]) >>> repeat_last_axis(a, 4) array([[0, 0, 0, 0], [1, 1, 1, 1], [2, 2, 2, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy first. See Also -------- repeat_last_axis """ return as_strided(array, array.shape + (count,), array.strides + (0,))
[ "def", "repeat_last_axis", "(", "array", ",", "count", ")", ":", "return", "as_strided", "(", "array", ",", "array", ".", "shape", "+", "(", "count", ",", ")", ",", "array", ".", "strides", "+", "(", "0", ",", ")", ")" ]
Restride `array` to repeat `count` times along the last axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape array.shape + (count,) composed of `array` repeated `count` times along the last axis. Example ------- >>> from numpy import arange >>> a = arange(3); a array([0, 1, 2]) >>> repeat_last_axis(a, 2) array([[0, 0], [1, 1], [2, 2]]) >>> repeat_last_axis(a, 4) array([[0, 0, 0, 0], [1, 1, 1, 1], [2, 2, 2, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy first. See Also -------- repeat_last_axis
[ "Restride", "array", "to", "repeat", "count", "times", "along", "the", "last", "axis", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L216-L256
train
Restrides array along the last axis and returns the resulting array.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L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tAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1103 - 1055) + chr(111) + chr(0b110111) + '\x33', 0o10), ehT0Px3KOsy9(chr(2089 - 2041) + chr(0b11101 + 0o122) + chr(0b11010 + 0o31) + chr(0b110011) + chr(54), 0o10), ehT0Px3KOsy9(chr(1154 - 1106) + chr(0b1001011 + 0o44) + chr(0b100000 + 0o22) + chr(0b10101 + 0o37) + chr(0b10 + 0o61), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1 + 0o156) + chr(0b101000 + 0o13) + '\x31' + '\x31', 0b1000), ehT0Px3KOsy9(chr(1150 - 1102) + chr(111) + chr(2209 - 2154), 48796 - 48788), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(49) + '\062' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(51) + '\x31' + chr(0b110000 + 0o1), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + '\x33' + chr(2134 - 2084), 0o10), ehT0Px3KOsy9(chr(2070 - 2022) + chr(0b1100 + 0o143) + chr(54) + chr(0b10011 + 0o37), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110011) + chr(0b10100 + 0o34) + chr(52), 44536 - 44528), ehT0Px3KOsy9('\060' + chr(6179 - 6068) + '\062' + chr(0b1011 + 0o54) + chr(0b11011 + 0o26), 24048 - 24040), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(362 - 312) + '\062' + chr(0b11010 + 0o26), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101011 + 0o4) + chr(0b10001 + 0o42) + chr(0b10011 + 0o36) + chr(847 - 795), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1167 - 1117) + '\063' + chr(0b11111 + 0o24), 24402 - 24394), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b1100 + 0o45) + chr(0b10000 + 0o47) + chr(1952 - 1902), ord("\x08")), ehT0Px3KOsy9(chr(1727 - 1679) + chr(0b1101111) + chr(50) + chr(0b110100) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(0b110010) + chr(1940 - 1887) + chr(0b101110 + 0o11), ord("\x08")), ehT0Px3KOsy9('\060' + chr(2010 - 1899) + chr(1234 - 1184) + chr(52) + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b10011 + 0o36) + chr(0b11111 + 0o23), 31275 - 31267), ehT0Px3KOsy9('\060' + chr(111) + chr(1302 - 1253) + chr(328 - 280) + chr(0b100111 + 0o11), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(9379 - 9268) + chr(0b10111 + 0o32) + chr(0b110100) + chr(0b11111 + 0o21), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\x30' + chr(0b10111 + 0o37), 26503 - 26495), ehT0Px3KOsy9('\x30' + chr(1538 - 1427) + '\x35' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(183 - 129) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + '\062' + chr(0b100100 + 0o22) + '\064', 15823 - 15815), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b100000 + 0o20) + '\x37', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b11100 + 0o25) + chr(0b100 + 0o62), 0o10), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + chr(0b101010 + 0o10) + '\x35' + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(2937 - 2826) + '\x32' + '\067' + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1010111 + 0o30) + chr(0b101010 + 0o11) + chr(0b110111) + chr(0b100011 + 0o15), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2081 - 2031) + chr(1606 - 1555) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(50) + chr(48), 0b1000), ehT0Px3KOsy9('\x30' + chr(11118 - 11007) + chr(0b110011) + '\x35' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\x31' + chr(0b10111 + 0o33) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(1908 - 1860) + chr(111) + '\x33' + chr(0b110111) + '\065', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + '\x6f' + chr(0b11100 + 0o32) + '\066', 0b1000), ehT0Px3KOsy9(chr(1787 - 1739) + chr(0b1101111) + '\x31' + chr(0b110010), 8), ehT0Px3KOsy9(chr(102 - 54) + chr(0b1101111) + chr(55) + '\064', 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + '\x33' + '\x35' + '\x34', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(111) + '\x35' + chr(0b101100 + 0o4), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x15'), chr(0b10010 + 0o122) + '\x65' + '\x63' + '\157' + '\144' + chr(101))(chr(313 - 196) + chr(0b1110100) + chr(0b1100110) + chr(643 - 598) + chr(1001 - 945)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def dL7AaJSVwYmy(B0ePDhpqxN5n, ualWdDeXJEGO): return RUxSkgpoKNmv(B0ePDhpqxN5n, xafqLlk3kkUe(B0ePDhpqxN5n, xafqLlk3kkUe(SXOLrMavuUCe(b'U\xbf\xd6\x90a\x1a\xae\xb6f\xb4\xda\xf2'), '\144' + chr(0b1000111 + 0o36) + '\143' + chr(0b1101111) + chr(0b1100100) + '\145')(chr(9840 - 9723) + chr(4985 - 4869) + chr(0b11100 + 0o112) + chr(0b101101) + chr(56))) + (ualWdDeXJEGO,), xafqLlk3kkUe(B0ePDhpqxN5n, xafqLlk3kkUe(SXOLrMavuUCe(b'I\xe6\xc8\xa7M;\x84\x8ef\x8f\xce\xe6'), chr(7257 - 7157) + chr(0b1100101) + '\143' + '\x6f' + '\144' + chr(7456 - 7355))('\165' + chr(0b100 + 0o160) + chr(102) + chr(45) + '\x38')) + (ehT0Px3KOsy9('\060' + chr(111) + chr(0b110000), ord("\x08")),))
quantopian/zipline
zipline/utils/numpy_utils.py
isnat
def isnat(obj): """ Check if a value is np.NaT. """ if obj.dtype.kind not in ('m', 'M'): raise ValueError("%s is not a numpy datetime or timedelta") return obj.view(int64_dtype) == iNaT
python
def isnat(obj): """ Check if a value is np.NaT. """ if obj.dtype.kind not in ('m', 'M'): raise ValueError("%s is not a numpy datetime or timedelta") return obj.view(int64_dtype) == iNaT
[ "def", "isnat", "(", "obj", ")", ":", "if", "obj", ".", "dtype", ".", "kind", "not", "in", "(", "'m'", ",", "'M'", ")", ":", "raise", "ValueError", "(", "\"%s is not a numpy datetime or timedelta\"", ")", "return", "obj", ".", "view", "(", "int64_dtype", ")", "==", "iNaT" ]
Check if a value is np.NaT.
[ "Check", "if", "a", "value", "is", "np", ".", "NaT", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/nump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eSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b1001 + 0o53) + '\x36', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(2187 - 2138) + '\061' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + '\x6f' + chr(0b110011) + chr(0b110 + 0o56) + chr(161 - 110), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(286 - 237) + chr(48) + chr(0b0 + 0o61), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\157' + chr(0b110001) + '\065' + '\067', 8648 - 8640), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + chr(48), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + chr(54) + '\061', 0b1000), ehT0Px3KOsy9(chr(1699 - 1651) + chr(0b1101111) + '\x32' + '\066' + chr(54), 0o10), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(0b1101111) + '\x33' + chr(2696 - 2642) + chr(49), 8), ehT0Px3KOsy9(chr(48) + chr(0b10 + 0o155) + chr(0b110011) + '\063' + chr(0b110111), 13779 - 13771), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10000 + 0o41) + chr(486 - 434) + chr(889 - 834), 0o10), ehT0Px3KOsy9(chr(48) + chr(11169 - 11058) + chr(0b110001) + '\x35' + '\x32', 38474 - 38466), ehT0Px3KOsy9('\x30' + chr(0b1101000 + 0o7) + chr(0b110011) + chr(0b10100 + 0o43) + chr(0b110000), 9917 - 9909), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(1819 - 1771), 610 - 602), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(457 - 406) + chr(0b110110) + '\064', 56794 - 56786), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\x32' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(595 - 544) + chr(0b110011) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11794 - 11683) + chr(0b110001) + '\065' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\060' + chr(50), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(0b110000 + 0o1) + chr(577 - 527), 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(7101 - 6990) + chr(1237 - 1185), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(1617 - 1569) + '\157' + '\x32' + chr(0b110000) + chr(51), 39923 - 39915), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(58 - 9) + '\066', 8), ehT0Px3KOsy9(chr(977 - 929) + chr(0b1101111) + '\067' + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1797 - 1746) + chr(0b100100 + 0o17) + chr(0b11111 + 0o24), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + '\x35' + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(9094 - 8983) + '\063' + '\x34' + '\064', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(1303 - 1254) + '\x36', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1001001 + 0o46) + '\062' + chr(48) + chr(0b100010 + 0o24), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110010) + chr(0b110101) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11010 + 0o31) + chr(0b100011 + 0o17) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(2124 - 2076) + chr(0b1101111) + chr(52) + '\x37', 5810 - 5802), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(111) + '\063' + chr(2606 - 2551) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b11001 + 0o126) + '\063' + chr(51) + chr(0b110011), 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + '\063' + chr(0b110100) + chr(1076 - 1027), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x34' + '\x30', 0b1000), ehT0Px3KOsy9('\060' + chr(0b110001 + 0o76) + '\x31' + chr(55) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1101111) + '\x32' + '\x33' + chr(0b10111 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(2537 - 2426) + chr(1476 - 1427) + chr(356 - 307), 44503 - 44495)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(929 - 881) + chr(4564 - 4453) + '\065' + '\060', 19039 - 19031)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'H'), chr(1052 - 952) + chr(101) + chr(0b1100011 + 0o0) + '\x6f' + chr(0b1100100) + chr(101))(chr(4857 - 4740) + chr(116) + chr(0b1100110) + chr(0b11011 + 0o22) + chr(0b100010 + 0o26)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def gtgKknxf4gHf(mDuDykdz0pcm): if xafqLlk3kkUe(mDuDykdz0pcm.dtype, xafqLlk3kkUe(SXOLrMavuUCe(b"\r'\x8d%"), '\144' + chr(101) + chr(6713 - 6614) + '\x6f' + '\144' + '\x65')(chr(0b1110101) + chr(10512 - 10396) + chr(0b1100110) + '\055' + chr(2370 - 2314))) not in (xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b'), chr(100) + chr(0b1010 + 0o133) + '\143' + chr(0b1000001 + 0o56) + '\144' + '\145')(chr(12899 - 12782) + '\164' + chr(6998 - 6896) + chr(0b101101) + chr(897 - 841)), xafqLlk3kkUe(SXOLrMavuUCe(b'+'), chr(100) + '\145' + chr(2563 - 2464) + chr(7748 - 7637) + '\144' + chr(0b1100101))(chr(5014 - 4897) + '\164' + '\146' + '\055' + chr(0b111000))): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"C=\xc3(\x1c(\x9f\xd9\x85\xff\x06J\x96e\x99\xe5\xa3H\xa6+pb\xf7'V\xbeI\x8b\xbc\xa6\xdd\xbdJ\x9b\xbf\x84L\x08\xfa"), '\x64' + '\x65' + '\143' + chr(111) + '\x64' + chr(0b1100101))(chr(0b1000001 + 0o64) + chr(0b1101010 + 0o12) + chr(0b1011000 + 0o16) + chr(45) + chr(1460 - 1404))) return xafqLlk3kkUe(mDuDykdz0pcm, xafqLlk3kkUe(SXOLrMavuUCe(b"\x10'\x866"), '\144' + chr(8160 - 8059) + chr(6421 - 6322) + chr(10338 - 10227) + '\144' + '\x65')('\165' + chr(2987 - 2871) + chr(0b1100110) + chr(0b101101) + chr(0b111000)))(kcCBRWN1iVp9) == gvW8CI2WhTEx
quantopian/zipline
zipline/utils/numpy_utils.py
is_missing
def is_missing(data, missing_value): """ Generic is_missing function that handles NaN and NaT. """ if is_float(data) and isnan(missing_value): return isnan(data) elif is_datetime(data) and isnat(missing_value): return isnat(data) return (data == missing_value)
python
def is_missing(data, missing_value): """ Generic is_missing function that handles NaN and NaT. """ if is_float(data) and isnan(missing_value): return isnan(data) elif is_datetime(data) and isnat(missing_value): return isnat(data) return (data == missing_value)
[ "def", "is_missing", "(", "data", ",", "missing_value", ")", ":", "if", "is_float", "(", "data", ")", "and", "isnan", "(", "missing_value", ")", ":", "return", "isnan", "(", "data", ")", "elif", "is_datetime", "(", "data", ")", "and", "isnat", "(", "missing_value", ")", ":", "return", "isnat", "(", "data", ")", "return", "(", "data", "==", "missing_value", ")" ]
Generic is_missing function that handles NaN and NaT.
[ "Generic", "is_missing", "function", "that", "handles", "NaN", "and", "NaT", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L343-L351
train
Generic is_missing function that handles NaN and NaT.
Pu7Z6IJCgH3a,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6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(11882 - 11771) + '\x33' + chr(466 - 418), 0o10), ehT0Px3KOsy9(chr(2048 - 2000) + chr(11149 - 11038) + chr(0b110001) + chr(0b110011) + chr(0b100001 + 0o17), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b1100 + 0o46) + chr(1271 - 1217), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b0 + 0o157) + chr(49) + chr(522 - 469) + '\061', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b11101 + 0o122) + chr(0b101 + 0o54) + '\x35' + '\065', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(0b1100001 + 0o16) + '\062' + '\067', 62110 - 62102), ehT0Px3KOsy9('\060' + '\157' + chr(489 - 439) + chr(0b110010) + chr(0b101101 + 0o12), 42562 - 42554), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011 + 0o0) + '\x34' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100001 + 0o22) + chr(0b101101 + 0o7) + chr(1303 - 1255), 25933 - 25925), ehT0Px3KOsy9('\x30' + '\x6f' + chr(50) + chr(54) + chr(51), 63446 - 63438), ehT0Px3KOsy9(chr(48) + chr(5102 - 4991) + '\063' + chr(55) + '\064', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(1517 - 1466) + '\x32' + chr(2376 - 2322), 6206 - 6198), ehT0Px3KOsy9(chr(48) + chr(2541 - 2430) + chr(0b101110 + 0o4) + '\x37' + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110100) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(7371 - 7260) + chr(2717 - 2663) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110 + 0o55) + chr(0b110000) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1367 - 1319) + chr(0b1101111) + '\061' + chr(0b10001 + 0o45) + '\062', 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(873 - 821) + chr(1072 - 1023), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(2896 - 2785) + '\x36', 65154 - 65146), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + '\063', 19697 - 19689), ehT0Px3KOsy9('\060' + chr(111) + chr(101 - 51) + chr(0b1101 + 0o45) + '\x37', 8), ehT0Px3KOsy9(chr(667 - 619) + '\157' + chr(0b101101 + 0o4), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(49) + chr(54), 28048 - 28040), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110011) + chr(1749 - 1701) + chr(0b1001 + 0o53), ord("\x08")), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(111) + chr(0b110001) + chr(1758 - 1707) + chr(0b1011 + 0o46), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + '\062' + chr(0b110001), 36908 - 36900), ehT0Px3KOsy9('\060' + chr(0b1011010 + 0o25) + chr(49) + '\x36', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(932 - 879) + '\065', 8), ehT0Px3KOsy9('\x30' + chr(0b1001010 + 0o45) + chr(349 - 295) + chr(0b10111 + 0o33), ord("\x08")), ehT0Px3KOsy9(chr(334 - 286) + chr(0b1101111) + chr(0b11010 + 0o27) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5103 - 4992) + chr(1323 - 1272) + chr(0b110101) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(1622 - 1574) + '\x6f' + chr(0b110 + 0o53) + chr(0b11101 + 0o30) + chr(50), 52745 - 52737), ehT0Px3KOsy9('\x30' + chr(111) + '\x35' + '\062', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110011) + '\x31' + chr(52), 61943 - 61935), ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + '\x31' + chr(0b10010 + 0o40) + '\062', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110000) + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(12095 - 11984) + chr(51) + '\x37' + chr(2463 - 2408), 15245 - 15237), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100011 + 0o21) + chr(0b11 + 0o57), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + '\065' + chr(0b11000 + 0o30), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'6'), chr(0b1100100) + chr(0b1001101 + 0o30) + '\x63' + '\x6f' + chr(100) + chr(0b1000110 + 0o37))('\x75' + '\164' + '\146' + chr(0b101101) + chr(167 - 111)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def U3w9Hd3T_KjS(ULnjp6D6efFH, cM6FSYO3vPuj): if got4HTQTZoix(ULnjp6D6efFH) and wN4RVZAxJEhp(cM6FSYO3vPuj): return wN4RVZAxJEhp(ULnjp6D6efFH) elif ArniSirHW7kI(ULnjp6D6efFH) and gtgKknxf4gHf(cM6FSYO3vPuj): return gtgKknxf4gHf(ULnjp6D6efFH) return ULnjp6D6efFH == cM6FSYO3vPuj
quantopian/zipline
zipline/utils/numpy_utils.py
busday_count_mask_NaT
def busday_count_mask_NaT(begindates, enddates, out=None): """ Simple of numpy.busday_count that returns `float` arrays rather than int arrays, and handles `NaT`s by returning `NaN`s where the inputs were `NaT`. Doesn't support custom weekdays or calendars, but probably should in the future. See Also -------- np.busday_count """ if out is None: out = empty(broadcast(begindates, enddates).shape, dtype=float) beginmask = isnat(begindates) endmask = isnat(enddates) out = busday_count( # Temporarily fill in non-NaT values. where(beginmask, _notNaT, begindates), where(endmask, _notNaT, enddates), out=out, ) # Fill in entries where either comparison was NaT with nan in the output. out[beginmask | endmask] = nan return out
python
def busday_count_mask_NaT(begindates, enddates, out=None): """ Simple of numpy.busday_count that returns `float` arrays rather than int arrays, and handles `NaT`s by returning `NaN`s where the inputs were `NaT`. Doesn't support custom weekdays or calendars, but probably should in the future. See Also -------- np.busday_count """ if out is None: out = empty(broadcast(begindates, enddates).shape, dtype=float) beginmask = isnat(begindates) endmask = isnat(enddates) out = busday_count( # Temporarily fill in non-NaT values. where(beginmask, _notNaT, begindates), where(endmask, _notNaT, enddates), out=out, ) # Fill in entries where either comparison was NaT with nan in the output. out[beginmask | endmask] = nan return out
[ "def", "busday_count_mask_NaT", "(", "begindates", ",", "enddates", ",", "out", "=", "None", ")", ":", "if", "out", "is", "None", ":", "out", "=", "empty", "(", "broadcast", "(", "begindates", ",", "enddates", ")", ".", "shape", ",", "dtype", "=", "float", ")", "beginmask", "=", "isnat", "(", "begindates", ")", "endmask", "=", "isnat", "(", "enddates", ")", "out", "=", "busday_count", "(", "# Temporarily fill in non-NaT values.", "where", "(", "beginmask", ",", "_notNaT", ",", "begindates", ")", ",", "where", "(", "endmask", ",", "_notNaT", ",", "enddates", ")", ",", "out", "=", "out", ",", ")", "# Fill in entries where either comparison was NaT with nan in the output.", "out", "[", "beginmask", "|", "endmask", "]", "=", "nan", "return", "out" ]
Simple of numpy.busday_count that returns `float` arrays rather than int arrays, and handles `NaT`s by returning `NaN`s where the inputs were `NaT`. Doesn't support custom weekdays or calendars, but probably should in the future. See Also -------- np.busday_count
[ "Simple", "of", "numpy", ".", "busday_count", "that", "returns", "float", "arrays", "rather", "than", "int", "arrays", "and", "handles", "NaT", "s", "by", "returning", "NaN", "s", "where", "the", "inputs", "were", "NaT", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L354-L381
train
Simple of numpy. busday_count that returns float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,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b110010) + '\x30' + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(7944 - 7833) + chr(0b110010) + chr(53) + chr(0b1111 + 0o43), 57634 - 57626), ehT0Px3KOsy9(chr(48) + chr(111) + chr(51) + '\x30' + chr(743 - 691), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(49) + chr(52) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x35' + chr(1585 - 1535), 0o10), ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\x6f' + '\x32' + chr(0b10110 + 0o34) + chr(1007 - 958), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b11010 + 0o30) + chr(1115 - 1067) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1863 - 1813) + chr(0b110101) + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(55) + '\060', 10518 - 10510), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + '\x33' + '\066', ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(0b11010 + 0o27) + chr(0b101110 + 0o3) + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2235 - 2187) + '\x6f' + chr(0b110010) + chr(55) + chr(1492 - 1443), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b110010 + 0o75) + chr(1057 - 1008) + '\065' + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b11110 + 0o25) + '\x37' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(49) + chr(0b110010) + '\x36', 0b1000), ehT0Px3KOsy9(chr(1463 - 1415) + '\157' + chr(0b110010) + chr(1431 - 1378) + '\066', 0o10), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + chr(49) + chr(0b1011 + 0o50), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101100 + 0o3) + chr(0b110011) + chr(1771 - 1716), 19021 - 19013), ehT0Px3KOsy9(chr(1670 - 1622) + chr(11786 - 11675) + '\063' + '\061' + chr(0b110101), 33864 - 33856), ehT0Px3KOsy9(chr(0b1001 + 0o47) + '\157' + chr(595 - 545) + chr(2694 - 2641) + chr(0b110100), 48466 - 48458), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101110 + 0o3) + chr(55) + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(1203 - 1155) + '\x6f' + chr(51) + chr(0b10101 + 0o33) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(2446 - 2335) + chr(49) + chr(51) + chr(1758 - 1703), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x34' + chr(0b1 + 0o66), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1740 - 1689) + chr(0b110011) + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(7892 - 7781) + chr(0b100100 + 0o16) + '\061', 45280 - 45272), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(0b100011 + 0o17) + chr(55) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(3433 - 3322) + '\061' + '\065' + chr(52), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\063' + '\063', 0b1000), ehT0Px3KOsy9(chr(176 - 128) + '\157' + '\063' + chr(55) + chr(48), 14364 - 14356), ehT0Px3KOsy9('\060' + chr(9804 - 9693) + '\064' + chr(0b11010 + 0o34), 0o10), ehT0Px3KOsy9(chr(447 - 399) + chr(2082 - 1971) + '\x31' + '\062' + chr(1670 - 1619), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + chr(675 - 627) + '\061', 8), ehT0Px3KOsy9(chr(0b100010 + 0o16) + '\157' + chr(0b1001 + 0o50) + chr(1826 - 1773) + chr(521 - 466), 8), ehT0Px3KOsy9(chr(1262 - 1214) + chr(111) + chr(0b110001) + chr(49) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(1775 - 1727) + chr(0b1101111) + chr(0b110001) + chr(55), 4555 - 4547), ehT0Px3KOsy9(chr(1526 - 1478) + chr(111) + chr(50) + '\x34' + chr(48), 0o10), ehT0Px3KOsy9('\x30' + chr(7351 - 7240) + chr(0b10101 + 0o34) + chr(174 - 126) + chr(1023 - 973), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9374 - 9263) + '\x32' + '\x36' + chr(0b110010), 60181 - 60173), ehT0Px3KOsy9(chr(456 - 408) + chr(6810 - 6699) + '\061' + chr(0b100011 + 0o16) + chr(2386 - 2334), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + chr(0b1010010 + 0o35) + chr(53) + '\060', 30977 - 30969)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xaf'), chr(0b101001 + 0o73) + '\x65' + chr(99) + chr(10733 - 10622) + '\144' + '\145')(chr(0b1011000 + 0o35) + chr(0b1110100) + chr(0b1100110) + '\055' + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def EcqSqB0tFD9Y(_MJlZLVm4OpC, LGYh5ZQieq36, UkrMp_I0RDmo=None): if UkrMp_I0RDmo is None: UkrMp_I0RDmo = QxT4AUiPWdm4(SFLwxj1AxqH2(_MJlZLVm4OpC, LGYh5ZQieq36).nauYfLglTpcb, dtype=kkSX4ccExqw4) jE1oeapdbYKc = gtgKknxf4gHf(_MJlZLVm4OpC) ztjbpPBSLyT7 = gtgKknxf4gHf(LGYh5ZQieq36) UkrMp_I0RDmo = hFQxy67Hfo2j(dRFAC59yQBm_(jE1oeapdbYKc, sA7VRB8xnxL5, _MJlZLVm4OpC), dRFAC59yQBm_(ztjbpPBSLyT7, sA7VRB8xnxL5, LGYh5ZQieq36), out=UkrMp_I0RDmo) UkrMp_I0RDmo[jE1oeapdbYKc | ztjbpPBSLyT7] = wL5W1xj47aOd return UkrMp_I0RDmo
quantopian/zipline
zipline/utils/numpy_utils.py
changed_locations
def changed_locations(a, include_first): """ Compute indices of values in ``a`` that differ from the previous value. Parameters ---------- a : np.ndarray The array on which to indices of change. include_first : bool Whether or not to consider the first index of the array as "changed". Example ------- >>> import numpy as np >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=False) array([2, 4]) >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=True) array([0, 2, 4]) """ if a.ndim > 1: raise ValueError("indices_of_changed_values only supports 1D arrays.") indices = flatnonzero(diff(a)) + 1 if not include_first: return indices return hstack([[0], indices])
python
def changed_locations(a, include_first): """ Compute indices of values in ``a`` that differ from the previous value. Parameters ---------- a : np.ndarray The array on which to indices of change. include_first : bool Whether or not to consider the first index of the array as "changed". Example ------- >>> import numpy as np >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=False) array([2, 4]) >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=True) array([0, 2, 4]) """ if a.ndim > 1: raise ValueError("indices_of_changed_values only supports 1D arrays.") indices = flatnonzero(diff(a)) + 1 if not include_first: return indices return hstack([[0], indices])
[ "def", "changed_locations", "(", "a", ",", "include_first", ")", ":", "if", "a", ".", "ndim", ">", "1", ":", "raise", "ValueError", "(", "\"indices_of_changed_values only supports 1D arrays.\"", ")", "indices", "=", "flatnonzero", "(", "diff", "(", "a", ")", ")", "+", "1", "if", "not", "include_first", ":", "return", "indices", "return", "hstack", "(", "[", "[", "0", "]", ",", "indices", "]", ")" ]
Compute indices of values in ``a`` that differ from the previous value. Parameters ---------- a : np.ndarray The array on which to indices of change. include_first : bool Whether or not to consider the first index of the array as "changed". Example ------- >>> import numpy as np >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=False) array([2, 4]) >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=True) array([0, 2, 4])
[ "Compute", "indices", "of", "values", "in", "a", "that", "differ", "from", "the", "previous", "value", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/numpy_utils.py#L469-L496
train
Compute indices of values in a that differ from the previous value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1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OC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1877 - 1829) + '\157' + chr(0b111 + 0o55) + '\x36', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11209 - 11098) + '\062' + chr(0b110011) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1101111) + chr(52) + chr(0b10110 + 0o32), 0o10), ehT0Px3KOsy9(chr(1067 - 1019) + chr(4512 - 4401) + '\x31' + '\064' + '\066', 63477 - 63469), ehT0Px3KOsy9(chr(0b110000) + chr(8692 - 8581) + '\x33' + '\x35' + chr(1922 - 1868), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(53) + chr(0b110101), 21584 - 21576), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + '\x32' + '\063' + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110011) + '\x33' + '\061', 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(460 - 411) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(110 - 62) + chr(0b1010 + 0o145) + '\x32' + '\061' + chr(989 - 936), 29295 - 29287), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100011 + 0o16) + chr(0b101100 + 0o7) + chr(615 - 562), 24049 - 24041), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(168 - 115) + '\x34', 21274 - 21266), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100110 + 0o11) + chr(0b110001) + chr(0b110101), 46086 - 46078), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2178 - 2127) + chr(2419 - 2366) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\157' + chr(0b110011) + chr(0b100101 + 0o17) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\063' + chr(0b100001 + 0o20) + chr(0b1011 + 0o50), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(51) + '\x31', 57963 - 57955), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1101111) + chr(181 - 132) + chr(1368 - 1313) + chr(0b1 + 0o65), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(0b1101111) + '\x33' + chr(52) + '\x31', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b110010 + 0o75) + chr(1493 - 1442) + chr(54) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1010011 + 0o34) + chr(0b110111) + chr(55), 36960 - 36952), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b110001) + chr(2508 - 2456), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(943 - 894) + chr(55) + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(55) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(200 - 152) + chr(3309 - 3198) + chr(49) + chr(0b110001) + '\x37', 55121 - 55113), ehT0Px3KOsy9(chr(461 - 413) + '\x6f' + chr(0b11001 + 0o31) + chr(0b10101 + 0o37) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(650 - 602) + '\157' + '\061' + chr(0b110 + 0o61), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(9157 - 9046) + '\062' + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + '\062' + chr(1153 - 1099) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(53) + chr(0b101001 + 0o10), 0b1000), ehT0Px3KOsy9(chr(154 - 106) + chr(7952 - 7841) + chr(479 - 424) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10010 + 0o135) + chr(815 - 766) + chr(0b11100 + 0o31) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b101001 + 0o12) + '\x32' + chr(0b110101), 0b1000), ehT0Px3KOsy9('\x30' + chr(5596 - 5485) + chr(0b110010) + '\x34' + '\061', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x37' + chr(0b10100 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(2217 - 2169) + '\x6f' + chr(1152 - 1101) + '\063' + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b1101111) + chr(51) + chr(53) + chr(811 - 761), 48248 - 48240), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(1489 - 1439) + chr(2196 - 2142) + chr(472 - 418), 55115 - 55107), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2061 - 2010) + '\x36' + '\x36', 8), ehT0Px3KOsy9(chr(1735 - 1687) + chr(0b10 + 0o155) + chr(0b10011 + 0o43), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b100101 + 0o13) + '\x6f' + chr(0b110101) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x08'), '\x64' + '\x65' + chr(0b1100011) + '\x6f' + '\144' + '\145')(chr(5912 - 5795) + '\164' + '\146' + chr(45) + chr(0b110000 + 0o10)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def FulzHSIWxANh(XPh1qbAgrPgG, eALq4BUOlAZV): if xafqLlk3kkUe(XPh1qbAgrPgG, xafqLlk3kkUe(SXOLrMavuUCe(b'A\xf5M\x16\xa6\xef\xf4\x8d\xbc\xeb\x17\xf8'), chr(0b1100100) + chr(101) + chr(0b1100011) + chr(0b1101111) + '\x64' + '\145')(chr(117) + '\164' + chr(5742 - 5640) + '\055' + chr(2149 - 2093))) > ehT0Px3KOsy9(chr(0b11001 + 0o27) + chr(9687 - 9576) + chr(0b110001), ord("\x08")): raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'O\xf4D\x0f\x8d\xc8\xee\x86\xa0\xeb\x02\xcfe\x8d\x8b\xac|\x1a\xbe\x80^ \x0e\xdb<\x86`x\xd9P\x1e\x1e\xa0\xd1L\xb5\x98\xc2\x85&\x17\xde\x00\x07\x9c\xdf\xfc\xa0\xbc\xa3'), chr(0b1100100) + chr(0b100011 + 0o102) + chr(0b1100011) + chr(111) + '\x64' + '\x65')('\165' + '\x74' + chr(102) + chr(45) + chr(2816 - 2760))) pIcoaXENl5Pw = ovIDE5WP7iWM(A3JtwFGKVTf0(XPh1qbAgrPgG)) + ehT0Px3KOsy9(chr(48) + chr(760 - 649) + '\x31', 8) if not eALq4BUOlAZV: return pIcoaXENl5Pw return UNwTzO2RRAN1([[ehT0Px3KOsy9(chr(2156 - 2108) + '\x6f' + '\x30', 6424 - 6416)], pIcoaXENl5Pw])
quantopian/zipline
zipline/utils/date_utils.py
compute_date_range_chunks
def compute_date_range_chunks(sessions, start_date, end_date, chunksize): """Compute the start and end dates to run a pipeline for. Parameters ---------- sessions : DatetimeIndex The available dates. start_date : pd.Timestamp The first date in the pipeline. end_date : pd.Timestamp The last date in the pipeline. chunksize : int or None The size of the chunks to run. Setting this to None returns one chunk. Returns ------- ranges : iterable[(np.datetime64, np.datetime64)] A sequence of start and end dates to run the pipeline for. """ if start_date not in sessions: raise KeyError("Start date %s is not found in calendar." % (start_date.strftime("%Y-%m-%d"),)) if end_date not in sessions: raise KeyError("End date %s is not found in calendar." % (end_date.strftime("%Y-%m-%d"),)) if end_date < start_date: raise ValueError("End date %s cannot precede start date %s." % (end_date.strftime("%Y-%m-%d"), start_date.strftime("%Y-%m-%d"))) if chunksize is None: return [(start_date, end_date)] start_ix, end_ix = sessions.slice_locs(start_date, end_date) return ( (r[0], r[-1]) for r in partition_all( chunksize, sessions[start_ix:end_ix] ) )
python
def compute_date_range_chunks(sessions, start_date, end_date, chunksize): """Compute the start and end dates to run a pipeline for. Parameters ---------- sessions : DatetimeIndex The available dates. start_date : pd.Timestamp The first date in the pipeline. end_date : pd.Timestamp The last date in the pipeline. chunksize : int or None The size of the chunks to run. Setting this to None returns one chunk. Returns ------- ranges : iterable[(np.datetime64, np.datetime64)] A sequence of start and end dates to run the pipeline for. """ if start_date not in sessions: raise KeyError("Start date %s is not found in calendar." % (start_date.strftime("%Y-%m-%d"),)) if end_date not in sessions: raise KeyError("End date %s is not found in calendar." % (end_date.strftime("%Y-%m-%d"),)) if end_date < start_date: raise ValueError("End date %s cannot precede start date %s." % (end_date.strftime("%Y-%m-%d"), start_date.strftime("%Y-%m-%d"))) if chunksize is None: return [(start_date, end_date)] start_ix, end_ix = sessions.slice_locs(start_date, end_date) return ( (r[0], r[-1]) for r in partition_all( chunksize, sessions[start_ix:end_ix] ) )
[ "def", "compute_date_range_chunks", "(", "sessions", ",", "start_date", ",", "end_date", ",", "chunksize", ")", ":", "if", "start_date", "not", "in", "sessions", ":", "raise", "KeyError", "(", "\"Start date %s is not found in calendar.\"", "%", "(", "start_date", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", ",", ")", ")", "if", "end_date", "not", "in", "sessions", ":", "raise", "KeyError", "(", "\"End date %s is not found in calendar.\"", "%", "(", "end_date", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", ",", ")", ")", "if", "end_date", "<", "start_date", ":", "raise", "ValueError", "(", "\"End date %s cannot precede start date %s.\"", "%", "(", "end_date", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", ",", "start_date", ".", "strftime", "(", "\"%Y-%m-%d\"", ")", ")", ")", "if", "chunksize", "is", "None", ":", "return", "[", "(", "start_date", ",", "end_date", ")", "]", "start_ix", ",", "end_ix", "=", "sessions", ".", "slice_locs", "(", "start_date", ",", "end_date", ")", "return", "(", "(", "r", "[", "0", "]", ",", "r", "[", "-", "1", "]", ")", "for", "r", "in", "partition_all", "(", "chunksize", ",", "sessions", "[", "start_ix", ":", "end_ix", "]", ")", ")" ]
Compute the start and end dates to run a pipeline for. Parameters ---------- sessions : DatetimeIndex The available dates. start_date : pd.Timestamp The first date in the pipeline. end_date : pd.Timestamp The last date in the pipeline. chunksize : int or None The size of the chunks to run. Setting this to None returns one chunk. Returns ------- ranges : iterable[(np.datetime64, np.datetime64)] A sequence of start and end dates to run the pipeline for.
[ "Compute", "the", "start", "and", "end", "dates", "to", "run", "a", "pipeline", "for", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/date_utils.py#L4-L42
train
Compute the start and end dates for a single segment of the pipeline for a given date range.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvh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,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + chr(321 - 271), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1496 - 1447) + '\062' + chr(49), 0o10), ehT0Px3KOsy9('\x30' + chr(4918 - 4807) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + chr(0b110010) + '\x36' + '\x35', 0b1000), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + chr(0b110 + 0o55) + chr(0b11101 + 0o24) + '\x32', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(51) + chr(0b101011 + 0o13) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1101000 + 0o7) + chr(1561 - 1511) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(1884 - 1836) + chr(111) + chr(0b110010) + chr(0b1111 + 0o44) + '\065', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b10111 + 0o130) + '\x32' + chr(724 - 669) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b100010 + 0o17) + '\x31' + chr(0b1010 + 0o46), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + '\063' + '\x30' + '\066', 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b101011 + 0o104) + '\062' + '\064' + chr(0b110011), 4643 - 4635), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(53) + chr(0b110111), ord("\x08")), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b1101111) + chr(0b1111 + 0o43) + chr(0b10001 + 0o43) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b110 + 0o52) + chr(5983 - 5872) + '\062' + chr(0b1011 + 0o53) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(374 - 263) + chr(49) + '\067' + chr(907 - 856), 0b1000), ehT0Px3KOsy9(chr(0b1100 + 0o44) + chr(111) + '\067' + '\x37', 0o10), ehT0Px3KOsy9(chr(723 - 675) + '\157' + '\061' + chr(2888 - 2833), 31005 - 30997), ehT0Px3KOsy9(chr(256 - 208) + chr(111) + '\061' + chr(699 - 646) + '\064', ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(3595 - 3484) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(1586 - 1536) + chr(51), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b11101 + 0o122) + chr(1481 - 1428) + chr(0b1011 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(1081 - 1033) + chr(0b1101111) + chr(586 - 536) + chr(1048 - 996) + '\x35', 18197 - 18189), ehT0Px3KOsy9(chr(703 - 655) + chr(6397 - 6286) + chr(0b110011) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x32' + chr(0b110010) + chr(0b110000), 25263 - 25255), ehT0Px3KOsy9('\060' + chr(10703 - 10592) + chr(0b110010) + '\062' + chr(0b10000 + 0o44), 16588 - 16580), ehT0Px3KOsy9(chr(151 - 103) + chr(990 - 879) + '\x32' + chr(0b110000) + '\064', 0b1000), ehT0Px3KOsy9(chr(48) + chr(7250 - 7139) + chr(0b100111 + 0o14) + chr(0b110011) + chr(0b10111 + 0o36), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(111) + chr(50) + '\x30', 0b1000), ehT0Px3KOsy9(chr(1038 - 990) + chr(0b1101111) + chr(0b10000 + 0o42) + '\060' + chr(0b110111), 42334 - 42326), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b101010 + 0o11) + chr(0b110001) + chr(0b110110), 18538 - 18530), ehT0Px3KOsy9('\060' + '\157' + chr(0b110010) + chr(48) + chr(1758 - 1707), 62125 - 62117), ehT0Px3KOsy9(chr(0b110000) + chr(8188 - 8077) + '\062' + chr(0b110111) + '\062', ord("\x08")), ehT0Px3KOsy9(chr(1030 - 982) + '\x6f' + chr(51) + '\x37' + chr(663 - 613), 42246 - 42238), ehT0Px3KOsy9(chr(1387 - 1339) + chr(0b1101111) + chr(0b110011) + chr(1800 - 1745) + chr(0b1000 + 0o57), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(54) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5678 - 5567) + chr(49) + chr(0b110010) + chr(0b10011 + 0o36), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110111) + chr(0b110111), 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x31' + chr(0b110111) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10700 - 10589) + chr(0b110001) + '\062' + chr(0b110000), 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(4191 - 4080) + chr(0b11011 + 0o32) + chr(0b110000), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'<'), '\144' + chr(7066 - 6965) + '\143' + chr(4466 - 4355) + chr(0b101010 + 0o72) + chr(0b1101 + 0o130))('\165' + '\x74' + chr(8931 - 8829) + chr(77 - 32) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def dlrjLVgZITIp(xmHFfrmM5EeF, NcwNd9gvgEB5, joOGoPpJ_sck, op94qe_Rdjul): if NcwNd9gvgEB5 not in xmHFfrmM5EeF: raise RQ6CSRrFArYB(xafqLlk3kkUe(SXOLrMavuUCe(b'A%e\xc7\xbe\xd2u\xfc\xcb-\xe6\x86\xdc\x81\xde\x08\x1fa\x03qsL\xcam\xfe\xf0\xa4\xb4~\xa7\xad\xe2\xd6\x9f\x91U0MW'), chr(0b100 + 0o140) + '\145' + '\143' + chr(0b1101111) + '\144' + chr(0b1001100 + 0o31))(chr(192 - 75) + chr(0b1001001 + 0o53) + chr(0b1000010 + 0o44) + '\x2d' + chr(0b101000 + 0o20)) % (xafqLlk3kkUe(NcwNd9gvgEB5, xafqLlk3kkUe(SXOLrMavuUCe(b'a%v\xd3\xbe\x9b|\xf8'), chr(0b11101 + 0o107) + '\145' + '\143' + chr(0b1101111 + 0o0) + '\x64' + chr(0b11000 + 0o115))('\165' + chr(0b1110100) + chr(102) + chr(45) + chr(0b1111 + 0o51)))(xafqLlk3kkUe(SXOLrMavuUCe(b'7\x08)\x90\xa7\xdf4\xf9'), '\x64' + '\x65' + '\143' + '\157' + chr(100) + '\x65')(chr(0b1110101) + chr(0b11 + 0o161) + '\x66' + '\055' + chr(684 - 628))),)) if joOGoPpJ_sck not in xmHFfrmM5EeF: raise RQ6CSRrFArYB(xafqLlk3kkUe(SXOLrMavuUCe(b'W?`\x95\xae\x93e\xf8\x9fm\xb5\x83\xc6\xd2\x97\x15P{Lc<_\xcb|\xb0\xfd\xea\xfds\xe6\xa2\xe6\xd4\x9e\x9eC\x7f'), chr(0b1100100) + chr(9399 - 9298) + chr(3354 - 3255) + chr(0b1101111) + '\x64' + chr(101))(chr(0b1110101) + '\164' + chr(0b1100110) + '\x2d' + chr(0b111000)) % (xafqLlk3kkUe(joOGoPpJ_sck, xafqLlk3kkUe(SXOLrMavuUCe(b'a%v\xd3\xbe\x9b|\xf8'), chr(8627 - 8527) + '\145' + chr(0b1011110 + 0o5) + chr(0b1101111) + chr(100) + chr(0b111010 + 0o53))(chr(6376 - 6259) + chr(0b111101 + 0o67) + '\146' + '\055' + chr(56)))(xafqLlk3kkUe(SXOLrMavuUCe(b'7\x08)\x90\xa7\xdf4\xf9'), chr(0b1100100) + '\x65' + chr(0b1011100 + 0o7) + chr(0b1001010 + 0o45) + '\x64' + chr(0b10101 + 0o120))('\x75' + chr(0b11100 + 0o130) + chr(102) + chr(45) + chr(56))),)) if joOGoPpJ_sck < NcwNd9gvgEB5: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b'W?`\x95\xae\x93e\xf8\x9fm\xb5\x83\xcc\xc0\xd9\x15P{Lu!O\xc6}\xf4\xf1\xa4\xaed\xe6\xbc\xf7\x9a\x9e\x9eE4\x1f\\#<'), chr(100) + chr(101) + '\143' + chr(0b111011 + 0o64) + '\144' + chr(0b111101 + 0o50))(chr(117) + '\164' + chr(0b1100110) + '\x2d' + chr(56)) % (xafqLlk3kkUe(joOGoPpJ_sck, xafqLlk3kkUe(SXOLrMavuUCe(b'a%v\xd3\xbe\x9b|\xf8'), chr(0b11100 + 0o110) + '\145' + chr(99) + chr(0b1000110 + 0o51) + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(1539 - 1437) + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(SXOLrMavuUCe(b'7\x08)\x90\xa7\xdf4\xf9'), chr(9882 - 9782) + '\145' + '\143' + chr(0b1101111) + chr(100) + '\x65')('\x75' + '\164' + '\x66' + chr(0b11010 + 0o23) + chr(56))), xafqLlk3kkUe(NcwNd9gvgEB5, xafqLlk3kkUe(SXOLrMavuUCe(b'a%v\xd3\xbe\x9b|\xf8'), '\x64' + chr(7786 - 7685) + chr(99) + chr(8789 - 8678) + '\144' + chr(101))(chr(117) + chr(0b1110100) + chr(0b100100 + 0o102) + chr(0b101101) + chr(0b110110 + 0o2)))(xafqLlk3kkUe(SXOLrMavuUCe(b'7\x08)\x90\xa7\xdf4\xf9'), chr(7063 - 6963) + '\145' + chr(99) + chr(0b1101111) + chr(0b1100100) + '\145')('\165' + chr(6432 - 6316) + '\146' + chr(0b101101) + chr(0b111000))))) if op94qe_Rdjul is None: return [(NcwNd9gvgEB5, joOGoPpJ_sck)] (MyWq51Oq33ym, n8b4ZbtzwxpZ) = xmHFfrmM5EeF.slice_locs(NcwNd9gvgEB5, joOGoPpJ_sck) return ((JWG5qApaeJkp[ehT0Px3KOsy9('\060' + '\157' + chr(48), 0b1000)], JWG5qApaeJkp[-ehT0Px3KOsy9(chr(48) + '\157' + '\061', 0o10)]) for JWG5qApaeJkp in XPZhL9vNVsnj(op94qe_Rdjul, xmHFfrmM5EeF[MyWq51Oq33ym:n8b4ZbtzwxpZ]))
quantopian/zipline
zipline/pipeline/engine.py
SimplePipelineEngine.run_pipeline
def run_pipeline(self, pipeline, start_date, end_date): """ Compute a pipeline. Parameters ---------- pipeline : zipline.pipeline.Pipeline The pipeline to run. start_date : pd.Timestamp Start date of the computed matrix. end_date : pd.Timestamp End date of the computed matrix. Returns ------- result : pd.DataFrame A frame of computed results. The ``result`` columns correspond to the entries of `pipeline.columns`, which should be a dictionary mapping strings to instances of :class:`zipline.pipeline.term.Term`. For each date between ``start_date`` and ``end_date``, ``result`` will contain a row for each asset that passed `pipeline.screen`. A screen of ``None`` indicates that a row should be returned for each asset that existed each day. See Also -------- :meth:`zipline.pipeline.engine.PipelineEngine.run_pipeline` :meth:`zipline.pipeline.engine.PipelineEngine.run_chunked_pipeline` """ # See notes at the top of this module for a description of the # algorithm implemented here. if end_date < start_date: raise ValueError( "start_date must be before or equal to end_date \n" "start_date=%s, end_date=%s" % (start_date, end_date) ) domain = self.resolve_domain(pipeline) graph = pipeline.to_execution_plan( domain, self._root_mask_term, start_date, end_date, ) extra_rows = graph.extra_rows[self._root_mask_term] root_mask = self._compute_root_mask( domain, start_date, end_date, extra_rows, ) dates, assets, root_mask_values = explode(root_mask) initial_workspace = self._populate_initial_workspace( { self._root_mask_term: root_mask_values, self._root_mask_dates_term: as_column(dates.values) }, self._root_mask_term, graph, dates, assets, ) results = self.compute_chunk(graph, dates, assets, initial_workspace) return self._to_narrow( graph.outputs, results, results.pop(graph.screen_name), dates[extra_rows:], assets, )
python
def run_pipeline(self, pipeline, start_date, end_date): """ Compute a pipeline. Parameters ---------- pipeline : zipline.pipeline.Pipeline The pipeline to run. start_date : pd.Timestamp Start date of the computed matrix. end_date : pd.Timestamp End date of the computed matrix. Returns ------- result : pd.DataFrame A frame of computed results. The ``result`` columns correspond to the entries of `pipeline.columns`, which should be a dictionary mapping strings to instances of :class:`zipline.pipeline.term.Term`. For each date between ``start_date`` and ``end_date``, ``result`` will contain a row for each asset that passed `pipeline.screen`. A screen of ``None`` indicates that a row should be returned for each asset that existed each day. See Also -------- :meth:`zipline.pipeline.engine.PipelineEngine.run_pipeline` :meth:`zipline.pipeline.engine.PipelineEngine.run_chunked_pipeline` """ # See notes at the top of this module for a description of the # algorithm implemented here. if end_date < start_date: raise ValueError( "start_date must be before or equal to end_date \n" "start_date=%s, end_date=%s" % (start_date, end_date) ) domain = self.resolve_domain(pipeline) graph = pipeline.to_execution_plan( domain, self._root_mask_term, start_date, end_date, ) extra_rows = graph.extra_rows[self._root_mask_term] root_mask = self._compute_root_mask( domain, start_date, end_date, extra_rows, ) dates, assets, root_mask_values = explode(root_mask) initial_workspace = self._populate_initial_workspace( { self._root_mask_term: root_mask_values, self._root_mask_dates_term: as_column(dates.values) }, self._root_mask_term, graph, dates, assets, ) results = self.compute_chunk(graph, dates, assets, initial_workspace) return self._to_narrow( graph.outputs, results, results.pop(graph.screen_name), dates[extra_rows:], assets, )
[ "def", "run_pipeline", "(", "self", ",", "pipeline", ",", "start_date", ",", "end_date", ")", ":", "# See notes at the top of this module for a description of the", "# algorithm implemented here.", "if", "end_date", "<", "start_date", ":", "raise", "ValueError", "(", "\"start_date must be before or equal to end_date \\n\"", "\"start_date=%s, end_date=%s\"", "%", "(", "start_date", ",", "end_date", ")", ")", "domain", "=", "self", ".", "resolve_domain", "(", "pipeline", ")", "graph", "=", "pipeline", ".", "to_execution_plan", "(", "domain", ",", "self", ".", "_root_mask_term", ",", "start_date", ",", "end_date", ",", ")", "extra_rows", "=", "graph", ".", "extra_rows", "[", "self", ".", "_root_mask_term", "]", "root_mask", "=", "self", ".", "_compute_root_mask", "(", "domain", ",", "start_date", ",", "end_date", ",", "extra_rows", ",", ")", "dates", ",", "assets", ",", "root_mask_values", "=", "explode", "(", "root_mask", ")", "initial_workspace", "=", "self", ".", "_populate_initial_workspace", "(", "{", "self", ".", "_root_mask_term", ":", "root_mask_values", ",", "self", ".", "_root_mask_dates_term", ":", "as_column", "(", "dates", ".", "values", ")", "}", ",", "self", ".", "_root_mask_term", ",", "graph", ",", "dates", ",", "assets", ",", ")", "results", "=", "self", ".", "compute_chunk", "(", "graph", ",", "dates", ",", "assets", ",", "initial_workspace", ")", "return", "self", ".", "_to_narrow", "(", "graph", ".", "outputs", ",", "results", ",", "results", ".", "pop", "(", "graph", ".", "screen_name", ")", ",", "dates", "[", "extra_rows", ":", "]", ",", "assets", ",", ")" ]
Compute a pipeline. Parameters ---------- pipeline : zipline.pipeline.Pipeline The pipeline to run. start_date : pd.Timestamp Start date of the computed matrix. end_date : pd.Timestamp End date of the computed matrix. Returns ------- result : pd.DataFrame A frame of computed results. The ``result`` columns correspond to the entries of `pipeline.columns`, which should be a dictionary mapping strings to instances of :class:`zipline.pipeline.term.Term`. For each date between ``start_date`` and ``end_date``, ``result`` will contain a row for each asset that passed `pipeline.screen`. A screen of ``None`` indicates that a row should be returned for each asset that existed each day. See Also -------- :meth:`zipline.pipeline.engine.PipelineEngine.run_pipeline` :meth:`zipline.pipeline.engine.PipelineEngine.run_chunked_pipeline`
[ "Compute", "a", "pipeline", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/engine.py#L265-L336
train
Compute a pipeline and return a DataFrame of results.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEO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mQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(0b110100) + chr(1265 - 1213), 14035 - 14027), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1493 - 1443) + chr(2674 - 2620) + chr(2352 - 2300), 60659 - 60651), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1001 + 0o51) + chr(411 - 356), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\x32' + '\065' + chr(0b101001 + 0o11), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\x33' + '\x36', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x32' + '\065' + chr(0b100001 + 0o20), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x33' + chr(0b110111), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + '\x36' + '\064', 3858 - 3850), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1101111) + chr(0b100000 + 0o23) + chr(0b110110) + chr(2515 - 2461), 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1635 - 1585) + '\064' + chr(0b110111), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(4651 - 4540) + chr(827 - 776) + '\062' + '\x36', ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\065', ord("\x08")), ehT0Px3KOsy9(chr(1537 - 1489) + chr(4369 - 4258) + '\x35' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062' + '\x32' + '\x32', 55401 - 55393), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(4964 - 4853) + chr(1255 - 1205) + chr(1709 - 1656) + chr(0b110011 + 0o1), 0b1000), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b11011 + 0o124) + chr(50) + chr(50) + chr(49), 0o10), ehT0Px3KOsy9(chr(0b100011 + 0o15) + '\x6f' + '\066' + '\064', 8), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b100 + 0o57) + chr(0b1111 + 0o44) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1001000 + 0o47) + chr(50) + '\062' + chr(54), 40734 - 40726), ehT0Px3KOsy9('\x30' + chr(9580 - 9469) + chr(0b10000 + 0o41) + chr(51) + chr(1148 - 1095), 0b1000), ehT0Px3KOsy9('\060' + chr(454 - 343) + '\062' + chr(0b110011) + '\x32', 0o10), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + chr(0b101 + 0o55) + chr(798 - 749) + chr(55), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\061' + chr(1566 - 1518) + '\061', 39310 - 39302), ehT0Px3KOsy9(chr(470 - 422) + chr(0b1101111 + 0o0) + chr(394 - 343) + chr(0b1001 + 0o56) + chr(55), 17788 - 17780), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(111) + '\x33' + '\x32' + chr(51), 4436 - 4428), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b101110 + 0o101) + chr(0b110001) + '\x36' + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b110011) + '\062', 0b1000), ehT0Px3KOsy9(chr(141 - 93) + chr(0b1101111) + chr(0b11101 + 0o26) + '\063' + chr(2118 - 2068), 8), ehT0Px3KOsy9(chr(206 - 158) + '\x6f' + chr(0b1110 + 0o44) + chr(0b11110 + 0o26) + chr(0b110010 + 0o5), 8), ehT0Px3KOsy9(chr(1854 - 1806) + chr(0b1101111) + chr(0b100111 + 0o13) + chr(0b110110) + chr(0b110001), 20773 - 20765), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1528 - 1478) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(2989 - 2878) + chr(1683 - 1631) + '\066', 61095 - 61087), ehT0Px3KOsy9('\x30' + '\157' + chr(0b110010) + chr(1171 - 1116) + chr(0b100110 + 0o16), 9752 - 9744), ehT0Px3KOsy9('\x30' + chr(111) + chr(2273 - 2224) + '\062' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1100100 + 0o13) + '\x34' + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(54) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6450 - 6339) + chr(0b10000 + 0o41) + chr(0b110110) + '\065', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\066' + '\066', 8), ehT0Px3KOsy9(chr(1641 - 1593) + chr(0b11100 + 0o123) + chr(51) + chr(2121 - 2066) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + '\x33' + chr(2172 - 2122), 16807 - 16799)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\065' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x8a'), chr(2343 - 2243) + chr(0b1000 + 0o135) + chr(0b1100011) + '\x6f' + '\144' + chr(0b10101 + 0o120))(chr(10398 - 10281) + chr(5659 - 5543) + chr(102) + chr(0b101101) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ccrbs4WUfSdK(oVre8I6UXc3b, ri8yqNQ1eQuR, NcwNd9gvgEB5, joOGoPpJ_sck): if joOGoPpJ_sck < NcwNd9gvgEB5: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"\xd7\xc0v\xd8\xaa\xf6{U\x82\xc2\xf6hY\xe1\xd8\xb1V\xb9\xb6?\xff\xe9.\x8d\xb6T\xb5\xa8\x87\xd4dS\xdd8\x04\x81\x1a\xd6\x9ct\xc0\xebs\xcb\xaa\xcc?>\x85\xd3\xb7wX\xcd\xc8\xf0@\xb9\xabx\xe9\xa3a\x9a\xbd\x10\x85\xbe\xc6\xc5p\x1b\x99'"), '\x64' + chr(0b1100101) + chr(99) + chr(0b1101111) + '\144' + chr(101))('\165' + '\164' + chr(0b111 + 0o137) + '\x2d' + chr(0b111000)) % (NcwNd9gvgEB5, joOGoPpJ_sck)) psizfxY_oCoV = oVre8I6UXc3b.resolve_domain(ri8yqNQ1eQuR) H9yw8tZKkKME = ri8yqNQ1eQuR.to_execution_plan(psizfxY_oCoV, oVre8I6UXc3b._root_mask_term, NcwNd9gvgEB5, joOGoPpJ_sck) TXd2BYxb2pNV = H9yw8tZKkKME.extra_rows[oVre8I6UXc3b._root_mask_term] IKVWMS0lN6mN = oVre8I6UXc3b._compute_root_mask(psizfxY_oCoV, NcwNd9gvgEB5, joOGoPpJ_sck, TXd2BYxb2pNV) (SLiSZu5nk7Kn, YGFU3oxACPcg, COdAXT6sci0k) = n69eHvRvZMka(IKVWMS0lN6mN) UA_xrSW_iNom = oVre8I6UXc3b._populate_initial_workspace({oVre8I6UXc3b._root_mask_term: COdAXT6sci0k, oVre8I6UXc3b._root_mask_dates_term: xt0x9fsZpIQK(SLiSZu5nk7Kn.SPnCNu54H1db)}, oVre8I6UXc3b._root_mask_term, H9yw8tZKkKME, SLiSZu5nk7Kn, YGFU3oxACPcg) iIGKX2zSEGYP = oVre8I6UXc3b.compute_chunk(H9yw8tZKkKME, SLiSZu5nk7Kn, YGFU3oxACPcg, UA_xrSW_iNom) return xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfb\xc0x\xf5\xb0\xc8mF\x99\xd0'), chr(4660 - 4560) + chr(7694 - 7593) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(101))(chr(117) + '\164' + '\146' + '\055' + chr(2837 - 2781)))(xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'\xe0\xccH\xee\xb2\xc5E\x0c\x83\xe4\xbdj'), '\144' + '\x65' + chr(0b1010 + 0o131) + '\157' + chr(0b1100100) + '\x65')('\x75' + chr(8214 - 8098) + '\146' + '\055' + chr(56))), iIGKX2zSEGYP, xafqLlk3kkUe(iIGKX2zSEGYP, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd4\xdbg'), chr(0b1100100) + chr(0b1100101) + chr(99) + chr(0b1101111) + '\144' + chr(0b1100101))(chr(0b1110101) + chr(0b11110 + 0o126) + chr(0b1100110) + '\055' + '\070'))(xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7\xd7e\xcf\xbb\xc7@Z\x97\xca\xb3'), chr(0b1100100) + chr(101) + chr(5355 - 5256) + chr(0b11111 + 0o120) + chr(1710 - 1610) + chr(101))('\x75' + '\x74' + chr(102) + '\x2d' + chr(709 - 653)))), SLiSZu5nk7Kn[TXd2BYxb2pNV:], YGFU3oxACPcg)
quantopian/zipline
zipline/pipeline/engine.py
SimplePipelineEngine._compute_root_mask
def _compute_root_mask(self, domain, start_date, end_date, extra_rows): """ Compute a lifetimes matrix from our AssetFinder, then drop columns that didn't exist at all during the query dates. Parameters ---------- domain : zipline.pipeline.domain.Domain Domain for which we're computing a pipeline. start_date : pd.Timestamp Base start date for the matrix. end_date : pd.Timestamp End date for the matrix. extra_rows : int Number of extra rows to compute before `start_date`. Extra rows are needed by terms like moving averages that require a trailing window of data. Returns ------- lifetimes : pd.DataFrame Frame of dtype `bool` containing dates from `extra_rows` days before `start_date`, continuing through to `end_date`. The returned frame contains as columns all assets in our AssetFinder that existed for at least one day between `start_date` and `end_date`. """ sessions = domain.all_sessions() if start_date not in sessions: raise ValueError( "Pipeline start date ({}) is not a trading session for " "domain {}.".format(start_date, domain) ) elif end_date not in sessions: raise ValueError( "Pipeline end date {} is not a trading session for " "domain {}.".format(end_date, domain) ) start_idx, end_idx = sessions.slice_locs(start_date, end_date) if start_idx < extra_rows: raise NoFurtherDataError.from_lookback_window( initial_message="Insufficient data to compute Pipeline:", first_date=sessions[0], lookback_start=start_date, lookback_length=extra_rows, ) # NOTE: This logic should probably be delegated to the domain once we # start adding more complex domains. # # Build lifetimes matrix reaching back to `extra_rows` days before # `start_date.` finder = self._finder lifetimes = finder.lifetimes( sessions[start_idx - extra_rows:end_idx], include_start_date=False, country_codes=(domain.country_code,), ) if not lifetimes.columns.unique: columns = lifetimes.columns duplicated = columns[columns.duplicated()].unique() raise AssertionError("Duplicated sids: %d" % duplicated) # Filter out columns that didn't exist from the farthest look back # window through the end of the requested dates. existed = lifetimes.any() ret = lifetimes.loc[:, existed] num_assets = ret.shape[1] if num_assets == 0: raise ValueError( "Failed to find any assets with country_code {!r} that traded " "between {} and {}.\n" "This probably means that your asset db is old or that it has " "incorrect country/exchange metadata.".format( domain.country_code, start_date, end_date, ) ) return ret
python
def _compute_root_mask(self, domain, start_date, end_date, extra_rows): """ Compute a lifetimes matrix from our AssetFinder, then drop columns that didn't exist at all during the query dates. Parameters ---------- domain : zipline.pipeline.domain.Domain Domain for which we're computing a pipeline. start_date : pd.Timestamp Base start date for the matrix. end_date : pd.Timestamp End date for the matrix. extra_rows : int Number of extra rows to compute before `start_date`. Extra rows are needed by terms like moving averages that require a trailing window of data. Returns ------- lifetimes : pd.DataFrame Frame of dtype `bool` containing dates from `extra_rows` days before `start_date`, continuing through to `end_date`. The returned frame contains as columns all assets in our AssetFinder that existed for at least one day between `start_date` and `end_date`. """ sessions = domain.all_sessions() if start_date not in sessions: raise ValueError( "Pipeline start date ({}) is not a trading session for " "domain {}.".format(start_date, domain) ) elif end_date not in sessions: raise ValueError( "Pipeline end date {} is not a trading session for " "domain {}.".format(end_date, domain) ) start_idx, end_idx = sessions.slice_locs(start_date, end_date) if start_idx < extra_rows: raise NoFurtherDataError.from_lookback_window( initial_message="Insufficient data to compute Pipeline:", first_date=sessions[0], lookback_start=start_date, lookback_length=extra_rows, ) # NOTE: This logic should probably be delegated to the domain once we # start adding more complex domains. # # Build lifetimes matrix reaching back to `extra_rows` days before # `start_date.` finder = self._finder lifetimes = finder.lifetimes( sessions[start_idx - extra_rows:end_idx], include_start_date=False, country_codes=(domain.country_code,), ) if not lifetimes.columns.unique: columns = lifetimes.columns duplicated = columns[columns.duplicated()].unique() raise AssertionError("Duplicated sids: %d" % duplicated) # Filter out columns that didn't exist from the farthest look back # window through the end of the requested dates. existed = lifetimes.any() ret = lifetimes.loc[:, existed] num_assets = ret.shape[1] if num_assets == 0: raise ValueError( "Failed to find any assets with country_code {!r} that traded " "between {} and {}.\n" "This probably means that your asset db is old or that it has " "incorrect country/exchange metadata.".format( domain.country_code, start_date, end_date, ) ) return ret
[ "def", "_compute_root_mask", "(", "self", ",", "domain", ",", "start_date", ",", "end_date", ",", "extra_rows", ")", ":", "sessions", "=", "domain", ".", "all_sessions", "(", ")", "if", "start_date", "not", "in", "sessions", ":", "raise", "ValueError", "(", "\"Pipeline start date ({}) is not a trading session for \"", "\"domain {}.\"", ".", "format", "(", "start_date", ",", "domain", ")", ")", "elif", "end_date", "not", "in", "sessions", ":", "raise", "ValueError", "(", "\"Pipeline end date {} is not a trading session for \"", "\"domain {}.\"", ".", "format", "(", "end_date", ",", "domain", ")", ")", "start_idx", ",", "end_idx", "=", "sessions", ".", "slice_locs", "(", "start_date", ",", "end_date", ")", "if", "start_idx", "<", "extra_rows", ":", "raise", "NoFurtherDataError", ".", "from_lookback_window", "(", "initial_message", "=", "\"Insufficient data to compute Pipeline:\"", ",", "first_date", "=", "sessions", "[", "0", "]", ",", "lookback_start", "=", "start_date", ",", "lookback_length", "=", "extra_rows", ",", ")", "# NOTE: This logic should probably be delegated to the domain once we", "# start adding more complex domains.", "#", "# Build lifetimes matrix reaching back to `extra_rows` days before", "# `start_date.`", "finder", "=", "self", ".", "_finder", "lifetimes", "=", "finder", ".", "lifetimes", "(", "sessions", "[", "start_idx", "-", "extra_rows", ":", "end_idx", "]", ",", "include_start_date", "=", "False", ",", "country_codes", "=", "(", "domain", ".", "country_code", ",", ")", ",", ")", "if", "not", "lifetimes", ".", "columns", ".", "unique", ":", "columns", "=", "lifetimes", ".", "columns", "duplicated", "=", "columns", "[", "columns", ".", "duplicated", "(", ")", "]", ".", "unique", "(", ")", "raise", "AssertionError", "(", "\"Duplicated sids: %d\"", "%", "duplicated", ")", "# Filter out columns that didn't exist from the farthest look back", "# window through the end of the requested dates.", "existed", "=", "lifetimes", ".", "any", "(", ")", "ret", "=", "lifetimes", ".", "loc", "[", ":", ",", "existed", "]", "num_assets", "=", "ret", ".", "shape", "[", "1", "]", "if", "num_assets", "==", "0", ":", "raise", "ValueError", "(", "\"Failed to find any assets with country_code {!r} that traded \"", "\"between {} and {}.\\n\"", "\"This probably means that your asset db is old or that it has \"", "\"incorrect country/exchange metadata.\"", ".", "format", "(", "domain", ".", "country_code", ",", "start_date", ",", "end_date", ",", ")", ")", "return", "ret" ]
Compute a lifetimes matrix from our AssetFinder, then drop columns that didn't exist at all during the query dates. Parameters ---------- domain : zipline.pipeline.domain.Domain Domain for which we're computing a pipeline. start_date : pd.Timestamp Base start date for the matrix. end_date : pd.Timestamp End date for the matrix. extra_rows : int Number of extra rows to compute before `start_date`. Extra rows are needed by terms like moving averages that require a trailing window of data. Returns ------- lifetimes : pd.DataFrame Frame of dtype `bool` containing dates from `extra_rows` days before `start_date`, continuing through to `end_date`. The returned frame contains as columns all assets in our AssetFinder that existed for at least one day between `start_date` and `end_date`.
[ "Compute", "a", "lifetimes", "matrix", "from", "our", "AssetFinder", "then", "drop", "columns", "that", "didn", "t", "exist", "at", "all", "during", "the", "query", "dates", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/engine.py#L356-L439
train
Compute a lifetimes matrix from our AssetFinder and then drop columns that didn t exist at all during the query dates.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyK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OError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1712 - 1664) + '\157' + chr(0b1 + 0o62) + chr(0b110010) + '\x33', 22844 - 22836), ehT0Px3KOsy9('\x30' + '\157' + '\x31' + chr(0b110101) + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + '\x33' + chr(0b1000 + 0o52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + chr(0b110100) + '\x35', 0b1000), ehT0Px3KOsy9(chr(0b10 + 0o56) + chr(111) + '\x33' + chr(0b101110 + 0o4) + chr(0b110100), 41207 - 41199), ehT0Px3KOsy9(chr(1358 - 1310) + '\x6f' + chr(51) + chr(181 - 130) + chr(52), 15576 - 15568), ehT0Px3KOsy9(chr(48) + chr(6504 - 6393) + '\x33' + '\066' + chr(0b100110 + 0o17), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1359 - 1309) + chr(48) + '\x32', 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1022 - 970) + chr(0b11000 + 0o33), 19151 - 19143), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(52) + chr(52), 5064 - 5056), ehT0Px3KOsy9(chr(0b110000) + chr(2461 - 2350) + chr(0b10100 + 0o36) + '\060' + chr(49), 0b1000), ehT0Px3KOsy9('\060' + chr(0b11011 + 0o124) + chr(0b101011 + 0o10) + chr(108 - 57) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10110 + 0o35) + chr(51) + chr(0b10011 + 0o43), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + '\060' + chr(0b11010 + 0o27), 47099 - 47091), ehT0Px3KOsy9(chr(0b100101 + 0o13) + chr(0b1101111) + chr(2116 - 2065) + '\x36' + chr(271 - 219), 0b1000), ehT0Px3KOsy9(chr(1159 - 1111) + chr(111) + chr(50) + chr(2122 - 2069) + chr(0b11110 + 0o24), 48033 - 48025), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + chr(50) + chr(0b110100) + chr(1754 - 1702), 8), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\x6f' + '\061' + '\x33' + chr(358 - 308), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(111) + '\061' + chr(0b10111 + 0o32), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b110011 + 0o1), 0o10), ehT0Px3KOsy9(chr(252 - 204) + chr(10246 - 10135) + chr(49) + chr(0b100111 + 0o12) + chr(1835 - 1782), 0b1000), ehT0Px3KOsy9(chr(48) + chr(8366 - 8255) + chr(50) + chr(0b110110) + '\066', 47290 - 47282), ehT0Px3KOsy9('\060' + chr(0b110111 + 0o70) + chr(0b110011) + chr(0b101111 + 0o10) + chr(0b110011), 44605 - 44597), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\066' + chr(0b11111 + 0o24), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1100000 + 0o17) + chr(1781 - 1732) + chr(0b110001) + chr(54), 41927 - 41919), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(9037 - 8926) + chr(49) + chr(0b110110) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(49) + chr(0b110010) + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(1610 - 1562) + chr(0b111100 + 0o63) + chr(0b110010) + chr(55) + chr(2513 - 2462), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b100 + 0o56) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(1369 - 1321) + chr(0b1010 + 0o145) + '\x37' + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b111111 + 0o60) + chr(0b1001 + 0o52) + chr(52) + chr(0b10100 + 0o36), 0b1000), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(111) + '\x32' + chr(398 - 344) + chr(0b110111), 0o10), ehT0Px3KOsy9(chr(2073 - 2025) + '\157' + chr(0b110010) + chr(151 - 100) + chr(1691 - 1641), 8), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b1100 + 0o50) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(671 - 623) + chr(0b1101111) + chr(110 - 61) + chr(48) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(10015 - 9904) + chr(49) + '\x36' + chr(48), 0o10), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b11001 + 0o126) + '\x33' + chr(2235 - 2185) + chr(0b100100 + 0o15), 28749 - 28741), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + chr(0b10101 + 0o42) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x36' + chr(228 - 175), 0o10), ehT0Px3KOsy9('\060' + '\157' + chr(0b1101 + 0o50) + chr(0b110000), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(774 - 721) + chr(1702 - 1654), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xfd'), chr(0b1010010 + 0o22) + chr(101) + chr(0b1100010 + 0o1) + chr(0b1101111) + chr(6991 - 6891) + chr(101))('\165' + '\164' + chr(0b11101 + 0o111) + '\x2d' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def T43qg9uYcXSD(oVre8I6UXc3b, psizfxY_oCoV, NcwNd9gvgEB5, joOGoPpJ_sck, TXd2BYxb2pNV): xmHFfrmM5EeF = psizfxY_oCoV.all_sessions() if NcwNd9gvgEB5 not in xmHFfrmM5EeF: raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\x02\xea\x80\xb8\xb5\x9b\xe7\x03\xd7\xf5\xbe\xac\xb5\xd4\xce\xc5.l$e\xcd\x86\xdan\x1f%\x9b9U\x96\x97\xfb\x057\x02\xb0\x9b\\F\xb4K\xe9\x80\xa7\xaf\x9c\xedM\x84\xe7\xb0\xac\xe1\x90\xc5\xc9;`jm\xcd\x86\xdd'), '\x64' + '\145' + chr(0b1001100 + 0o27) + '\157' + '\144' + chr(843 - 742))(chr(0b101010 + 0o113) + '\164' + chr(102) + chr(0b11111 + 0o16) + chr(56)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x85_\xe8\x8a\x9c\xbd\xa6\xb1s\xd4\xe4\xb5'), chr(0b1100100) + '\145' + chr(0b1100011) + chr(0b111011 + 0o64) + chr(100) + chr(0b1100101))(chr(4165 - 4048) + chr(116) + '\146' + chr(45) + chr(2534 - 2478)))(NcwNd9gvgEB5, psizfxY_oCoV)) elif joOGoPpJ_sck not in xmHFfrmM5EeF: raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x83\x02\xea\x80\xb8\xb5\x9b\xe7\x03\xc1\xef\xbb\xfe\xa5\x95\xde\xc1zrym\xdf\x88\xd3 \x19"\x9b6\x1a\x96\xc5\xfbA*\x1e\xb6\xdfFM\xa0\x18\xf3\x8a\xba\xfc\x93\xedQ\x84\xe5\xb0\xb3\xa0\x9d\xc4\x84!t*'), chr(100) + '\145' + chr(0b110100 + 0o57) + chr(111) + chr(0b1100100) + chr(101))(chr(0b1110101) + chr(8407 - 8291) + chr(0b1100110) + '\x2d' + chr(0b1001 + 0o57)), xafqLlk3kkUe(SXOLrMavuUCe(b'\x85_\xe8\x8a\x9c\xbd\xa6\xb1s\xd4\xe4\xb5'), '\x64' + '\145' + chr(2886 - 2787) + chr(5279 - 5168) + chr(100) + chr(0b1100101))('\x75' + chr(3776 - 3660) + chr(0b1100110) + chr(45) + '\x38'))(joOGoPpJ_sck, psizfxY_oCoV)) (NOt5Gkf5z9g4, p6zNIQAtD3F5) = xmHFfrmM5EeF.slice_locs(NcwNd9gvgEB5, joOGoPpJ_sck) if NOt5Gkf5z9g4 < TXd2BYxb2pNV: raise xafqLlk3kkUe(rLplDgouBqvI, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb5\x19\xf5\x88\x8b\xb0\x9a\xedH\xc6\xe0\xbc\xb5\x9e\x83\xc3\xca>fs'), '\144' + chr(101) + '\x63' + chr(9820 - 9709) + '\x64' + chr(6123 - 6022))('\165' + chr(0b1110100) + '\x66' + '\055' + chr(1019 - 963)))(initial_message=xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a\x05\xe9\x90\xb2\xba\x9c\xe1J\xc1\xef\xab\xfe\xa5\x95\xde\xc5z}km\xd5\x94\x9e>\x03"\xdewj\x8b\xc7\xffI*\x1e\xb4\xc5'), '\x64' + chr(0b100000 + 0o105) + chr(0b1100011) + chr(1120 - 1009) + chr(4278 - 4178) + '\145')(chr(0b1101100 + 0o11) + chr(116) + '\x66' + chr(0b101101) + chr(0b1 + 0o67)), first_date=xmHFfrmM5EeF[ehT0Px3KOsy9(chr(0b110000) + chr(0b0 + 0o157) + chr(0b101 + 0o53), 0o10)], lookback_start=NcwNd9gvgEB5, lookback_length=TXd2BYxb2pNV) KYdCfy6A0CPH = oVre8I6UXc3b._finder nAo8tPyqOYrw = KYdCfy6A0CPH.lifetimes(xmHFfrmM5EeF[NOt5Gkf5z9g4 - TXd2BYxb2pNV:p6zNIQAtD3F5], include_start_date=ehT0Px3KOsy9('\060' + '\157' + '\060', 8), country_codes=(psizfxY_oCoV.country_code,)) if not xafqLlk3kkUe(nAo8tPyqOYrw.columns, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6\x05\xf3\x94\xa1\xb9'), chr(100) + chr(0b1011100 + 0o11) + chr(99) + '\x6f' + chr(0b1100000 + 0o4) + '\145')(chr(0b1010001 + 0o44) + '\164' + chr(0b1000010 + 0o44) + '\055' + chr(0b101000 + 0o20))): qKlXBtn3PKy4 = nAo8tPyqOYrw.qKlXBtn3PKy4 X0bnUMgjnLF5 = qKlXBtn3PKy4[qKlXBtn3PKy4.duplicated()].unique() raise vcEHXBQXuDuh(xafqLlk3kkUe(SXOLrMavuUCe(b'\x97\x1e\xea\x89\xbd\xbf\x94\xf6F\xc0\xa1\xac\xb7\xa5\x87\x90\x84\x7fm'), '\x64' + '\x65' + chr(0b1100011) + '\157' + '\x64' + chr(0b1100101))(chr(0b1110101) + chr(0b10010 + 0o142) + chr(2261 - 2159) + chr(98 - 53) + chr(56)) % X0bnUMgjnLF5) KMnrvcWQX3s6 = nAo8tPyqOYrw.UVSi4XW7eBIM() VHn4CV4Ymrei = nAo8tPyqOYrw.MmVY7Id_ODNA[:, KMnrvcWQX3s6] jItIh7dn3Gvo = VHn4CV4Ymrei.nauYfLglTpcb[ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31', 39595 - 39587)] if jItIh7dn3Gvo == ehT0Px3KOsy9('\x30' + chr(0b1 + 0o156) + '\x30', 8): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x95\n\xf3\x89\xb1\xb8\xd5\xf6L\x84\xe7\xb6\xb0\xa5\xd4\xcb\xca#)e>\xc5\x9e\x87=V!\xd2#R\xc2\xd4\xf5P-\x04\xa3\x86jK\xbc\x0f\xff\xc5\xaf\xfd\x87\xff\x03\xd0\xe9\xbe\xaa\xe1\x80\xd8\xc5>l`m\xd4\x9e\x879\x133\xd5wA\x9f\x97\xfbK\'P\xaa\x82\x1b"\x87\x03\xf3\x96\xf4\xac\x87\xedA\xc5\xe3\xb3\xa7\xe1\x99\xcf\xc54z$9\xde\x9a\x87n\x0f9\xce%\x1a\x83\xc4\xe9@7P\xb5\x9d\x15A\xa0K\xf5\x89\xb0\xfc\x9a\xf0\x03\xd0\xe9\xbe\xaa\xe1\x9d\xde\x842hwm\xdf\x95\x90!\x04$\xde4N\xc2\xd4\xf5P-\x04\xa3\x86\x1aM\xab\x08\xf2\x84\xba\xbb\x90\xa2N\xc1\xf5\xbe\xba\xa0\x80\xcb\x8a'), chr(3594 - 3494) + chr(0b0 + 0o145) + chr(99) + '\157' + chr(100) + '\145')('\x75' + '\x74' + chr(0b101011 + 0o73) + '\055' + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x85_\xe8\x8a\x9c\xbd\xa6\xb1s\xd4\xe4\xb5'), chr(0b1100100) + '\145' + '\143' + '\x6f' + '\x64' + '\145')(chr(117) + chr(116) + chr(0b1100110) + chr(45) + chr(0b10101 + 0o43)))(xafqLlk3kkUe(psizfxY_oCoV, xafqLlk3kkUe(SXOLrMavuUCe(b'\xb0\x04\xef\x8b\xa0\xae\x8c\xdd@\xcb\xe5\xba'), chr(100) + chr(3577 - 3476) + '\x63' + chr(0b1100111 + 0o10) + chr(2488 - 2388) + chr(419 - 318))('\165' + chr(8484 - 8368) + '\146' + '\055' + chr(0b111000))), NcwNd9gvgEB5, joOGoPpJ_sck)) return VHn4CV4Ymrei
quantopian/zipline
zipline/pipeline/engine.py
SimplePipelineEngine.compute_chunk
def compute_chunk(self, graph, dates, sids, initial_workspace): """ Compute the Pipeline terms in the graph for the requested start and end dates. This is where we do the actual work of running a pipeline. Parameters ---------- graph : zipline.pipeline.graph.ExecutionPlan Dependency graph of the terms to be executed. dates : pd.DatetimeIndex Row labels for our root mask. assets : pd.Int64Index Column labels for our root mask. initial_workspace : dict Map from term -> output. Must contain at least entry for `self._root_mask_term` whose shape is `(len(dates), len(assets))`, but may contain additional pre-computed terms for testing or optimization purposes. Returns ------- results : dict Dictionary mapping requested results to outputs. """ self._validate_compute_chunk_params( graph, dates, sids, initial_workspace, ) get_loader = self._get_loader # Copy the supplied initial workspace so we don't mutate it in place. workspace = initial_workspace.copy() refcounts = graph.initial_refcounts(workspace) execution_order = graph.execution_order(refcounts) domain = graph.domain # Many loaders can fetch data more efficiently if we ask them to # retrieve all their inputs at once. For example, a loader backed by a # SQL database can fetch multiple columns from the database in a single # query. # # To enable these loaders to fetch their data efficiently, we group # together requests for LoadableTerms if they are provided by the same # loader and they require the same number of extra rows. # # The extra rows condition is a simplification: we don't currently have # a mechanism for asking a loader to fetch different windows of data # for different terms, so we only batch requests together when they're # going to produce data for the same set of dates. That may change in # the future if we find a loader that can still benefit significantly # from batching unequal-length requests. def loader_group_key(term): loader = get_loader(term) extra_rows = graph.extra_rows[term] return loader, extra_rows # Only produce loader groups for the terms we expect to load. This # ensures that we can run pipelines for graphs where we don't have a # loader registered for an atomic term if all the dependencies of that # term were supplied in the initial workspace. will_be_loaded = graph.loadable_terms - viewkeys(workspace) loader_groups = groupby( loader_group_key, (t for t in execution_order if t in will_be_loaded), ) for term in graph.execution_order(refcounts): # `term` may have been supplied in `initial_workspace`, and in the # future we may pre-compute loadable terms coming from the same # dataset. In either case, we will already have an entry for this # term, which we shouldn't re-compute. if term in workspace: continue # Asset labels are always the same, but date labels vary by how # many extra rows are needed. mask, mask_dates = graph.mask_and_dates_for_term( term, self._root_mask_term, workspace, dates, ) if isinstance(term, LoadableTerm): loader = get_loader(term) to_load = sorted( loader_groups[loader_group_key(term)], key=lambda t: t.dataset ) loaded = loader.load_adjusted_array( domain, to_load, mask_dates, sids, mask, ) assert set(loaded) == set(to_load), ( 'loader did not return an AdjustedArray for each column\n' 'expected: %r\n' 'got: %r' % (sorted(to_load), sorted(loaded)) ) workspace.update(loaded) else: workspace[term] = term._compute( self._inputs_for_term(term, workspace, graph, domain), mask_dates, sids, mask, ) if term.ndim == 2: assert workspace[term].shape == mask.shape else: assert workspace[term].shape == (mask.shape[0], 1) # Decref dependencies of ``term``, and clear any terms whose # refcounts hit 0. for garbage_term in graph.decref_dependencies(term, refcounts): del workspace[garbage_term] # At this point, all the output terms are in the workspace. out = {} graph_extra_rows = graph.extra_rows for name, term in iteritems(graph.outputs): # Truncate off extra rows from outputs. out[name] = workspace[term][graph_extra_rows[term]:] return out
python
def compute_chunk(self, graph, dates, sids, initial_workspace): """ Compute the Pipeline terms in the graph for the requested start and end dates. This is where we do the actual work of running a pipeline. Parameters ---------- graph : zipline.pipeline.graph.ExecutionPlan Dependency graph of the terms to be executed. dates : pd.DatetimeIndex Row labels for our root mask. assets : pd.Int64Index Column labels for our root mask. initial_workspace : dict Map from term -> output. Must contain at least entry for `self._root_mask_term` whose shape is `(len(dates), len(assets))`, but may contain additional pre-computed terms for testing or optimization purposes. Returns ------- results : dict Dictionary mapping requested results to outputs. """ self._validate_compute_chunk_params( graph, dates, sids, initial_workspace, ) get_loader = self._get_loader # Copy the supplied initial workspace so we don't mutate it in place. workspace = initial_workspace.copy() refcounts = graph.initial_refcounts(workspace) execution_order = graph.execution_order(refcounts) domain = graph.domain # Many loaders can fetch data more efficiently if we ask them to # retrieve all their inputs at once. For example, a loader backed by a # SQL database can fetch multiple columns from the database in a single # query. # # To enable these loaders to fetch their data efficiently, we group # together requests for LoadableTerms if they are provided by the same # loader and they require the same number of extra rows. # # The extra rows condition is a simplification: we don't currently have # a mechanism for asking a loader to fetch different windows of data # for different terms, so we only batch requests together when they're # going to produce data for the same set of dates. That may change in # the future if we find a loader that can still benefit significantly # from batching unequal-length requests. def loader_group_key(term): loader = get_loader(term) extra_rows = graph.extra_rows[term] return loader, extra_rows # Only produce loader groups for the terms we expect to load. This # ensures that we can run pipelines for graphs where we don't have a # loader registered for an atomic term if all the dependencies of that # term were supplied in the initial workspace. will_be_loaded = graph.loadable_terms - viewkeys(workspace) loader_groups = groupby( loader_group_key, (t for t in execution_order if t in will_be_loaded), ) for term in graph.execution_order(refcounts): # `term` may have been supplied in `initial_workspace`, and in the # future we may pre-compute loadable terms coming from the same # dataset. In either case, we will already have an entry for this # term, which we shouldn't re-compute. if term in workspace: continue # Asset labels are always the same, but date labels vary by how # many extra rows are needed. mask, mask_dates = graph.mask_and_dates_for_term( term, self._root_mask_term, workspace, dates, ) if isinstance(term, LoadableTerm): loader = get_loader(term) to_load = sorted( loader_groups[loader_group_key(term)], key=lambda t: t.dataset ) loaded = loader.load_adjusted_array( domain, to_load, mask_dates, sids, mask, ) assert set(loaded) == set(to_load), ( 'loader did not return an AdjustedArray for each column\n' 'expected: %r\n' 'got: %r' % (sorted(to_load), sorted(loaded)) ) workspace.update(loaded) else: workspace[term] = term._compute( self._inputs_for_term(term, workspace, graph, domain), mask_dates, sids, mask, ) if term.ndim == 2: assert workspace[term].shape == mask.shape else: assert workspace[term].shape == (mask.shape[0], 1) # Decref dependencies of ``term``, and clear any terms whose # refcounts hit 0. for garbage_term in graph.decref_dependencies(term, refcounts): del workspace[garbage_term] # At this point, all the output terms are in the workspace. out = {} graph_extra_rows = graph.extra_rows for name, term in iteritems(graph.outputs): # Truncate off extra rows from outputs. out[name] = workspace[term][graph_extra_rows[term]:] return out
[ "def", "compute_chunk", "(", "self", ",", "graph", ",", "dates", ",", "sids", ",", "initial_workspace", ")", ":", "self", ".", "_validate_compute_chunk_params", "(", "graph", ",", "dates", ",", "sids", ",", "initial_workspace", ",", ")", "get_loader", "=", "self", ".", "_get_loader", "# Copy the supplied initial workspace so we don't mutate it in place.", "workspace", "=", "initial_workspace", ".", "copy", "(", ")", "refcounts", "=", "graph", ".", "initial_refcounts", "(", "workspace", ")", "execution_order", "=", "graph", ".", "execution_order", "(", "refcounts", ")", "domain", "=", "graph", ".", "domain", "# Many loaders can fetch data more efficiently if we ask them to", "# retrieve all their inputs at once. For example, a loader backed by a", "# SQL database can fetch multiple columns from the database in a single", "# query.", "#", "# To enable these loaders to fetch their data efficiently, we group", "# together requests for LoadableTerms if they are provided by the same", "# loader and they require the same number of extra rows.", "#", "# The extra rows condition is a simplification: we don't currently have", "# a mechanism for asking a loader to fetch different windows of data", "# for different terms, so we only batch requests together when they're", "# going to produce data for the same set of dates. That may change in", "# the future if we find a loader that can still benefit significantly", "# from batching unequal-length requests.", "def", "loader_group_key", "(", "term", ")", ":", "loader", "=", "get_loader", "(", "term", ")", "extra_rows", "=", "graph", ".", "extra_rows", "[", "term", "]", "return", "loader", ",", "extra_rows", "# Only produce loader groups for the terms we expect to load. This", "# ensures that we can run pipelines for graphs where we don't have a", "# loader registered for an atomic term if all the dependencies of that", "# term were supplied in the initial workspace.", "will_be_loaded", "=", "graph", ".", "loadable_terms", "-", "viewkeys", "(", "workspace", ")", "loader_groups", "=", "groupby", "(", "loader_group_key", ",", "(", "t", "for", "t", "in", "execution_order", "if", "t", "in", "will_be_loaded", ")", ",", ")", "for", "term", "in", "graph", ".", "execution_order", "(", "refcounts", ")", ":", "# `term` may have been supplied in `initial_workspace`, and in the", "# future we may pre-compute loadable terms coming from the same", "# dataset. In either case, we will already have an entry for this", "# term, which we shouldn't re-compute.", "if", "term", "in", "workspace", ":", "continue", "# Asset labels are always the same, but date labels vary by how", "# many extra rows are needed.", "mask", ",", "mask_dates", "=", "graph", ".", "mask_and_dates_for_term", "(", "term", ",", "self", ".", "_root_mask_term", ",", "workspace", ",", "dates", ",", ")", "if", "isinstance", "(", "term", ",", "LoadableTerm", ")", ":", "loader", "=", "get_loader", "(", "term", ")", "to_load", "=", "sorted", "(", "loader_groups", "[", "loader_group_key", "(", "term", ")", "]", ",", "key", "=", "lambda", "t", ":", "t", ".", "dataset", ")", "loaded", "=", "loader", ".", "load_adjusted_array", "(", "domain", ",", "to_load", ",", "mask_dates", ",", "sids", ",", "mask", ",", ")", "assert", "set", "(", "loaded", ")", "==", "set", "(", "to_load", ")", ",", "(", "'loader did not return an AdjustedArray for each column\\n'", "'expected: %r\\n'", "'got: %r'", "%", "(", "sorted", "(", "to_load", ")", ",", "sorted", "(", "loaded", ")", ")", ")", "workspace", ".", "update", "(", "loaded", ")", "else", ":", "workspace", "[", "term", "]", "=", "term", ".", "_compute", "(", "self", ".", "_inputs_for_term", "(", "term", ",", "workspace", ",", "graph", ",", "domain", ")", ",", "mask_dates", ",", "sids", ",", "mask", ",", ")", "if", "term", ".", "ndim", "==", "2", ":", "assert", "workspace", "[", "term", "]", ".", "shape", "==", "mask", ".", "shape", "else", ":", "assert", "workspace", "[", "term", "]", ".", "shape", "==", "(", "mask", ".", "shape", "[", "0", "]", ",", "1", ")", "# Decref dependencies of ``term``, and clear any terms whose", "# refcounts hit 0.", "for", "garbage_term", "in", "graph", ".", "decref_dependencies", "(", "term", ",", "refcounts", ")", ":", "del", "workspace", "[", "garbage_term", "]", "# At this point, all the output terms are in the workspace.", "out", "=", "{", "}", "graph_extra_rows", "=", "graph", ".", "extra_rows", "for", "name", ",", "term", "in", "iteritems", "(", "graph", ".", "outputs", ")", ":", "# Truncate off extra rows from outputs.", "out", "[", "name", "]", "=", "workspace", "[", "term", "]", "[", "graph_extra_rows", "[", "term", "]", ":", "]", "return", "out" ]
Compute the Pipeline terms in the graph for the requested start and end dates. This is where we do the actual work of running a pipeline. Parameters ---------- graph : zipline.pipeline.graph.ExecutionPlan Dependency graph of the terms to be executed. dates : pd.DatetimeIndex Row labels for our root mask. assets : pd.Int64Index Column labels for our root mask. initial_workspace : dict Map from term -> output. Must contain at least entry for `self._root_mask_term` whose shape is `(len(dates), len(assets))`, but may contain additional pre-computed terms for testing or optimization purposes. Returns ------- results : dict Dictionary mapping requested results to outputs.
[ "Compute", "the", "Pipeline", "terms", "in", "the", "graph", "for", "the", "requested", "start", "and", "end", "dates", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/engine.py#L484-L606
train
Compute the pipeline terms for the requested start and end dates and store the results in a dict.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m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NS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(12160 - 12049) + '\061' + '\064' + chr(0b1101 + 0o52), 31778 - 31770), ehT0Px3KOsy9(chr(0b110000) + chr(3419 - 3308) + '\063' + chr(0b110010) + '\065', 22321 - 22313), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + chr(0b110011) + chr(0b101000 + 0o12), 0o10), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b1001100 + 0o43) + '\061' + chr(1996 - 1947) + chr(0b101011 + 0o6), 46749 - 46741), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110001) + chr(52) + chr(55), 8), ehT0Px3KOsy9('\x30' + chr(9433 - 9322) + '\063' + chr(55) + chr(0b10011 + 0o44), 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(50) + chr(0b110111) + chr(0b110110), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(91 - 41) + chr(55) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\063' + chr(0b110 + 0o55) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(1781 - 1731) + chr(0b110001) + chr(0b110001 + 0o2), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(1670 - 1621) + chr(0b110011), 8), ehT0Px3KOsy9(chr(837 - 789) + chr(0b1101111) + chr(0b10001 + 0o42) + '\x30' + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11110 + 0o23) + chr(707 - 654) + chr(611 - 563), 0b1000), ehT0Px3KOsy9('\x30' + '\157' + chr(1173 - 1123), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101001 + 0o7), 17114 - 17106), ehT0Px3KOsy9(chr(1065 - 1017) + '\x6f' + '\061' + chr(0b110000) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(2215 - 2167) + chr(0b111010 + 0o65) + chr(51) + '\x36' + chr(52), 0o10), ehT0Px3KOsy9(chr(514 - 466) + '\x6f' + '\061' + chr(0b100011 + 0o20) + chr(52), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b100111 + 0o14) + '\x37', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + chr(0b110 + 0o55) + chr(597 - 544), 0o10), ehT0Px3KOsy9('\060' + chr(0b11110 + 0o121) + '\063' + chr(1175 - 1127) + chr(246 - 191), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(729 - 681) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\064' + chr(295 - 241), 4410 - 4402), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(10749 - 10638) + chr(0b11011 + 0o27) + chr(307 - 259) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(111) + chr(0b110001) + chr(1489 - 1435) + chr(0b11010 + 0o33), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + '\x31' + '\x33' + chr(748 - 699), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100011 + 0o20) + chr(0b101110 + 0o4) + '\x32', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + '\066' + chr(1252 - 1199), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(10548 - 10437) + chr(0b101010 + 0o7) + '\065' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\062' + chr(51) + chr(1630 - 1575), 0o10), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1101100 + 0o3) + chr(54) + chr(52), 51798 - 51790), ehT0Px3KOsy9(chr(343 - 295) + chr(0b1101111) + '\062' + chr(0b110011), 47043 - 47035), ehT0Px3KOsy9('\060' + chr(4113 - 4002) + chr(676 - 627) + chr(0b110100 + 0o0) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(1527 - 1416) + '\x33' + '\x30' + chr(0b10101 + 0o36), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1010111 + 0o30) + '\063' + chr(0b110000) + chr(0b110011), 8), ehT0Px3KOsy9(chr(306 - 258) + chr(111) + '\x33' + chr(0b110010) + chr(48), 27095 - 27087), ehT0Px3KOsy9('\x30' + chr(6189 - 6078) + '\x33' + '\x33' + chr(55), 8), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(48), 0b1000)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b1010 + 0o53) + chr(0b110000), 0b1000)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'I'), chr(0b1011100 + 0o10) + '\x65' + '\x63' + '\x6f' + chr(7122 - 7022) + chr(0b1100101))(chr(12349 - 12232) + chr(0b1110100) + chr(102) + chr(0b100001 + 0o14) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Y8mIS9Lgn4Rp(oVre8I6UXc3b, H9yw8tZKkKME, SLiSZu5nk7Kn, vpNBss375oFz, UA_xrSW_iNom): xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'8\xa3\xfb%\x0e\x9b\xdf\xcc\xbc]\xe8\xe4\xadm\x1dve\x1e\x974\xaa\xb3\xac\x19V\xe5\x078\xbf\x86'), chr(0b10111 + 0o115) + chr(0b1100101) + chr(0b110101 + 0o56) + chr(7019 - 6908) + chr(1561 - 1461) + '\145')(chr(117) + '\x74' + chr(102) + chr(0b101000 + 0o5) + chr(56)))(H9yw8tZKkKME, SLiSZu5nk7Kn, vpNBss375oFz, UA_xrSW_iNom) SIYxeZnWoV9m = oVre8I6UXc3b._get_loader ODF7TTtq_kKc = UA_xrSW_iNom.igThHS4jwVsa() dTprSchKabOH = H9yw8tZKkKME.initial_refcounts(ODF7TTtq_kKc) vlljLe878nOt = H9yw8tZKkKME.execution_order(dTprSchKabOH) psizfxY_oCoV = H9yw8tZKkKME.psizfxY_oCoV def frMDZ1YniLWm(BnuOe7t2jDZ6): JtQ_Es21wyVN = SIYxeZnWoV9m(BnuOe7t2jDZ6) TXd2BYxb2pNV = H9yw8tZKkKME.extra_rows[BnuOe7t2jDZ6] return (JtQ_Es21wyVN, TXd2BYxb2pNV) XGlQwxszPOiw = H9yw8tZKkKME.loadable_terms - ibVce80NjHnP(ODF7TTtq_kKc) W6rG8X6Rc7xX = MRtOn47tdSTy(frMDZ1YniLWm, (YeT3l7JgTbWR for YeT3l7JgTbWR in vlljLe878nOt if YeT3l7JgTbWR in XGlQwxszPOiw)) for BnuOe7t2jDZ6 in xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xad\xff*\x12\x8b\xd7\xd7\xb7]\xe4\xf9\xa4x\x1a'), chr(0b1100100) + '\x65' + chr(0b11111 + 0o104) + chr(0b100000 + 0o117) + '\x64' + chr(9565 - 9464))('\165' + chr(116) + chr(102) + chr(0b101101) + '\x38'))(dTprSchKabOH): if BnuOe7t2jDZ6 in ODF7TTtq_kKc: continue (Iz1jSgUKZDvt, D4397KeSpAkR) = H9yw8tZKkKME.mask_and_dates_for_term(BnuOe7t2jDZ6, oVre8I6UXc3b._root_mask_term, ODF7TTtq_kKc, SLiSZu5nk7Kn) if PlSM16l2KDPD(BnuOe7t2jDZ6, p6lYdHiP4DL2): JtQ_Es21wyVN = SIYxeZnWoV9m(BnuOe7t2jDZ6) UlobiOKdx0j8 = vUlqIvNSaRMa(W6rG8X6Rc7xX[frMDZ1YniLWm(BnuOe7t2jDZ6)], key=lambda YeT3l7JgTbWR: YeT3l7JgTbWR.dataset) KPNLJT5LGB6k = JtQ_Es21wyVN.load_adjusted_array(psizfxY_oCoV, UlobiOKdx0j8, D4397KeSpAkR, vpNBss375oFz, Iz1jSgUKZDvt) assert MVEN8G6CxlvR(KPNLJT5LGB6k) == MVEN8G6CxlvR(UlobiOKdx0j8), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0b\xba\xfb-\x02\x8d\x9e\xdc\xb0f\xab\xe5\xafiHpe5\x81.\xb1\xfd\xa6(\x06\xc5\x113\xa7\x86\x19\xfaPR\x10\xb1\xa2\xa9\xff~\x08\xa7\xba,\x06\x9c\xd6\x98\xbam\xe7\xfe\xadsbgx1\x91?\xab\xb8\xa3|\x06\xa1\x07S\xb5\x9a\x19\xa5\x143B\xe3\xe3\xf0\xfaj'), chr(0b1100100) + chr(101) + chr(0b10010 + 0o121) + chr(111) + chr(0b111011 + 0o51) + chr(5050 - 4949))('\165' + '\x74' + '\x66' + '\055' + chr(0b111000)) % (vUlqIvNSaRMa(UlobiOKdx0j8), vUlqIvNSaRMa(KPNLJT5LGB6k)) xafqLlk3kkUe(ODF7TTtq_kKc, xafqLlk3kkUe(SXOLrMavuUCe(b'=\xa1\xdb\x0c\x0e\xb1\xf4\xd6\xa06\xee\xbb'), chr(3542 - 3442) + chr(101) + chr(486 - 387) + '\157' + chr(2691 - 2591) + chr(0b1100101))(chr(7253 - 7136) + chr(0b0 + 0o164) + chr(0b1001111 + 0o27) + chr(1081 - 1036) + '\x38'))(KPNLJT5LGB6k) else: ODF7TTtq_kKc[BnuOe7t2jDZ6] = BnuOe7t2jDZ6._compute(oVre8I6UXc3b._inputs_for_term(BnuOe7t2jDZ6, ODF7TTtq_kKc, H9yw8tZKkKME, psizfxY_oCoV), D4397KeSpAkR, vpNBss375oFz, Iz1jSgUKZDvt) if xafqLlk3kkUe(BnuOe7t2jDZ6, xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\xba\xf79/\xbd\xd7\xec\xaad\xc1\xdf'), chr(2136 - 2036) + chr(0b1101 + 0o130) + '\143' + '\x6f' + chr(100) + '\145')(chr(117) + chr(0b100010 + 0o122) + chr(4667 - 4565) + chr(1051 - 1006) + '\x38')) == ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062', 8): assert xafqLlk3kkUe(ODF7TTtq_kKc[BnuOe7t2jDZ6], xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xb4\xef\x10\x01\xb3\xd9\xd4\x8dr\xe8\xe9'), chr(0b1100100) + chr(0b1011110 + 0o7) + chr(0b1100011) + '\157' + chr(4746 - 4646) + '\145')(chr(0b1110101) + chr(0b1110100) + '\146' + chr(45) + chr(3102 - 3046))) == xafqLlk3kkUe(Iz1jSgUKZDvt, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xb4\xef\x10\x01\xb3\xd9\xd4\x8dr\xe8\xe9'), chr(0b1011111 + 0o5) + chr(101) + chr(0b1100011) + chr(0b1101011 + 0o4) + chr(100) + chr(8429 - 8328))(chr(7504 - 7387) + chr(0b1110100) + chr(3688 - 3586) + chr(1989 - 1944) + chr(0b11001 + 0o37))) else: assert xafqLlk3kkUe(ODF7TTtq_kKc[BnuOe7t2jDZ6], xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xb4\xef\x10\x01\xb3\xd9\xd4\x8dr\xe8\xe9'), '\144' + '\x65' + '\143' + '\157' + '\x64' + '\145')(chr(117) + chr(0b1110100) + chr(0b1100110) + chr(45) + '\070')) == (xafqLlk3kkUe(Iz1jSgUKZDvt, xafqLlk3kkUe(SXOLrMavuUCe(b'\t\xb4\xef\x10\x01\xb3\xd9\xd4\x8dr\xe8\xe9'), '\144' + '\145' + chr(0b1100011) + chr(0b111 + 0o150) + chr(8638 - 8538) + chr(0b1001011 + 0o32))(chr(117) + chr(7356 - 7240) + chr(8424 - 8322) + chr(436 - 391) + chr(56)))[ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(48), 8)], ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100000 + 0o21), 0b1000)) for c_U0ERi2jqKp in xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'\x03\xb0\xf9;\x02\x99\xe1\xdc\xbcr\xee\xe5\xa4x\x06ai$\x87'), '\x64' + chr(0b1100101) + chr(99) + '\157' + '\x64' + chr(101))(chr(0b1110101) + chr(116) + chr(8906 - 8804) + chr(45) + '\070'))(BnuOe7t2jDZ6, dTprSchKabOH): del ODF7TTtq_kKc[c_U0ERi2jqKp] UkrMp_I0RDmo = {} vSrLKnDgxSv4 = H9yw8tZKkKME.extra_rows for (AIvJRzLdDfgF, BnuOe7t2jDZ6) in WYXqUHkBa2Bx(xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'#\xad\xc5\r\x0b\x93\xe4\x80\xacA\xe0\xe4'), chr(0b1100100) + chr(1701 - 1600) + chr(0b1000001 + 0o42) + chr(111) + chr(9800 - 9700) + '\145')(chr(888 - 771) + chr(0b1110100) + chr(102) + '\x2d' + chr(469 - 413)))): UkrMp_I0RDmo[AIvJRzLdDfgF] = ODF7TTtq_kKc[BnuOe7t2jDZ6][vSrLKnDgxSv4[BnuOe7t2jDZ6]:] return UkrMp_I0RDmo
quantopian/zipline
zipline/pipeline/engine.py
SimplePipelineEngine._to_narrow
def _to_narrow(self, terms, data, mask, dates, assets): """ Convert raw computed pipeline results into a DataFrame for public APIs. Parameters ---------- terms : dict[str -> Term] Dict mapping column names to terms. data : dict[str -> ndarray[ndim=2]] Dict mapping column names to computed results for those names. mask : ndarray[bool, ndim=2] Mask array of values to keep. dates : ndarray[datetime64, ndim=1] Row index for arrays `data` and `mask` assets : ndarray[int64, ndim=2] Column index for arrays `data` and `mask` Returns ------- results : pd.DataFrame The indices of `results` are as follows: index : two-tiered MultiIndex of (date, asset). Contains an entry for each (date, asset) pair corresponding to a `True` value in `mask`. columns : Index of str One column per entry in `data`. If mask[date, asset] is True, then result.loc[(date, asset), colname] will contain the value of data[colname][date, asset]. """ if not mask.any(): # Manually handle the empty DataFrame case. This is a workaround # to pandas failing to tz_localize an empty dataframe with a # MultiIndex. It also saves us the work of applying a known-empty # mask to each array. # # Slicing `dates` here to preserve pandas metadata. empty_dates = dates[:0] empty_assets = array([], dtype=object) return DataFrame( data={ name: array([], dtype=arr.dtype) for name, arr in iteritems(data) }, index=MultiIndex.from_arrays([empty_dates, empty_assets]), ) resolved_assets = array(self._finder.retrieve_all(assets)) dates_kept = repeat_last_axis(dates.values, len(assets))[mask] assets_kept = repeat_first_axis(resolved_assets, len(dates))[mask] final_columns = {} for name in data: # Each term that computed an output has its postprocess method # called on the filtered result. # # As of Mon May 2 15:38:47 2016, we only use this to convert # LabelArrays into categoricals. final_columns[name] = terms[name].postprocess(data[name][mask]) return DataFrame( data=final_columns, index=MultiIndex.from_arrays([dates_kept, assets_kept]), ).tz_localize('UTC', level=0)
python
def _to_narrow(self, terms, data, mask, dates, assets): """ Convert raw computed pipeline results into a DataFrame for public APIs. Parameters ---------- terms : dict[str -> Term] Dict mapping column names to terms. data : dict[str -> ndarray[ndim=2]] Dict mapping column names to computed results for those names. mask : ndarray[bool, ndim=2] Mask array of values to keep. dates : ndarray[datetime64, ndim=1] Row index for arrays `data` and `mask` assets : ndarray[int64, ndim=2] Column index for arrays `data` and `mask` Returns ------- results : pd.DataFrame The indices of `results` are as follows: index : two-tiered MultiIndex of (date, asset). Contains an entry for each (date, asset) pair corresponding to a `True` value in `mask`. columns : Index of str One column per entry in `data`. If mask[date, asset] is True, then result.loc[(date, asset), colname] will contain the value of data[colname][date, asset]. """ if not mask.any(): # Manually handle the empty DataFrame case. This is a workaround # to pandas failing to tz_localize an empty dataframe with a # MultiIndex. It also saves us the work of applying a known-empty # mask to each array. # # Slicing `dates` here to preserve pandas metadata. empty_dates = dates[:0] empty_assets = array([], dtype=object) return DataFrame( data={ name: array([], dtype=arr.dtype) for name, arr in iteritems(data) }, index=MultiIndex.from_arrays([empty_dates, empty_assets]), ) resolved_assets = array(self._finder.retrieve_all(assets)) dates_kept = repeat_last_axis(dates.values, len(assets))[mask] assets_kept = repeat_first_axis(resolved_assets, len(dates))[mask] final_columns = {} for name in data: # Each term that computed an output has its postprocess method # called on the filtered result. # # As of Mon May 2 15:38:47 2016, we only use this to convert # LabelArrays into categoricals. final_columns[name] = terms[name].postprocess(data[name][mask]) return DataFrame( data=final_columns, index=MultiIndex.from_arrays([dates_kept, assets_kept]), ).tz_localize('UTC', level=0)
[ "def", "_to_narrow", "(", "self", ",", "terms", ",", "data", ",", "mask", ",", "dates", ",", "assets", ")", ":", "if", "not", "mask", ".", "any", "(", ")", ":", "# Manually handle the empty DataFrame case. This is a workaround", "# to pandas failing to tz_localize an empty dataframe with a", "# MultiIndex. It also saves us the work of applying a known-empty", "# mask to each array.", "#", "# Slicing `dates` here to preserve pandas metadata.", "empty_dates", "=", "dates", "[", ":", "0", "]", "empty_assets", "=", "array", "(", "[", "]", ",", "dtype", "=", "object", ")", "return", "DataFrame", "(", "data", "=", "{", "name", ":", "array", "(", "[", "]", ",", "dtype", "=", "arr", ".", "dtype", ")", "for", "name", ",", "arr", "in", "iteritems", "(", "data", ")", "}", ",", "index", "=", "MultiIndex", ".", "from_arrays", "(", "[", "empty_dates", ",", "empty_assets", "]", ")", ",", ")", "resolved_assets", "=", "array", "(", "self", ".", "_finder", ".", "retrieve_all", "(", "assets", ")", ")", "dates_kept", "=", "repeat_last_axis", "(", "dates", ".", "values", ",", "len", "(", "assets", ")", ")", "[", "mask", "]", "assets_kept", "=", "repeat_first_axis", "(", "resolved_assets", ",", "len", "(", "dates", ")", ")", "[", "mask", "]", "final_columns", "=", "{", "}", "for", "name", "in", "data", ":", "# Each term that computed an output has its postprocess method", "# called on the filtered result.", "#", "# As of Mon May 2 15:38:47 2016, we only use this to convert", "# LabelArrays into categoricals.", "final_columns", "[", "name", "]", "=", "terms", "[", "name", "]", ".", "postprocess", "(", "data", "[", "name", "]", "[", "mask", "]", ")", "return", "DataFrame", "(", "data", "=", "final_columns", ",", "index", "=", "MultiIndex", ".", "from_arrays", "(", "[", "dates_kept", ",", "assets_kept", "]", ")", ",", ")", ".", "tz_localize", "(", "'UTC'", ",", "level", "=", "0", ")" ]
Convert raw computed pipeline results into a DataFrame for public APIs. Parameters ---------- terms : dict[str -> Term] Dict mapping column names to terms. data : dict[str -> ndarray[ndim=2]] Dict mapping column names to computed results for those names. mask : ndarray[bool, ndim=2] Mask array of values to keep. dates : ndarray[datetime64, ndim=1] Row index for arrays `data` and `mask` assets : ndarray[int64, ndim=2] Column index for arrays `data` and `mask` Returns ------- results : pd.DataFrame The indices of `results` are as follows: index : two-tiered MultiIndex of (date, asset). Contains an entry for each (date, asset) pair corresponding to a `True` value in `mask`. columns : Index of str One column per entry in `data`. If mask[date, asset] is True, then result.loc[(date, asset), colname] will contain the value of data[colname][date, asset].
[ "Convert", "raw", "computed", "pipeline", "results", "into", "a", "DataFrame", "for", "public", "APIs", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc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bn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(1019 - 971) + '\x6f' + chr(0b110001) + '\066' + chr(2462 - 2408), 64179 - 64171), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x33' + '\x32' + chr(50), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101100 + 0o103) + '\x31' + chr(0b110001) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + chr(0b11101 + 0o25) + chr(55) + chr(50), 0o10), ehT0Px3KOsy9(chr(1222 - 1174) + chr(2714 - 2603) + '\x31' + '\x37' + chr(0b110100), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(10082 - 9971) + '\x32' + chr(0b1000 + 0o56) + '\x33', 0b1000), ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + '\x31' + chr(54) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(111) + '\066' + chr(951 - 900), 0o10), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(0b1101111) + chr(0b110001) + chr(0b100100 + 0o16) + chr(55), 57600 - 57592), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(0b1 + 0o61) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + '\x37' + chr(0b1011 + 0o52), 52293 - 52285), ehT0Px3KOsy9('\060' + '\x6f' + chr(1281 - 1232) + chr(51) + '\x30', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(51) + chr(1811 - 1762) + '\065', 0b1000), ehT0Px3KOsy9(chr(455 - 407) + chr(0b11 + 0o154) + '\062' + '\062' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(111) + '\x34' + chr(715 - 663), 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(1999 - 1945) + chr(0b101 + 0o56), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100010 + 0o15) + '\x32' + chr(0b110111) + '\066', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + '\x36' + chr(52), 0b1000), ehT0Px3KOsy9(chr(766 - 718) + '\157' + '\x32' + '\x37' + '\x32', 8), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(111) + chr(0b11110 + 0o27) + chr(0b110111), 25836 - 25828), ehT0Px3KOsy9('\060' + '\157' + '\x32' + '\063' + chr(339 - 290), 0o10), ehT0Px3KOsy9(chr(68 - 20) + '\x6f' + chr(50) + chr(683 - 633) + chr(0b10001 + 0o40), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(2267 - 2216) + '\x30' + '\x35', 4647 - 4639), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + '\061' + chr(1033 - 978) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(858 - 808) + chr(2082 - 2028) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100000 + 0o21) + chr(1462 - 1414) + chr(1191 - 1142), 41387 - 41379), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(9296 - 9185) + chr(0b11110 + 0o25) + chr(1932 - 1882) + chr(0b101011 + 0o7), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010) + chr(1725 - 1676) + chr(0b110 + 0o53), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b100110 + 0o16) + chr(53), ord("\x08")), ehT0Px3KOsy9(chr(1250 - 1202) + chr(9893 - 9782) + chr(51) + '\062' + chr(0b100100 + 0o14), 0o10), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + '\x33' + chr(0b110001) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x33' + chr(53) + chr(0b10110 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(0b1101111) + chr(0b1000 + 0o52) + chr(0b101 + 0o53) + chr(0b110000), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(51) + '\x31' + '\x34', 0o10), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b10111 + 0o130) + '\062' + '\065' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + chr(0b110010) + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + '\063' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1011100 + 0o23) + '\065' + chr(1032 - 983), 0b1000), ehT0Px3KOsy9('\060' + chr(6563 - 6452) + '\x33' + chr(0b111 + 0o56) + chr(0b100110 + 0o16), 29433 - 29425), ehT0Px3KOsy9(chr(1344 - 1296) + '\x6f' + chr(1703 - 1652) + chr(0b1 + 0o62) + chr(396 - 341), 49285 - 49277)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1000 + 0o147) + '\x35' + '\060', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'X'), chr(100) + '\145' + '\143' + chr(6773 - 6662) + '\144' + chr(101))(chr(0b1110101) + chr(0b1010000 + 0o44) + chr(4322 - 4220) + chr(0b101101) + chr(0b1010 + 0o56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def czfhOpVX3c2n(oVre8I6UXc3b, XN41EaTdyMxN, ULnjp6D6efFH, Iz1jSgUKZDvt, SLiSZu5nk7Kn, YGFU3oxACPcg): if not xafqLlk3kkUe(Iz1jSgUKZDvt, xafqLlk3kkUe(SXOLrMavuUCe(b'#\x84\x19\xd3H\xeb&\x042\x11\xb4\x15'), chr(0b101010 + 0o72) + chr(0b1100101) + '\143' + '\157' + chr(2146 - 2046) + chr(101))(chr(0b10110 + 0o137) + chr(0b1110100) + '\x66' + chr(45) + chr(2449 - 2393)))(): qY8lITCF1MsC = SLiSZu5nk7Kn[:ehT0Px3KOsy9(chr(0b11000 + 0o30) + '\157' + chr(2098 - 2050), 5672 - 5664)] GjCH8sQTzLnT = B0ePDhpqxN5n([], dtype=sR_24x3xd4bh) return TTWbaLX2VikC(data={AIvJRzLdDfgF: B0ePDhpqxN5n([], dtype=xafqLlk3kkUe(ZxkNvNvuRNy5, xafqLlk3kkUe(SXOLrMavuUCe(b'\x1c\x81\x1c\x835\xf8\x1fV:\x1b\xca\x13'), chr(8515 - 8415) + chr(605 - 504) + chr(3836 - 3737) + chr(0b1101111) + chr(100) + chr(101))(chr(0b1110101) + chr(116) + chr(0b1010010 + 0o24) + '\055' + chr(0b111000)))) for (AIvJRzLdDfgF, ZxkNvNvuRNy5) in WYXqUHkBa2Bx(ULnjp6D6efFH)}, index=xafqLlk3kkUe(X6ABZiFGr623, xafqLlk3kkUe(SXOLrMavuUCe(b'\x10\xa0%\xd7#\xd2\x03A6*\x8e'), chr(100) + chr(101) + chr(0b1000001 + 0o42) + '\157' + '\144' + chr(8389 - 8288))('\x75' + chr(0b10000 + 0o144) + '\x66' + chr(0b101101) + chr(56)))([qY8lITCF1MsC, GjCH8sQTzLnT])) wWwpsdkCkRj7 = B0ePDhpqxN5n(oVre8I6UXc3b._finder.retrieve_all(YGFU3oxACPcg)) HtG6k_wVaPS6 = dL7AaJSVwYmy(SLiSZu5nk7Kn.SPnCNu54H1db, c2A0yzQpDQB3(YGFU3oxACPcg))[Iz1jSgUKZDvt] NGeQo9ovdag7 = ahH60iEANaPk(wWwpsdkCkRj7, c2A0yzQpDQB3(SLiSZu5nk7Kn))[Iz1jSgUKZDvt] QHMwZLBBd0DG = {} for AIvJRzLdDfgF in ULnjp6D6efFH: QHMwZLBBd0DG[AIvJRzLdDfgF] = XN41EaTdyMxN[AIvJRzLdDfgF].postprocess(ULnjp6D6efFH[AIvJRzLdDfgF][Iz1jSgUKZDvt]) return xafqLlk3kkUe(TTWbaLX2VikC(data=QHMwZLBBd0DG, index=X6ABZiFGr623.from_arrays([HtG6k_wVaPS6, NGeQo9ovdag7])), xafqLlk3kkUe(SXOLrMavuUCe(b'\x02\xa8\x15\xd6\x13\xd0\x10_>)\x98'), '\x64' + '\145' + chr(0b1100011) + '\157' + chr(0b1100100) + '\x65')(chr(117) + '\x74' + chr(0b1100110) + '\055' + chr(1753 - 1697)))(xafqLlk3kkUe(SXOLrMavuUCe(b'#\x86\t'), chr(0b1100100) + chr(5902 - 5801) + chr(0b110100 + 0o57) + chr(111) + '\x64' + '\145')(chr(0b0 + 0o165) + chr(0b1011101 + 0o27) + '\x66' + chr(0b101101) + chr(0b111000)), level=ehT0Px3KOsy9(chr(1231 - 1183) + chr(111) + chr(48), 8))
quantopian/zipline
zipline/pipeline/engine.py
SimplePipelineEngine._validate_compute_chunk_params
def _validate_compute_chunk_params(self, graph, dates, sids, initial_workspace): """ Verify that the values passed to compute_chunk are well-formed. """ root = self._root_mask_term clsname = type(self).__name__ # Writing this out explicitly so this errors in testing if we change # the name without updating this line. compute_chunk_name = self.compute_chunk.__name__ if root not in initial_workspace: raise AssertionError( "root_mask values not supplied to {cls}.{method}".format( cls=clsname, method=compute_chunk_name, ) ) shape = initial_workspace[root].shape implied_shape = len(dates), len(sids) if shape != implied_shape: raise AssertionError( "root_mask shape is {shape}, but received dates/assets " "imply that shape should be {implied}".format( shape=shape, implied=implied_shape, ) ) for term in initial_workspace: if self._is_special_root_term(term): continue if term.domain is GENERIC: # XXX: We really shouldn't allow **any** generic terms to be # populated in the initial workspace. A generic term, by # definition, can't correspond to concrete data until it's # paired with a domain, and populate_initial_workspace isn't # given the domain of execution, so it can't possibly know what # data to use when populating a generic term. # # In our current implementation, however, we don't have a good # way to represent specializations of ComputableTerms that take # only generic inputs, so there's no good way for the initial # workspace to provide data for such terms except by populating # the generic ComputableTerm. # # The right fix for the above is to implement "full # specialization", i.e., implementing ``specialize`` uniformly # across all terms, not just LoadableTerms. Having full # specialization will also remove the need for all of the # remaining ``maybe_specialize`` calls floating around in this # file. # # In the meantime, disallowing ComputableTerms in the initial # workspace would break almost every test in # `test_filter`/`test_factor`/`test_classifier`, and fixing # them would require updating all those tests to compute with # more specialized terms. Once we have full specialization, we # can fix all the tests without a large volume of edits by # simply specializing their workspaces, so for now I'm leaving # this in place as a somewhat sharp edge. if isinstance(term, LoadableTerm): raise ValueError( "Loadable workspace terms must be specialized to a " "domain, but got generic term {}".format(term) ) elif term.domain != graph.domain: raise ValueError( "Initial workspace term {} has domain {}. " "Does not match pipeline domain {}".format( term, term.domain, graph.domain, ) )
python
def _validate_compute_chunk_params(self, graph, dates, sids, initial_workspace): """ Verify that the values passed to compute_chunk are well-formed. """ root = self._root_mask_term clsname = type(self).__name__ # Writing this out explicitly so this errors in testing if we change # the name without updating this line. compute_chunk_name = self.compute_chunk.__name__ if root not in initial_workspace: raise AssertionError( "root_mask values not supplied to {cls}.{method}".format( cls=clsname, method=compute_chunk_name, ) ) shape = initial_workspace[root].shape implied_shape = len(dates), len(sids) if shape != implied_shape: raise AssertionError( "root_mask shape is {shape}, but received dates/assets " "imply that shape should be {implied}".format( shape=shape, implied=implied_shape, ) ) for term in initial_workspace: if self._is_special_root_term(term): continue if term.domain is GENERIC: # XXX: We really shouldn't allow **any** generic terms to be # populated in the initial workspace. A generic term, by # definition, can't correspond to concrete data until it's # paired with a domain, and populate_initial_workspace isn't # given the domain of execution, so it can't possibly know what # data to use when populating a generic term. # # In our current implementation, however, we don't have a good # way to represent specializations of ComputableTerms that take # only generic inputs, so there's no good way for the initial # workspace to provide data for such terms except by populating # the generic ComputableTerm. # # The right fix for the above is to implement "full # specialization", i.e., implementing ``specialize`` uniformly # across all terms, not just LoadableTerms. Having full # specialization will also remove the need for all of the # remaining ``maybe_specialize`` calls floating around in this # file. # # In the meantime, disallowing ComputableTerms in the initial # workspace would break almost every test in # `test_filter`/`test_factor`/`test_classifier`, and fixing # them would require updating all those tests to compute with # more specialized terms. Once we have full specialization, we # can fix all the tests without a large volume of edits by # simply specializing their workspaces, so for now I'm leaving # this in place as a somewhat sharp edge. if isinstance(term, LoadableTerm): raise ValueError( "Loadable workspace terms must be specialized to a " "domain, but got generic term {}".format(term) ) elif term.domain != graph.domain: raise ValueError( "Initial workspace term {} has domain {}. " "Does not match pipeline domain {}".format( term, term.domain, graph.domain, ) )
[ "def", "_validate_compute_chunk_params", "(", "self", ",", "graph", ",", "dates", ",", "sids", ",", "initial_workspace", ")", ":", "root", "=", "self", ".", "_root_mask_term", "clsname", "=", "type", "(", "self", ")", ".", "__name__", "# Writing this out explicitly so this errors in testing if we change", "# the name without updating this line.", "compute_chunk_name", "=", "self", ".", "compute_chunk", ".", "__name__", "if", "root", "not", "in", "initial_workspace", ":", "raise", "AssertionError", "(", "\"root_mask values not supplied to {cls}.{method}\"", ".", "format", "(", "cls", "=", "clsname", ",", "method", "=", "compute_chunk_name", ",", ")", ")", "shape", "=", "initial_workspace", "[", "root", "]", ".", "shape", "implied_shape", "=", "len", "(", "dates", ")", ",", "len", "(", "sids", ")", "if", "shape", "!=", "implied_shape", ":", "raise", "AssertionError", "(", "\"root_mask shape is {shape}, but received dates/assets \"", "\"imply that shape should be {implied}\"", ".", "format", "(", "shape", "=", "shape", ",", "implied", "=", "implied_shape", ",", ")", ")", "for", "term", "in", "initial_workspace", ":", "if", "self", ".", "_is_special_root_term", "(", "term", ")", ":", "continue", "if", "term", ".", "domain", "is", "GENERIC", ":", "# XXX: We really shouldn't allow **any** generic terms to be", "# populated in the initial workspace. A generic term, by", "# definition, can't correspond to concrete data until it's", "# paired with a domain, and populate_initial_workspace isn't", "# given the domain of execution, so it can't possibly know what", "# data to use when populating a generic term.", "#", "# In our current implementation, however, we don't have a good", "# way to represent specializations of ComputableTerms that take", "# only generic inputs, so there's no good way for the initial", "# workspace to provide data for such terms except by populating", "# the generic ComputableTerm.", "#", "# The right fix for the above is to implement \"full", "# specialization\", i.e., implementing ``specialize`` uniformly", "# across all terms, not just LoadableTerms. Having full", "# specialization will also remove the need for all of the", "# remaining ``maybe_specialize`` calls floating around in this", "# file.", "#", "# In the meantime, disallowing ComputableTerms in the initial", "# workspace would break almost every test in", "# `test_filter`/`test_factor`/`test_classifier`, and fixing", "# them would require updating all those tests to compute with", "# more specialized terms. Once we have full specialization, we", "# can fix all the tests without a large volume of edits by", "# simply specializing their workspaces, so for now I'm leaving", "# this in place as a somewhat sharp edge.", "if", "isinstance", "(", "term", ",", "LoadableTerm", ")", ":", "raise", "ValueError", "(", "\"Loadable workspace terms must be specialized to a \"", "\"domain, but got generic term {}\"", ".", "format", "(", "term", ")", ")", "elif", "term", ".", "domain", "!=", "graph", ".", "domain", ":", "raise", "ValueError", "(", "\"Initial workspace term {} has domain {}. \"", "\"Does not match pipeline domain {}\"", ".", "format", "(", "term", ",", "term", ".", "domain", ",", "graph", ".", "domain", ",", ")", ")" ]
Verify that the values passed to compute_chunk are well-formed.
[ "Verify", "that", "the", "values", "passed", "to", "compute_chunk", "are", "well", "-", "formed", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/engine.py#L674-L752
train
Verify that the values passed to compute_chunk are well - formed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,R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PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(84 - 36) + chr(4965 - 4854) + chr(51) + chr(54) + chr(2272 - 2218), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1110 + 0o141) + chr(1094 - 1044) + chr(2177 - 2124), 35490 - 35482), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(347 - 236) + chr(652 - 603) + chr(55) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(0b101011 + 0o5) + chr(1473 - 1362) + chr(0b101001 + 0o10) + chr(0b1100 + 0o47) + chr(54), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\062' + chr(1933 - 1884) + chr(1943 - 1895), 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(7735 - 7624) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(111) + chr(50) + chr(1343 - 1294) + chr(489 - 439), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b101000 + 0o107) + chr(0b110011) + '\x31' + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x35' + '\061', 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(0b110110) + '\x37', 15102 - 15094), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + chr(0b100 + 0o62) + chr(49), 0o10), ehT0Px3KOsy9(chr(1219 - 1171) + chr(111) + chr(50) + '\x36' + '\x33', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b101011 + 0o104) + chr(51) + chr(55) + chr(1566 - 1517), 0b1000), ehT0Px3KOsy9(chr(1312 - 1264) + chr(111) + chr(0b100000 + 0o21) + '\x31' + chr(0b110111), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(50) + '\063' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b111001 + 0o66) + '\063' + '\x33' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + chr(0b110101) + '\x30', 8730 - 8722), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + chr(0b110010) + chr(0b110001), 6133 - 6125), ehT0Px3KOsy9(chr(0b110000) + chr(7541 - 7430) + '\x36', 48424 - 48416), ehT0Px3KOsy9(chr(367 - 319) + '\x6f' + chr(51) + chr(0b110100) + chr(0b110010), 54410 - 54402), ehT0Px3KOsy9(chr(2226 - 2178) + '\x6f' + '\x33' + chr(2421 - 2370) + chr(52), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + chr(51) + chr(0b110011) + chr(2573 - 2518), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\061' + chr(0b110000) + '\x30', 0o10), ehT0Px3KOsy9(chr(725 - 677) + chr(0b110101 + 0o72) + '\x32' + chr(0b110001) + chr(0b100110 + 0o17), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101010 + 0o5) + '\x32' + chr(50) + chr(51), 0o10), ehT0Px3KOsy9(chr(0b11101 + 0o23) + chr(517 - 406) + chr(0b110 + 0o53) + '\x32' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b1010 + 0o46) + chr(0b1011000 + 0o27) + chr(0b11000 + 0o33) + '\066' + '\060', 0o10), ehT0Px3KOsy9(chr(2079 - 2031) + chr(0b1101111) + chr(0b110010) + chr(0b10010 + 0o42) + chr(49), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + '\062' + chr(1806 - 1758) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\157' + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + chr(12214 - 12103) + '\066' + chr(0b110000), 44240 - 44232), ehT0Px3KOsy9('\060' + chr(0b1000110 + 0o51) + chr(0b110010) + chr(0b110011) + chr(0b110110), 0o10), ehT0Px3KOsy9('\060' + '\157' + '\x33' + chr(50), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + '\064' + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + '\062' + chr(2310 - 2256) + chr(53), 31517 - 31509), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + chr(53) + '\063', 0b1000), ehT0Px3KOsy9(chr(66 - 18) + chr(0b10000 + 0o137) + chr(49) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + chr(597 - 546) + chr(55), 8), ehT0Px3KOsy9('\060' + '\x6f' + chr(1275 - 1226) + chr(0b1100 + 0o51) + chr(53), 0b1000), ehT0Px3KOsy9(chr(1068 - 1020) + '\x6f' + chr(786 - 737) + chr(53) + '\x33', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b110101) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xd8'), chr(0b1100100) + chr(0b1100101) + chr(1095 - 996) + chr(9844 - 9733) + '\x64' + '\x65')('\x75' + '\164' + chr(0b1100110) + chr(45) + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def ZITSHhSuehMZ(oVre8I6UXc3b, H9yw8tZKkKME, SLiSZu5nk7Kn, vpNBss375oFz, UA_xrSW_iNom): FiL2Xt3u2AMN = oVre8I6UXc3b._root_mask_term Dt4PDLh0nfgN = wmQmyeWBmUpv(oVre8I6UXc3b).Gbej4oZqKLA6 TVqlrzMcWSkx = oVre8I6UXc3b.compute_chunk.Gbej4oZqKLA6 if FiL2Xt3u2AMN not in UA_xrSW_iNom: raise vcEHXBQXuDuh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x84z\x11*\xd7i\xeb\xb9B\xd7\x87\xd2\x95:\xfa\xaeH?i\x96\xfc\xac5\xfd\xe3?\x99\xc4\xe1%D\xf1:\x19\xd6\x87\x7f\xe2C\x10\x9bp\n6\xe7`\xf7'), '\x64' + '\x65' + '\143' + chr(2458 - 2347) + chr(9948 - 9848) + chr(0b1100101))(chr(117) + '\164' + chr(3882 - 3780) + '\x2d' + chr(0b100111 + 0o21)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0!\x0c1\xc0e\xd9\xf9y\x87\x94\xd9'), '\x64' + chr(0b111110 + 0o47) + chr(0b1011010 + 0o11) + chr(0b1101111) + '\x64' + '\x65')('\x75' + chr(116) + chr(0b1100110) + '\055' + chr(56)))(cls=Dt4PDLh0nfgN, method=TVqlrzMcWSkx)) nauYfLglTpcb = UA_xrSW_iNom[FiL2Xt3u2AMN].nauYfLglTpcb Gfg7xPlz3_QT = (c2A0yzQpDQB3(SLiSZu5nk7Kn), c2A0yzQpDQB3(vpNBss375oFz)) if nauYfLglTpcb != Gfg7xPlz3_QT: raise vcEHXBQXuDuh(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x84z\x11*\xd7i\xeb\xb9B\xd7\x82\xdb\x98?\xfa\xfd\x01"&\x99\xaf\xb7!\xfd\xf6.\xdc\x81\xe7pD\xbeh\x07\xd6\x8ee\xe9\x08\x0f\xd6q\x1f*\xedw\xa5\xabZ\x84\x94\xc7\x8ao\xf6\xb0\x18=\x7f\xc2\xa8\xb7!\xf9\xb3 \x98\xc0\xf5`\x10\xedr\r\xc0\x87h\xbf\x0f\x0e\xd6n\x173\xf8h\xe3\xafM\x8a'), chr(0b1100100) + '\x65' + chr(0b1010011 + 0o20) + '\157' + chr(100) + chr(0b101111 + 0o66))('\165' + '\164' + '\x66' + chr(0b101101) + chr(1434 - 1378)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0!\x0c1\xc0e\xd9\xf9y\x87\x94\xd9'), '\144' + chr(101) + '\x63' + chr(10079 - 9968) + chr(100) + chr(9499 - 9398))(chr(0b1110101) + '\x74' + '\146' + chr(45) + chr(2265 - 2209)))(shape=nauYfLglTpcb, implied=Gfg7xPlz3_QT)) for BnuOe7t2jDZ6 in UA_xrSW_iNom: if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\xa9|\r\x01\xfbt\xef\xa9@\x96\x9d\xec\x8b \xf0\xa97%c\x90\xb1'), chr(0b11001 + 0o113) + chr(3097 - 2996) + chr(0b1100000 + 0o3) + chr(3443 - 3332) + chr(2182 - 2082) + '\145')(chr(0b1110101) + chr(11899 - 11783) + chr(7565 - 7463) + chr(45) + '\070'))(BnuOe7t2jDZ6): continue if xafqLlk3kkUe(BnuOe7t2jDZ6, xafqLlk3kkUe(SXOLrMavuUCe(b'\x86f\x17$\xee|\xd3\x95F\xb4\x9e\xe5'), chr(0b101000 + 0o74) + '\145' + chr(99) + chr(0b1101111) + chr(0b1100100) + '\145')(chr(0b110100 + 0o101) + chr(0b1011 + 0o151) + '\146' + chr(144 - 99) + chr(56))) is kxwMF5OOnoDq: if PlSM16l2KDPD(BnuOe7t2jDZ6, p6lYdHiP4DL2): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"\xbaz\x1f:\xe9f\xe6\xaf\t\x80\x9e\xc1\x92<\xef\xbc\x0b4&\x96\xb9\xad-\xfe\xb3>\x85\xd2\xf1%R\xfb:\x11\xc5\x8eo\xf6\x0c\x07\x9fo\x1b:\xa8p\xe5\xeaH\xd7\x95\xdc\x94.\xf6\xb3Dqd\x97\xa8\xff'\xe2\xe7s\x97\xc4\xeb`B\xf7yB\xc1\x8e~\xf2M\x10\x8b"), chr(0b1010101 + 0o17) + '\x65' + '\143' + chr(111) + chr(0b1100100) + '\145')('\x75' + chr(3558 - 3442) + '\146' + chr(0b1011 + 0o42) + chr(2365 - 2309)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0!\x0c1\xc0e\xd9\xf9y\x87\x94\xd9'), '\144' + chr(946 - 845) + '\x63' + '\157' + chr(100) + '\x65')(chr(0b1110101 + 0o0) + chr(10489 - 10373) + chr(0b1100110) + chr(0b101101) + '\x38'))(BnuOe7t2jDZ6)) elif xafqLlk3kkUe(BnuOe7t2jDZ6, xafqLlk3kkUe(SXOLrMavuUCe(b'\x86f\x17$\xee|\xd3\x95F\xb4\x9e\xe5'), '\x64' + chr(101) + '\x63' + chr(0b110100 + 0o73) + chr(0b1101 + 0o127) + '\x65')(chr(7679 - 7562) + chr(0b110110 + 0o76) + '\146' + chr(45) + chr(56))) != xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'\x86f\x17$\xee|\xd3\x95F\xb4\x9e\xe5'), chr(100) + chr(2390 - 2289) + chr(0b100010 + 0o101) + chr(0b1101111) + chr(8781 - 8681) + chr(0b1100101))(chr(0b11001 + 0o134) + chr(0b1110100) + '\x66' + chr(0b100010 + 0o13) + '\x38')): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\xbf{\x17*\xe1e\xe6\xea^\x98\x83\xd8\x8a?\xfe\xbe\rqr\x87\xae\xb2`\xf6\xees\x98\xc0\xf6%T\xf1w\x03\xdc\x85,\xe4\x10E\xd6Q\x11;\xfb$\xe4\xa5]\xd7\x9c\xd2\x8d,\xf7\xfd\x188v\x87\xb0\xb6.\xe8\xb37\x9f\xcc\xe4l^\xbea\x1f'), chr(0b1100100) + '\145' + '\143' + chr(7921 - 7810) + '\144' + chr(0b100 + 0o141))(chr(0b1110101) + chr(9464 - 9348) + chr(0b1010110 + 0o20) + chr(0b101011 + 0o2) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xa0!\x0c1\xc0e\xd9\xf9y\x87\x94\xd9'), chr(0b1001001 + 0o33) + '\145' + '\x63' + chr(0b1101111) + chr(6498 - 6398) + chr(6182 - 6081))(chr(0b100001 + 0o124) + '\x74' + chr(102) + '\x2d' + chr(0b10011 + 0o45)))(BnuOe7t2jDZ6, xafqLlk3kkUe(BnuOe7t2jDZ6, xafqLlk3kkUe(SXOLrMavuUCe(b'\x86f\x17$\xee|\xd3\x95F\xb4\x9e\xe5'), chr(5282 - 5182) + chr(101) + chr(99) + chr(0b1101111) + '\x64' + chr(7144 - 7043))('\165' + '\x74' + '\146' + chr(0b100000 + 0o15) + chr(56))), xafqLlk3kkUe(H9yw8tZKkKME, xafqLlk3kkUe(SXOLrMavuUCe(b'\x86f\x17$\xee|\xd3\x95F\xb4\x9e\xe5'), '\144' + chr(1589 - 1488) + '\143' + chr(0b1101111) + chr(100) + chr(0b1100101))('\x75' + '\x74' + chr(102) + chr(0b101101) + chr(56)))))
quantopian/zipline
zipline/pipeline/engine.py
SimplePipelineEngine.resolve_domain
def resolve_domain(self, pipeline): """Resolve a concrete domain for ``pipeline``. """ domain = pipeline.domain(default=self._default_domain) if domain is GENERIC: raise ValueError( "Unable to determine domain for Pipeline.\n" "Pass domain=<desired domain> to your Pipeline to set a " "domain." ) return domain
python
def resolve_domain(self, pipeline): """Resolve a concrete domain for ``pipeline``. """ domain = pipeline.domain(default=self._default_domain) if domain is GENERIC: raise ValueError( "Unable to determine domain for Pipeline.\n" "Pass domain=<desired domain> to your Pipeline to set a " "domain." ) return domain
[ "def", "resolve_domain", "(", "self", ",", "pipeline", ")", ":", "domain", "=", "pipeline", ".", "domain", "(", "default", "=", "self", ".", "_default_domain", ")", "if", "domain", "is", "GENERIC", ":", "raise", "ValueError", "(", "\"Unable to determine domain for Pipeline.\\n\"", "\"Pass domain=<desired domain> to your Pipeline to set a \"", "\"domain.\"", ")", "return", "domain" ]
Resolve a concrete domain for ``pipeline``.
[ "Resolve", "a", "concrete", "domain", "for", "pipeline", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/engine.py#L754-L764
train
Resolve a concrete domain for the given Pipeline.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstr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pXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b1011110 + 0o21) + '\061' + chr(0b10 + 0o63) + '\x32', 30293 - 30285), ehT0Px3KOsy9(chr(855 - 807) + '\157' + chr(51) + chr(1839 - 1787) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(50) + '\x32' + chr(1414 - 1365), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + chr(49) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + '\061' + chr(0b110100) + chr(0b11100 + 0o24), 6537 - 6529), ehT0Px3KOsy9(chr(48) + chr(8348 - 8237) + chr(0b100010 + 0o21) + chr(55) + '\x31', 0o10), ehT0Px3KOsy9(chr(526 - 478) + chr(0b1000100 + 0o53) + chr(49) + chr(0b10101 + 0o42) + '\067', 54493 - 54485), ehT0Px3KOsy9(chr(0b110000) + chr(0b110011 + 0o74) + chr(2999 - 2944) + chr(1350 - 1302), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1893 - 1839) + chr(927 - 879), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x31' + chr(0b10010 + 0o43) + chr(475 - 425), 8), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1111 + 0o47) + '\x35', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(11968 - 11857) + chr(0b11111 + 0o22) + chr(50) + chr(0b110001), 0o10), ehT0Px3KOsy9(chr(0b101000 + 0o10) + '\157' + chr(0b1 + 0o61) + chr(48) + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b11011 + 0o26) + '\x34' + '\065', 3856 - 3848), ehT0Px3KOsy9(chr(0b110000) + chr(0b111110 + 0o61) + chr(51) + chr(51) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(964 - 853) + chr(51) + chr(1390 - 1342) + chr(0b10 + 0o61), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + chr(0b110010) + '\065', 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x32' + '\066', 3243 - 3235), ehT0Px3KOsy9(chr(0b110000) + chr(0b11 + 0o154) + chr(0b110001) + chr(1359 - 1307) + chr(198 - 150), 8), ehT0Px3KOsy9('\060' + chr(0b1000001 + 0o56) + '\063' + chr(62 - 14) + chr(2132 - 2084), 0o10), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(0b1111 + 0o47) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(2688 - 2577) + '\061' + '\x36' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(63 - 15) + chr(0b1101111) + '\x31' + '\x31' + chr(729 - 679), 65430 - 65422), ehT0Px3KOsy9('\060' + '\157' + chr(247 - 197) + chr(1636 - 1581) + '\x31', 30959 - 30951), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(0b100110 + 0o14) + chr(0b110001) + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(2169 - 2121) + chr(0b110110 + 0o71) + '\x31' + '\064' + chr(49), 60011 - 60003), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b10011 + 0o36) + chr(2597 - 2544) + chr(0b110001), 18381 - 18373), ehT0Px3KOsy9(chr(1563 - 1515) + chr(0b1001110 + 0o41) + chr(50) + chr(457 - 408), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(55) + '\065', 0b1000), ehT0Px3KOsy9(chr(352 - 304) + chr(111) + chr(0b110101) + chr(0b100000 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b10100 + 0o133) + chr(2295 - 2244) + chr(395 - 347) + chr(0b110000), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10110 + 0o35) + chr(0b11000 + 0o30) + '\061', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1100110 + 0o11) + '\062' + chr(0b11011 + 0o26) + chr(473 - 422), 34012 - 34004), ehT0Px3KOsy9(chr(48) + chr(12022 - 11911) + '\x32' + '\067' + chr(51), 0b1000), ehT0Px3KOsy9('\060' + chr(5797 - 5686) + '\062' + chr(53) + '\x37', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10111 + 0o130) + chr(0b110010) + chr(115 - 67), 0b1000), ehT0Px3KOsy9(chr(48) + chr(11623 - 11512) + chr(0b110011) + chr(0b111 + 0o57) + chr(0b110000 + 0o3), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(809 - 760) + '\062' + chr(299 - 247), 0o10), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10111 + 0o32) + chr(55) + chr(0b11011 + 0o25), 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(0b1001010 + 0o45) + '\063' + chr(0b110001) + chr(52), 53924 - 53916)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + chr(53) + chr(258 - 210), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'D'), chr(1935 - 1835) + chr(0b1100101) + chr(0b1100011) + '\157' + chr(0b11000 + 0o114) + '\145')('\x75' + '\164' + chr(0b1100010 + 0o4) + chr(0b100010 + 0o13) + chr(0b101110 + 0o12)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def DLtxX9M2UrHO(oVre8I6UXc3b, ri8yqNQ1eQuR): psizfxY_oCoV = ri8yqNQ1eQuR.psizfxY_oCoV(default=oVre8I6UXc3b._default_domain) if psizfxY_oCoV is kxwMF5OOnoDq: raise q1QCh3W88sgk(xafqLlk3kkUe(SXOLrMavuUCe(b"?\x8f\xf0\xab\x0c\x9c_L_JQ4\xf1\x00\xa8\xae\xbc8\x05\xe0P\x18'\xd8\xe0\x0fIw\xd2_\xe0\x91\xe2\xcb\xca|\x9a:\x1d\xe2`\xb1\xf0\xba\x13\xd9\x1bW]\x0b\\?\xb8Y\xbe\xa6\xa6?\x12\xa5PW.\xd6\xe4\x00\x00\x7f\x83\r\xb4\xae\xab\xc2\xc0e\x81t(\xa5\x1a\x84\xfd\xa0\x0e\x9c_L_JF4\xf1E\xbb\xe3\xb19\r\xa1]\x19d"), '\x64' + '\x65' + '\x63' + chr(10847 - 10736) + chr(5243 - 5143) + chr(0b111111 + 0o46))('\x75' + chr(586 - 470) + '\146' + chr(45) + chr(3026 - 2970))) return psizfxY_oCoV
quantopian/zipline
zipline/utils/api_support.py
require_initialized
def require_initialized(exception): """ Decorator for API methods that should only be called after TradingAlgorithm.initialize. `exception` will be raised if the method is called before initialize has completed. Examples -------- @require_initialized(SomeException("Don't do that!")) def method(self): # Do stuff that should only be allowed after initialize. """ def decorator(method): @wraps(method) def wrapped_method(self, *args, **kwargs): if not self.initialized: raise exception return method(self, *args, **kwargs) return wrapped_method return decorator
python
def require_initialized(exception): """ Decorator for API methods that should only be called after TradingAlgorithm.initialize. `exception` will be raised if the method is called before initialize has completed. Examples -------- @require_initialized(SomeException("Don't do that!")) def method(self): # Do stuff that should only be allowed after initialize. """ def decorator(method): @wraps(method) def wrapped_method(self, *args, **kwargs): if not self.initialized: raise exception return method(self, *args, **kwargs) return wrapped_method return decorator
[ "def", "require_initialized", "(", "exception", ")", ":", "def", "decorator", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "wrapped_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "initialized", ":", "raise", "exception", "return", "method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", "wrapped_method", "return", "decorator" ]
Decorator for API methods that should only be called after TradingAlgorithm.initialize. `exception` will be raised if the method is called before initialize has completed. Examples -------- @require_initialized(SomeException("Don't do that!")) def method(self): # Do stuff that should only be allowed after initialize.
[ "Decorator", "for", "API", "methods", "that", "should", "only", "be", "called", "after", "TradingAlgorithm", ".", "initialize", ".", "exception", "will", "be", "raised", "if", "the", "method", "is", "called", "before", "initialize", "has", "completed", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/api_support.py#L86-L105
train
Decorator for API methods that should only be called after TradingAlgorithm. initialize.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jI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xiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(323 - 274) + chr(0b110001) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(111) + chr(1947 - 1898) + chr(52) + chr(0b11001 + 0o34), ord("\x08")), ehT0Px3KOsy9(chr(0b1100 + 0o44) + '\157' + chr(0b110001) + '\061' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b100 + 0o55) + chr(0b100010 + 0o22) + '\067', 0b1000), ehT0Px3KOsy9(chr(421 - 373) + '\157' + '\x32' + '\x37' + '\x31', 0b1000), ehT0Px3KOsy9(chr(1742 - 1694) + chr(111) + '\061' + chr(0b110001) + '\x30', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1100100 + 0o13) + chr(0b100110 + 0o14) + '\062' + chr(52), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(932 - 883) + chr(0b11010 + 0o30), 4843 - 4835), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + chr(0b100001 + 0o23) + chr(0b101100 + 0o11), 8), ehT0Px3KOsy9(chr(2129 - 2081) + chr(0b1101111) + chr(49) + chr(93 - 39) + chr(1974 - 1922), 57216 - 57208), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\062' + chr(2760 - 2705) + chr(0b1100 + 0o45), 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b110111) + chr(51), 19527 - 19519), ehT0Px3KOsy9('\x30' + chr(111) + '\063' + chr(1137 - 1084) + chr(2180 - 2125), ord("\x08")), ehT0Px3KOsy9(chr(2010 - 1962) + '\157' + chr(0b110001) + chr(1904 - 1856) + chr(1832 - 1784), 0b1000), ehT0Px3KOsy9(chr(1822 - 1774) + chr(0b110100 + 0o73) + '\061' + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110100) + chr(633 - 580), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(49) + '\066' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b1000 + 0o50) + '\157' + '\061' + chr(2252 - 2202), 8), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + '\x31' + chr(50), 0o10), ehT0Px3KOsy9(chr(607 - 559) + chr(11849 - 11738) + chr(0b110001) + chr(0b110000), 28327 - 28319), ehT0Px3KOsy9('\060' + chr(0b1000111 + 0o50) + chr(49) + chr(0b111 + 0o57) + '\x34', 8), ehT0Px3KOsy9(chr(0b10 + 0o56) + '\157' + '\x31' + '\063' + chr(49), 10128 - 10120), ehT0Px3KOsy9('\060' + '\x6f' + '\x33' + '\062' + chr(0b111 + 0o56), 0b1000), ehT0Px3KOsy9('\060' + '\157' + '\x31' + chr(50) + chr(0b110001), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110001) + chr(49) + chr(530 - 476), 8), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b11100 + 0o25) + '\060' + '\066', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(1499 - 1388) + chr(1030 - 981) + '\x31' + chr(53), 0o10), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(5564 - 5453) + chr(49) + '\x30' + chr(0b110001), 52177 - 52169), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\x6f' + chr(0b110010) + chr(0b100010 + 0o24) + chr(0b110100), 59931 - 59923), ehT0Px3KOsy9(chr(48) + '\157' + '\x37' + chr(1162 - 1109), 44052 - 44044), ehT0Px3KOsy9(chr(0b100111 + 0o11) + chr(111) + chr(0b110001) + '\x35' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101111 + 0o1) + chr(0b1101111) + '\061' + chr(0b110011) + '\x31', 8), ehT0Px3KOsy9(chr(0b10010 + 0o36) + chr(0b1010101 + 0o32) + chr(1683 - 1630) + '\x30', 60223 - 60215), ehT0Px3KOsy9('\x30' + chr(0b100111 + 0o110) + '\x33' + chr(549 - 497) + '\x34', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(54) + '\066', 0b1000), ehT0Px3KOsy9(chr(1715 - 1667) + '\157' + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(51) + '\063', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + chr(2323 - 2273) + '\067' + chr(906 - 851), 50516 - 50508), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b101001 + 0o12) + '\066' + chr(50), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101010 + 0o5) + '\063' + '\x33' + '\061', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + '\x6f' + chr(1951 - 1898) + chr(0b100000 + 0o20), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'g'), '\144' + chr(0b1100101) + chr(0b1001001 + 0o32) + chr(111) + '\144' + '\x65')('\165' + chr(116) + chr(0b1100110) + '\x2d' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def N8QzXSBLr5vB(mfDdKhdzI25A): def aInxBLSrGyiI(CVRCXTcnOnH6): @cUOaMZfY2Ho1(CVRCXTcnOnH6) def lJ4svo5ze18F(oVre8I6UXc3b, *kJDRfRhcZHjS, **M8EIoTs2GJXE): if not xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b' Q\x04P\x8b\x10\xeeA\x06G\xd1\x9d'), chr(0b1100100) + chr(101) + chr(0b110100 + 0o57) + chr(111) + chr(3155 - 3055) + '\145')(chr(0b10 + 0o163) + '\x74' + chr(102) + chr(0b101101) + chr(56))): raise mfDdKhdzI25A return CVRCXTcnOnH6(oVre8I6UXc3b, *kJDRfRhcZHjS, **M8EIoTs2GJXE) return lJ4svo5ze18F return aInxBLSrGyiI
quantopian/zipline
zipline/utils/api_support.py
disallowed_in_before_trading_start
def disallowed_in_before_trading_start(exception): """ Decorator for API methods that cannot be called from within TradingAlgorithm.before_trading_start. `exception` will be raised if the method is called inside `before_trading_start`. Examples -------- @disallowed_in_before_trading_start(SomeException("Don't do that!")) def method(self): # Do stuff that is not allowed inside before_trading_start. """ def decorator(method): @wraps(method) def wrapped_method(self, *args, **kwargs): if self._in_before_trading_start: raise exception return method(self, *args, **kwargs) return wrapped_method return decorator
python
def disallowed_in_before_trading_start(exception): """ Decorator for API methods that cannot be called from within TradingAlgorithm.before_trading_start. `exception` will be raised if the method is called inside `before_trading_start`. Examples -------- @disallowed_in_before_trading_start(SomeException("Don't do that!")) def method(self): # Do stuff that is not allowed inside before_trading_start. """ def decorator(method): @wraps(method) def wrapped_method(self, *args, **kwargs): if self._in_before_trading_start: raise exception return method(self, *args, **kwargs) return wrapped_method return decorator
[ "def", "disallowed_in_before_trading_start", "(", "exception", ")", ":", "def", "decorator", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "wrapped_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_in_before_trading_start", ":", "raise", "exception", "return", "method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", "wrapped_method", "return", "decorator" ]
Decorator for API methods that cannot be called from within TradingAlgorithm.before_trading_start. `exception` will be raised if the method is called inside `before_trading_start`. Examples -------- @disallowed_in_before_trading_start(SomeException("Don't do that!")) def method(self): # Do stuff that is not allowed inside before_trading_start.
[ "Decorator", "for", "API", "methods", "that", "cannot", "be", "called", "from", "within", "TradingAlgorithm", ".", "before_trading_start", ".", "exception", "will", "be", "raised", "if", "the", "method", "is", "called", "inside", "before_trading_start", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/api_support.py#L108-L127
train
Decorator for API methods that cannot be called from within TradingAlgorithm. before_trading_start. exception will be raised if the exception is raised.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3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I2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + '\157' + '\061' + '\x30' + chr(0b110100 + 0o2), ord("\x08")), ehT0Px3KOsy9('\060' + chr(6988 - 6877) + chr(0b110001) + chr(0b100100 + 0o22) + chr(0b110100), 57027 - 57019), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(0b10001 + 0o40) + chr(0b10100 + 0o34), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(1572 - 1521) + chr(0b110001 + 0o3) + chr(49), 14335 - 14327), ehT0Px3KOsy9(chr(179 - 131) + chr(3807 - 3696) + '\x31' + chr(0b1 + 0o64) + chr(0b100100 + 0o22), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b10100 + 0o35) + chr(1696 - 1648), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + '\067' + chr(1071 - 1018), 9388 - 9380), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(0b1000 + 0o52) + '\061' + '\x35', 36420 - 36412), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1 + 0o156) + chr(0b101 + 0o55) + chr(2166 - 2118) + '\062', 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b100001 + 0o25) + chr(51), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b110011) + '\x35' + '\060', 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(111) + chr(1751 - 1700) + chr(55) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\062' + chr(0b10 + 0o56) + chr(0b101111 + 0o10), 0o10), ehT0Px3KOsy9(chr(0b1001 + 0o47) + chr(0b1101111) + '\x33' + chr(52) + '\x33', 0b1000), ehT0Px3KOsy9(chr(1896 - 1848) + chr(111) + '\x32', 0o10), ehT0Px3KOsy9(chr(2105 - 2057) + chr(111) + chr(2296 - 2247) + chr(48), 8), ehT0Px3KOsy9(chr(1066 - 1018) + chr(0b1101111) + chr(710 - 659) + chr(0b110100) + '\061', 8), ehT0Px3KOsy9(chr(48) + '\157' + chr(51) + chr(0b11101 + 0o30), 0b1000), ehT0Px3KOsy9(chr(0b11001 + 0o27) + '\157' + chr(54), 0o10), ehT0Px3KOsy9(chr(48) + chr(6927 - 6816) + chr(52) + '\x32', 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + '\x6f' + chr(51) + chr(957 - 906) + chr(2257 - 2207), 0o10), ehT0Px3KOsy9(chr(48) + chr(3038 - 2927) + chr(0b110011) + chr(0b110100) + chr(0b100100 + 0o17), 8), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + chr(52) + '\x34', 23541 - 23533), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(2098 - 2049) + chr(0b110100) + '\063', 0b1000), ehT0Px3KOsy9('\060' + chr(7556 - 7445) + chr(0b100011 + 0o16) + chr(53) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(51) + '\x30' + chr(1434 - 1381), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(506 - 457) + '\x37' + chr(0b110111), 62912 - 62904), ehT0Px3KOsy9('\x30' + chr(9889 - 9778) + chr(0b110001) + chr(48) + chr(304 - 251), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(0b110001) + '\x32' + '\066', 13922 - 13914), ehT0Px3KOsy9('\060' + '\x6f' + chr(1332 - 1281) + '\x35' + chr(55), 14833 - 14825), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(2240 - 2189) + '\063', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1110 + 0o43) + chr(0b110001) + chr(0b1000 + 0o55), 0b1000), ehT0Px3KOsy9(chr(0b1110 + 0o42) + chr(0b1 + 0o156) + chr(50) + chr(54) + chr(1992 - 1942), ord("\x08")), ehT0Px3KOsy9(chr(0b100100 + 0o14) + chr(0b1101111) + chr(0b10101 + 0o35) + '\063' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(0b1011010 + 0o25) + '\061' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(3550 - 3439) + chr(0b110010) + chr(0b110100) + chr(0b100110 + 0o16), ord("\x08")), ehT0Px3KOsy9(chr(0b10010 + 0o36) + '\x6f' + '\x32' + chr(50) + '\x36', 45228 - 45220), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110011) + '\x35' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(49) + '\062' + chr(0b1011 + 0o51), ord("\x08")), ehT0Px3KOsy9(chr(1621 - 1573) + '\x6f' + '\063' + '\066' + chr(0b100101 + 0o22), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(159 - 111) + chr(111) + '\065' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'h'), '\x64' + '\x65' + chr(7489 - 7390) + chr(0b1101111) + chr(0b1100100) + '\x65')('\x75' + chr(116) + chr(7847 - 7745) + '\x2d' + chr(0b11011 + 0o35)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def TLCdqhn9GEod(mfDdKhdzI25A): def aInxBLSrGyiI(CVRCXTcnOnH6): @cUOaMZfY2Ho1(CVRCXTcnOnH6) def lJ4svo5ze18F(oVre8I6UXc3b, *kJDRfRhcZHjS, **M8EIoTs2GJXE): if xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'\x19\x1d\xe6\xbe\x0cm[\xe2\xf0V\xb7\x88\xf5\x82fa\x8fzYQ\xae\x82\x16\x17'), '\x64' + chr(2127 - 2026) + chr(0b1100011) + '\x6f' + '\x64' + chr(9946 - 9845))(chr(0b1011010 + 0o33) + chr(0b1110100) + chr(0b101101 + 0o71) + '\055' + chr(0b11101 + 0o33))): raise mfDdKhdzI25A return CVRCXTcnOnH6(oVre8I6UXc3b, *kJDRfRhcZHjS, **M8EIoTs2GJXE) return lJ4svo5ze18F return aInxBLSrGyiI
quantopian/zipline
zipline/lib/normalize.py
naive_grouped_rowwise_apply
def naive_grouped_rowwise_apply(data, group_labels, func, func_args=(), out=None): """ Simple implementation of grouped row-wise function application. Parameters ---------- data : ndarray[ndim=2] Input array over which to apply a grouped function. group_labels : ndarray[ndim=2, dtype=int64] Labels to use to bucket inputs from array. Should be the same shape as array. func : function[ndarray[ndim=1]] -> function[ndarray[ndim=1]] Function to apply to pieces of each row in array. func_args : tuple Additional positional arguments to provide to each row in array. out : ndarray, optional Array into which to write output. If not supplied, a new array of the same shape as ``data`` is allocated and returned. Examples -------- >>> data = np.array([[1., 2., 3.], ... [2., 3., 4.], ... [5., 6., 7.]]) >>> labels = np.array([[0, 0, 1], ... [0, 1, 0], ... [1, 0, 2]]) >>> naive_grouped_rowwise_apply(data, labels, lambda row: row - row.min()) array([[ 0., 1., 0.], [ 0., 0., 2.], [ 0., 0., 0.]]) >>> naive_grouped_rowwise_apply(data, labels, lambda row: row / row.sum()) array([[ 0.33333333, 0.66666667, 1. ], [ 0.33333333, 1. , 0.66666667], [ 1. , 1. , 1. ]]) """ if out is None: out = np.empty_like(data) for (row, label_row, out_row) in zip(data, group_labels, out): for label in np.unique(label_row): locs = (label_row == label) out_row[locs] = func(row[locs], *func_args) return out
python
def naive_grouped_rowwise_apply(data, group_labels, func, func_args=(), out=None): """ Simple implementation of grouped row-wise function application. Parameters ---------- data : ndarray[ndim=2] Input array over which to apply a grouped function. group_labels : ndarray[ndim=2, dtype=int64] Labels to use to bucket inputs from array. Should be the same shape as array. func : function[ndarray[ndim=1]] -> function[ndarray[ndim=1]] Function to apply to pieces of each row in array. func_args : tuple Additional positional arguments to provide to each row in array. out : ndarray, optional Array into which to write output. If not supplied, a new array of the same shape as ``data`` is allocated and returned. Examples -------- >>> data = np.array([[1., 2., 3.], ... [2., 3., 4.], ... [5., 6., 7.]]) >>> labels = np.array([[0, 0, 1], ... [0, 1, 0], ... [1, 0, 2]]) >>> naive_grouped_rowwise_apply(data, labels, lambda row: row - row.min()) array([[ 0., 1., 0.], [ 0., 0., 2.], [ 0., 0., 0.]]) >>> naive_grouped_rowwise_apply(data, labels, lambda row: row / row.sum()) array([[ 0.33333333, 0.66666667, 1. ], [ 0.33333333, 1. , 0.66666667], [ 1. , 1. , 1. ]]) """ if out is None: out = np.empty_like(data) for (row, label_row, out_row) in zip(data, group_labels, out): for label in np.unique(label_row): locs = (label_row == label) out_row[locs] = func(row[locs], *func_args) return out
[ "def", "naive_grouped_rowwise_apply", "(", "data", ",", "group_labels", ",", "func", ",", "func_args", "=", "(", ")", ",", "out", "=", "None", ")", ":", "if", "out", "is", "None", ":", "out", "=", "np", ".", "empty_like", "(", "data", ")", "for", "(", "row", ",", "label_row", ",", "out_row", ")", "in", "zip", "(", "data", ",", "group_labels", ",", "out", ")", ":", "for", "label", "in", "np", ".", "unique", "(", "label_row", ")", ":", "locs", "=", "(", "label_row", "==", "label", ")", "out_row", "[", "locs", "]", "=", "func", "(", "row", "[", "locs", "]", ",", "*", "func_args", ")", "return", "out" ]
Simple implementation of grouped row-wise function application. Parameters ---------- data : ndarray[ndim=2] Input array over which to apply a grouped function. group_labels : ndarray[ndim=2, dtype=int64] Labels to use to bucket inputs from array. Should be the same shape as array. func : function[ndarray[ndim=1]] -> function[ndarray[ndim=1]] Function to apply to pieces of each row in array. func_args : tuple Additional positional arguments to provide to each row in array. out : ndarray, optional Array into which to write output. If not supplied, a new array of the same shape as ``data`` is allocated and returned. Examples -------- >>> data = np.array([[1., 2., 3.], ... [2., 3., 4.], ... [5., 6., 7.]]) >>> labels = np.array([[0, 0, 1], ... [0, 1, 0], ... [1, 0, 2]]) >>> naive_grouped_rowwise_apply(data, labels, lambda row: row - row.min()) array([[ 0., 1., 0.], [ 0., 0., 2.], [ 0., 0., 0.]]) >>> naive_grouped_rowwise_apply(data, labels, lambda row: row / row.sum()) array([[ 0.33333333, 0.66666667, 1. ], [ 0.33333333, 1. , 0.66666667], [ 1. , 1. , 1. ]])
[ "Simple", "implementation", "of", "grouped", "row", "-", "wise", "function", "application", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/lib/normalize.py#L4-L51
train
A naive version of grouped row - wise function application.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dF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,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(0b110000) + chr(0b100 + 0o153) + '\x33' + chr(2052 - 1997), 0b1000), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(111) + '\063' + '\061' + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + '\060' + chr(1260 - 1211), 7571 - 7563), ehT0Px3KOsy9('\060' + chr(11770 - 11659) + '\063' + '\x32' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1000011 + 0o54) + '\x33' + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(333 - 282) + chr(0b10010 + 0o42), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(49) + chr(0b110100) + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(5718 - 5607) + chr(2372 - 2323) + chr(54) + chr(50), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(49) + chr(0b110000) + chr(52), 0b1000), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(111) + chr(1919 - 1870) + chr(1408 - 1353) + chr(0b101011 + 0o7), ord("\x08")), ehT0Px3KOsy9(chr(0b101101 + 0o3) + '\x6f' + chr(1768 - 1717) + chr(53), 35256 - 35248), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(53) + chr(54), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(51), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\063', 8), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100010 + 0o17) + chr(55) + chr(51), 0b1000), ehT0Px3KOsy9(chr(498 - 450) + chr(6529 - 6418) + chr(49) + chr(0b110011) + '\064', 0o10), ehT0Px3KOsy9('\x30' + chr(0b110000 + 0o77) + '\063' + chr(1306 - 1251) + '\067', 15075 - 15067), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(1179 - 1127) + chr(0b1110 + 0o47), ord("\x08")), ehT0Px3KOsy9(chr(1649 - 1601) + '\157' + chr(1483 - 1434) + chr(50), 59930 - 59922), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101011 + 0o4) + '\067' + '\065', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b10001 + 0o136) + '\x31' + '\x31' + '\x35', 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x32' + chr(0b11 + 0o56) + '\x33', 36465 - 36457), ehT0Px3KOsy9(chr(0b11101 + 0o23) + '\157' + chr(1824 - 1773) + '\062' + chr(52), 44995 - 44987), ehT0Px3KOsy9('\060' + '\157' + chr(51) + '\x37' + chr(0b100111 + 0o15), 0b1000), ehT0Px3KOsy9(chr(2249 - 2201) + chr(0b1101111) + chr(0b100100 + 0o17) + chr(0b101011 + 0o13), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b101 + 0o55) + chr(2520 - 2468) + chr(51), 52411 - 52403), ehT0Px3KOsy9(chr(1867 - 1819) + '\157' + '\062' + chr(0b110011) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\061' + chr(2464 - 2411) + '\x36', 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + chr(0b1101111) + '\067', 463 - 455), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2292 - 2240) + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(1525 - 1477) + chr(0b100011 + 0o114) + '\063' + '\x32' + chr(55), 5764 - 5756), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\x31' + chr(0b1111 + 0o42) + chr(52), 24836 - 24828), ehT0Px3KOsy9(chr(672 - 624) + '\x6f' + '\x31' + chr(0b110111) + chr(0b100101 + 0o14), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + chr(0b1010111 + 0o30) + '\x32' + '\x36' + chr(0b110011), 20288 - 20280), ehT0Px3KOsy9(chr(663 - 615) + chr(0b1101111) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x33' + '\060' + chr(674 - 624), 0b1000), ehT0Px3KOsy9(chr(2003 - 1955) + chr(0b1101111) + chr(0b110010) + chr(0b110000) + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\x6f' + chr(0b110001) + chr(49) + chr(0b110001), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + '\x33' + '\x32', 8), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\157' + chr(1494 - 1443) + chr(0b110111), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(0b110101 + 0o0) + chr(0b110000), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'1'), '\144' + '\x65' + '\143' + '\x6f' + chr(100) + '\145')('\165' + chr(116) + '\x66' + chr(45) + chr(3023 - 2967)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def XnZniGnO7pv8(ULnjp6D6efFH, z84WRqa7yzGO, EzOtJ3kbK5x4, ImCZKrTr2uRJ=(), UkrMp_I0RDmo=None): if UkrMp_I0RDmo is None: UkrMp_I0RDmo = WqUC3KWvYVup.empty_like(ULnjp6D6efFH) for (TAK9K32TkBdA, H5KWWjOiwPuj, Zl0muFvsQ93d) in pZ0NK2y6HRbn(ULnjp6D6efFH, z84WRqa7yzGO, UkrMp_I0RDmo): for TRUOLFLuD08x in xafqLlk3kkUe(WqUC3KWvYVup, xafqLlk3kkUe(SXOLrMavuUCe(b'j\xa0\xe8\xa0ny'), chr(0b1100100) + '\145' + chr(0b1000000 + 0o43) + '\x6f' + chr(0b1011101 + 0o7) + chr(0b10011 + 0o122))(chr(117) + '\x74' + chr(0b1000111 + 0o37) + chr(0b101101) + chr(2999 - 2943)))(H5KWWjOiwPuj): wWlRsdZxY7aO = H5KWWjOiwPuj == TRUOLFLuD08x Zl0muFvsQ93d[wWlRsdZxY7aO] = EzOtJ3kbK5x4(TAK9K32TkBdA[wWlRsdZxY7aO], *ImCZKrTr2uRJ) return UkrMp_I0RDmo
quantopian/zipline
zipline/utils/formatting.py
bulleted_list
def bulleted_list(items, indent=0, bullet_type='-'): """Format a bulleted list of values. Parameters ---------- items : sequence The items to make a list. indent : int, optional The number of spaces to add before each bullet. bullet_type : str, optional The bullet type to use. Returns ------- formatted_list : str The formatted list as a single string. """ format_string = ' ' * indent + bullet_type + ' {}' return "\n".join(map(format_string.format, items))
python
def bulleted_list(items, indent=0, bullet_type='-'): """Format a bulleted list of values. Parameters ---------- items : sequence The items to make a list. indent : int, optional The number of spaces to add before each bullet. bullet_type : str, optional The bullet type to use. Returns ------- formatted_list : str The formatted list as a single string. """ format_string = ' ' * indent + bullet_type + ' {}' return "\n".join(map(format_string.format, items))
[ "def", "bulleted_list", "(", "items", ",", "indent", "=", "0", ",", "bullet_type", "=", "'-'", ")", ":", "format_string", "=", "' '", "*", "indent", "+", "bullet_type", "+", "' {}'", "return", "\"\\n\"", ".", "join", "(", "map", "(", "format_string", ".", "format", ",", "items", ")", ")" ]
Format a bulleted list of values. Parameters ---------- items : sequence The items to make a list. indent : int, optional The number of spaces to add before each bullet. bullet_type : str, optional The bullet type to use. Returns ------- formatted_list : str The formatted list as a single string.
[ "Format", "a", "bulleted", "list", "of", "values", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/formatting.py#L48-L66
train
Format a bulleted list of values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,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D,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(4347 - 4236) + chr(50) + chr(0b1111 + 0o41) + chr(548 - 494), 38910 - 38902), ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + '\x33' + '\064' + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(4255 - 4144) + chr(2245 - 2196) + chr(51) + chr(0b100010 + 0o24), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(0b110100) + chr(53), 0o10), ehT0Px3KOsy9(chr(48) + '\157' + chr(549 - 498) + chr(0b110011) + chr(0b110010), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101 + 0o142) + chr(50) + chr(50) + chr(144 - 91), 0b1000), ehT0Px3KOsy9(chr(188 - 140) + chr(0b1101111) + '\061' + chr(53) + '\066', 24109 - 24101), ehT0Px3KOsy9(chr(48) + chr(12081 - 11970) + chr(380 - 325) + '\x33', 0b1000), ehT0Px3KOsy9(chr(280 - 232) + chr(0b1101111) + chr(49) + chr(52) + chr(49), 63941 - 63933), ehT0Px3KOsy9(chr(48) + chr(6001 - 5890) + chr(0b100001 + 0o22) + chr(395 - 341) + '\x36', 0b1000), ehT0Px3KOsy9(chr(0b100 + 0o54) + chr(0b1101111) + '\067' + chr(55), 13652 - 13644), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(2405 - 2351), 0o10), ehT0Px3KOsy9('\x30' + chr(10026 - 9915) + chr(0b100 + 0o56) + '\x35' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(12232 - 12121) + chr(0b101011 + 0o6) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(0b1110 + 0o141) + chr(0b110011) + chr(0b110010) + '\x34', 0o10), ehT0Px3KOsy9(chr(2280 - 2232) + chr(0b101010 + 0o105) + chr(0b110110) + '\x33', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(411 - 361) + chr(502 - 453) + '\067', 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(0b1101111) + chr(0b101 + 0o55) + chr(50) + '\060', 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(490 - 441) + '\066' + chr(55), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\061' + chr(1029 - 980) + chr(50), 0o10), ehT0Px3KOsy9(chr(0b10000 + 0o40) + '\157' + chr(0b101111 + 0o2) + '\062', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110011) + '\x34' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(11550 - 11439) + chr(2573 - 2522) + '\062' + '\x33', 0o10), ehT0Px3KOsy9(chr(0b1111 + 0o41) + '\x6f' + chr(49) + chr(54) + chr(0b101111 + 0o1), ord("\x08")), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(10739 - 10628) + chr(0b110001) + '\x34' + chr(0b10100 + 0o35), 8), ehT0Px3KOsy9('\060' + chr(0b100011 + 0o114) + '\061' + chr(1070 - 1015) + chr(1095 - 1044), 3144 - 3136), ehT0Px3KOsy9('\060' + chr(4206 - 4095) + chr(0b1100 + 0o52) + chr(0b1011 + 0o50), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(50) + '\060' + chr(0b110011), 5947 - 5939), ehT0Px3KOsy9(chr(1899 - 1851) + '\x6f' + chr(0b110111) + chr(2874 - 2819), 8), ehT0Px3KOsy9(chr(0b101101 + 0o3) + chr(111) + chr(50) + '\x34' + chr(48), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(51) + '\064' + chr(51), ord("\x08")), ehT0Px3KOsy9(chr(2071 - 2023) + '\157' + chr(0b110001) + chr(1081 - 1032) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b1000 + 0o50) + chr(0b1101111) + chr(51) + chr(51) + '\060', 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(0b1101111) + chr(49) + '\062' + chr(49), 53599 - 53591), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x31' + '\x37' + '\067', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1000010 + 0o55) + chr(51) + chr(0b1000 + 0o51) + chr(639 - 588), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\062' + chr(0b10010 + 0o40) + chr(734 - 686), 8), ehT0Px3KOsy9(chr(399 - 351) + '\157' + chr(1244 - 1194) + chr(0b110110) + chr(0b110011), 0b1000), ehT0Px3KOsy9(chr(0b10101 + 0o33) + chr(11859 - 11748) + chr(49) + '\066' + '\x33', 17208 - 17200), ehT0Px3KOsy9('\x30' + chr(0b100100 + 0o113) + chr(0b11000 + 0o31) + '\x35', 2319 - 2311)][WVxHKyX45z_L % ehT0Px3KOsy9('\x30' + '\x6f' + '\x35' + chr(48), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa8'), '\144' + '\145' + chr(1157 - 1058) + chr(0b1 + 0o156) + chr(1069 - 969) + chr(0b1100001 + 0o4))(chr(5492 - 5375) + '\x74' + chr(10263 - 10161) + '\055' + chr(0b10010 + 0o46)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def YyakJZQxp5Pe(NzveIZ3IlSH9, rxwJk_g4F6Db=ehT0Px3KOsy9(chr(1384 - 1336) + chr(4636 - 4525) + '\x30', 0b1000), DndsP3wWoG_L=xafqLlk3kkUe(SXOLrMavuUCe(b'\xab'), '\144' + '\145' + '\x63' + chr(0b1101111) + '\x64' + '\x65')(chr(11982 - 11865) + '\x74' + '\146' + '\055' + chr(0b111000))): jZqz8hSX6gm7 = xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6'), chr(0b1100100) + chr(635 - 534) + chr(0b1011011 + 0o10) + chr(111) + '\144' + chr(0b1100101))('\x75' + '\x74' + '\146' + '\x2d' + chr(1390 - 1334)) * rxwJk_g4F6Db + DndsP3wWoG_L + xafqLlk3kkUe(SXOLrMavuUCe(b'\xa6\x99#'), '\144' + chr(8414 - 8313) + chr(3649 - 3550) + chr(0b1101111) + chr(0b111 + 0o135) + '\x65')('\x75' + '\164' + '\146' + chr(45) + '\x38') return xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x8c'), chr(100) + '\145' + '\x63' + '\x6f' + '\x64' + chr(0b11110 + 0o107))('\x75' + chr(0b110110 + 0o76) + chr(4866 - 4764) + '\055' + chr(2070 - 2014)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9\x8d\t=\xa0\xe18u\x0f\x87w@'), '\x64' + chr(0b1100101) + chr(0b100000 + 0o103) + '\157' + '\x64' + chr(0b1100101))('\x75' + chr(116) + chr(6466 - 6364) + '\x2d' + '\x38'))(abA97kOQKaLo(xafqLlk3kkUe(jZqz8hSX6gm7, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd0\xd6,\n\x92\xf4=\x081\x86Zl'), '\x64' + '\145' + '\143' + chr(111) + chr(0b1100100) + '\145')(chr(8693 - 8576) + chr(0b1110100) + '\146' + chr(825 - 780) + chr(0b11000 + 0o40))), NzveIZ3IlSH9))
quantopian/zipline
zipline/assets/synthetic.py
make_rotating_equity_info
def make_rotating_equity_info(num_assets, first_start, frequency, periods_between_starts, asset_lifetime, exchange='TEST'): """ Create a DataFrame representing lifetimes of assets that are constantly rotating in and out of existence. Parameters ---------- num_assets : int How many assets to create. first_start : pd.Timestamp The start date for the first asset. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret next two arguments. periods_between_starts : int Create a new asset every `frequency` * `periods_between_new` asset_lifetime : int Each asset exists for `frequency` * `asset_lifetime` days. exchange : str, optional The exchange name. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ return pd.DataFrame( { 'symbol': [chr(ord('A') + i) for i in range(num_assets)], # Start a new asset every `periods_between_starts` days. 'start_date': pd.date_range( first_start, freq=(periods_between_starts * frequency), periods=num_assets, ), # Each asset lasts for `asset_lifetime` days. 'end_date': pd.date_range( first_start + (asset_lifetime * frequency), freq=(periods_between_starts * frequency), periods=num_assets, ), 'exchange': exchange, }, index=range(num_assets), )
python
def make_rotating_equity_info(num_assets, first_start, frequency, periods_between_starts, asset_lifetime, exchange='TEST'): """ Create a DataFrame representing lifetimes of assets that are constantly rotating in and out of existence. Parameters ---------- num_assets : int How many assets to create. first_start : pd.Timestamp The start date for the first asset. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret next two arguments. periods_between_starts : int Create a new asset every `frequency` * `periods_between_new` asset_lifetime : int Each asset exists for `frequency` * `asset_lifetime` days. exchange : str, optional The exchange name. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ return pd.DataFrame( { 'symbol': [chr(ord('A') + i) for i in range(num_assets)], # Start a new asset every `periods_between_starts` days. 'start_date': pd.date_range( first_start, freq=(periods_between_starts * frequency), periods=num_assets, ), # Each asset lasts for `asset_lifetime` days. 'end_date': pd.date_range( first_start + (asset_lifetime * frequency), freq=(periods_between_starts * frequency), periods=num_assets, ), 'exchange': exchange, }, index=range(num_assets), )
[ "def", "make_rotating_equity_info", "(", "num_assets", ",", "first_start", ",", "frequency", ",", "periods_between_starts", ",", "asset_lifetime", ",", "exchange", "=", "'TEST'", ")", ":", "return", "pd", ".", "DataFrame", "(", "{", "'symbol'", ":", "[", "chr", "(", "ord", "(", "'A'", ")", "+", "i", ")", "for", "i", "in", "range", "(", "num_assets", ")", "]", ",", "# Start a new asset every `periods_between_starts` days.", "'start_date'", ":", "pd", ".", "date_range", "(", "first_start", ",", "freq", "=", "(", "periods_between_starts", "*", "frequency", ")", ",", "periods", "=", "num_assets", ",", ")", ",", "# Each asset lasts for `asset_lifetime` days.", "'end_date'", ":", "pd", ".", "date_range", "(", "first_start", "+", "(", "asset_lifetime", "*", "frequency", ")", ",", "freq", "=", "(", "periods_between_starts", "*", "frequency", ")", ",", "periods", "=", "num_assets", ",", ")", ",", "'exchange'", ":", "exchange", ",", "}", ",", "index", "=", "range", "(", "num_assets", ")", ",", ")" ]
Create a DataFrame representing lifetimes of assets that are constantly rotating in and out of existence. Parameters ---------- num_assets : int How many assets to create. first_start : pd.Timestamp The start date for the first asset. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret next two arguments. periods_between_starts : int Create a new asset every `frequency` * `periods_between_new` asset_lifetime : int Each asset exists for `frequency` * `asset_lifetime` days. exchange : str, optional The exchange name. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets.
[ "Create", "a", "DataFrame", "representing", "lifetimes", "of", "assets", "that", "are", "constantly", "rotating", "in", "and", "out", "of", "existence", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/synthetic.py#L11-L59
train
Creates a DataFrame representing lifetimes of assets that are constantly rotating in and out of existence.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pd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eError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(7415 - 7304) + chr(50) + chr(2093 - 2040) + chr(0b1101 + 0o45), 0b1000), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x32' + chr(0b110001) + chr(49), 21148 - 21140), ehT0Px3KOsy9(chr(48) + chr(111) + chr(1059 - 1010) + chr(54) + chr(307 - 259), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11010 + 0o125) + '\062' + chr(2344 - 2289) + chr(0b110010), 2160 - 2152), ehT0Px3KOsy9(chr(48) + chr(3771 - 3660) + chr(0b110110) + '\x34', ord("\x08")), ehT0Px3KOsy9('\060' + chr(9322 - 9211) + chr(0b100011 + 0o16) + '\x33' + chr(49), 60150 - 60142), ehT0Px3KOsy9(chr(0b11000 + 0o30) + chr(111) + chr(0b110111) + '\x33', 0o10), ehT0Px3KOsy9('\060' + chr(0b101010 + 0o105) + chr(49) + '\063' + '\067', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(2450 - 2400) + chr(882 - 834), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110010) + chr(0b101 + 0o55) + '\060', 0o10), ehT0Px3KOsy9('\060' + chr(111) + chr(0b110001 + 0o1) + '\067' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1011100 + 0o23) + chr(1203 - 1148) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(992 - 938) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1075 - 1025) + chr(52) + '\x35', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b1011 + 0o50) + chr(0b110000) + chr(279 - 227), 707 - 699), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + '\x35' + chr(1730 - 1682), ord("\x08")), ehT0Px3KOsy9('\x30' + '\x6f' + chr(0b110011) + '\066', 0o10), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b10011 + 0o37) + chr(0b110000) + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(455 - 344) + chr(0b110001) + chr(53) + chr(0b10100 + 0o40), 0b1000), ehT0Px3KOsy9('\x30' + chr(5898 - 5787) + chr(0b110010) + chr(49) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b10010 + 0o135) + chr(49) + chr(0b110110) + chr(0b110001), 61448 - 61440), ehT0Px3KOsy9(chr(1176 - 1128) + chr(0b1101111) + chr(0b110010) + chr(52) + chr(0b110110 + 0o0), 58716 - 58708), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + chr(470 - 416) + '\067', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\067' + chr(0b11000 + 0o32), 8), ehT0Px3KOsy9(chr(0b10110 + 0o32) + '\157' + chr(0b110100) + '\067', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101011 + 0o4) + '\x31' + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(0b10111 + 0o31) + chr(0b1101111) + '\062' + '\065' + chr(1784 - 1729), 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b11000 + 0o127) + chr(1235 - 1185) + chr(0b10110 + 0o41) + chr(0b110000), 23557 - 23549), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(0b110010) + chr(0b110001), 0o10), ehT0Px3KOsy9('\060' + chr(8263 - 8152) + chr(0b110001) + chr(2744 - 2689), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110011) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b101101 + 0o102) + chr(50) + chr(53) + chr(52), 26427 - 26419), ehT0Px3KOsy9(chr(0b11110 + 0o22) + chr(0b110100 + 0o73) + '\x37' + '\x35', 33164 - 33156), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1100011 + 0o14) + chr(0b110011), 0o10), ehT0Px3KOsy9('\060' + chr(1231 - 1120) + chr(0b110001) + '\x32' + chr(55), 12224 - 12216), ehT0Px3KOsy9(chr(48 - 0) + '\x6f' + chr(2431 - 2381) + chr(0b110100) + '\x34', ord("\x08")), ehT0Px3KOsy9(chr(2066 - 2018) + chr(6266 - 6155) + chr(0b100101 + 0o15) + chr(0b110010) + '\066', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b100111 + 0o12) + chr(0b11001 + 0o30) + chr(0b101000 + 0o16), 61524 - 61516), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(703 - 654) + '\063', ord("\x08")), ehT0Px3KOsy9(chr(0b100010 + 0o16) + chr(0b111110 + 0o61) + chr(51) + '\067' + chr(0b110010), 10598 - 10590)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b0 + 0o60) + chr(9405 - 9294) + chr(53) + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x84'), '\x64' + '\x65' + chr(0b1100011) + chr(0b1101111) + '\x64' + chr(0b1010 + 0o133))(chr(0b1110101) + '\164' + '\146' + '\055' + chr(0b111000)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def BADRTlf4Fdzk(jItIh7dn3Gvo, AvEETt9BgLiU, pOUplog6yHx6, Eka07l4H3LRY, V8qls1nCzkFY, jveBRz9b3tAb=xafqLlk3kkUe(SXOLrMavuUCe(b'\xfe\xcc#\xee'), '\x64' + '\145' + chr(99) + chr(0b1101111) + '\x64' + '\145')('\165' + chr(0b1110100) + chr(3168 - 3066) + '\x2d' + chr(56))): return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\xee\xe8\x04\xdbr+Z2u'), chr(100) + chr(8685 - 8584) + chr(4827 - 4728) + chr(111) + chr(0b1011010 + 0o12) + chr(101))('\165' + chr(0b1110100) + '\146' + '\x2d' + chr(0b1000 + 0o60)))({xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9\xf0\x1d\xd8[5'), chr(8974 - 8874) + '\145' + chr(0b1100011) + '\x6f' + chr(4008 - 3908) + '\145')(chr(0b1110 + 0o147) + '\x74' + chr(102) + chr(45) + chr(0b111000)): [iDQ_gSK8V7h0(Jp8aZ6mjyZZT(xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb'), '\144' + '\x65' + '\143' + chr(1487 - 1376) + chr(100) + '\145')('\x75' + chr(0b1000101 + 0o57) + chr(0b1100101 + 0o1) + chr(45) + chr(0b111000))) + WVxHKyX45z_L) for WVxHKyX45z_L in vQr8gNKaIaWE(jItIh7dn3Gvo)], xafqLlk3kkUe(SXOLrMavuUCe(b'\xd9\xfd\x11\xc8@\x06_>d\xf5'), chr(0b1001000 + 0o34) + chr(101) + '\143' + '\x6f' + chr(100) + chr(6938 - 6837))('\x75' + '\x74' + '\146' + chr(288 - 243) + '\070'): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\xe8\x04\xdfk+Z1w\xf5'), '\144' + chr(0b1100101) + chr(0b1100011) + chr(0b1000000 + 0o57) + chr(100) + chr(101))('\x75' + '\x74' + chr(0b1100110) + chr(0b11001 + 0o24) + chr(0b111000)))(AvEETt9BgLiU, freq=Eka07l4H3LRY * pOUplog6yHx6, periods=jItIh7dn3Gvo), xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf\xe7\x14\xe5P8O:'), chr(100) + '\x65' + '\143' + chr(0b1011111 + 0o20) + chr(0b1010101 + 0o17) + chr(0b110111 + 0o56))('\x75' + chr(12667 - 12551) + '\146' + chr(0b11001 + 0o24) + chr(56)): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\xce\xe8\x04\xdfk+Z1w\xf5'), chr(0b1100100) + chr(8656 - 8555) + chr(5676 - 5577) + chr(111) + '\144' + '\145')(chr(117) + chr(116) + chr(5352 - 5250) + '\x2d' + chr(954 - 898)))(AvEETt9BgLiU + V8qls1nCzkFY * pOUplog6yHx6, freq=Eka07l4H3LRY * pOUplog6yHx6, periods=jItIh7dn3Gvo), xafqLlk3kkUe(SXOLrMavuUCe(b'\xcf\xf1\x13\xd2U7\\:'), '\x64' + chr(0b100110 + 0o77) + '\143' + '\157' + '\x64' + chr(0b1100101))(chr(117) + chr(0b11000 + 0o134) + chr(102) + chr(45) + chr(56)): jveBRz9b3tAb}, index=vQr8gNKaIaWE(jItIh7dn3Gvo))
quantopian/zipline
zipline/assets/synthetic.py
make_simple_equity_info
def make_simple_equity_info(sids, start_date, end_date, symbols=None, names=None, exchange='TEST'): """ Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`. Parameters ---------- sids : array-like of int start_date : pd.Timestamp, optional end_date : pd.Timestamp, optional symbols : list, optional Symbols to use for the assets. If not provided, symbols are generated from the sequence 'A', 'B', ... names : list, optional Names to use for the assets. If not provided, names are generated by adding " INC." to each of the symbols (which might also be auto-generated). exchange : str, optional The exchange name. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ num_assets = len(sids) if symbols is None: symbols = list(ascii_uppercase[:num_assets]) else: symbols = list(symbols) if names is None: names = [str(s) + " INC." for s in symbols] return pd.DataFrame( { 'symbol': symbols, 'start_date': pd.to_datetime([start_date] * num_assets), 'end_date': pd.to_datetime([end_date] * num_assets), 'asset_name': list(names), 'exchange': exchange, }, index=sids, columns=( 'start_date', 'end_date', 'symbol', 'exchange', 'asset_name', ), )
python
def make_simple_equity_info(sids, start_date, end_date, symbols=None, names=None, exchange='TEST'): """ Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`. Parameters ---------- sids : array-like of int start_date : pd.Timestamp, optional end_date : pd.Timestamp, optional symbols : list, optional Symbols to use for the assets. If not provided, symbols are generated from the sequence 'A', 'B', ... names : list, optional Names to use for the assets. If not provided, names are generated by adding " INC." to each of the symbols (which might also be auto-generated). exchange : str, optional The exchange name. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ num_assets = len(sids) if symbols is None: symbols = list(ascii_uppercase[:num_assets]) else: symbols = list(symbols) if names is None: names = [str(s) + " INC." for s in symbols] return pd.DataFrame( { 'symbol': symbols, 'start_date': pd.to_datetime([start_date] * num_assets), 'end_date': pd.to_datetime([end_date] * num_assets), 'asset_name': list(names), 'exchange': exchange, }, index=sids, columns=( 'start_date', 'end_date', 'symbol', 'exchange', 'asset_name', ), )
[ "def", "make_simple_equity_info", "(", "sids", ",", "start_date", ",", "end_date", ",", "symbols", "=", "None", ",", "names", "=", "None", ",", "exchange", "=", "'TEST'", ")", ":", "num_assets", "=", "len", "(", "sids", ")", "if", "symbols", "is", "None", ":", "symbols", "=", "list", "(", "ascii_uppercase", "[", ":", "num_assets", "]", ")", "else", ":", "symbols", "=", "list", "(", "symbols", ")", "if", "names", "is", "None", ":", "names", "=", "[", "str", "(", "s", ")", "+", "\" INC.\"", "for", "s", "in", "symbols", "]", "return", "pd", ".", "DataFrame", "(", "{", "'symbol'", ":", "symbols", ",", "'start_date'", ":", "pd", ".", "to_datetime", "(", "[", "start_date", "]", "*", "num_assets", ")", ",", "'end_date'", ":", "pd", ".", "to_datetime", "(", "[", "end_date", "]", "*", "num_assets", ")", ",", "'asset_name'", ":", "list", "(", "names", ")", ",", "'exchange'", ":", "exchange", ",", "}", ",", "index", "=", "sids", ",", "columns", "=", "(", "'start_date'", ",", "'end_date'", ",", "'symbol'", ",", "'exchange'", ",", "'asset_name'", ",", ")", ",", ")" ]
Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`. Parameters ---------- sids : array-like of int start_date : pd.Timestamp, optional end_date : pd.Timestamp, optional symbols : list, optional Symbols to use for the assets. If not provided, symbols are generated from the sequence 'A', 'B', ... names : list, optional Names to use for the assets. If not provided, names are generated by adding " INC." to each of the symbols (which might also be auto-generated). exchange : str, optional The exchange name. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets.
[ "Create", "a", "DataFrame", "representing", "assets", "that", "exist", "for", "the", "full", "duration", "between", "start_date", "and", "end_date", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/synthetic.py#L62-L117
train
Create a DataFrame representing assets that exist for the full duration between start_date and end_date.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufVC,hOkXjmluKZfJ,q1QCh3W88sgk,TLbJ60djyws0,rIcPej9ZqMqV,WTxpD_zsEOh2,LgE_IO_tHXvM,K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3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\x30' + chr(0b110010 + 0o75) + '\062' + '\060', ord("\x08")), ehT0Px3KOsy9(chr(2300 - 2252) + '\x6f' + chr(0b100010 + 0o21) + chr(0b110100) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10060 - 9949) + chr(49) + chr(0b110100) + '\063', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x33' + chr(55) + chr(0b110101), 64117 - 64109), ehT0Px3KOsy9(chr(0b10001 + 0o37) + chr(0b1011101 + 0o22) + '\063' + chr(52) + chr(0b110010), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1011011 + 0o24) + '\065' + chr(0b11100 + 0o30), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x33' + chr(2164 - 2116) + chr(0b100100 + 0o16), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1100010 + 0o15) + chr(0b110011) + chr(54) + '\067', 0o10), ehT0Px3KOsy9('\x30' + chr(10781 - 10670) + chr(1779 - 1730) + chr(490 - 441) + '\061', ord("\x08")), ehT0Px3KOsy9(chr(1034 - 986) + chr(6304 - 6193) + '\x33' + chr(0b1001 + 0o50) + '\x33', ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101000 + 0o7) + chr(1331 - 1282) + chr(54) + chr(50), 44648 - 44640), ehT0Px3KOsy9(chr(0b101011 + 0o5) + '\157' + '\061' + chr(0b100111 + 0o13) + '\061', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110001) + chr(0b110010) + chr(1684 - 1634), 0o10), ehT0Px3KOsy9(chr(2251 - 2203) + '\157' + '\061' + '\061' + chr(1982 - 1932), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + '\063' + chr(51) + chr(0b110101), 0o10), ehT0Px3KOsy9(chr(48) + chr(5401 - 5290) + chr(49) + chr(0b110000) + chr(0b110000), 12431 - 12423), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110011) + chr(0b110101), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b10010 + 0o41) + chr(0b1 + 0o64) + chr(52), 0o10), ehT0Px3KOsy9('\060' + chr(0b1011101 + 0o22) + chr(0b110010) + chr(0b110000) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(1803 - 1754) + '\x32' + '\x30', ord("\x08")), ehT0Px3KOsy9('\060' + chr(8130 - 8019) + '\x37' + '\066', 0b1000), ehT0Px3KOsy9(chr(2248 - 2200) + chr(0b1011110 + 0o21) + chr(0b110001) + chr(0b110010) + chr(0b110010), 8), ehT0Px3KOsy9(chr(48) + chr(0b1001111 + 0o40) + '\062' + chr(53), 20453 - 20445), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(111) + '\061' + chr(0b101110 + 0o3) + '\062', 8), ehT0Px3KOsy9('\x30' + chr(111) + '\x33' + chr(590 - 539), 30952 - 30944), ehT0Px3KOsy9(chr(0b11 + 0o55) + chr(0b1101111) + chr(0b11001 + 0o30) + chr(0b10110 + 0o34) + chr(0b100100 + 0o14), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\063' + '\x32' + chr(54), 4729 - 4721), ehT0Px3KOsy9(chr(48) + chr(0b11010 + 0o125) + '\x33' + '\062' + '\063', 0o10), ehT0Px3KOsy9('\x30' + chr(111) + '\x32' + chr(48), 8), ehT0Px3KOsy9(chr(0b110000) + chr(5330 - 5219) + chr(50) + chr(59 - 10) + chr(0b100 + 0o61), 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1000011 + 0o54) + '\063' + chr(1691 - 1643) + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110011) + chr(0b110110) + chr(2323 - 2274), 33541 - 33533), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b110001) + chr(2093 - 2040) + '\065', ord("\x08")), ehT0Px3KOsy9(chr(854 - 806) + '\157' + chr(0b110010) + chr(0b110000), 8), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10010 + 0o41) + '\062' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b100000 + 0o20) + chr(0b110011 + 0o74) + chr(51) + chr(0b10101 + 0o33) + chr(0b110100), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b11001 + 0o30) + chr(0b101100 + 0o11) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(810 - 699) + '\063' + chr(55) + chr(0b110001), 45309 - 45301), ehT0Px3KOsy9(chr(605 - 557) + '\x6f' + chr(49) + '\066' + chr(1542 - 1494), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(51) + '\064' + chr(0b111 + 0o53), 8)][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110101) + '\x30', 39125 - 39117)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'>'), chr(100) + chr(101) + chr(5484 - 5385) + '\x6f' + '\144' + chr(101))(chr(117) + chr(0b1110100) + '\x66' + chr(249 - 204) + '\070') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def DrdtoeyyJD3_(vpNBss375oFz, NcwNd9gvgEB5, joOGoPpJ_sck, gTbywfQd6zu7=None, OcnR1hZ7pGdr=None, jveBRz9b3tAb=xafqLlk3kkUe(SXOLrMavuUCe(b'D\xa10\xa9'), '\144' + chr(5089 - 4988) + chr(0b110101 + 0o56) + chr(0b111010 + 0o65) + chr(0b11101 + 0o107) + chr(0b101001 + 0o74))(chr(8852 - 8735) + chr(0b1110100) + chr(0b1100110 + 0o0) + '\055' + chr(0b11111 + 0o31))): jItIh7dn3Gvo = c2A0yzQpDQB3(vpNBss375oFz) if gTbywfQd6zu7 is None: gTbywfQd6zu7 = YyaZ4tpXu4lf(S9Ss7U3eoMkx[:jItIh7dn3Gvo]) else: gTbywfQd6zu7 = YyaZ4tpXu4lf(gTbywfQd6zu7) if OcnR1hZ7pGdr is None: OcnR1hZ7pGdr = [M8_cKLkHVB2V(vGrByMSYMp9h) + xafqLlk3kkUe(SXOLrMavuUCe(b'0\xad-\xbe\xcc'), chr(0b1100100) + chr(0b1011000 + 0o15) + chr(8748 - 8649) + chr(111) + chr(100) + chr(4561 - 4460))(chr(0b1011100 + 0o31) + '\164' + '\146' + chr(0b100010 + 0o13) + chr(874 - 818)) for vGrByMSYMp9h in gTbywfQd6zu7] return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'T\x85\x17\x9c\xa4^\xa3\x9a,'), chr(0b1100100) + '\145' + chr(0b1001100 + 0o27) + chr(2934 - 2823) + chr(100) + chr(0b110010 + 0o63))(chr(0b1011111 + 0o26) + chr(116) + chr(0b101110 + 0o70) + chr(0b101101) + '\x38'))({xafqLlk3kkUe(SXOLrMavuUCe(b'c\x9d\x0e\x9f\x8d@'), chr(376 - 276) + chr(3427 - 3326) + chr(3518 - 3419) + chr(111) + chr(9764 - 9664) + '\145')('\x75' + chr(0b1101100 + 0o10) + chr(9005 - 8903) + chr(45) + chr(0b111000)): gTbywfQd6zu7, xafqLlk3kkUe(SXOLrMavuUCe(b'c\x90\x02\x8f\x96s\xa6\x96=\xae'), '\144' + chr(0b1100101) + '\x63' + chr(0b111110 + 0o61) + chr(100) + chr(0b1011101 + 0o10))(chr(514 - 397) + chr(6361 - 6245) + chr(5861 - 5759) + '\055' + '\x38'): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'd\x8b<\x99\x83X\xa7\x83 \xa6\x17'), chr(0b111101 + 0o47) + '\x65' + chr(99) + '\x6f' + '\144' + '\145')(chr(0b1011011 + 0o32) + chr(0b11111 + 0o125) + '\146' + chr(45) + '\x38'))([NcwNd9gvgEB5] * jItIh7dn3Gvo), xafqLlk3kkUe(SXOLrMavuUCe(b'u\x8a\x07\xa2\x86M\xb6\x92'), chr(0b1100100) + chr(0b1 + 0o144) + '\143' + chr(3079 - 2968) + '\x64' + chr(0b1100101))(chr(0b1001100 + 0o51) + '\164' + chr(102) + chr(45) + chr(0b111000)): xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'd\x8b<\x99\x83X\xa7\x83 \xa6\x17'), '\x64' + chr(0b1100101) + chr(0b1100011) + chr(5657 - 5546) + '\144' + chr(2349 - 2248))('\x75' + chr(116) + '\146' + chr(1420 - 1375) + chr(56)))([joOGoPpJ_sck] * jItIh7dn3Gvo), xafqLlk3kkUe(SXOLrMavuUCe(b'q\x97\x10\x98\x96s\xac\x96$\xae'), chr(100) + '\x65' + chr(0b1100011) + '\x6f' + chr(0b110111 + 0o55) + '\145')('\165' + '\164' + chr(408 - 306) + '\x2d' + chr(0b100 + 0o64)): YyaZ4tpXu4lf(OcnR1hZ7pGdr), xafqLlk3kkUe(SXOLrMavuUCe(b'u\x9c\x00\x95\x83B\xa5\x92'), chr(0b111100 + 0o50) + '\145' + '\143' + chr(0b1101111) + chr(0b111010 + 0o52) + chr(101))('\165' + chr(116) + '\x66' + '\055' + chr(0b111000)): jveBRz9b3tAb}, index=vpNBss375oFz, columns=(xafqLlk3kkUe(SXOLrMavuUCe(b'c\x90\x02\x8f\x96s\xa6\x96=\xae'), '\144' + '\145' + '\x63' + '\x6f' + chr(100) + chr(101))(chr(0b1110101) + chr(7569 - 7453) + chr(102) + chr(0b1001 + 0o44) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'u\x8a\x07\xa2\x86M\xb6\x92'), '\144' + chr(0b0 + 0o145) + '\143' + chr(3986 - 3875) + '\x64' + chr(0b1100101))(chr(0b1110101) + '\x74' + chr(102) + chr(0b110 + 0o47) + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'c\x9d\x0e\x9f\x8d@'), chr(100) + chr(0b1100101) + '\143' + '\x6f' + chr(0b1100011 + 0o1) + '\x65')(chr(4810 - 4693) + chr(5838 - 5722) + '\146' + chr(0b1110 + 0o37) + chr(0b10100 + 0o44)), xafqLlk3kkUe(SXOLrMavuUCe(b'u\x9c\x00\x95\x83B\xa5\x92'), chr(733 - 633) + '\x65' + chr(0b1100011) + '\x6f' + chr(6529 - 6429) + chr(101))('\165' + chr(0b10110 + 0o136) + '\x66' + chr(0b100110 + 0o7) + chr(2137 - 2081)), xafqLlk3kkUe(SXOLrMavuUCe(b'q\x97\x10\x98\x96s\xac\x96$\xae'), '\144' + chr(4650 - 4549) + chr(99) + chr(0b1000100 + 0o53) + chr(0b1100100) + chr(9652 - 9551))('\x75' + '\x74' + chr(0b1100110) + '\x2d' + chr(1668 - 1612))))
quantopian/zipline
zipline/assets/synthetic.py
make_simple_multi_country_equity_info
def make_simple_multi_country_equity_info(countries_to_sids, countries_to_exchanges, start_date, end_date): """Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`, from multiple countries. """ sids = [] symbols = [] exchanges = [] for country, country_sids in countries_to_sids.items(): exchange = countries_to_exchanges[country] for i, sid in enumerate(country_sids): sids.append(sid) symbols.append('-'.join([country, str(i)])) exchanges.append(exchange) return pd.DataFrame( { 'symbol': symbols, 'start_date': start_date, 'end_date': end_date, 'asset_name': symbols, 'exchange': exchanges, }, index=sids, columns=( 'start_date', 'end_date', 'symbol', 'exchange', 'asset_name', ), )
python
def make_simple_multi_country_equity_info(countries_to_sids, countries_to_exchanges, start_date, end_date): """Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`, from multiple countries. """ sids = [] symbols = [] exchanges = [] for country, country_sids in countries_to_sids.items(): exchange = countries_to_exchanges[country] for i, sid in enumerate(country_sids): sids.append(sid) symbols.append('-'.join([country, str(i)])) exchanges.append(exchange) return pd.DataFrame( { 'symbol': symbols, 'start_date': start_date, 'end_date': end_date, 'asset_name': symbols, 'exchange': exchanges, }, index=sids, columns=( 'start_date', 'end_date', 'symbol', 'exchange', 'asset_name', ), )
[ "def", "make_simple_multi_country_equity_info", "(", "countries_to_sids", ",", "countries_to_exchanges", ",", "start_date", ",", "end_date", ")", ":", "sids", "=", "[", "]", "symbols", "=", "[", "]", "exchanges", "=", "[", "]", "for", "country", ",", "country_sids", "in", "countries_to_sids", ".", "items", "(", ")", ":", "exchange", "=", "countries_to_exchanges", "[", "country", "]", "for", "i", ",", "sid", "in", "enumerate", "(", "country_sids", ")", ":", "sids", ".", "append", "(", "sid", ")", "symbols", ".", "append", "(", "'-'", ".", "join", "(", "[", "country", ",", "str", "(", "i", ")", "]", ")", ")", "exchanges", ".", "append", "(", "exchange", ")", "return", "pd", ".", "DataFrame", "(", "{", "'symbol'", ":", "symbols", ",", "'start_date'", ":", "start_date", ",", "'end_date'", ":", "end_date", ",", "'asset_name'", ":", "symbols", ",", "'exchange'", ":", "exchanges", ",", "}", ",", "index", "=", "sids", ",", "columns", "=", "(", "'start_date'", ",", "'end_date'", ",", "'symbol'", ",", "'exchange'", ",", "'asset_name'", ",", ")", ",", ")" ]
Create a DataFrame representing assets that exist for the full duration between `start_date` and `end_date`, from multiple countries.
[ "Create", "a", "DataFrame", "representing", "assets", "that", "exist", "for", "the", "full", "duration", "between", "start_date", "and", "end_date", "from", "multiple", "countries", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/synthetic.py#L120-L154
train
Create a DataFrame representing assets that exist for the full duration between start_date and end_date from multiple countries.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,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hlZjMfR0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + chr(111) + chr(50) + '\066' + chr(52), 0b1000), ehT0Px3KOsy9(chr(1905 - 1857) + chr(0b1101111) + chr(377 - 328) + chr(1988 - 1937) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(2150 - 2039) + chr(50) + chr(51) + '\061', 32716 - 32708), ehT0Px3KOsy9(chr(48) + chr(0b11011 + 0o124) + '\062' + '\062' + chr(106 - 53), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b11 + 0o154) + chr(0b110011) + chr(1002 - 954) + chr(2126 - 2078), 62910 - 62902), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(1249 - 1200) + chr(283 - 231) + chr(1992 - 1944), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b1000 + 0o57) + chr(53), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(0b101111 + 0o2) + '\066' + chr(1288 - 1240), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(54) + '\x35', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(51) + chr(49) + chr(0b110000), 7203 - 7195), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b100001 + 0o21) + chr(0b111 + 0o55) + chr(0b11010 + 0o30), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1001100 + 0o43) + '\062' + chr(0b110011) + '\x33', 29602 - 29594), ehT0Px3KOsy9(chr(0b101010 + 0o6) + '\157' + '\x31', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110010) + '\x34' + chr(0b110100), 29530 - 29522), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b110010) + chr(1964 - 1913) + '\064', 25315 - 25307), ehT0Px3KOsy9(chr(469 - 421) + chr(0b1101111) + chr(2487 - 2436) + chr(1248 - 1200) + '\x34', 4542 - 4534), ehT0Px3KOsy9(chr(1665 - 1617) + chr(2718 - 2607) + chr(651 - 603), 0b1000), ehT0Px3KOsy9('\060' + chr(111) + chr(49) + '\060' + chr(2230 - 2179), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(111) + chr(949 - 899) + chr(53) + chr(50), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(5112 - 5001) + chr(123 - 73) + chr(55) + '\066', ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b1101111) + '\x31' + '\x36' + chr(0b110110), 0b1000), ehT0Px3KOsy9(chr(1666 - 1618) + chr(0b1101111) + chr(51) + '\063' + '\x31', 28563 - 28555), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b1010 + 0o47) + chr(1621 - 1570) + chr(0b110001), 54642 - 54634), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(653 - 604) + chr(0b110101) + chr(50), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(796 - 747) + '\x34' + '\x31', 39358 - 39350), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(2651 - 2598) + '\x32', ord("\x08")), ehT0Px3KOsy9(chr(1002 - 954) + chr(0b1101111) + chr(0b100111 + 0o20) + chr(54), 0o10), ehT0Px3KOsy9(chr(0b100111 + 0o11) + '\x6f' + chr(0b1000 + 0o53) + chr(52) + chr(52), 0b1000), ehT0Px3KOsy9(chr(48) + chr(7167 - 7056) + chr(165 - 115) + chr(2435 - 2380), 0o10), ehT0Px3KOsy9('\060' + chr(5020 - 4909) + '\061' + chr(0b11000 + 0o34) + chr(2094 - 2039), 0o10), ehT0Px3KOsy9(chr(48) + chr(5895 - 5784) + '\061' + chr(0b101010 + 0o13) + chr(0b1111 + 0o41), 0o10), ehT0Px3KOsy9(chr(1024 - 976) + chr(111) + chr(53 - 3) + chr(0b101000 + 0o12) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b100110 + 0o14) + '\061' + chr(55), 63107 - 63099), ehT0Px3KOsy9('\x30' + chr(4626 - 4515) + chr(49) + chr(2487 - 2436) + chr(51), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b101011 + 0o6) + chr(1415 - 1362) + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x35' + chr(0b110111), 0o10), ehT0Px3KOsy9('\x30' + chr(111) + chr(1089 - 1039) + chr(0b110101) + '\x34', 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\063' + chr(0b101101 + 0o10) + chr(1884 - 1834), ord("\x08")), ehT0Px3KOsy9(chr(1269 - 1221) + chr(0b11100 + 0o123) + chr(0b110010) + chr(53) + chr(0b100010 + 0o24), ord("\x08")), ehT0Px3KOsy9('\x30' + '\157' + chr(0b100001 + 0o20) + '\x31' + chr(0b110111), ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9(chr(92 - 44) + chr(3211 - 3100) + chr(2610 - 2557) + '\x30', ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\x9a'), chr(0b100101 + 0o77) + chr(0b10101 + 0o120) + chr(763 - 664) + chr(111) + chr(5383 - 5283) + '\145')(chr(0b101001 + 0o114) + chr(116) + chr(3707 - 3605) + chr(209 - 164) + chr(0b101001 + 0o17)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def Mi1kPxg9ythv(rh2mjNzHyafV, WDAeZsVQAOKb, NcwNd9gvgEB5, joOGoPpJ_sck): vpNBss375oFz = [] gTbywfQd6zu7 = [] fNiM4tIuLrqX = [] for (YoiWD89mtHEZ, r3D4R8n2ccVH) in xafqLlk3kkUe(rh2mjNzHyafV, xafqLlk3kkUe(SXOLrMavuUCe(b'\xfa%\xef\xf0\x89:\x0e9Y\x9b\xea\xa2'), chr(905 - 805) + '\145' + chr(99) + chr(111) + chr(0b10 + 0o142) + chr(1943 - 1842))(chr(0b1100001 + 0o24) + '\x74' + '\146' + chr(45) + '\x38'))(): jveBRz9b3tAb = WDAeZsVQAOKb[YoiWD89mtHEZ] for (WVxHKyX45z_L, Cli4Sf5HnGOS) in YlkZvXL8qwsX(r3D4R8n2ccVH): xafqLlk3kkUe(vpNBss375oFz, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5/\xe9\xf0\xae\x04'), chr(0b1100100) + chr(7185 - 7084) + chr(0b111011 + 0o50) + '\157' + '\144' + chr(301 - 200))(chr(0b1110101) + chr(0b1110100) + chr(10288 - 10186) + '\055' + chr(56)))(Cli4Sf5HnGOS) xafqLlk3kkUe(gTbywfQd6zu7, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5/\xe9\xf0\xae\x04'), '\x64' + chr(101) + chr(0b1100011) + '\157' + chr(0b1100001 + 0o3) + chr(0b1100101))('\165' + '\164' + '\x66' + chr(0b101101) + chr(0b111000)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'\x99'), chr(100) + chr(3579 - 3478) + chr(99) + chr(0b1101111) + chr(0b1100100) + chr(101))('\x75' + chr(0b1110100) + chr(7958 - 7856) + chr(0b101101) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xeb0\xce\xcd\xba\x14k>[\xb9\xea\xdd'), chr(0b1100011 + 0o1) + chr(101) + '\x63' + chr(0b110100 + 0o73) + chr(1554 - 1454) + chr(101))(chr(0b1110101) + chr(116) + chr(102) + chr(0b100110 + 0o7) + chr(995 - 939)))([YoiWD89mtHEZ, M8_cKLkHVB2V(WVxHKyX45z_L)])) xafqLlk3kkUe(fNiM4tIuLrqX, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5/\xe9\xf0\xae\x04'), chr(0b110111 + 0o55) + chr(7293 - 7192) + chr(8698 - 8599) + chr(0b1101111) + chr(100) + chr(0b10100 + 0o121))(chr(0b1011111 + 0o26) + chr(116) + chr(0b1100110) + chr(45) + chr(56)))(jveBRz9b3tAb) return xafqLlk3kkUe(dubtF9GfzOdC, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf0>\xed\xf4\x86\x12\\\x1dP'), chr(9180 - 9080) + chr(101) + chr(0b1100011) + chr(8605 - 8494) + '\x64' + chr(0b1100101))('\165' + chr(6092 - 5976) + chr(0b1100110) + chr(0b101101) + chr(0b101000 + 0o20)))({xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7&\xf4\xf7\xaf\x0c'), chr(0b1100100) + chr(5605 - 5504) + chr(99) + '\157' + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b111001 + 0o73) + chr(0b1100110) + chr(0b101101) + '\070'): gTbywfQd6zu7, xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7+\xf8\xe7\xb4?Y\x11A\xad'), '\x64' + '\145' + chr(0b11010 + 0o111) + '\x6f' + chr(0b1100100) + '\x65')('\x75' + chr(0b1110100) + '\146' + chr(1890 - 1845) + '\070'): NcwNd9gvgEB5, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd11\xfd\xca\xa4\x01I\x15'), chr(4731 - 4631) + '\145' + chr(0b1100011) + chr(0b111101 + 0o62) + '\144' + chr(0b101001 + 0o74))('\x75' + '\x74' + chr(0b1100001 + 0o5) + chr(0b101 + 0o50) + '\x38'): joOGoPpJ_sck, xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5,\xea\xf0\xb4?S\x11X\xad'), chr(6942 - 6842) + chr(101) + chr(99) + chr(0b11101 + 0o122) + '\144' + chr(101))(chr(10441 - 10324) + '\164' + chr(0b1100110) + '\055' + chr(56)): gTbywfQd6zu7, xafqLlk3kkUe(SXOLrMavuUCe(b"\xd1'\xfa\xfd\xa1\x0eZ\x15"), chr(0b0 + 0o144) + chr(0b1100101) + chr(0b110011 + 0o60) + '\x6f' + chr(100) + chr(101))(chr(0b1110101) + '\x74' + chr(102) + chr(0b101101) + chr(0b111000)): fNiM4tIuLrqX}, index=vpNBss375oFz, columns=(xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7+\xf8\xe7\xb4?Y\x11A\xad'), chr(0b1100011 + 0o1) + '\x65' + '\143' + chr(0b1010111 + 0o30) + chr(0b100110 + 0o76) + chr(6494 - 6393))('\165' + chr(0b1110100) + chr(0b1100110) + chr(0b10100 + 0o31) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd11\xfd\xca\xa4\x01I\x15'), chr(987 - 887) + chr(2411 - 2310) + '\143' + '\157' + '\x64' + '\145')(chr(1750 - 1633) + '\164' + chr(0b0 + 0o146) + chr(0b101101) + chr(2490 - 2434)), xafqLlk3kkUe(SXOLrMavuUCe(b'\xc7&\xf4\xf7\xaf\x0c'), chr(0b100101 + 0o77) + chr(0b10 + 0o143) + '\x63' + chr(0b1101 + 0o142) + chr(0b1100100) + chr(0b1111 + 0o126))(chr(117) + '\x74' + chr(6287 - 6185) + chr(0b101000 + 0o5) + chr(0b111000)), xafqLlk3kkUe(SXOLrMavuUCe(b"\xd1'\xfa\xfd\xa1\x0eZ\x15"), chr(0b1100100) + chr(0b1100101) + '\143' + chr(111) + chr(0b1010001 + 0o23) + '\x65')('\165' + '\164' + chr(5615 - 5513) + '\x2d' + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\xd5,\xea\xf0\xb4?S\x11X\xad'), chr(100) + '\145' + '\x63' + '\x6f' + chr(0b110001 + 0o63) + '\145')(chr(0b1110101) + chr(0b11111 + 0o125) + chr(102) + chr(0b101101) + chr(56))))
quantopian/zipline
zipline/assets/synthetic.py
make_jagged_equity_info
def make_jagged_equity_info(num_assets, start_date, first_end, frequency, periods_between_ends, auto_close_delta): """ Create a DataFrame representing assets that all begin at the same start date, but have cascading end dates. Parameters ---------- num_assets : int How many assets to create. start_date : pd.Timestamp The start date for all the assets. first_end : pd.Timestamp The date at which the first equity will end. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret the next argument. periods_between_ends : int Starting after the first end date, end each asset every `frequency` * `periods_between_ends`. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ frame = pd.DataFrame( { 'symbol': [chr(ord('A') + i) for i in range(num_assets)], 'start_date': start_date, 'end_date': pd.date_range( first_end, freq=(periods_between_ends * frequency), periods=num_assets, ), 'exchange': 'TEST', }, index=range(num_assets), ) # Explicitly pass None to disable setting the auto_close_date column. if auto_close_delta is not None: frame['auto_close_date'] = frame['end_date'] + auto_close_delta return frame
python
def make_jagged_equity_info(num_assets, start_date, first_end, frequency, periods_between_ends, auto_close_delta): """ Create a DataFrame representing assets that all begin at the same start date, but have cascading end dates. Parameters ---------- num_assets : int How many assets to create. start_date : pd.Timestamp The start date for all the assets. first_end : pd.Timestamp The date at which the first equity will end. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret the next argument. periods_between_ends : int Starting after the first end date, end each asset every `frequency` * `periods_between_ends`. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets. """ frame = pd.DataFrame( { 'symbol': [chr(ord('A') + i) for i in range(num_assets)], 'start_date': start_date, 'end_date': pd.date_range( first_end, freq=(periods_between_ends * frequency), periods=num_assets, ), 'exchange': 'TEST', }, index=range(num_assets), ) # Explicitly pass None to disable setting the auto_close_date column. if auto_close_delta is not None: frame['auto_close_date'] = frame['end_date'] + auto_close_delta return frame
[ "def", "make_jagged_equity_info", "(", "num_assets", ",", "start_date", ",", "first_end", ",", "frequency", ",", "periods_between_ends", ",", "auto_close_delta", ")", ":", "frame", "=", "pd", ".", "DataFrame", "(", "{", "'symbol'", ":", "[", "chr", "(", "ord", "(", "'A'", ")", "+", "i", ")", "for", "i", "in", "range", "(", "num_assets", ")", "]", ",", "'start_date'", ":", "start_date", ",", "'end_date'", ":", "pd", ".", "date_range", "(", "first_end", ",", "freq", "=", "(", "periods_between_ends", "*", "frequency", ")", ",", "periods", "=", "num_assets", ",", ")", ",", "'exchange'", ":", "'TEST'", ",", "}", ",", "index", "=", "range", "(", "num_assets", ")", ",", ")", "# Explicitly pass None to disable setting the auto_close_date column.", "if", "auto_close_delta", "is", "not", "None", ":", "frame", "[", "'auto_close_date'", "]", "=", "frame", "[", "'end_date'", "]", "+", "auto_close_delta", "return", "frame" ]
Create a DataFrame representing assets that all begin at the same start date, but have cascading end dates. Parameters ---------- num_assets : int How many assets to create. start_date : pd.Timestamp The start date for all the assets. first_end : pd.Timestamp The date at which the first equity will end. frequency : str or pd.tseries.offsets.Offset (e.g. trading_day) Frequency used to interpret the next argument. periods_between_ends : int Starting after the first end date, end each asset every `frequency` * `periods_between_ends`. Returns ------- info : pd.DataFrame DataFrame representing newly-created assets.
[ "Create", "a", "DataFrame", "representing", "assets", "that", "all", "begin", "at", "the", "same", "start", "date", "but", "have", "cascading", "end", "dates", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/synthetic.py#L157-L204
train
Create a DataFrame representing assets that all begin at the same start_date but have cascading end dates.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDz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,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(939 - 891) + '\157' + '\x32' + chr(2187 - 2137) + chr(0b110110), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(5612 - 5501) + '\062' + chr(0b100000 + 0o26) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\x6f' + chr(0b110010) + chr(52) + chr(0b110100), 0b1000), ehT0Px3KOsy9(chr(1765 - 1717) + chr(9388 - 9277) + chr(1095 - 1045) + '\062' + chr(49), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + chr(0b1101000 + 0o7) + chr(51) + '\x34' + chr(167 - 115), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1066 - 1016) + chr(0b10001 + 0o42) + chr(0b100001 + 0o22), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + chr(0b101011 + 0o12) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b1101111) + '\x32' + '\064' + chr(51), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(0b110100) + chr(0b1 + 0o63), 65458 - 65450), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b11001 + 0o31) + chr(49) + chr(0b101111 + 0o5), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b1110 + 0o44) + '\067' + '\061', 0b1000), ehT0Px3KOsy9(chr(1825 - 1777) + chr(0b10000 + 0o137) + chr(1633 - 1584) + chr(53), 0o10), ehT0Px3KOsy9('\x30' + chr(0b111010 + 0o65) + chr(0b110010) + chr(0b10101 + 0o33) + '\x30', 0b1000), ehT0Px3KOsy9(chr(791 - 743) + chr(0b1101111) + chr(0b11000 + 0o34) + chr(0b101001 + 0o10), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(1635 - 1584) + '\067' + '\066', 0o10), ehT0Px3KOsy9('\060' + chr(2718 - 2607) + chr(0b110100) + chr(2289 - 2241), 0b1000), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110001) + chr(0b110 + 0o56) + '\060', 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + chr(1351 - 1302) + '\x32' + chr(0b110000), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + '\x31' + '\x34', 31719 - 31711), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b111 + 0o53) + chr(0b10101 + 0o33) + chr(1372 - 1320), 0b1000), ehT0Px3KOsy9('\x30' + chr(111) + chr(287 - 237) + chr(48) + chr(850 - 795), 0o10), ehT0Px3KOsy9('\060' + chr(111) + '\x31' + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(0b1011 + 0o50) + chr(70 - 20) + chr(0b110010), 62726 - 62718), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(11097 - 10986) + chr(55) + chr(885 - 831), 0b1000), ehT0Px3KOsy9(chr(126 - 78) + '\157' + '\061' + chr(53) + chr(0b110001), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(53) + chr(0b100000 + 0o22), 32712 - 32704), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + chr(50) + '\x32' + chr(453 - 399), 8), ehT0Px3KOsy9(chr(48) + chr(9629 - 9518) + '\062' + chr(0b10 + 0o65) + chr(2580 - 2529), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b1001101 + 0o42) + chr(0b110100) + chr(48), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + '\060' + chr(0b101101 + 0o11), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + chr(0b1100100 + 0o13) + chr(51) + '\065' + '\x36', 5698 - 5690), ehT0Px3KOsy9('\060' + chr(0b1000000 + 0o57) + '\061' + chr(0b1011 + 0o50) + chr(0b110110), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10000 + 0o43) + chr(472 - 418) + chr(1159 - 1104), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1010 + 0o145) + chr(50) + chr(2386 - 2337) + chr(48), 0b1000), ehT0Px3KOsy9(chr(48) + chr(1411 - 1300) + chr(0b100110 + 0o14) + '\060' + chr(0b101011 + 0o14), 8), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(54) + '\065', 0o10), ehT0Px3KOsy9('\060' + chr(0b101001 + 0o106) + '\061' + '\x37' + chr(0b1111 + 0o43), ord("\x08")), ehT0Px3KOsy9(chr(0b101001 + 0o7) + '\157' + chr(0b0 + 0o61) + '\064' + '\067', 0b1000), ehT0Px3KOsy9(chr(0b1011 + 0o45) + chr(3567 - 3456) + chr(0b110011) + '\064' + '\061', 40084 - 40076), ehT0Px3KOsy9(chr(0b110000) + chr(0b1011010 + 0o25) + '\063' + chr(52) + '\x35', 0o10)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(48) + chr(111) + '\065' + chr(1852 - 1804), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'\xb8'), chr(0b1100100) + chr(3384 - 3283) + chr(99) + chr(0b1011010 + 0o25) + '\x64' + chr(0b1100101))('\x75' + '\x74' + chr(0b11010 + 0o114) + chr(45) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def dx3WCLSjTW9d(jItIh7dn3Gvo, NcwNd9gvgEB5, oHNPm2lFqn4w, pOUplog6yHx6, FhfhUVonLLbq, j5YIrtrw7_Zr): C4IqNNmLfHXB = dubtF9GfzOdC.DataFrame({xafqLlk3kkUe(SXOLrMavuUCe(b'\xe5\xc9\xc9\xf3\x8b\xf7'), '\x64' + '\x65' + '\x63' + '\157' + chr(100) + chr(1257 - 1156))(chr(11134 - 11017) + '\x74' + chr(939 - 837) + chr(45) + chr(0b100100 + 0o24)): [iDQ_gSK8V7h0(Jp8aZ6mjyZZT(xafqLlk3kkUe(SXOLrMavuUCe(b'\xd7'), chr(0b1100100) + chr(9605 - 9504) + chr(0b1100011) + chr(111) + chr(0b1100100) + chr(5782 - 5681))(chr(117) + chr(0b1110100) + '\146' + chr(704 - 659) + '\070')) + WVxHKyX45z_L) for WVxHKyX45z_L in vQr8gNKaIaWE(jItIh7dn3Gvo)], xafqLlk3kkUe(SXOLrMavuUCe(b'\xe5\xc4\xc5\xe3\x90\xc4L\xc2P\xe9'), chr(100) + '\145' + '\143' + '\x6f' + chr(0b1100100) + '\x65')(chr(12225 - 12108) + chr(13170 - 13054) + chr(0b1100110) + '\x2d' + '\070'): NcwNd9gvgEB5, xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xde\xc0\xce\x80\xfa\\\xc6'), chr(100) + chr(101) + chr(0b1000000 + 0o43) + chr(10357 - 10246) + chr(0b10001 + 0o123) + '\145')(chr(7785 - 7668) + '\x74' + chr(0b1100110) + chr(1000 - 955) + chr(0b111000)): dubtF9GfzOdC.date_range(oHNPm2lFqn4w, freq=FhfhUVonLLbq * pOUplog6yHx6, periods=jItIh7dn3Gvo), xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xc8\xc7\xf9\x85\xf5O\xc6'), chr(0b1100100) + chr(101) + '\143' + chr(0b111110 + 0o61) + '\144' + chr(0b1100101))(chr(0b1000001 + 0o64) + chr(5125 - 5009) + chr(7057 - 6955) + chr(45) + chr(2254 - 2198)): xafqLlk3kkUe(SXOLrMavuUCe(b'\xc2\xf5\xf7\xc5'), '\x64' + '\x65' + chr(0b1100011) + '\157' + chr(0b1000111 + 0o35) + chr(1157 - 1056))(chr(117) + chr(0b1110100) + chr(102) + '\055' + chr(56))}, index=vQr8gNKaIaWE(jItIh7dn3Gvo)) if j5YIrtrw7_Zr is not None: C4IqNNmLfHXB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf7\xc5\xd0\xfe\xbb\xf8D\xccW\xe9\xe6i\xe1U\x9b'), chr(8325 - 8225) + chr(9664 - 9563) + '\x63' + chr(0b1100111 + 0o10) + chr(100) + chr(0b1100101))(chr(0b1110101) + chr(0b1110100) + chr(0b1100110) + '\x2d' + chr(386 - 330))] = C4IqNNmLfHXB[xafqLlk3kkUe(SXOLrMavuUCe(b'\xf3\xde\xc0\xce\x80\xfa\\\xc6'), chr(0b101100 + 0o70) + chr(0b1100101) + chr(99) + chr(111) + chr(0b0 + 0o144) + chr(101))(chr(0b11011 + 0o132) + chr(3871 - 3755) + chr(102) + chr(0b100101 + 0o10) + '\070')] + j5YIrtrw7_Zr return C4IqNNmLfHXB
quantopian/zipline
zipline/assets/synthetic.py
make_future_info
def make_future_info(first_sid, root_symbols, years, notice_date_func, expiration_date_func, start_date_func, month_codes=None, multiplier=500): """ Create a DataFrame representing futures for `root_symbols` during `year`. Generates a contract per triple of (symbol, year, month) supplied to `root_symbols`, `years`, and `month_codes`. Parameters ---------- first_sid : int The first sid to use for assigning sids to the created contracts. root_symbols : list[str] A list of root symbols for which to create futures. years : list[int or str] Years (e.g. 2014), for which to produce individual contracts. notice_date_func : (Timestamp) -> Timestamp Function to generate notice dates from first of the month associated with asset month code. Return NaT to simulate futures with no notice date. expiration_date_func : (Timestamp) -> Timestamp Function to generate expiration dates from first of the month associated with asset month code. start_date_func : (Timestamp) -> Timestamp, optional Function to generate start dates from first of the month associated with each asset month code. Defaults to a start_date one year prior to the month_code date. month_codes : dict[str -> [1..12]], optional Dictionary of month codes for which to create contracts. Entries should be strings mapped to values from 1 (January) to 12 (December). Default is zipline.futures.CMES_CODE_TO_MONTH multiplier : int The contract multiplier. Returns ------- futures_info : pd.DataFrame DataFrame of futures data suitable for passing to an AssetDBWriter. """ if month_codes is None: month_codes = CMES_CODE_TO_MONTH year_strs = list(map(str, years)) years = [pd.Timestamp(s, tz='UTC') for s in year_strs] # Pairs of string/date like ('K06', 2006-05-01) contract_suffix_to_beginning_of_month = tuple( (month_code + year_str[-2:], year + MonthBegin(month_num)) for ((year, year_str), (month_code, month_num)) in product( zip(years, year_strs), iteritems(month_codes), ) ) contracts = [] parts = product(root_symbols, contract_suffix_to_beginning_of_month) for sid, (root_sym, (suffix, month_begin)) in enumerate(parts, first_sid): contracts.append({ 'sid': sid, 'root_symbol': root_sym, 'symbol': root_sym + suffix, 'start_date': start_date_func(month_begin), 'notice_date': notice_date_func(month_begin), 'expiration_date': notice_date_func(month_begin), 'multiplier': multiplier, 'exchange': "TEST", }) return pd.DataFrame.from_records(contracts, index='sid')
python
def make_future_info(first_sid, root_symbols, years, notice_date_func, expiration_date_func, start_date_func, month_codes=None, multiplier=500): """ Create a DataFrame representing futures for `root_symbols` during `year`. Generates a contract per triple of (symbol, year, month) supplied to `root_symbols`, `years`, and `month_codes`. Parameters ---------- first_sid : int The first sid to use for assigning sids to the created contracts. root_symbols : list[str] A list of root symbols for which to create futures. years : list[int or str] Years (e.g. 2014), for which to produce individual contracts. notice_date_func : (Timestamp) -> Timestamp Function to generate notice dates from first of the month associated with asset month code. Return NaT to simulate futures with no notice date. expiration_date_func : (Timestamp) -> Timestamp Function to generate expiration dates from first of the month associated with asset month code. start_date_func : (Timestamp) -> Timestamp, optional Function to generate start dates from first of the month associated with each asset month code. Defaults to a start_date one year prior to the month_code date. month_codes : dict[str -> [1..12]], optional Dictionary of month codes for which to create contracts. Entries should be strings mapped to values from 1 (January) to 12 (December). Default is zipline.futures.CMES_CODE_TO_MONTH multiplier : int The contract multiplier. Returns ------- futures_info : pd.DataFrame DataFrame of futures data suitable for passing to an AssetDBWriter. """ if month_codes is None: month_codes = CMES_CODE_TO_MONTH year_strs = list(map(str, years)) years = [pd.Timestamp(s, tz='UTC') for s in year_strs] # Pairs of string/date like ('K06', 2006-05-01) contract_suffix_to_beginning_of_month = tuple( (month_code + year_str[-2:], year + MonthBegin(month_num)) for ((year, year_str), (month_code, month_num)) in product( zip(years, year_strs), iteritems(month_codes), ) ) contracts = [] parts = product(root_symbols, contract_suffix_to_beginning_of_month) for sid, (root_sym, (suffix, month_begin)) in enumerate(parts, first_sid): contracts.append({ 'sid': sid, 'root_symbol': root_sym, 'symbol': root_sym + suffix, 'start_date': start_date_func(month_begin), 'notice_date': notice_date_func(month_begin), 'expiration_date': notice_date_func(month_begin), 'multiplier': multiplier, 'exchange': "TEST", }) return pd.DataFrame.from_records(contracts, index='sid')
[ "def", "make_future_info", "(", "first_sid", ",", "root_symbols", ",", "years", ",", "notice_date_func", ",", "expiration_date_func", ",", "start_date_func", ",", "month_codes", "=", "None", ",", "multiplier", "=", "500", ")", ":", "if", "month_codes", "is", "None", ":", "month_codes", "=", "CMES_CODE_TO_MONTH", "year_strs", "=", "list", "(", "map", "(", "str", ",", "years", ")", ")", "years", "=", "[", "pd", ".", "Timestamp", "(", "s", ",", "tz", "=", "'UTC'", ")", "for", "s", "in", "year_strs", "]", "# Pairs of string/date like ('K06', 2006-05-01)", "contract_suffix_to_beginning_of_month", "=", "tuple", "(", "(", "month_code", "+", "year_str", "[", "-", "2", ":", "]", ",", "year", "+", "MonthBegin", "(", "month_num", ")", ")", "for", "(", "(", "year", ",", "year_str", ")", ",", "(", "month_code", ",", "month_num", ")", ")", "in", "product", "(", "zip", "(", "years", ",", "year_strs", ")", ",", "iteritems", "(", "month_codes", ")", ",", ")", ")", "contracts", "=", "[", "]", "parts", "=", "product", "(", "root_symbols", ",", "contract_suffix_to_beginning_of_month", ")", "for", "sid", ",", "(", "root_sym", ",", "(", "suffix", ",", "month_begin", ")", ")", "in", "enumerate", "(", "parts", ",", "first_sid", ")", ":", "contracts", ".", "append", "(", "{", "'sid'", ":", "sid", ",", "'root_symbol'", ":", "root_sym", ",", "'symbol'", ":", "root_sym", "+", "suffix", ",", "'start_date'", ":", "start_date_func", "(", "month_begin", ")", ",", "'notice_date'", ":", "notice_date_func", "(", "month_begin", ")", ",", "'expiration_date'", ":", "notice_date_func", "(", "month_begin", ")", ",", "'multiplier'", ":", "multiplier", ",", "'exchange'", ":", "\"TEST\"", ",", "}", ")", "return", "pd", ".", "DataFrame", ".", "from_records", "(", "contracts", ",", "index", "=", "'sid'", ")" ]
Create a DataFrame representing futures for `root_symbols` during `year`. Generates a contract per triple of (symbol, year, month) supplied to `root_symbols`, `years`, and `month_codes`. Parameters ---------- first_sid : int The first sid to use for assigning sids to the created contracts. root_symbols : list[str] A list of root symbols for which to create futures. years : list[int or str] Years (e.g. 2014), for which to produce individual contracts. notice_date_func : (Timestamp) -> Timestamp Function to generate notice dates from first of the month associated with asset month code. Return NaT to simulate futures with no notice date. expiration_date_func : (Timestamp) -> Timestamp Function to generate expiration dates from first of the month associated with asset month code. start_date_func : (Timestamp) -> Timestamp, optional Function to generate start dates from first of the month associated with each asset month code. Defaults to a start_date one year prior to the month_code date. month_codes : dict[str -> [1..12]], optional Dictionary of month codes for which to create contracts. Entries should be strings mapped to values from 1 (January) to 12 (December). Default is zipline.futures.CMES_CODE_TO_MONTH multiplier : int The contract multiplier. Returns ------- futures_info : pd.DataFrame DataFrame of futures data suitable for passing to an AssetDBWriter.
[ "Create", "a", "DataFrame", "representing", "futures", "for", "root_symbols", "during", "year", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/synthetic.py#L207-L281
train
Create a DataFrame representing futures for the given root_symbols and years.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLs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0,wLqBDw8l0eIm,g1Uy6IV0tyJQ,f9CsFWzvg0Vq,YlkZvXL8qwsX,MCqssyYhLtLC,bpgWCAbiJWkL,CMUdZtaORwo4,hi1V0ySZcNds,kkSX4ccExqw4,V4roHaS3Ppej,o8rvoPw8ep3k,xafqLlk3kkUe,h0qciNl3EEEj,lot1PSoAwYhj,xfhwxiBOH72k,HcyiPkCViZiX,fOIXYo9a1WNS,z8EhBlYI2Bx4,Y3jVKaC8LEDU,ehT0Px3KOsy9,PlSM16l2KDPD,J6u1YyThfhgG,ZdP978XkGspL,c2A0yzQpDQB3,I7ZO3Ma9cXBb,YyaZ4tpXu4lf,eHmS9durw_Vs,abA97kOQKaLo,tsdjvlgh9gDP,VTYZGD68sBIs,Dx22bkKPdt5d,nSwwHEeM4cxI,sR_24x3xd4bh,xmV2riMOClNT,_fwkIVCGgtAN,Jp8aZ6mjyZZT,eO8Xfv8UVFey,zLUzGokYBM2Z,FL7SmUoxlR9h,k6bl9sLammpH,vQr8gNKaIaWE,S6hV9M2g7fO0,RFiwrCZH9Ie6,jB_HdqgHmVpI,MVEN8G6CxlvR,t0rOMsrOC7R_,W3g84rNiEdDQ,vUlqIvNSaRMa,gDnh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(5078 - 4967) + '\061' + chr(0b110100) + chr(0b110001 + 0o0), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(0b110010) + chr(2437 - 2387) + chr(50), 8739 - 8731), ehT0Px3KOsy9(chr(0b1101 + 0o43) + '\157' + '\063' + '\060' + chr(54), ord("\x08")), ehT0Px3KOsy9(chr(0b11111 + 0o21) + '\x6f' + '\065' + chr(1339 - 1287), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(7122 - 7011) + chr(0b1111 + 0o43) + chr(0b10 + 0o60), 35300 - 35292), ehT0Px3KOsy9(chr(0b110000) + chr(12086 - 11975) + chr(0b110111) + chr(55), 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(595 - 545) + '\061' + chr(0b100 + 0o57), 19409 - 19401), ehT0Px3KOsy9(chr(0b110000) + chr(661 - 550) + '\x31' + chr(49) + chr(0b101011 + 0o10), ord("\x08")), ehT0Px3KOsy9(chr(48) + chr(6354 - 6243) + chr(51) + chr(48) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + chr(0b1011001 + 0o26) + '\063' + '\x32' + chr(2221 - 2168), 0o10), ehT0Px3KOsy9('\x30' + chr(0b1100110 + 0o11) + chr(0b110011) + chr(50) + '\066', ord("\x08")), ehT0Px3KOsy9(chr(688 - 640) + chr(0b1101 + 0o142) + chr(0b110001) + chr(49) + chr(0b110101), ord("\x08")), ehT0Px3KOsy9(chr(48) + '\157' + '\061' + chr(2650 - 2595) + chr(54), ord("\x08")), ehT0Px3KOsy9('\060' + '\157' + '\062' + chr(0b10 + 0o65) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(652 - 604) + chr(111) + '\x31' + chr(78 - 30) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1111 + 0o140) + '\062' + '\066' + chr(1018 - 965), 0b1000), ehT0Px3KOsy9(chr(0b111 + 0o51) + chr(0b1101111) + '\x33' + chr(53), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1100 + 0o143) + chr(0b101100 + 0o6) + '\060' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b11111 + 0o21) + chr(0b1101111) + '\x32' + chr(0b110001) + '\x33', 8), ehT0Px3KOsy9(chr(543 - 495) + chr(0b1101111) + chr(650 - 600) + chr(52) + chr(0b110010), 24527 - 24519), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(0b111001 + 0o66) + chr(0b1100 + 0o45) + chr(2518 - 2466) + chr(0b101000 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(0b110010 + 0o5), 62935 - 62927), ehT0Px3KOsy9(chr(1417 - 1369) + chr(5410 - 5299) + '\063' + chr(0b101000 + 0o12) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(0b110111) + chr(0b1101 + 0o52), 39342 - 39334), ehT0Px3KOsy9(chr(0b1111 + 0o41) + chr(111) + '\063' + chr(51) + chr(50), 0o10), ehT0Px3KOsy9(chr(232 - 184) + '\x6f' + chr(49) + chr(2338 - 2287) + chr(50), 0o10), ehT0Px3KOsy9('\x30' + chr(10432 - 10321) + chr(0b110001) + '\061' + '\x36', ord("\x08")), ehT0Px3KOsy9(chr(494 - 446) + chr(0b1101111) + chr(0b110011) + chr(49), 56822 - 56814), ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(0b110001) + '\x35' + chr(48), 0b1000), ehT0Px3KOsy9(chr(0b10011 + 0o35) + '\157' + '\061' + chr(1545 - 1491) + '\x37', 0o10), ehT0Px3KOsy9(chr(0b111 + 0o51) + '\157' + chr(0b110111) + '\x37', 8), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(3174 - 3063) + '\x32' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b110000 + 0o0) + '\x6f' + chr(0b100000 + 0o22) + '\x31' + chr(0b0 + 0o66), 65049 - 65041), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b110001) + '\067' + chr(48), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(50) + chr(0b100101 + 0o16) + chr(0b101 + 0o56), 0b1000), ehT0Px3KOsy9(chr(0b101000 + 0o10) + chr(417 - 306) + chr(50) + '\062' + chr(0b100100 + 0o22), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(50) + chr(51) + '\062', 0b1000), ehT0Px3KOsy9(chr(48) + chr(111) + chr(0b110010) + chr(0b11 + 0o62) + '\067', 0b1000), ehT0Px3KOsy9('\060' + '\157' + chr(49) + chr(2648 - 2596) + '\x37', 0b1000), ehT0Px3KOsy9(chr(1506 - 1458) + chr(111) + chr(0b11010 + 0o31) + chr(1329 - 1279) + '\065', 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000) + chr(0b1001111 + 0o40) + '\x35' + chr(2070 - 2022), ord("\x08"))] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'O'), '\x64' + chr(101) + chr(99) + '\157' + chr(0b1100100) + chr(0b1100101))(chr(11442 - 11325) + '\164' + chr(1832 - 1730) + '\055' + '\x38') + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def rkEirrCc3hqK(sW9Lx8G7Lmy0, _hFyfoRobDUt, fUx9L05l7bBr, i8OvyXXPaxGe, BGK3WCVlJgoz, L4Ppl4EUpOLQ, pzDNTux1xoA0=None, S0Mp0SOoXply=ehT0Px3KOsy9(chr(48) + chr(6697 - 6586) + chr(0b10010 + 0o45) + '\066' + '\x34', 58056 - 58048)): if pzDNTux1xoA0 is None: pzDNTux1xoA0 = KW_5LOwX_brU yMszvuzjJmZN = YyaZ4tpXu4lf(abA97kOQKaLo(M8_cKLkHVB2V, fUx9L05l7bBr)) fUx9L05l7bBr = [dubtF9GfzOdC.Timestamp(vGrByMSYMp9h, tz=xafqLlk3kkUe(SXOLrMavuUCe(b'4\xc6\x85'), chr(0b1100100) + chr(101) + '\143' + chr(4715 - 4604) + chr(100) + '\145')(chr(0b1001100 + 0o51) + chr(0b1101001 + 0o13) + chr(5274 - 5172) + '\x2d' + '\x38')) for vGrByMSYMp9h in yMszvuzjJmZN] LabeAhKPgMl4 = KNyTy8rYcwji(((_BS8kg27brhO + LALvqqZIUiFb[-ehT0Px3KOsy9('\x30' + chr(111) + '\x32', ord("\x08")):], tHDbziHu8esk + hAkq39ZWPL3L(u4QqRQ6Fef0g)) for ((tHDbziHu8esk, LALvqqZIUiFb), (_BS8kg27brhO, u4QqRQ6Fef0g)) in uIRUM5ZtFNrn(pZ0NK2y6HRbn(fUx9L05l7bBr, yMszvuzjJmZN), WYXqUHkBa2Bx(pzDNTux1xoA0)))) NFa1rHnSeEBT = [] gIfWK5W_pmM4 = uIRUM5ZtFNrn(_hFyfoRobDUt, LabeAhKPgMl4) for (Cli4Sf5HnGOS, (tKbWz4MmE7LA, (YhhkyMvxPIjH, WraGC97e9J6A))) in YlkZvXL8qwsX(gIfWK5W_pmM4, sW9Lx8G7Lmy0): xafqLlk3kkUe(NFa1rHnSeEBT, xafqLlk3kkUe(SXOLrMavuUCe(b'\x00\xe2\xb6I|['), chr(0b1100100) + chr(0b1100101) + chr(6889 - 6790) + chr(0b101 + 0o152) + chr(0b1100100) + '\x65')('\165' + chr(116) + '\146' + chr(1089 - 1044) + '\070'))({xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\xfb\xa2'), chr(5946 - 5846) + chr(0b1100101) + '\x63' + chr(0b101111 + 0o100) + '\x64' + chr(0b1100101))(chr(117) + '\164' + chr(0b1010111 + 0o17) + chr(1876 - 1831) + chr(56)): Cli4Sf5HnGOS, xafqLlk3kkUe(SXOLrMavuUCe(b'\x13\xfd\xa9XML\xf2&\xa1\xba\xba'), chr(8752 - 8652) + chr(0b1100101) + chr(99) + '\157' + '\x64' + chr(0b10100 + 0o121))(chr(0b101111 + 0o106) + chr(0b1100000 + 0o24) + chr(0b1100110) + chr(1308 - 1263) + chr(56)): tKbWz4MmE7LA, xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\xeb\xabN}S'), chr(3166 - 3066) + chr(2484 - 2383) + '\x63' + chr(0b1101111) + chr(6646 - 6546) + '\145')('\165' + chr(0b1100101 + 0o17) + chr(0b1100001 + 0o5) + chr(987 - 942) + '\070'): tKbWz4MmE7LA + YhhkyMvxPIjH, xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\xe6\xa7^f`\xef*\xb7\xb0'), '\x64' + '\145' + '\143' + chr(0b1101100 + 0o3) + chr(100) + chr(0b1100101))(chr(0b11010 + 0o133) + chr(116) + '\146' + '\x2d' + '\070'): L4Ppl4EUpOLQ(WraGC97e9J6A), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f\xfd\xb2EqZ\xd4/\xa2\xa1\xb3'), '\x64' + chr(9112 - 9011) + chr(99) + chr(0b110100 + 0o73) + chr(8421 - 8321) + '\x65')(chr(117) + chr(0b1110100) + chr(102) + '\x2d' + '\070'): i8OvyXXPaxGe(WraGC97e9J6A), xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\xea\xb6E`^\xff"\xac\xbb\x89)\x1f\xcf\''), chr(4384 - 4284) + '\x65' + chr(99) + '\x6f' + chr(5783 - 5683) + chr(101))(chr(0b1110101) + chr(116) + chr(0b101 + 0o141) + '\x2d' + '\070'): i8OvyXXPaxGe(WraGC97e9J6A), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0c\xe7\xaaX{O\xe7"\xa6\xa7'), chr(0b110 + 0o136) + chr(101) + chr(0b1100011) + chr(111) + chr(4459 - 4359) + '\x65')('\165' + chr(116) + chr(10352 - 10250) + '\055' + '\070'): S0Mp0SOoXply, xafqLlk3kkUe(SXOLrMavuUCe(b'\x04\xea\xa5DsQ\xec.'), chr(0b100111 + 0o75) + chr(0b1001110 + 0o27) + chr(0b110011 + 0o60) + '\x6f' + chr(0b111100 + 0o50) + chr(8925 - 8824))(chr(0b100011 + 0o122) + chr(0b1110100) + chr(0b11000 + 0o116) + '\x2d' + chr(56)): xafqLlk3kkUe(SXOLrMavuUCe(b'5\xd7\x95x'), '\x64' + chr(101) + chr(0b100010 + 0o101) + chr(0b1101111) + '\x64' + '\145')(chr(0b1001011 + 0o52) + chr(0b110100 + 0o100) + chr(6980 - 6878) + chr(1204 - 1159) + '\x38')}) return xafqLlk3kkUe(dubtF9GfzOdC.DataFrame, xafqLlk3kkUe(SXOLrMavuUCe(b'\x07\xe0\xa9AMM\xee(\xac\xa7\xb2>'), '\x64' + chr(6496 - 6395) + chr(99) + chr(0b1101111) + chr(100) + chr(2114 - 2013))(chr(117) + chr(4878 - 4762) + '\x66' + '\x2d' + '\070'))(NFa1rHnSeEBT, index=xafqLlk3kkUe(SXOLrMavuUCe(b'\x12\xfb\xa2'), chr(100) + '\145' + chr(99) + '\x6f' + chr(100) + chr(0b110010 + 0o63))(chr(0b1001000 + 0o55) + chr(0b111010 + 0o72) + '\146' + chr(0b101101) + chr(0b110011 + 0o5)))
quantopian/zipline
zipline/assets/synthetic.py
make_commodity_future_info
def make_commodity_future_info(first_sid, root_symbols, years, month_codes=None, multiplier=500): """ Make futures testing data that simulates the notice/expiration date behavior of physical commodities like oil. Parameters ---------- first_sid : int The first sid to use for assigning sids to the created contracts. root_symbols : list[str] A list of root symbols for which to create futures. years : list[int or str] Years (e.g. 2014), for which to produce individual contracts. month_codes : dict[str -> [1..12]], optional Dictionary of month codes for which to create contracts. Entries should be strings mapped to values from 1 (January) to 12 (December). Default is zipline.futures.CMES_CODE_TO_MONTH multiplier : int The contract multiplier. Expiration dates are on the 20th of the month prior to the month code. Notice dates are are on the 20th two months prior to the month code. Start dates are one year before the contract month. See Also -------- make_future_info """ nineteen_days = pd.Timedelta(days=19) one_year = pd.Timedelta(days=365) return make_future_info( first_sid=first_sid, root_symbols=root_symbols, years=years, notice_date_func=lambda dt: dt - MonthBegin(2) + nineteen_days, expiration_date_func=lambda dt: dt - MonthBegin(1) + nineteen_days, start_date_func=lambda dt: dt - one_year, month_codes=month_codes, multiplier=multiplier, )
python
def make_commodity_future_info(first_sid, root_symbols, years, month_codes=None, multiplier=500): """ Make futures testing data that simulates the notice/expiration date behavior of physical commodities like oil. Parameters ---------- first_sid : int The first sid to use for assigning sids to the created contracts. root_symbols : list[str] A list of root symbols for which to create futures. years : list[int or str] Years (e.g. 2014), for which to produce individual contracts. month_codes : dict[str -> [1..12]], optional Dictionary of month codes for which to create contracts. Entries should be strings mapped to values from 1 (January) to 12 (December). Default is zipline.futures.CMES_CODE_TO_MONTH multiplier : int The contract multiplier. Expiration dates are on the 20th of the month prior to the month code. Notice dates are are on the 20th two months prior to the month code. Start dates are one year before the contract month. See Also -------- make_future_info """ nineteen_days = pd.Timedelta(days=19) one_year = pd.Timedelta(days=365) return make_future_info( first_sid=first_sid, root_symbols=root_symbols, years=years, notice_date_func=lambda dt: dt - MonthBegin(2) + nineteen_days, expiration_date_func=lambda dt: dt - MonthBegin(1) + nineteen_days, start_date_func=lambda dt: dt - one_year, month_codes=month_codes, multiplier=multiplier, )
[ "def", "make_commodity_future_info", "(", "first_sid", ",", "root_symbols", ",", "years", ",", "month_codes", "=", "None", ",", "multiplier", "=", "500", ")", ":", "nineteen_days", "=", "pd", ".", "Timedelta", "(", "days", "=", "19", ")", "one_year", "=", "pd", ".", "Timedelta", "(", "days", "=", "365", ")", "return", "make_future_info", "(", "first_sid", "=", "first_sid", ",", "root_symbols", "=", "root_symbols", ",", "years", "=", "years", ",", "notice_date_func", "=", "lambda", "dt", ":", "dt", "-", "MonthBegin", "(", "2", ")", "+", "nineteen_days", ",", "expiration_date_func", "=", "lambda", "dt", ":", "dt", "-", "MonthBegin", "(", "1", ")", "+", "nineteen_days", ",", "start_date_func", "=", "lambda", "dt", ":", "dt", "-", "one_year", ",", "month_codes", "=", "month_codes", ",", "multiplier", "=", "multiplier", ",", ")" ]
Make futures testing data that simulates the notice/expiration date behavior of physical commodities like oil. Parameters ---------- first_sid : int The first sid to use for assigning sids to the created contracts. root_symbols : list[str] A list of root symbols for which to create futures. years : list[int or str] Years (e.g. 2014), for which to produce individual contracts. month_codes : dict[str -> [1..12]], optional Dictionary of month codes for which to create contracts. Entries should be strings mapped to values from 1 (January) to 12 (December). Default is zipline.futures.CMES_CODE_TO_MONTH multiplier : int The contract multiplier. Expiration dates are on the 20th of the month prior to the month code. Notice dates are are on the 20th two months prior to the month code. Start dates are one year before the contract month. See Also -------- make_future_info
[ "Make", "futures", "testing", "data", "that", "simulates", "the", "notice", "/", "expiration", "date", "behavior", "of", "physical", "commodities", "like", "oil", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/assets/synthetic.py#L284-L327
train
Create a new future info for a commodity.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGLtp_O,sR2sPcm7Zrfn,yROw0HWBk0Qc,j9rjMYnN2BMp,hIlP7994qj8O,_fsda0v2_OKU,o0CgT5HPthxA,DXjfarvgFnbl,RQ6CSRrFArYB,RouZF7bjEXAv,jIl9qoALCRyb,bdLuls3EQFSd,FXUco0R3m83n,V5s4UV3vwoyK,Q6d3QdTENfxw,sbc9gub6LIFp,QWgp4ELTmqy4,_zJ24Vce7wp0,KlPSljPzIJ_u,N5Ee6d9YGQ_x,yDcnbVVBZ5VZ,OTstrxJfIC1n,GXwwnDRMCHJX,a9IKoVgO_m3w,GNd6AVvhYicE,ixtrydDuthdu,n0ZkatoveZpF,eh4BeXwijHpf,ZMHESMWYyt8h,hr2QaoivbFQ2,Iiw8L0MH5qfg,koCeDPYTrOFe,qqrhSmCSbbqk,pz9FlfzsWoy1,BXIwDASQ0Qkq,NL8dtWOpbcjF,_bikzMuRfbJG,sznFqDbNBHlx,ZsDPvpP4xdo3,cW7yQuyEnJ6E,KOHQGQ8qLDWm,NE1Yam2HHroQ,ygAzbDzrvRMh,SBRjvOU1ufV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nh40_OUDCn,M8_cKLkHVB2V,xkxBmo49x2An,KNx0Ujaz9UM0,KNyTy8rYcwji,wmQmyeWBmUpv,p1G5VS3dE_Ss,pZ0NK2y6HRbn,HByLaO1XdVEe,pgRJLRS7Iy8j,OZYzwAeSQh7N,tmzuw0hjv33u,RwRZiUMA3VWp,Gbej4oZqKLA6,TqkAMbUz4aLg,rw68imZ2Ikxp=ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9('\060' + chr(7321 - 7210) + chr(0b110001) + '\x35' + chr(52), ord("\x08")), ehT0Px3KOsy9('\x30' + chr(0b110100 + 0o73) + '\x32' + '\066' + chr(55), 0b1000), ehT0Px3KOsy9(chr(0b101110 + 0o2) + chr(0b1101111) + '\061' + chr(1222 - 1172) + '\x30', 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(0b0 + 0o64) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b101 + 0o53) + chr(0b1101111) + chr(0b10111 + 0o40) + chr(0b100000 + 0o26), 0o10), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\061' + '\x31' + '\x37', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(0b100001 + 0o116) + '\062' + chr(0b110100) + '\063', 53052 - 53044), ehT0Px3KOsy9(chr(167 - 119) + chr(0b11001 + 0o126) + '\062' + chr(0b101 + 0o54) + chr(0b100100 + 0o16), 0b1000), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\063' + chr(0b101011 + 0o10) + chr(49), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\x6f' + '\x33' + '\061' + chr(0b110101), 0b1000), ehT0Px3KOsy9(chr(48) + chr(10740 - 10629) + '\x32' + '\x34' + chr(1089 - 1034), ord("\x08")), ehT0Px3KOsy9('\060' + '\x6f' + chr(49) + chr(602 - 548) + '\x30', 0o10), ehT0Px3KOsy9('\x30' + '\x6f' + '\x33' + chr(51) + '\x33', 0b1000), ehT0Px3KOsy9('\x30' + '\157' + '\061' + chr(1427 - 1379) + chr(0b110000), 0b1000), ehT0Px3KOsy9(chr(0b10001 + 0o37) + '\x6f' + chr(0b110010) + chr(0b110001 + 0o6) + chr(53), 0b1000), ehT0Px3KOsy9('\x30' + '\x6f' + chr(1425 - 1374) + '\x37', 49635 - 49627), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(0b1011100 + 0o23) + chr(0b101101 + 0o11) + '\x34', 0o10), ehT0Px3KOsy9(chr(0b11011 + 0o25) + chr(0b100001 + 0o116) + chr(50) + chr(52) + chr(0b110000 + 0o6), 0b1000), ehT0Px3KOsy9('\060' + chr(11497 - 11386) + chr(0b110001) + chr(0b10 + 0o57) + chr(1264 - 1209), 8), ehT0Px3KOsy9(chr(0b110000) + chr(111) + chr(53) + chr(0b110000), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x32' + chr(0b110100) + '\066', 8), ehT0Px3KOsy9('\x30' + '\157' + chr(2426 - 2376) + '\x33' + chr(0b101001 + 0o13), 0b1000), ehT0Px3KOsy9(chr(553 - 505) + '\157' + '\061' + chr(52) + chr(655 - 604), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + '\065' + '\x34', 8), ehT0Px3KOsy9(chr(633 - 585) + chr(0b1101111) + chr(0b101000 + 0o13) + chr(55) + '\062', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + '\061' + chr(0b110101 + 0o1) + chr(51), 46594 - 46586), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\061' + '\061' + chr(487 - 439), 0o10), ehT0Px3KOsy9(chr(48) + chr(3205 - 3094) + '\x36' + '\061', 0o10), ehT0Px3KOsy9(chr(0b1 + 0o57) + chr(7137 - 7026) + chr(0b101011 + 0o6) + chr(0b110101) + chr(920 - 872), 51194 - 51186), ehT0Px3KOsy9(chr(0b100110 + 0o12) + chr(8781 - 8670) + chr(0b110010) + chr(50 - 0), 0b1000), ehT0Px3KOsy9(chr(2209 - 2161) + chr(0b1101111) + chr(55) + '\x30', 0b1000), ehT0Px3KOsy9(chr(848 - 800) + chr(111) + '\063' + chr(0b110010) + chr(52), 0o10), ehT0Px3KOsy9(chr(0b1101 + 0o43) + chr(0b1010 + 0o145) + chr(1251 - 1202) + chr(0b1011 + 0o52) + chr(703 - 655), 8), ehT0Px3KOsy9(chr(48) + '\x6f' + '\063' + '\060' + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(1664 - 1613) + '\x36' + chr(0b110011), 0o10), ehT0Px3KOsy9(chr(0b1011 + 0o45) + '\157' + chr(0b110100 + 0o2) + chr(1655 - 1605), 41138 - 41130), ehT0Px3KOsy9(chr(938 - 890) + chr(1941 - 1830) + chr(0b101111 + 0o4) + '\060' + chr(0b110000), ord("\x08")), ehT0Px3KOsy9(chr(0b10100 + 0o34) + chr(3858 - 3747) + chr(50) + '\x34' + '\x35', ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(9964 - 9853) + '\061' + '\x34', 0b1000), ehT0Px3KOsy9(chr(1260 - 1212) + chr(111) + '\063' + chr(0b1 + 0o65) + chr(51), 8)][WVxHKyX45z_L % ehT0Px3KOsy9(chr(0b110000 + 0o0) + chr(111) + '\x35' + chr(48), 8)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'B'), chr(100) + '\145' + chr(0b111 + 0o134) + chr(111) + chr(0b10111 + 0o115) + chr(9173 - 9072))(chr(117) + chr(12363 - 12247) + chr(0b1001011 + 0o33) + chr(0b100100 + 0o11) + chr(0b1100 + 0o54)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def dcIij6H0MNEC(sW9Lx8G7Lmy0, _hFyfoRobDUt, fUx9L05l7bBr, pzDNTux1xoA0=None, S0Mp0SOoXply=ehT0Px3KOsy9(chr(0b11100 + 0o24) + '\157' + chr(55) + chr(54) + chr(0b100 + 0o60), 27960 - 27952)): UkRo1QkG_YCf = dubtF9GfzOdC.Timedelta(days=ehT0Px3KOsy9(chr(1489 - 1441) + chr(111) + '\x32' + chr(651 - 600), 0o10)) ZB9SDykBKahk = dubtF9GfzOdC.Timedelta(days=ehT0Px3KOsy9('\060' + chr(0b10001 + 0o136) + chr(53) + '\x35' + '\065', 0o10)) return rkEirrCc3hqK(first_sid=sW9Lx8G7Lmy0, root_symbols=_hFyfoRobDUt, years=fUx9L05l7bBr, notice_date_func=lambda OmU3Un949MWT: OmU3Un949MWT - hAkq39ZWPL3L(ehT0Px3KOsy9(chr(48) + chr(3804 - 3693) + '\062', 0b1000)) + UkRo1QkG_YCf, expiration_date_func=lambda OmU3Un949MWT: OmU3Un949MWT - hAkq39ZWPL3L(ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\x31', 0o10)) + UkRo1QkG_YCf, start_date_func=lambda OmU3Un949MWT: OmU3Un949MWT - ZB9SDykBKahk, month_codes=pzDNTux1xoA0, multiplier=S0Mp0SOoXply)
quantopian/zipline
zipline/pipeline/classifiers/classifier.py
Classifier.eq
def eq(self, other): """ Construct a Filter returning True for asset/date pairs where the output of ``self`` matches ``other``. """ # We treat this as an error because missing_values have NaN semantics, # which means this would return an array of all False, which is almost # certainly not what the user wants. if other == self.missing_value: raise ValueError( "Comparison against self.missing_value ({value!r}) in" " {typename}.eq().\n" "Missing values have NaN semantics, so the " "requested comparison would always produce False.\n" "Use the isnull() method to check for missing values.".format( value=other, typename=(type(self).__name__), ) ) if isinstance(other, Number) != (self.dtype == int64_dtype): raise InvalidClassifierComparison(self, other) if isinstance(other, Number): return NumExprFilter.create( "x_0 == {other}".format(other=int(other)), binds=(self,), ) else: return ArrayPredicate( term=self, op=operator.eq, opargs=(other,), )
python
def eq(self, other): """ Construct a Filter returning True for asset/date pairs where the output of ``self`` matches ``other``. """ # We treat this as an error because missing_values have NaN semantics, # which means this would return an array of all False, which is almost # certainly not what the user wants. if other == self.missing_value: raise ValueError( "Comparison against self.missing_value ({value!r}) in" " {typename}.eq().\n" "Missing values have NaN semantics, so the " "requested comparison would always produce False.\n" "Use the isnull() method to check for missing values.".format( value=other, typename=(type(self).__name__), ) ) if isinstance(other, Number) != (self.dtype == int64_dtype): raise InvalidClassifierComparison(self, other) if isinstance(other, Number): return NumExprFilter.create( "x_0 == {other}".format(other=int(other)), binds=(self,), ) else: return ArrayPredicate( term=self, op=operator.eq, opargs=(other,), )
[ "def", "eq", "(", "self", ",", "other", ")", ":", "# We treat this as an error because missing_values have NaN semantics,", "# which means this would return an array of all False, which is almost", "# certainly not what the user wants.", "if", "other", "==", "self", ".", "missing_value", ":", "raise", "ValueError", "(", "\"Comparison against self.missing_value ({value!r}) in\"", "\" {typename}.eq().\\n\"", "\"Missing values have NaN semantics, so the \"", "\"requested comparison would always produce False.\\n\"", "\"Use the isnull() method to check for missing values.\"", ".", "format", "(", "value", "=", "other", ",", "typename", "=", "(", "type", "(", "self", ")", ".", "__name__", ")", ",", ")", ")", "if", "isinstance", "(", "other", ",", "Number", ")", "!=", "(", "self", ".", "dtype", "==", "int64_dtype", ")", ":", "raise", "InvalidClassifierComparison", "(", "self", ",", "other", ")", "if", "isinstance", "(", "other", ",", "Number", ")", ":", "return", "NumExprFilter", ".", "create", "(", "\"x_0 == {other}\"", ".", "format", "(", "other", "=", "int", "(", "other", ")", ")", ",", "binds", "=", "(", "self", ",", ")", ",", ")", "else", ":", "return", "ArrayPredicate", "(", "term", "=", "self", ",", "op", "=", "operator", ".", "eq", ",", "opargs", "=", "(", "other", ",", ")", ",", ")" ]
Construct a Filter returning True for asset/date pairs where the output of ``self`` matches ``other``.
[ "Construct", "a", "Filter", "returning", "True", "for", "asset", "/", "date", "pairs", "where", "the", "output", "of", "self", "matches", "other", "." ]
77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/classifiers/classifier.py#L83-L116
train
Construct a Filter returning True for asset / date pairs where the output of self matches other.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,F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enPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EncodingWarning,EnvironmentError,Exception,False,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,None,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,True,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,WindowsError,ZeroDivisionError,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,aiter,all,anext,any,ascii,bin,bool,breakpoint,bytearray,bytes,callable,chr,classmethod,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,exit,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,isinstance,issubclass,iter,len,license,list,locals,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,vars,zip,__builtins__,__cached__,__doc__,__file__,__loader__,__name__,__package__,__spec__ SXOLrMavuUCe = lambda XbwU38w7NW8n: QOfmzcVJsrp8([OeWW0F1dBPRQ ^ [ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + '\063' + '\x31', 0b1000), ehT0Px3KOsy9(chr(419 - 371) + chr(111) + '\x31' + chr(0b110101) + chr(1250 - 1195), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b10011 + 0o134) + chr(0b11 + 0o56) + '\067' + chr(184 - 136), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(111) + '\061' + chr(49) + chr(49), 5903 - 5895), ehT0Px3KOsy9('\060' + chr(4746 - 4635) + '\062' + chr(2554 - 2502), 13951 - 13943), ehT0Px3KOsy9(chr(48) + chr(8568 - 8457) + chr(448 - 398) + chr(2523 - 2468) + chr(0b110011), ord("\x08")), ehT0Px3KOsy9(chr(0b110000) + chr(6510 - 6399) + '\062' + chr(54) + '\065', 0o10), ehT0Px3KOsy9(chr(48) + '\x6f' + '\062' + '\060' + chr(0b100111 + 0o14), 64785 - 64777), ehT0Px3KOsy9('\x30' + chr(0b1101111) + chr(0b11110 + 0o24) + chr(54), 53594 - 53586), ehT0Px3KOsy9('\x30' + '\x6f' + '\x36' + chr(53), 3923 - 3915), ehT0Px3KOsy9('\x30' + chr(0b1010011 + 0o34) + chr(0b110001) + chr(53) + '\060', 12053 - 12045), ehT0Px3KOsy9(chr(1258 - 1210) + chr(5275 - 5164) + '\062', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b1101111) + chr(2040 - 1991) + chr(0b110111), 0b1000), ehT0Px3KOsy9(chr(200 - 152) + chr(0b1101111) + '\062' + chr(109 - 58) + chr(0b111 + 0o51), 0o10), ehT0Px3KOsy9(chr(0b11110 + 0o22) + '\x6f' + chr(50) + chr(0b110010), 0o10), ehT0Px3KOsy9(chr(1420 - 1372) + chr(10489 - 10378) + chr(2562 - 2511) + chr(0b110000) + chr(0b101001 + 0o14), 0o10), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x32' + '\x31' + chr(49), 61561 - 61553), ehT0Px3KOsy9(chr(48) + '\157' + '\x31' + chr(1116 - 1064) + '\064', 0o10), ehT0Px3KOsy9(chr(0b110000) + chr(0b101000 + 0o107) + chr(53) + chr(0b110110), 0b1000), ehT0Px3KOsy9('\060' + '\x6f' + '\x32' + chr(48) + chr(0b110000), 33989 - 33981), ehT0Px3KOsy9(chr(48) + '\x6f' + '\x34' + '\x37', 59768 - 59760), ehT0Px3KOsy9(chr(857 - 809) + chr(0b1101111) + chr(0b110110) + '\x31', 0b1000), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + chr(0b11 + 0o60) + chr(0b110010) + '\061', 0b1000), ehT0Px3KOsy9(chr(1181 - 1133) + chr(0b1000110 + 0o51) + chr(0b100110 + 0o15) + '\x36' + chr(1592 - 1537), 2938 - 2930), ehT0Px3KOsy9(chr(48) + chr(0b1101111) + '\x31' + chr(0b110111) + '\x37', 0b1000), ehT0Px3KOsy9(chr(0b110000) + '\157' + chr(0b110010) + chr(54) + chr(0b110100), ord("\x08")), ehT0Px3KOsy9('\060' + chr(0b1101111) + chr(1993 - 1943) + chr(1333 - 1280) + chr(0b100 + 0o62), 18434 - 18426), ehT0Px3KOsy9(chr(48) + chr(111) + '\061' + chr(54), 0b1000), ehT0Px3KOsy9(chr(0b101010 + 0o6) + chr(6837 - 6726) + chr(0b10001 + 0o40) + chr(49) + chr(0b11111 + 0o22), 8), ehT0Px3KOsy9(chr(48) + chr(111) + '\x33' + chr(0b10001 + 0o45) + chr(1033 - 982), 0o10), ehT0Px3KOsy9('\060' + chr(0b1101111) + '\x31' + chr(0b110101) + '\x33', ord("\x08")), ehT0Px3KOsy9(chr(1456 - 1408) + chr(8344 - 8233) + '\061' + '\061' + chr(53), 61427 - 61419), ehT0Px3KOsy9(chr(48) + chr(0b1011010 + 0o25) + chr(941 - 891) + chr(127 - 79) + '\x31', ord("\x08")), ehT0Px3KOsy9(chr(1831 - 1783) + chr(111) + chr(0b110011) + chr(52), 25834 - 25826), ehT0Px3KOsy9(chr(1435 - 1387) + chr(0b1100 + 0o143) + chr(958 - 909) + '\066' + chr(0b110101), 0o10), ehT0Px3KOsy9('\x30' + '\157' + chr(0b10110 + 0o36) + chr(0b100110 + 0o14), ord("\x08")), ehT0Px3KOsy9(chr(1427 - 1379) + '\157' + chr(55), 0o10), ehT0Px3KOsy9(chr(0b100001 + 0o17) + chr(111) + '\x32' + '\x36' + '\x30', 64014 - 64006), ehT0Px3KOsy9('\060' + '\x6f' + chr(0b110 + 0o53) + chr(0b10010 + 0o45) + chr(0b10011 + 0o40), ord("\x08")), ehT0Px3KOsy9(chr(0b11100 + 0o24) + chr(12205 - 12094) + '\061' + '\062' + '\062', ord("\x08"))][WVxHKyX45z_L % ehT0Px3KOsy9('\060' + '\157' + chr(53) + chr(1626 - 1578), 0o10)] for (WVxHKyX45z_L, OeWW0F1dBPRQ) in YlkZvXL8qwsX(XbwU38w7NW8n)]) def NPPHb59961Bv(RqocVGOryNPv, _CF03Rifpmdh): try: return jFWsnpHpAUWz(RqocVGOryNPv + xafqLlk3kkUe(SXOLrMavuUCe(b'w'), '\x64' + '\145' + chr(99) + chr(10732 - 10621) + '\x64' + '\x65')(chr(0b1110101) + '\164' + chr(0b1100110) + chr(0b101101) + chr(56)) + _CF03Rifpmdh) except yROw0HWBk0Qc: return jFWsnpHpAUWz(RqocVGOryNPv) def X2R_duAuOx1k(oVre8I6UXc3b, KK0ERS7DqYrY): if KK0ERS7DqYrY == xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b':"N\x0fG\xe2\xfa\xb0`e\x1dh'), chr(0b1100100) + chr(101) + '\143' + chr(0b1101111) + chr(100) + chr(0b100010 + 0o103))(chr(0b110001 + 0o104) + '\x74' + '\146' + '\x2d' + '\070')): raise q1QCh3W88sgk(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b"\x1a\x00\x159u\xc9\xdc\xf0y[Hch\xf9{\xab\xfa\x10\x0e\xf3B]\xb7\xd9\x12\xdd\xdd} \x9d\x0c\x12\xf7}\x19Wb\x90S)/\x0e\x14<q\x9a\xc7\xfe?\x15\x01l/\xe3f\xbc\xf9\x01@\xe1JT\xac\xd9\x1a\xc5\x86'g\xf9&$\xf2o\x1cL`\x90\r35\x1a\x1d:4\xd3\xd4\xf5s\x15&cA\xb8a\xa0\xe4\x05@\xf4NR\xa2\xdb_\xc7\xc1.=\x9b\x0em\xf3y\x04Wb\xc3\x0f7=O\x1b&y\xcb\xd4\xf1\x7fF\x07l/\xef}\xb0\xe5\x00\x0e\xe1KF\xb0\x8e\x0c\x94\xde|&\x97\x1e.\xe4<3Ck\xc3\x1e|S:\x0b,4\xcf\xdd\xe66\\\x1blz\xf4~\xed\xa0DC\xe5SY\xbe\x93_\xc0\xc1.*\x9b\x0e.\xea<\x13Mu\x90\x16;*\x1c\x11's\x9b\xc3\xe2z@\rq!"), chr(100) + chr(0b1000010 + 0o43) + '\x63' + chr(861 - 750) + chr(0b1101 + 0o127) + chr(101))('\165' + '\164' + chr(0b1100100 + 0o2) + chr(45) + '\070'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f[\n&\\\xda\xe6\xb0FE\rh'), chr(1916 - 1816) + chr(0b1000010 + 0o43) + chr(0b1100011) + '\x6f' + chr(0b1100100) + chr(0b1100101))(chr(0b1101000 + 0o15) + chr(4906 - 4790) + chr(0b1100110) + chr(190 - 145) + chr(0b111000)))(value=KK0ERS7DqYrY, typename=xafqLlk3kkUe(wmQmyeWBmUpv(oVre8I6UXc3b), xafqLlk3kkUe(SXOLrMavuUCe(b'\x1e\r\x1d# \xd4\xef\xf2]y)4'), '\x64' + '\x65' + chr(6653 - 6554) + chr(0b1100001 + 0o16) + '\144' + chr(101))('\x75' + chr(116) + '\146' + chr(0b10100 + 0o31) + '\x38')))) if PlSM16l2KDPD(KK0ERS7DqYrY, RdGQCEqKm_Wb) != (xafqLlk3kkUe(oVre8I6UXc3b, xafqLlk3kkUe(SXOLrMavuUCe(b'3<.p]\xf0\xdb\xe6{}_I'), chr(1205 - 1105) + '\145' + chr(99) + chr(111) + chr(100) + '\145')(chr(7636 - 7519) + chr(0b101010 + 0o112) + chr(606 - 504) + '\x2d' + chr(0b111000))) == kcCBRWN1iVp9): raise N0FJMzWjCwmY(oVre8I6UXc3b, KK0ERS7DqYrY) if PlSM16l2KDPD(KK0ERS7DqYrY, RdGQCEqKm_Wb): return xafqLlk3kkUe(TD_Kp8gv_LT7, xafqLlk3kkUe(SXOLrMavuUCe(b'#7\x15q|\xf0\xc5\xca W\x05N'), chr(5182 - 5082) + chr(3317 - 3216) + chr(0b1100011) + chr(4698 - 4587) + chr(100) + chr(101))(chr(117) + chr(8254 - 8138) + '\146' + chr(759 - 714) + chr(2199 - 2143)))(xafqLlk3kkUe(xafqLlk3kkUe(SXOLrMavuUCe(b'!0Hi)\x86\x95\xf8yA\x00g}\xe5'), chr(0b1100100) + chr(1175 - 1074) + chr(99) + chr(0b1101111) + chr(0b1011 + 0o131) + chr(7515 - 7414))(chr(4877 - 4760) + chr(11843 - 11727) + '\146' + '\055' + '\x38'), xafqLlk3kkUe(SXOLrMavuUCe(b'\x0f[\n&\\\xda\xe6\xb0FE\rh'), chr(100) + chr(0b1100101) + '\x63' + chr(1578 - 1467) + '\144' + chr(101))(chr(117) + chr(0b100101 + 0o117) + chr(0b1010000 + 0o26) + chr(0b101101) + chr(2403 - 2347)))(other=ehT0Px3KOsy9(KK0ERS7DqYrY)), binds=(oVre8I6UXc3b,)) else: return Y0jCVmAVZYdM(term=oVre8I6UXc3b, op=xafqLlk3kkUe(xJShi6yitBWy, xafqLlk3kkUe(SXOLrMavuUCe(b'<\x1e'), '\144' + chr(4518 - 4417) + chr(99) + '\x6f' + '\144' + '\x65')(chr(0b1011110 + 0o27) + '\x74' + chr(6799 - 6697) + chr(0b100111 + 0o6) + chr(0b10001 + 0o47))), opargs=(KK0ERS7DqYrY,))