Funcat2保持与funcat兼容;Funcat 将同花顺、通达信、文华财经等的公式移植到了 Python 中。同花顺、通达信、文华财经麦语言等公式的表达十分简洁,适合做技术分析。苦于 Python 缺乏这种领域特定语言的表达能力,所以用 Python 基于 numpy 实现了一套。Funcat2增加QUANTAXIS的支持
Project description
b'# Funcat2\n\n[![PyPI](https://img.shields.io/pypi/v/funcat2.svg)](https://pypi.python.org/pypi/funcat2)\n[![PythonVersion](https://img.shields.io/pypi/pyversions/funcat2.svg)](https://pypi.python.org/pypi/funcat2)\n[![License](https://img.shields.io/pypi/l/funcat2.svg)](https://pypi.python.org/pypi/funcat2)\n\nFuncat2\xe4\xbf\x9d\xe6\x8c\x81\xe4\xb8\x8efuncat\xe5\x85\xbc\xe5\xae\xb9;\n\nFuncat \xe5\xb0\x86\xe5\x90\x8c\xe8\x8a\xb1\xe9\xa1\xba\xe3\x80\x81\xe9\x80\x9a\xe8\xbe\xbe\xe4\xbf\xa1\xe3\x80\x81\xe6\x96\x87\xe5\x8d\x8e\xe8\xb4\xa2\xe7\xbb\x8f\xe7\xad\x89\xe7\x9a\x84\xe5\x85\xac\xe5\xbc\x8f\xe7\xa7\xbb\xe6\xa4\x8d\xe5\x88\xb0\xe4\xba\x86 Python \xe4\xb8\xad\xe3\x80\x82\n\n\xe5\x90\x8c\xe8\x8a\xb1\xe9\xa1\xba\xe3\x80\x81\xe9\x80\x9a\xe8\xbe\xbe\xe4\xbf\xa1\xe3\x80\x81\xe6\x96\x87\xe5\x8d\x8e\xe8\xb4\xa2\xe7\xbb\x8f\xe9\xba\xa6\xe8\xaf\xad\xe8\xa8\x80\xe7\xad\x89\xe5\x85\xac\xe5\xbc\x8f\xe7\x9a\x84\xe8\xa1\xa8\xe8\xbe\xbe\xe5\x8d\x81\xe5\x88\x86\xe7\xae\x80\xe6\xb4\x81\xef\xbc\x8c\xe9\x80\x82\xe5\x90\x88\xe5\x81\x9a\xe6\x8a\x80\xe6\x9c\xaf\xe5\x88\x86\xe6\x9e\x90\xe3\x80\x82\n\n\xe8\x8b\xa6\xe4\xba\x8e Python \xe7\xbc\xba\xe4\xb9\x8f\xe8\xbf\x99\xe7\xa7\x8d\xe9\xa2\x86\xe5\x9f\x9f\xe7\x89\xb9\xe5\xae\x9a\xe8\xaf\xad\xe8\xa8\x80\xe7\x9a\x84\xe8\xa1\xa8\xe8\xbe\xbe\xe8\x83\xbd\xe5\x8a\x9b\xef\xbc\x8c\xe6\x89\x80\xe4\xbb\xa5\xe7\x94\xa8 Python \xe5\x9f\xba\xe4\xba\x8e numpy \xe5\xae\x9e\xe7\x8e\xb0\xe4\xba\x86\xe4\xb8\x80\xe5\xa5\x97\xe3\x80\x82\n\n* Funcat2\xe5\xa2\x9e\xe5\x8a\xa0QUANTAXIS\xe7\x9a\x84\xe6\x94\xaf\xe6\x8c\x81\n\n## \xe5\xae\x89\xe8\xa3\x85\n```bash\npip install funcat2\n# update funcat2\npip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U funcat2\n```\n\n## notebooks \xe6\x95\x99\xe7\xa8\x8b\n- [quick-start](https://github.com/pchaos/funcat2/blob/master/notebooks/funcat2-tutorial.ipynb)\n\n## API\n### \xe8\xa1\x8c\xe6\x83\x85\xe5\x8f\x98\xe9\x87\x8f\n\n- \xe5\xbc\x80\xe7\x9b\x98\xe4\xbb\xb7\xef\xbc\x9a`OPEN` `O`\n- \xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\xef\xbc\x9a`CLOSE` `C`\n- \xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\xef\xbc\x9a`HIGH` `H`\n- \xe6\x9c\x80\xe4\xbd\x8e\xe4\xbb\xb7\xef\xbc\x9a`LOW` `L`\n- \xe6\x88\x90\xe4\xba\xa4\xe9\x87\x8f\xef\xbc\x9a`VOLUME` `V` `VOL`\n\n### \xe5\xb7\xa5\xe5\x85\xb7\xe5\x87\xbd\n\n- n\xe5\xa4\xa9\xe5\x89\x8d\xe7\x9a\x84\xe6\x95\xb0\xe6\x8d\xae\xef\xbc\x9a`REF`\n``` python\nREF(C, 10) # 10\xe5\xa4\xa9\xe5\x89\x8d\xe7\x9a\x84\xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\n```\n\n- \xe9\x87\x91\xe5\x8f\x89\xe5\x88\xa4\xe6\x96\xad\xef\xbc\x9a`CROSS`\n``` python\nCROSS(MA(C, 5), MA(C, 10)) # 5\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe4\xb8\x8a\xe7\xa9\xbf10\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\n```\n\n- \xe4\xb8\xa4\xe4\xb8\xaa\xe5\xba\x8f\xe5\x88\x97\xe5\x8f\x96\xe6\x9c\x80\xe5\xb0\x8f\xe5\x80\xbc\xef\xbc\x9a`MIN`\n``` python\nMIN(O, C) # K\xe7\xba\xbf\xe5\xae\x9e\xe4\xbd\x93\xe7\x9a\x84\xe6\x9c\x80\xe4\xbd\x8e\xe4\xbb\xb7\n```\n\n- \xe4\xb8\xa4\xe4\xb8\xaa\xe5\xba\x8f\xe5\x88\x97\xe5\x8f\x96\xe6\x9c\x80\xe5\xa4\xa7\xe5\x80\xbc\xef\xbc\x9a`MAX`\n``` python\nMAX(O, C) # K\xe7\xba\xbf\xe5\xae\x9e\xe4\xbd\x93\xe7\x9a\x84\xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\n```\n\n- n\xe5\xa4\xa9\xe9\x83\xbd\xe6\xbb\xa1\xe8\xb6\xb3\xe6\x9d\xa1\xe4\xbb\xb6\xef\xbc\x9a`EVERY`\n``` python\nEVERY(C > MA(C, 5), 10) # \xe6\x9c\x80\xe8\xbf\x9110\xe5\xa4\xa9\xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\xe9\x83\xbd\xe5\xa4\xa7\xe4\xba\x8e5\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\n```\n\n- n\xe5\xa4\xa9\xe5\x86\x85\xe6\xbb\xa1\xe8\xb6\xb3\xe6\x9d\xa1\xe4\xbb\xb6\xe7\x9a\x84\xe5\xa4\xa9\xe6\x95\xb0\xef\xbc\x9a`COUNT`\n``` python\nCOUNT(C > O, 10) # \xe6\x9c\x80\xe8\xbf\x9110\xe5\xa4\xa9\xe6\x94\xb6\xe9\x98\xb3\xe7\xba\xbf\xe7\x9a\x84\xe5\xa4\xa9\xe6\x95\xb0\n```\n\n- n\xe5\xa4\xa9\xe5\x86\x85\xe6\x9c\x80\xe5\xa4\xa7\xe5\x80\xbc\xef\xbc\x9a`HHV`\n``` python\nHHV(MAX(O, C), 60) # \xe6\x9c\x80\xe8\xbf\x9160\xe5\xa4\xa9K\xe7\xba\xbf\xe5\xae\x9e\xe4\xbd\x93\xe7\x9a\x84\xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\n```\n\n- n\xe5\xa4\xa9\xe5\x86\x85\xe6\x9c\x80\xe5\xb0\x8f\xe5\x80\xbc\xef\xbc\x9a`LLV`\n``` python\nLLV(MIN(O, C), 60) # \xe6\x9c\x80\xe8\xbf\x9160\xe5\xa4\xa9K\xe7\xba\xbf\xe5\xae\x9e\xe4\xbd\x93\xe7\x9a\x84\xe6\x9c\x80\xe4\xbd\x8e\xe4\xbb\xb7\n```\n\n- \xe6\xb1\x82\xe5\x92\x8cn\xe6\x97\xa5\xe6\x95\xb0\xe6\x8d\xae `SUM`\n``` python\nSUM(C, 10) # \xe6\xb1\x82\xe5\x92\x8c10\xe5\xa4\xa9\xe7\x9a\x84\xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\n```\n\n- \xe6\xb1\x82\xe7\xbb\x9d\xe5\xaf\xb9\xe5\x80\xbc `ABS`\n``` python\nABS(C - O)\n```\n\n- \xe6\x9d\xa1\xe4\xbb\xb6 `IF`\n``` python\nIF(OPEN > CLOSE, OPEN, CLOSE)\n```\n\n### \xe6\x9d\xa1\xe4\xbb\xb6\xe3\x80\x8c\xe5\x92\x8c\xe3\x80\x8d\xe4\xb8\x8e\xe3\x80\x8c\xe6\x88\x96\xe3\x80\x8d\n\xe5\x9b\xa0\xe4\xb8\xba\xe8\xaf\xad\xe6\xb3\x95\xe7\x9a\x84\xe9\x97\xae\xe9\xa2\x98\xef\xbc\x8c\xe6\x88\x91\xe4\xbb\xac\xe9\x9c\x80\xe8\xa6\x81\xe4\xbd\xbf\xe7\x94\xa8 `&` \xe4\xbb\xa3\xe6\x9b\xbf `and` \xe3\x80\x8c\xe5\x92\x8c\xe3\x80\x8d\xef\xbc\x8c\xe7\x94\xa8 `|` \xe4\xbb\xa3\xe6\x9b\xbf `or` \xe3\x80\x8c\xe6\x88\x96\xe3\x80\x8d\xe3\x80\x82\n\n``` python\n# \xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\xe5\x9c\xa810\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe4\xb8\x8a \xe4\xb8\x94 10\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe5\x9c\xa820\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe4\xb8\x8a\n(C > MA(C, 10)) & (MA(C, 10) > MA(C, 20))\n\n# \xe6\x94\xb6\xe9\x98\xb3\xe7\xba\xbf \xe6\x88\x96 \xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\xe5\xa4\xa7\xe4\xba\x8e\xe6\x98\xa8\xe6\x94\xb6\n(C > O) | (C > REF(C, 1))\n\n```\n\n### \xe6\x8c\x87\xe6\xa0\x87\n\n- \xe5\x9d\x87\xe7\xba\xbf\xef\xbc\x9a`MA`\n``` python\nMA(C, 60) # 60\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\n```\n\n\xe5\x85\xb6\xe4\xbb\x96\xe6\x9b\xb4\xe5\xa4\x9a\xe8\xaf\xb7\xe8\xa7\x81\xef\xbc\x9a[\xe6\x8c\x87\xe6\xa0\x87\xe5\xba\x93](https://github.com/pchaos/funcat2/blob/master/funcat/indicators.py)\n\n\n\xe8\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82\n\n``` python\nN, M1, M2 = 9, 3, 3\n\nRSV = (CLOSE - LLV(LOW, N)) / (HHV(HIGH, N) - LLV(LOW, N)) * 100\nK = EMA(RSV, (M1 * 2 - 1))\nD = EMA(K, (M2 * 2 - 1))\nJ = K * 3 - D * 2\n\nprint(K, D, J)\n```\n\n[DMI\xe6\x8c\x87\xe6\xa0\x87](http://wiki.mbalib.com/wiki/DMI)\xe3\x80\x82\xe5\x8a\xa8\xe5\x90\x91\xe6\x8c\x87\xe6\x95\xb0\xe5\x8f\x88\xe5\x8f\xab\xe7\xa7\xbb\xe5\x8a\xa8\xe6\x96\xb9\xe5\x90\x91\xe6\x8c\x87\xe6\x95\xb0\xe6\x88\x96\xe8\xb6\x8b\xe5\x90\x91\xe6\x8c\x87\xe6\x95\xb0\xe3\x80\x82\xe6\x98\xaf\xe5\xb1\x9e\xe4\xba\x8e\xe8\xb6\x8b\xe5\x8a\xbf\xe5\x88\xa4\xe6\x96\xad\xe7\x9a\x84\xe6\x8a\x80\xe6\x9c\xaf\xe6\x80\xa7\xe6\x8c\x87\xe6\xa0\x87\xef\xbc\x8c\xe5\x85\xb6\xe5\x9f\xba\xe6\x9c\xac\xe5\x8e\x9f\xe7\x90\x86\xe6\x98\xaf\xe9\x80\x9a\xe8\xbf\x87\xe5\x88\x86\xe6\x9e\x90\xe8\x82\xa1\xe7\xa5\xa8\xe4\xbb\xb7\xe6\xa0\xbc\xe5\x9c\xa8\xe4\xb8\x8a\xe5\x8d\x87\xe5\x8f\x8a\xe4\xb8\x8b\xe8\xb7\x8c\xe8\xbf\x87\xe7\xa8\x8b\xe4\xb8\xad\xe4\xbe\x9b\xe9\x9c\x80\xe5\x85\xb3\xe7\xb3\xbb\xe7\x9a\x84\xe5\x9d\x87\xe8\xa1\xa1\xe7\x82\xb9\xef\xbc\x8c\xe5\x8d\xb3\xe4\xbe\x9b\xe9\x9c\x80\xe5\x85\xb3\xe7\xb3\xbb\xe5\x8f\x97\xe4\xbb\xb7\xe6\x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\x84\xe8\xae\xa1\xe7\xae\x97\xe5\x85\xac\xe5\xbc\x8f\xe4\xb8\x8d\xe4\xb8\x80\xe6\xa0\xb7\xef\xbc\x8c\xe5\xaf\xb9\xe4\xba\x8e\xe8\xbf\x99\xe7\xa7\x8d\xe6\x83\x85\xe5\x86\xb5\xef\xbc\x8c\xe6\x88\x91\xe4\xbb\xac\xe6\x8a\x8a\xe5\x90\x8c\xe8\x8a\xb1\xe9\xa1\xba\xe7\x9a\x84\xe5\x85\xac\xe5\xbc\x8f\xe6\x90\xac\xe8\xbf\x87\xe6\x9d\xa5\xef\xbc\x8c\xe5\xb0\xb1\xe5\x8f\xaf\xe4\xbb\xa5\xe7\xae\x97\xe5\x87\xba\xe5\x92\x8c\xe5\x90\x8c\xe8\x8a\xb1\xe9\xa1\xba\xe4\xb8\x80\xe6\xa0\xb7\xe7\x9a\x84\xe7\xbb\x93\xe6\x9e\x9c\xe3\x80\x82\n\n``` python\nM1, M2 = 14, 6\n\nTR = SUM(MAX(MAX(HIGH - LOW, ABS(HIGH - REF(CLOSE, 1))), ABS(LOW - REF(CLOSE, 1))), M1)\nHD = HIGH - REF(HIGH, 1)\nLD = REF(LOW, 1) - LOW\n\nDMP = SUM(IF((HD > 0) & (HD > LD), HD, 0), M1)\nDMM = SUM(IF((LD > 0) & (LD > HD), LD, 0), M1)\nDI1 = DMP * 100 / TR\nDI2 = DMM * 100 / TR\nADX = MA(ABS(DI2 - DI1) / (DI1 + DI2) * 100, M2)\nADXR = (ADX + REF(ADX, M2)) / 2\n\nprint(DI1, DI2, ADX, ADXR)\n```\n\n## \xe9\x80\x89\xe8\x82\xa1\n\n``` python\nfrom funcat import *\n\n\n# \xe9\x80\x89\xe5\x87\xba\xe6\xb6\xa8\xe5\x81\x9c\xe8\x82\xa1\nselect(\n lambda : C / C[1] - 1 >= 0.0995,\n start_date=20161231,\n\tend_date=20170104,\n)\n\n\'\'\'\n[20170104]\n20170104 000017.XSHE 000017.XSHE[\xe6\xb7\xb1\xe4\xb8\xad\xe5\x8d\x8eA]\n20170104 000026.XSHE 000026.XSHE[\xe9\xa3\x9e\xe4\xba\x9a\xe8\xbe\xbe\xef\xbc\xa1]\n20170104 000045.XSHE 000045.XSHE[\xe6\xb7\xb1\xe7\xba\xba\xe7\xbb\x87\xef\xbc\xa1]\n20170104 000585.XSHE 000585.XSHE[\xe4\xb8\x9c\xe5\x8c\x97\xe7\x94\xb5\xe6\xb0\x94]\n20170104 000595.XSHE 000595.XSHE[\xe5\xae\x9d\xe5\xa1\x94\xe5\xae\x9e\xe4\xb8\x9a]\n20170104 000678.XSHE 000678.XSHE[\xe8\xa5\x84\xe9\x98\xb3\xe8\xbd\xb4\xe6\x89\xbf]\n...\n\'\'\'\n\n\n# \xe9\x80\x89\xe5\x87\xba\xe6\x9c\x80\xe8\xbf\x9130\xe5\xa4\xa9K\xe7\xba\xbf\xe5\xae\x9e\xe4\xbd\x93\xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\xe6\x9c\x80\xe4\xbd\x8e\xe4\xbb\xb7\xe5\xb7\xae7%\xe4\xbb\xa5\xe5\x86\x85\xef\xbc\x8c\xe6\x9c\x80\xe8\xbf\x91100\xe5\xa4\xa9K\xe7\xba\xbf\xe5\xae\x9e\xe4\xbd\x93\xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\xe6\x9c\x80\xe4\xbd\x8e\xe4\xbb\xb7\xe5\xb7\xae\xe5\xa4\xa7\xe4\xba\x8e25%\xef\xbc\x8c\n# \xe6\x9c\x80\xe8\xbf\x9110\xe5\xa4\xa9\xef\xbc\x8c\xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\xe5\xa4\xa7\xe4\xba\x8e60\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe7\x9a\x84\xe5\xa4\xa9\xe6\x95\xb0\xe5\xa4\xa7\xe4\xba\x8e3\xe5\xa4\xa9\nselect(\n lambda : ((HHV(MAX(C, O), 30) / LLV(MIN(C, O), 30) - 1 < 0.07)\n & (HHV(MAX(C, O), 100) / LLV(MIN(C, O), 100) - 1 > 0.25)\n & (COUNT(C > MA(C, 60), 10) > 3)\n ),\n start_date=20161220,\n)\n\n\'\'\'\n[20170104]\n20170104 600512.XSHG 600512.XSHG[\xe8\x85\xbe\xe8\xbe\xbe\xe5\xbb\xba\xe8\xae\xbe]\n[20170103]\n[20161230]\n20161230 000513.XSHE 000513.XSHE[\xe4\xb8\xbd\xe7\x8f\xa0\xe9\x9b\x86\xe5\x9b\xa2]\n...\n\'\'\'\n\n\n# \xe9\x80\x89\xe5\x87\xba\xe6\x9c\x80\xe8\xbf\x913\xe5\xa4\xa9\xe6\xaf\x8f\xe5\xa4\xa9\xe7\x9a\x84\xe6\x88\x90\xe4\xba\xa4\xe9\x87\x8f\xe5\xb0\x8f\xe4\xba\x8e20\xe6\x97\xa5\xe6\x88\x90\xe4\xba\xa4\xe9\x87\x8f\xe5\x9d\x87\xe7\xba\xbf\xef\xbc\x8c\xe6\x9c\x80\xe8\xbf\x913\xe5\xa4\xa9\xe6\x9c\x80\xe4\xbd\x8e\xe4\xbb\xb7\xe4\xbd\x8e\xe4\xba\x8e20\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xef\xbc\x8c\xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\xe9\xab\x98\xe4\xba\x8e20\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\n# \xe8\x87\xaa\xe5\xae\x9a\xe4\xb9\x89\xe9\x80\x89\xe8\x82\xa1\xe5\x9b\x9e\xe8\xb0\x83\xe5\x87\xbd\xe6\x95\xb0\ndef callback(date, order_book_id, symbol):\n print("Cool, \xe5\x9c\xa8", date, "\xe9\x80\x89\xe5\x87\xba", order_book_id, symbol)\n\n\nselect(\n lambda : (EVERY(V < MA(V, 20) / 2, 3) & EVERY(L < MA(C, 20), 3) & EVERY(H > MA(C, 20), 3)),\n start_date=20161231,\n callback=callback,\n)\n\n\'\'\'\n[20170104]\nCool, \xe5\x9c\xa8 20170104 \xe9\x80\x89\xe5\x87\xba 002633.XSHE 002633.XSHE[\xe7\x94\xb3\xe7\xa7\x91\xe8\x82\xa1\xe4\xbb\xbd]\nCool, \xe5\x9c\xa8 20170104 \xe9\x80\x89\xe5\x87\xba 600857.XSHG 600857.XSHG[\xe5\xae\x81\xe6\xb3\xa2\xe4\xb8\xad\xe7\x99\xbe]\n...\n\'\'\'\n```\n\n## \xe5\x8d\x95\xe8\x82\xa1\xe7\xa5\xa8\xe7\xa0\x94\xe7\xa9\xb6\n``` python\nfrom funcat import *\nfrom funcat.data.tushare_backend import TushareDataBackend\n\nset_data_backend(TushareDataBackend())\n\n# \xe8\xae\xbe\xe7\xbd\xae\xe7\x9b\xae\xe5\x89\x8d\xe5\xa4\xa9\xe6\x95\xb0\xe4\xb8\xba2017\xe5\xb9\xb41\xe6\x9c\x884\xe6\x97\xa5\nT("20170104")\n# \xe8\xae\xbe\xe7\xbd\xae\xe5\x85\xb3\xe6\xb3\xa8\xe8\x82\xa1\xe7\xa5\xa8\xe4\xb8\xba\xe4\xb8\x8a\xe8\xaf\x81\xe6\x8c\x87\xe6\x95\xb0\nS("000001.XSHG")\n\n# \xe6\x89\x93\xe5\x8d\xb0 Open High Low Close\n>>> print(O, H, L, C)\n3133.79 3160.1 3130.11 3158.79\n\n# \xe5\xbd\x93\xe5\xa4\xa9\xe6\xb6\xa8\xe5\xb9\x85\n>>> C / C[1] - 1\n0.0072929156356\n\n# \xe6\x89\x93\xe5\x8d\xb060\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\n>>> MA(C, 60)\n3154.78333333\n\n# \xe5\x88\xa4\xe6\x96\xad\xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7\xe6\x98\xaf\xe5\x90\xa6\xe5\xa4\xa7\xe4\xba\x8e60\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\n>>> C > MA(C, 60)\nTrue\n\n# 30\xe6\x97\xa5\xe6\x9c\x80\xe9\xab\x98\xe4\xbb\xb7\n>>> HHV(H, 30)\n3301.21\n\n# \xe6\x9c\x80\xe8\xbf\x9130\xe6\x97\xa5\xef\xbc\x8c\xe6\x94\xb6\xe7\x9b\x98\xe4\xbb\xb7 Close \xe5\xa4\xa7\xe4\xba\x8e60\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe7\x9a\x84\xe5\xa4\xa9\xe6\x95\xb0\n>>> COUNT(C > MA(C, 60), 30)\n17\n\n# 10\xe6\x97\xa5\xe5\x9d\x87\xe7\xba\xbf\xe4\xb8\x8a\xe7\xa9\xbf\n>>> CROSS(MA(C, 10), MA(C, 20))\nFalse\n```\n\n## DataBackend\n* \xe9\xbb\x98\xe8\xae\xa4\xe5\xae\x9e\xe7\x8e\xb0\xe4\xba\x86\xe4\xb8\x80\xe4\xb8\xaa\xe4\xbb\x8e tushare \xe4\xb8\x8a\xe9\x9d\xa2\xe5\xae\x9e\xe6\x97\xb6\xe6\x8b\x89\xe6\x95\xb0\xe6\x8d\xae\xe9\x80\x89\xe8\x82\xa1\xe7\x9a\x84 Backend\xe3\x80\x82\n\n* [RQAlpha](https://github.com/ricequant/rqalpha) \xe7\x9a\x84 Backend\xef\xbc\x8c\xe4\xbd\xbf\xe7\x94\xa8\xe5\xae\x83\xe5\x8f\xaf\xe4\xbb\xa5\xe4\xb8\xba\xe6\x88\x91\xe4\xbb\xac\xe6\x8f\x90\xe4\xbe\x9b\xe6\x9c\xac\xe5\x9c\xb0\xe7\x9a\x84\xe6\x95\xb0\xe6\x8d\xae\xe6\xba\x90\xef\xbc\x8c\xe6\xaf\x94\xe4\xbb\x8e tushare \xe6\x8b\x89\xe6\x95\xb0\xe6\x8d\xae\xe9\x80\x9f\xe5\xba\xa6\xe6\x9b\xb4\xe6\x9c\x89\xe4\xbc\x98\xe5\x8a\xbf\xe3\x80\x82\n\n``` bash\npip install rqalpha # \xe5\xae\x89\xe8\xa3\x85\xe4\xbe\x9d\xe8\xb5\x96\xe5\xba\x93 RQAlpha\nrqalpha update_bundle # \xe6\x9b\xb4\xe6\x96\xb0\xe6\x95\xb0\xe6\x8d\xae\n```\n\n\xe6\x9b\xbf\xe6\x8d\xa2 DataBackend \xe4\xb8\xba RQAlpha \xe7\x9a\x84 DataProxy\xef\xbc\x8c\xe8\xbf\x99\xe6\xa0\xb7\xe5\x8f\xaf\xe4\xbb\xa5\xe4\xbb\x8e RQAlpha \xe7\x9a\x84 bundle \xe4\xb8\xad\xe8\x8e\xb7\xe5\x8f\x96\xe6\x95\xb0\xe6\x8d\xae\xe3\x80\x82\n\n``` python\nfrom funcat.data.rqalpha_data_backend import RQAlphaDataBackend\nfrom funcat import *\n\nset_data_backend(RQAlphaDataBackend("~/.rqalpha/bundle"))\n```\n* [QUANTAXIS](https://github.com/QUANTAXIS/QUANTAXIS) \xe7\x9a\x84Backend\xe3\x80\x82\n\xe6\x9b\xbf\xe6\x8d\xa2 DataBackend \xe4\xb8\xba QUANTAXIS \xe7\x9a\x84 DataProxy\xef\xbc\x8c\xe8\xbf\x99\xe6\xa0\xb7\xe5\x8f\xaf\xe4\xbb\xa5\xe4\xbb\x8e QUANTAXIS \xe4\xb8\xad\xe8\x8e\xb7\xe5\x8f\x96\xe6\x95\xb0\xe6\x8d\xae\xe3\x80\x82\n\n``` python\nfrom funcat.data.quantaxis_backend import QuantaxisDataBackend as BACKEND\nfrom funcat import *\n\nset_data_backend(BACKEND())\n```\n\xe4\xb8\xba\xe4\xba\x86\xe6\x9b\xb4\xe9\xab\x98\xe7\x9a\x84\xe6\x80\xa7\xe8\x83\xbd\xef\xbc\x8c\xe6\x82\xa8\xe4\xb9\x9f\xe5\x8f\xaf\xe4\xbb\xa5\xe8\x87\xaa\xe5\xae\x9a\xe4\xb9\x89Backend\xe4\xbd\xbf\xe7\x94\xa8\xe6\x9c\xac\xe5\x9c\xb0\xe6\x95\xb0\xe6\x8d\xae\xe3\x80\x82\xe8\xbf\x99\xe6\xa0\xb7\xe5\x8f\xaf\xe4\xbb\xa5\xe6\x9e\x81\xe5\xa4\xa7\xe5\x9c\xb0\xe6\x8f\x90\xe9\xab\x98\xe8\xbf\x90\xe8\xa1\x8c\xe9\x80\x9f\xe5\xba\xa6\xe3\x80\x82\n\n## git\xe5\xbc\x80\xe5\x8f\x91\xe6\xb5\x81\xe7\xa8\x8b\xef\xbc\x9a\n### \xe5\xbc\x80\xe5\x8f\x91\xe5\x88\x86\xe6\x94\xaf\n```bash\ngit clone https://github.com/pchaos/funcat2.git\ncd funcat2\npip install QUANTAXIS\ngit chechkout dev \n# ... do your self\n```\n### \xe6\x8f\x90\xe4\xba\xa4\xe5\xbc\x80\xe5\x8f\x91\xe5\x88\xb0master\xe5\x88\x86\xe6\x94\xaf\n```bash\ngit checkout master\ngit merge dev\ngit push\ngit checkout dev\n\n# \xe4\xb8\x80\xe5\x8f\xa5\xe8\xaf\x9d\xe6\x89\xa7\xe8\xa1\x8c\ngit push && git checkout master && git merge dev && git push && git checkout dev\n```\n### \xe4\xb8\x8d\xe7\x94\xa8\xe6\xaf\x8f\xe6\xac\xa1\xe8\xbe\x93\xe5\x85\xa5\xe5\xaf\x86\xe7\xa0\x81\xef\xbc\x8c\xe8\xae\xbe\xe7\xbd\xaehttps\xe4\xb8\xbassh\xe7\x99\xbb\xe5\xbd\x95\n> git remote set-url origin git@github.com:pchaos/funcat2.git\n\n* PS\xef\xbc\x9a\xe4\xb8\x8a\xe9\x9d\xa2\xe7\x9a\x84\xe2\x80\x9cpchaos\xe2\x80\x9d\xe4\xbd\xbf\xe7\x94\xa8\xe4\xbd\xa0\xe7\x9a\x84\xe7\x94\xa8\xe6\x88\xb7\xe5\x90\x8d'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
funcat2-0.4.4a0-py3-none-any.whl
(91.5 kB
view hashes)
Close
Hashes for funcat2-0.4.4a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0093fffd217b4181896d13901ac076072bff8e173bac472e555466db6a6d9de1 |
|
MD5 | aff03d38a15d4af40eab833a2d88652e |
|
BLAKE2b-256 | 19b8ebb1e7eb0cfc27c41edac1608987ae22dc25730e030e8c493d05ed1b3a09 |
Close
Hashes for funcat2-0.4.4a0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320bbbf2f4dd154e3c4aa5ce171b8695164cfbd8b55e3ee3c09eab1c1795f2e7 |
|
MD5 | 8c987c391755db6d375c76e96897f0ef |
|
BLAKE2b-256 | e2fc432dcd78d66ff16065eb41fbeea08fa6cd4792693f623c16dc328d82f54a |