pydsxkline


Namepydsxkline JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://github.com/dsxkline/dsxkline_python
Summarypydsxkline是一个有趣的python包,一行代码即可显示K线图,主要应用于股票金融量化领域,当您想要把股票数据图形化的时候,可以试试这个小工具,希望能帮到有需要的朋友。
upload_time2023-04-02 02:57:46
maintainer
docs_urlNone
authorfangyunsm
requires_python>=3.6,<4
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pydsxkline

pydsxkline是一个有趣的python包,一行代码即可显示K线图,主要应用于股票金融量化领域,当您想要把股票数据图形化的时候,可以试试这个小工具,希望能帮到有需要的朋友。

pydsxkline基于dsxkline进行封装,具体的接口可以查看官网 http://www.dsxkline.com

![PyPI](https://img.shields.io/pypi/v/pydsxkline?color=0&label=pypi%20pydsxkline) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydsxkline?color=0) ![PyPI - Downloads](https://img.shields.io/pypi/dm/pydsxkline) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/dsxkline/dsxkline_python)

# 预览

<img width="600" alt="WechatIMG548" src="https://user-images.githubusercontent.com/105279193/211977193-cae8cb52-fcb6-4d95-b812-c07b157d91e7.png">

# Getting started

### Install

``` bash
pip install pydsxkline
```

- Currently only python version 3.8 or older supported 

### Hello world
``` python
from pydsxkline.dsxkline import DsxKline
DsxKline.show("sh000001","上证指数")
```
### 分时图
``` python
DsxKline.show("sh000001","上证指数",CycleType.t)
```
<img width="600" alt="WechatIMG549" src="https://user-images.githubusercontent.com/105279193/212050752-c76aabbd-b909-470f-bad4-d68f5c2a2cb1.png">

### 五日图
``` python
# 五日图
DsxKline.show("sh000001","上证指数",CycleType.t5)
```
<img width="600" alt="WechatIMG550" src="https://user-images.githubusercontent.com/105279193/212050872-06e0bf47-8920-43e4-a70d-24013908bd2c.png">

### 日K
``` python
DsxKline.show("sh000001","上证指数",CycleType.day)
```

### 周K
``` python
DsxKline.show("sh000001","上证指数",CycleType.week)
```


### 月K
``` python
DsxKline.show("sh000001","上证指数",CycleType.month)
```

### 年K
``` python
DsxKline.show("sh000001","上证指数",CycleType.year)
```

### 1分钟k线
``` python
DsxKline.show("sh000001","上证指数",CycleType.m1)
```

### 自定义
``` python
DsxKline.show("sh000001","上证指数",CycleType.day,FqType.qfq,theme=DsxThemeName.white,sides["VOL","MACD","KDJ","RSI","WR","CCI","PSY","BIAS"],height=1600)
```



### 加载本地数据
``` python
# 日线数据
datas = [
    "20210915,3651.16,3677.53,3638.32,3656.22,474970001.00,60423154.41",
    "20210916,3664.84,3677.92,3606.73,3607.09,546741474.00,67395534.04",
    "20210917,3595.27,3620.96,3569.27,3613.97,516850210.00,62883439.43",
    "20210922,3563.21,3629.45,3560.50,3628.49,472296053.00,55987472.96",
    "20210923,3651.27,3670.95,3632.28,3642.22,534995486.00,63321892.91",
    "20210924,3637.87,3651.43,3607.79,3613.07,507304772.00,60678860.91",
    ...
]

DsxKline.show("sh000001","上证指数",datas=datas,enable_data_api=False,cycle=CycleType.day)
```

### 画买卖点
```python
def draw_event():
        return [
        DsxKline.draw_cycle_with_date("20230313","买","red","#ffffff"),
        DsxKline.draw_cycle_with_date("20221129","卖","green","#ffffff",12.99),
        DsxKline.draw_cycle_with_date("202303241104","买","red","#ffffff")
        ]
DsxKline.show("sh000001","上证指数",CycleType.day,draw_event=draw_event(),main=["SAR"]) 
```

### 自定义头部HTML
```python
header = """
    <h1 style="color:#fff;text-align:center;font-size:20px;line-height:50px;border-bottom:1px solid #191b28">这是一个大师兄线图 pydsxkline </h1>
    <ul class="mycss">
        <li><span>累计收益率:</span><b>30.6%</b></li>
        <li><span>年化收益率:</span><b>80.6%</b></li>
        <li><span>夏普比率:</span><b>0.35</b></li>
        <li><span>盈亏比:</span><b>1.2</b></li>
        <li><span>胜率:</span><b>67.6%</b></li>
        <li><span>最大回撤:</span><b>30.6%</b></li>
        <li><span>最大收益率:</span><b>10.6%</b></li>
        <li><span>最小收益率:</span><b>-8.6%</b></li>
        <li><span>总资产:</span><b>240098.9 元</b></li>
        <li><span>盈利:</span><b>20366 元</b></li>
        <li><span>亏损:</span><b>-90880 元</b></li>
    </ul>
    <style>
        .mycss{
            list-style:none;
            padding:10px 20px;
            color:#c5cbc0;
            font-size:14px;
        }
        .mycss li{
            float:left;
            width:25%;
            padding:5px 0;
        }
        .mycss li span{
            color:#c5cbce;
        }
    </style>
"""
DsxKline.show("sh000001","上证指数",CycleType.day,header_html=header,header_height=160)
```

<img width="600" alt="image" src="https://user-images.githubusercontent.com/105279193/227477956-1a5ebc76-12de-4937-883a-0131dcc01c86.png">

### 自定义指标数据
```python
# 自定义指标数据
# 这个要准备跟K线数据一一对应的指标数据
# 指标名称
name1 = "MYMA"
def _install_js():
    # 指标值名称 MA10,line 画折线,颜色 #ff0000
    _model = [DrawModel("MA10","line","#ff0000")]
    # 支持蜡烛图
    _chartType = [ChartType.candle]
    # 副图 sides 或者主图 main 或者两者
    _location = ["sides"]
    # 指标数据
    _datas = []
    # 这里模拟计算一个均线指标
    N = 10
    # 获取K线数据
    klines = get_datas()
    for i in range(len(klines)):
        if i>=N:
            amount = 0
            for j in range(max(0,i-N+1),i+1):
                subitem = klines[j]
                subobj = subitem.split(",")
                close = float(subobj[4])
                amount += close
            MA10 = amount / N
            _datas.append({"MA10":MA10})
        else:
            _datas.append({"MA10":None})
    
    # 生成js 
    install_js = DsxKline.get_install_index_js(name1,_model,_chartType,_location,_datas)
    return install_js

DsxKline.show("sh000001","上证指数",CycleType.day,main=["SAR"],sides=[name1,"VOL","MACD","KDJ"],datas=get_datas(),enable_data_api=False,install_index_js=_install_js())
```

### 自定义指标算法
自定义指标算法比较麻烦,因为js引擎只能执行js代码,所以指标算法需要用js代码来写
```python
# 自定义指标算法,这个比较麻烦,算法需要用js来写
name2 = "MYMAMA"
def _create_index_js():
    # 指标值名称 MA10,line 画折线,颜色 #ff0000
    _model = [
        DrawModel("MA10","line","#ff0000"),
        DrawModel("MA30","line","#ffff00")
    ]
    # 支持蜡烛图
    _chartType = [ChartType.candle]
    # 副图 sides 或者主图 main 或者两者
    _location = ["sides"]
    # 指标算法帧函数
    _func = """
    // 这里写js函数代码
    var _name2 = "%s";
    var _func = function(){
        
        // 取得当前坐标数据
        var item = this.datas[this.day];
        // 初始化指标
        if (item.ZHIBIAO[_name2] == null)
            item.ZHIBIAO[_name2] = {
            };
        // 开始计算指标值,这里我们计算个均线指标吧
        var N = 10;
        if(this.day<N) {
            item.ZHIBIAO[_name2]["MA10"] = null;
            item.ZHIBIAO[_name2]["MA30"] = null;
            return;
        }
        var amount = 0;
        for(var i=Math.max(this.day-N+1,0);i<=this.day;i++){
            var subitem = this.datas[i];
            amount += subitem.CLOSE;
        }
        var MA10 = amount / N;
        item.ZHIBIAO[_name2]["MA10"] = MA10;
        N = 30;
        if(this.day<N) {
            item.ZHIBIAO[_name2]["MA30"] = null;
            return;
        }
        amount = 0;
        for(var i=Math.max(this.day-N+1,0);i<=this.day;i++){
            var subitem = this.datas[i];
            // 这里模型数据里有K线所有的字段值可以引用
            amount += subitem.CLOSE;
        }
        var MA30 = amount / N;
        // 保存指标值
        item.ZHIBIAO[_name2]["MA30"] = MA30;
    }
    """ % name2
    # 生成js 
    create_js = DsxKline.get_create_index_js(name2,_model,_chartType,_location,_func)
    return create_js

DsxKline.show("sh000001","上证指数",CycleType.day,main=["SAR"],sides=[name2,"VOL","MACD","KDJ"],create_index_js=_create_index_js())
```
<img width="600" alt="image" src="https://user-images.githubusercontent.com/105279193/229328387-2d3543c3-94e9-4b8a-8bd1-900bc6a30da8.png">

### 参数属性
- 详细的文档可参考:http://www.dsxkline.com
``` python
    # 名称
    name = ""
    # 证券代码
    symbol = ""
    # 昨日收盘价
    last_close = 0
    # 宽
    width = 800
    # 高
    height = 600
    # 图表类型
    chartType = ChartType.timeSharing
    # 周期类型
    cycle = CycleType.t
    # 复权类型
    fq = FqType.default
    # 主题
    theme = DsxThemeName.dark
    # 主图指标
    main = ["MA"]
    # 副图指标
    sides = ["VOL","MACD","RSI"]
    # 数据
    datas = []
    # 每页请求数据大小
    page_size = 320
    # 页码
    page = 1
    # 十字线回调
    on_crossing = None
    # 更新完成
    update_complate = None
    # 副图高度
    side_height = 80
    # 底部间距
    padding_bottom = 10
    # 蜡烛图类型 默认空心
    candel_type = CandleType.hollow
    # 缩放类型 默认固定左边进行缩放
    zoom_lock_type = ZoomLockType.right
    # 是否显示提示面板,十字线移动的时候显示的详情面板
    is_show_kline_tip_pannel = True
    # 自动适配,k线图根据父窗口的大小自动调整
    autosize = False
    # 是否启用内置行情数据接口,当使用本地数据的时候请关闭设置为 false
    enable_data_api = True
    # debug
    debug = False
    # 画图事件集合
    draw_event = None
    # 头部html
    header_html = None
    # 头部高度
    header_height = 0
    # 安装自定义指标数据
    install_index_js = install_index_js
    # 创建自定义指标算法js代码
    create_index_js = create_index_js
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dsxkline/dsxkline_python",
    "name": "pydsxkline",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4",
    "maintainer_email": "",
    "keywords": "",
    "author": "fangyunsm",
    "author_email": "fangyunsm <934476300@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/44/df/3c0d2ae66cc798590937872dd3204d730aeb0e8ef348173f7d75db45af7e/pydsxkline-1.2.1.tar.gz",
    "platform": null,
    "description": "# pydsxkline\n\npydsxkline\u662f\u4e00\u4e2a\u6709\u8da3\u7684python\u5305\uff0c\u4e00\u884c\u4ee3\u7801\u5373\u53ef\u663e\u793aK\u7ebf\u56fe\uff0c\u4e3b\u8981\u5e94\u7528\u4e8e\u80a1\u7968\u91d1\u878d\u91cf\u5316\u9886\u57df\uff0c\u5f53\u60a8\u60f3\u8981\u628a\u80a1\u7968\u6570\u636e\u56fe\u5f62\u5316\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u8fd9\u4e2a\u5c0f\u5de5\u5177\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u6709\u9700\u8981\u7684\u670b\u53cb\u3002\n\npydsxkline\u57fa\u4e8edsxkline\u8fdb\u884c\u5c01\u88c5,\u5177\u4f53\u7684\u63a5\u53e3\u53ef\u4ee5\u67e5\u770b\u5b98\u7f51 http://www.dsxkline.com\n\n![PyPI](https://img.shields.io/pypi/v/pydsxkline?color=0&label=pypi%20pydsxkline) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydsxkline?color=0) ![PyPI - Downloads](https://img.shields.io/pypi/dm/pydsxkline) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/dsxkline/dsxkline_python)\n\n# \u9884\u89c8\n\n<img width=\"600\" alt=\"WechatIMG548\" src=\"https://user-images.githubusercontent.com/105279193/211977193-cae8cb52-fcb6-4d95-b812-c07b157d91e7.png\">\n\n# Getting started\n\n### Install\n\n``` bash\npip install pydsxkline\n```\n\n- Currently only python version 3.8 or older supported \n\n### Hello world\n``` python\nfrom pydsxkline.dsxkline import DsxKline\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\")\n```\n### \u5206\u65f6\u56fe\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.t)\n```\n<img width=\"600\" alt=\"WechatIMG549\" src=\"https://user-images.githubusercontent.com/105279193/212050752-c76aabbd-b909-470f-bad4-d68f5c2a2cb1.png\">\n\n### \u4e94\u65e5\u56fe\n``` python\n# \u4e94\u65e5\u56fe\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.t5)\n```\n<img width=\"600\" alt=\"WechatIMG550\" src=\"https://user-images.githubusercontent.com/105279193/212050872-06e0bf47-8920-43e4-a70d-24013908bd2c.png\">\n\n### \u65e5K\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.day)\n```\n\n### \u5468K\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.week)\n```\n\n\n### \u6708K\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.month)\n```\n\n### \u5e74K\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.year)\n```\n\n### 1\u5206\u949fk\u7ebf\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.m1)\n```\n\n### \u81ea\u5b9a\u4e49\n``` python\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.day,FqType.qfq,theme=DsxThemeName.white,sides[\"VOL\",\"MACD\",\"KDJ\",\"RSI\",\"WR\",\"CCI\",\"PSY\",\"BIAS\"],height=1600)\n```\n\n\n\n### \u52a0\u8f7d\u672c\u5730\u6570\u636e\n``` python\n# \u65e5\u7ebf\u6570\u636e\ndatas = [\n    \"20210915,3651.16,3677.53,3638.32,3656.22,474970001.00,60423154.41\",\n    \"20210916,3664.84,3677.92,3606.73,3607.09,546741474.00,67395534.04\",\n    \"20210917,3595.27,3620.96,3569.27,3613.97,516850210.00,62883439.43\",\n    \"20210922,3563.21,3629.45,3560.50,3628.49,472296053.00,55987472.96\",\n    \"20210923,3651.27,3670.95,3632.28,3642.22,534995486.00,63321892.91\",\n    \"20210924,3637.87,3651.43,3607.79,3613.07,507304772.00,60678860.91\",\n    ...\n]\n\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",datas=datas,enable_data_api=False,cycle=CycleType.day)\n```\n\n### \u753b\u4e70\u5356\u70b9\n```python\ndef draw_event():\n        return [\n        DsxKline.draw_cycle_with_date(\"20230313\",\"\u4e70\",\"red\",\"#ffffff\"),\n        DsxKline.draw_cycle_with_date(\"20221129\",\"\u5356\",\"green\",\"#ffffff\",12.99),\n        DsxKline.draw_cycle_with_date(\"202303241104\",\"\u4e70\",\"red\",\"#ffffff\")\n        ]\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.day,draw_event=draw_event(),main=[\"SAR\"]) \n```\n\n### \u81ea\u5b9a\u4e49\u5934\u90e8HTML\n```python\nheader = \"\"\"\n    <h1 style=\"color:#fff;text-align:center;font-size:20px;line-height:50px;border-bottom:1px solid #191b28\">\u8fd9\u662f\u4e00\u4e2a\u5927\u5e08\u5144\u7ebf\u56fe pydsxkline </h1>\n    <ul class=\"mycss\">\n        <li><span>\u7d2f\u8ba1\u6536\u76ca\u7387\uff1a</span><b>30.6%</b></li>\n        <li><span>\u5e74\u5316\u6536\u76ca\u7387\uff1a</span><b>80.6%</b></li>\n        <li><span>\u590f\u666e\u6bd4\u7387\uff1a</span><b>0.35</b></li>\n        <li><span>\u76c8\u4e8f\u6bd4\uff1a</span><b>1.2</b></li>\n        <li><span>\u80dc\u7387\uff1a</span><b>67.6%</b></li>\n        <li><span>\u6700\u5927\u56de\u64a4\uff1a</span><b>30.6%</b></li>\n        <li><span>\u6700\u5927\u6536\u76ca\u7387\uff1a</span><b>10.6%</b></li>\n        <li><span>\u6700\u5c0f\u6536\u76ca\u7387\uff1a</span><b>-8.6%</b></li>\n        <li><span>\u603b\u8d44\u4ea7\uff1a</span><b>240098.9 \u5143</b></li>\n        <li><span>\u76c8\u5229\uff1a</span><b>20366 \u5143</b></li>\n        <li><span>\u4e8f\u635f\uff1a</span><b>-90880 \u5143</b></li>\n    </ul>\n    <style>\n        .mycss{\n            list-style:none;\n            padding:10px 20px;\n            color:#c5cbc0;\n            font-size:14px;\n        }\n        .mycss li{\n            float:left;\n            width:25%;\n            padding:5px 0;\n        }\n        .mycss li span{\n            color:#c5cbce;\n        }\n    </style>\n\"\"\"\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.day,header_html=header,header_height=160)\n```\n\n<img width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/105279193/227477956-1a5ebc76-12de-4937-883a-0131dcc01c86.png\">\n\n### \u81ea\u5b9a\u4e49\u6307\u6807\u6570\u636e\n```python\n# \u81ea\u5b9a\u4e49\u6307\u6807\u6570\u636e\n# \u8fd9\u4e2a\u8981\u51c6\u5907\u8ddfK\u7ebf\u6570\u636e\u4e00\u4e00\u5bf9\u5e94\u7684\u6307\u6807\u6570\u636e\n# \u6307\u6807\u540d\u79f0\nname1 = \"MYMA\"\ndef _install_js():\n    # \u6307\u6807\u503c\u540d\u79f0 MA10\uff0cline \u753b\u6298\u7ebf\uff0c\u989c\u8272 #ff0000\n    _model = [DrawModel(\"MA10\",\"line\",\"#ff0000\")]\n    # \u652f\u6301\u8721\u70db\u56fe\n    _chartType = [ChartType.candle]\n    # \u526f\u56fe sides \u6216\u8005\u4e3b\u56fe main \u6216\u8005\u4e24\u8005\n    _location = [\"sides\"]\n    # \u6307\u6807\u6570\u636e\n    _datas = []\n    # \u8fd9\u91cc\u6a21\u62df\u8ba1\u7b97\u4e00\u4e2a\u5747\u7ebf\u6307\u6807\n    N = 10\n    # \u83b7\u53d6K\u7ebf\u6570\u636e\n    klines = get_datas()\n    for i in range(len(klines)):\n        if i>=N:\n            amount = 0\n            for j in range(max(0,i-N+1),i+1):\n                subitem = klines[j]\n                subobj = subitem.split(\",\")\n                close = float(subobj[4])\n                amount += close\n            MA10 = amount / N\n            _datas.append({\"MA10\":MA10})\n        else:\n            _datas.append({\"MA10\":None})\n    \n    # \u751f\u6210js \n    install_js = DsxKline.get_install_index_js(name1,_model,_chartType,_location,_datas)\n    return install_js\n\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.day,main=[\"SAR\"],sides=[name1,\"VOL\",\"MACD\",\"KDJ\"],datas=get_datas(),enable_data_api=False,install_index_js=_install_js())\n```\n\n### \u81ea\u5b9a\u4e49\u6307\u6807\u7b97\u6cd5\n\u81ea\u5b9a\u4e49\u6307\u6807\u7b97\u6cd5\u6bd4\u8f83\u9ebb\u70e6\uff0c\u56e0\u4e3ajs\u5f15\u64ce\u53ea\u80fd\u6267\u884cjs\u4ee3\u7801\uff0c\u6240\u4ee5\u6307\u6807\u7b97\u6cd5\u9700\u8981\u7528js\u4ee3\u7801\u6765\u5199\n```python\n# \u81ea\u5b9a\u4e49\u6307\u6807\u7b97\u6cd5\uff0c\u8fd9\u4e2a\u6bd4\u8f83\u9ebb\u70e6\uff0c\u7b97\u6cd5\u9700\u8981\u7528js\u6765\u5199\nname2 = \"MYMAMA\"\ndef _create_index_js():\n    # \u6307\u6807\u503c\u540d\u79f0 MA10\uff0cline \u753b\u6298\u7ebf\uff0c\u989c\u8272 #ff0000\n    _model = [\n        DrawModel(\"MA10\",\"line\",\"#ff0000\"),\n        DrawModel(\"MA30\",\"line\",\"#ffff00\")\n    ]\n    # \u652f\u6301\u8721\u70db\u56fe\n    _chartType = [ChartType.candle]\n    # \u526f\u56fe sides \u6216\u8005\u4e3b\u56fe main \u6216\u8005\u4e24\u8005\n    _location = [\"sides\"]\n    # \u6307\u6807\u7b97\u6cd5\u5e27\u51fd\u6570\n    _func = \"\"\"\n    // \u8fd9\u91cc\u5199js\u51fd\u6570\u4ee3\u7801\n    var _name2 = \"%s\";\n    var _func = function(){\n        \n        // \u53d6\u5f97\u5f53\u524d\u5750\u6807\u6570\u636e\n        var item = this.datas[this.day];\n        // \u521d\u59cb\u5316\u6307\u6807\n        if (item.ZHIBIAO[_name2] == null)\n            item.ZHIBIAO[_name2] = {\n            };\n        // \u5f00\u59cb\u8ba1\u7b97\u6307\u6807\u503c\uff0c\u8fd9\u91cc\u6211\u4eec\u8ba1\u7b97\u4e2a\u5747\u7ebf\u6307\u6807\u5427\n        var N = 10;\n        if(this.day<N) {\n            item.ZHIBIAO[_name2][\"MA10\"] = null;\n            item.ZHIBIAO[_name2][\"MA30\"] = null;\n            return;\n        }\n        var amount = 0;\n        for(var i=Math.max(this.day-N+1,0);i<=this.day;i++){\n            var subitem = this.datas[i];\n            amount += subitem.CLOSE;\n        }\n        var MA10 = amount / N;\n        item.ZHIBIAO[_name2][\"MA10\"] = MA10;\n        N = 30;\n        if(this.day<N) {\n            item.ZHIBIAO[_name2][\"MA30\"] = null;\n            return;\n        }\n        amount = 0;\n        for(var i=Math.max(this.day-N+1,0);i<=this.day;i++){\n            var subitem = this.datas[i];\n            // \u8fd9\u91cc\u6a21\u578b\u6570\u636e\u91cc\u6709K\u7ebf\u6240\u6709\u7684\u5b57\u6bb5\u503c\u53ef\u4ee5\u5f15\u7528\n            amount += subitem.CLOSE;\n        }\n        var MA30 = amount / N;\n        // \u4fdd\u5b58\u6307\u6807\u503c\n        item.ZHIBIAO[_name2][\"MA30\"] = MA30;\n    }\n    \"\"\" % name2\n    # \u751f\u6210js \n    create_js = DsxKline.get_create_index_js(name2,_model,_chartType,_location,_func)\n    return create_js\n\nDsxKline.show(\"sh000001\",\"\u4e0a\u8bc1\u6307\u6570\",CycleType.day,main=[\"SAR\"],sides=[name2,\"VOL\",\"MACD\",\"KDJ\"],create_index_js=_create_index_js())\n```\n<img width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/105279193/229328387-2d3543c3-94e9-4b8a-8bd1-900bc6a30da8.png\">\n\n### \u53c2\u6570\u5c5e\u6027\n- \u8be6\u7ec6\u7684\u6587\u6863\u53ef\u53c2\u8003\uff1ahttp://www.dsxkline.com\n``` python\n    # \u540d\u79f0\n    name = \"\"\n    # \u8bc1\u5238\u4ee3\u7801\n    symbol = \"\"\n    # \u6628\u65e5\u6536\u76d8\u4ef7\n    last_close = 0\n    # \u5bbd\n    width = 800\n    # \u9ad8\n    height = 600\n    # \u56fe\u8868\u7c7b\u578b\n    chartType = ChartType.timeSharing\n    # \u5468\u671f\u7c7b\u578b\n    cycle = CycleType.t\n    # \u590d\u6743\u7c7b\u578b\n    fq = FqType.default\n    # \u4e3b\u9898\n    theme = DsxThemeName.dark\n    # \u4e3b\u56fe\u6307\u6807\n    main = [\"MA\"]\n    # \u526f\u56fe\u6307\u6807\n    sides = [\"VOL\",\"MACD\",\"RSI\"]\n    # \u6570\u636e\n    datas = []\n    # \u6bcf\u9875\u8bf7\u6c42\u6570\u636e\u5927\u5c0f\n    page_size = 320\n    # \u9875\u7801\n    page = 1\n    # \u5341\u5b57\u7ebf\u56de\u8c03\n    on_crossing = None\n    # \u66f4\u65b0\u5b8c\u6210\n    update_complate = None\n    # \u526f\u56fe\u9ad8\u5ea6\n    side_height = 80\n    # \u5e95\u90e8\u95f4\u8ddd\n    padding_bottom = 10\n    # \u8721\u70db\u56fe\u7c7b\u578b \u9ed8\u8ba4\u7a7a\u5fc3\n    candel_type = CandleType.hollow\n    # \u7f29\u653e\u7c7b\u578b \u9ed8\u8ba4\u56fa\u5b9a\u5de6\u8fb9\u8fdb\u884c\u7f29\u653e\n    zoom_lock_type = ZoomLockType.right\n    # \u662f\u5426\u663e\u793a\u63d0\u793a\u9762\u677f\uff0c\u5341\u5b57\u7ebf\u79fb\u52a8\u7684\u65f6\u5019\u663e\u793a\u7684\u8be6\u60c5\u9762\u677f\n    is_show_kline_tip_pannel = True\n    # \u81ea\u52a8\u9002\u914d\uff0ck\u7ebf\u56fe\u6839\u636e\u7236\u7a97\u53e3\u7684\u5927\u5c0f\u81ea\u52a8\u8c03\u6574\n    autosize = False\n    # \u662f\u5426\u542f\u7528\u5185\u7f6e\u884c\u60c5\u6570\u636e\u63a5\u53e3\uff0c\u5f53\u4f7f\u7528\u672c\u5730\u6570\u636e\u7684\u65f6\u5019\u8bf7\u5173\u95ed\u8bbe\u7f6e\u4e3a false\n    enable_data_api = True\n    # debug\n    debug = False\n    # \u753b\u56fe\u4e8b\u4ef6\u96c6\u5408\n    draw_event = None\n    # \u5934\u90e8html\n    header_html = None\n    # \u5934\u90e8\u9ad8\u5ea6\n    header_height = 0\n    # \u5b89\u88c5\u81ea\u5b9a\u4e49\u6307\u6807\u6570\u636e\n    install_index_js = install_index_js\n    # \u521b\u5efa\u81ea\u5b9a\u4e49\u6307\u6807\u7b97\u6cd5js\u4ee3\u7801\n    create_index_js = create_index_js\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "pydsxkline\u662f\u4e00\u4e2a\u6709\u8da3\u7684python\u5305\uff0c\u4e00\u884c\u4ee3\u7801\u5373\u53ef\u663e\u793aK\u7ebf\u56fe\uff0c\u4e3b\u8981\u5e94\u7528\u4e8e\u80a1\u7968\u91d1\u878d\u91cf\u5316\u9886\u57df\uff0c\u5f53\u60a8\u60f3\u8981\u628a\u80a1\u7968\u6570\u636e\u56fe\u5f62\u5316\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u8fd9\u4e2a\u5c0f\u5de5\u5177\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u6709\u9700\u8981\u7684\u670b\u53cb\u3002",
    "version": "1.2.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b0a407f693eef242bbf6c9e0b25be734740fe0e528044b351bd2367ae88f7984",
                "md5": "d79f7426f19a43197ed1312b92ccb4f5",
                "sha256": "a7521edeff07bd3b665a72b5f5e3872290fa92e8ea7be1239f720a4119edac96"
            },
            "downloads": -1,
            "filename": "pydsxkline-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d79f7426f19a43197ed1312b92ccb4f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4",
            "size": 161552,
            "upload_time": "2023-04-02T02:57:42",
            "upload_time_iso_8601": "2023-04-02T02:57:42.973093Z",
            "url": "https://files.pythonhosted.org/packages/b0/a4/07f693eef242bbf6c9e0b25be734740fe0e528044b351bd2367ae88f7984/pydsxkline-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44df3c0d2ae66cc798590937872dd3204d730aeb0e8ef348173f7d75db45af7e",
                "md5": "7aeef9045103a300c805e16bf3dce98d",
                "sha256": "5e56d31f1c672a81e4eb87a72e38f79fe8b9299945476bb84491059e195f9caf"
            },
            "downloads": -1,
            "filename": "pydsxkline-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7aeef9045103a300c805e16bf3dce98d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4",
            "size": 157314,
            "upload_time": "2023-04-02T02:57:46",
            "upload_time_iso_8601": "2023-04-02T02:57:46.208605Z",
            "url": "https://files.pythonhosted.org/packages/44/df/3c0d2ae66cc798590937872dd3204d730aeb0e8ef348173f7d75db45af7e/pydsxkline-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-02 02:57:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dsxkline",
    "github_project": "dsxkline_python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pydsxkline"
}
        
Elapsed time: 0.09728s