<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Momentum策略 > 來源:https://uqer.io/community/share/5526191ef9f06c8f33904571 ```py import pandas as pd from pandas import Series, DataFrame start = datetime(2011, 1, 1) end = datetime(2014, 8, 1) benchmark = 'SH50' universe = set_universe('SH50') capital_base = 100000 refresh_rate = 10 window = 20 def initialize(account): account.amount = 300 add_history('hist', window) def handle_data(account): momentum = {'symbol':[], 'c_ret':[]} for stk in account.universe: momentum = pd.DataFrame(momentum) momentum = momentum.append([{'symbol':stk,'c_ret':account.hist[stk]['closePrice'].iloc[-1]/account.hist[stk]['closePrice'].iloc[0]}]) momentum = momentum.sort(columns='c_ret').reset_index(drop=True) momentum = momentum[len(momentum)*4/5:len(momentum)] buylist = momentum['symbol'].tolist() for stk in account.stkpos: if (stk not in buylist) and (account.stkpos[stk]>0): order_to(stk, 0) for stk in buylist: if account.stkpos.get(stk,0) == 0: order_to(stk, account.amount) ``` ![](https://box.kancloud.cn/2016-07-30_579cbb0507be9.jpg)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看