首页
数据字典 (opens new window)
  • 内置Python
  • 原生Python
  • VBA
投研服务平台 (opens new window)
迅投官网 (opens new window)

    暂无数据

    策略服务 (opens new window) 迅投知识库 迅投知识库
    首页
    数据字典 (opens new window)
    • 内置Python
    • 原生Python
    • VBA
    投研服务平台 (opens new window)
    迅投官网 (opens new window)
      • 内置Python

        • 快速上手
        • 开始使用
        • 新建一个Python策略
        • Python API 手册

          • 版本说明
          • 手册说明
          • 使用说明
          • 获取数据
          • 交易函数
          • 成交回报实时主推函数
          • 引用函数
          • 绘图函数
          • 财务数据接口
          • 附录

          • 常见问题Q&A
          • 行情示例
          • 交易示例
          • 回测示例
          • 策略迁移

        ×
        当前文档查询 “ ” 关键字 0 个
        0/0
        • 内置Python
        • 内置Python
        • Python API 手册
        RZRK
        2022-08-08
        目录

        绘图函数

        # 3.2.7. 绘图函数

        提示

        以下函数均支持回测和实盘/模拟运行模式。

        # (1)在界面上画图 ContextInfo.paint()

        用法: ContextInfo.paint(name, value, index, line_style, color = 'white', limit = '')

        释义: 在界面上画图

        参数:

        • name:string,需显示的指标名

        • value:number,需显示的数值

        • index:number,显示索引位置,填 -1 表示按主图索引显示

        • line_style:number,线型,可取值:

          0:曲线

          42:柱状线

        • color:string,颜色(不填默认为白色)目前支持以下几种颜色:

          blue:蓝

          brown:棕

          cyan:蓝绿

          green:绿

          magenta:品红

          red:红

          white:白

          yellow:黄

        • limit:string,画线控制,可取值:

          'noaxis': 不影响坐标画线

          'nodraw' :不画线

        返回: 无

        示例:

        def handlebar(ContextInfo):
            realtimetag = ContextInfo.get_bar_timetag(ContextInfo.barpos)
            value = ContextInfo.get_close_price('', '', realtimetag) 
            ContextInfo.paint('close', value, -1, 0, 'white','noaxis')
        
        1
        2
        3
        4

        # (2)在图形上显示文字 ContextInfo.draw_text()

        用法: ContextInfo.draw_text(condition, position, text)

        释义: 在图形上显示数字

        参数:

        • condition:条件
        • Position:位置
        • text:文字

        返回: 无

        示例:

        def handlebar(ContextInfo):
            ContextInfo.draw_text(1, 10, '文字')
        
        1
        2

        # (3)在图形上显示数字 ContextInfo.draw_number()

        用法: ContextInfo.draw_number(cond, height, number, precision)

        释义: 在图形上显示数字

        参数:

        • cond:bool,条件
        • height:number,显示文字的高度位置
        • text:string,显示的数字
        • precision:为小数显示位数(取值范围 0 - 7)

        返回: 无

        示例:

        def handlebar(ContextInfo):
            close = ContextInfo.get_market_data(['close'])   
            ContextInfo.draw_number(1 > 0, close, 66, 1)
        
        1
        2
        3

        # (4)在数字 1 和数字 2 之间绘垂直线 ContextInfo.draw_vertline()

        用法: ContextInfo.draw_vertline(cond, number1, number2, color = '', limit = '')

        释义: 在数字1和数字2之间绘垂直线

        参数:

        • cond:bool,条件

        • number1:number,数字1

        • number2:number,数字2

        • color:string,颜色(不填默认为白色)目前支持以下几种颜色:

          blue:蓝

          brown:棕

          cyan:蓝绿

          green:绿

          magenta:品红

          red:红

          white:白

          yellow:黄

        • limit:string,画线控制,可取值:

          'noaxis': 不影响坐标画线

          'nodraw' :不画线

        返回: 无

        示例:

        def handlebar(ContextInfo):
            close = ContextInfo.get_market_data(['close'])
            open = ContextInfo.get_market_data(['open'])
            ContextInfo.draw_vertline(1 > 0, close, open, 'cyan')
        
        1
        2
        3
        4

        # (5)在图形上绘制小图标 ContextInfo.draw_icon()

        用法: ContextInfo.draw_icon(cond, height, type)

        释义: 在图形上绘制小图标

        参数:

        • cond:bool,条件

        • height:number,图标的位置

        • text:number,图标的类型,可取值:

          1:椭圆

          0:矩形

        返回: 无

        示例:

        def handlebar(ContextInfo):
            close = ContextInfo.get_market_data(['close'])
            ContextInfo.draw_icon(1 > 0, close, 0)
        
        1
        2
        3
        上次更新: 2023/10/12, 10:45:51
        上一章-引用函数
        下一章-财务数据接口

        ← 引用函数 财务数据接口→

        Copyright © 2022-2024 北京睿智融科控股股份有限公司 | 迅投官网
        请使用微信扫码联系客服
        请使用微信扫码联系客服
        点击这里给我发消息
        • 跟随系统
        • 浅色模式
        • 深色模式
        • 阅读模式