quant api

该文详细介绍了JoinQuant平台的API,包括回测和实盘策略的生命周期函数如initialize、before_trading_start,以及交易操作如order、get_price。此外,还涵盖了数据获取功能,如财务分析、宏观数据、股票信息等,为量化交易策略开发提供全面支持。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

API:https://www.joinquant.com/help/api/help#name:api

数据说明:https://www.joinquant.com/help/api/help#name:aboutData

策略程序框架

  • initialize(context):整个回测、模型实盘中最开始执行一次
  • process_initialize(context):每次模拟盘、回测程序启动时执行一次
  • run_daily/run_weekly/run_monthly:
  • before_trading_start(context):
  • after_trading_end(context):
  • on_strategy_end(context):
  • after_code_changed(context):
  • unschedule_all(context):
  • on_event(context):
  • handle_date(context)

对象

  • g 全局变量
  • context:信息总览,包含账户、时间等等
  • Portfolio:总账户信息
  • SubPortfolio:子账户信息
  • Position:持仓信息
  • Trade:交易记录
  • Order:订单
  • OrderStatus:
  • OrderStyle:
  • Event:

设置函数

  • set_benchmark()
  • set_order_cost:佣金/印花税
  • set_slippage:设置滑点
  • use_real_price:
  • avoid_future_date:避免未来数据
  • set_option('use_real_price',True)

交易函数

  • order
  • order_target
  • order_value
  • order_targe_value
  • cancel_order
  • get_open_orders
  • get_orders
  • get_trades:
  • inout_cash:

获取数据函数

价格函数

get_price

get_bars

财务函数

get_fundamentals

get_fundamentals_continuously()

股东信息:

finance.run_query

宏观数据

macro.run_query

get_billboard_list():获取龙虎榜

get_locked_shares():限售、解禁数据

get_index_stocks:指数成分股

get_index_weights

get_industry_stocks

get_concept_stocks:

get_industries:获取行业列表

get_concepts:获取概念列表

get_industry:获取股票所处行业

其他函数

  • record
  • send_message:
  • log
  • write_file/read_file
  • enable_profile

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值