繁簡切換您正在訪問的是FX168財經網,本網站所提供的內容及信息均遵守中華人民共和國香港特別行政區當地法律法規。

FX168财经网>人物频道>帖子

小市值股票,干就完事了,不在乎回撤

作者/lcb173364 2019-05-10 06:25 0 来源: FX168财经网人物频道

nothing

import jqdata
def initialize(context):
    g.security='000001.XSHE'
    set_benchmark('000300.XSHG')
    set_option('use_real_price',True)
    run_daily(market_open,time='every_bar')
def market_open(context):
    security=g.security
    close_data=attribute_history(security,5,'id',['close'])
    MA5=close_data['close'].mean()
    current_price=close_data['close'][-1]
    cash=context.profolio.available_cash
    if current_price>1.01*MA5:
    order_value(security,cash)
    log.info('Buying %s'%(security))
    elif current_price<MA5 and context.profolio.positions[security].closeable_amount>0:
    order_target(security,0)
    log.info('Selling %s'%(security))
record(stock_price=current_price)
  File "<ipython-input-25-fa5fc04057b3>", line 8
    order_value(security,cash)
              ^
IndentationError: expected an indented block
    if current_price>1.01*MA5:
    order_value(security,cash)
    log.info('Buying %s'%(security))
    elif current_price<MA5 and 
context.profolio.positions[security].closeable_amount>0:
    order_target(security,0)
    log.info('Selling %s'%(security))
record(stock_price=current_price)
  File "<ipython-input-20-f7252b9a9fdd>", line 2
    order_value(security,cash)
              ^
IndentationError: expected an indented block
 
分享到:
举报财经168客户端下载

全部回复

0/140

投稿 您想发表你的观点和看法?

更多人气分析师

  • 张亦巧

    人气2208文章4145粉丝45

    暂无个人简介信息

  • 张迎妤

    人气1912文章3305粉丝34

    个人专注于行情技术分析,消息面解读剖析,给予您第一时间方向...

  • 指导老师

    人气1864文章4423粉丝52

    暂无个人简介信息

  • 李冉晴

    人气2320文章3821粉丝34

    李冉晴,专业现贷实盘分析师。

  • 梁孟梵

    人气2184文章3177粉丝39

    qq:2294906466 了解群指导添加微信mfmacd

  • 王启蒙现货黄金

    人气328文章3695粉丝8

    本人做分析师以来,并专注于贵金属投资市场,尤其是在现货黄金...

  • 金泰铬J

    人气2328文章3925粉丝51

    投资问答解咨询金泰铬V/信tgtg67即可获取每日的实时资讯、行情...

  • 金算盘

    人气2696文章7761粉丝125

    高级分析师,混过名校,厮杀于股市和期货、证券市场多年,专注...

  • 金帝财神

    人气4768文章8329粉丝119

    本文由资深分析师金帝财神微信:934295330,指导黄金,白银,...

FX168财经

FX168财经学院

FX168财经

FX168北美