# dsxkline_python
**Repository Path**: quarky/dsxkline_python
## Basic Information
- **Project Name**: dsxkline_python
- **Description**: No description available
- **Primary Language**: Python
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-09-28
- **Last Updated**: 2024-09-28
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# pydsxkline
pydsxkline是一个有趣的python包,一行代码即可显示K线图,主要应用于股票金融量化领域,当您想要把股票数据图形化的时候,可以试试这个小工具,希望能帮到有需要的朋友。
pydsxkline基于dsxkline进行封装,具体的接口可以查看官网 http://www.dsxkline.com
   
# 预览
# 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)
```
### 五日图
``` python
# 五日图
DsxKline.show("sh000001","上证指数",CycleType.t5)
```
### 日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 = """