1222380fa57be704844502726c2b51bbed37a859,test_backtest/strategy_qsdd.py,,,#,54
Before Change
order_model=QA.ORDER_MODEL.CLOSE,
amount_model=QA.AMOUNT_MODEL.BY_AMOUNT
)
Account.receive_deal(Broker.receive_order(QA.QA_Event(order=order,market_data=item)))
elif daily_ind.CROSS_SC.iloc[0] > 0:
if Account.sell_available.get(item.code[0], 0) > 0:
order=Account.send_order(
code=item.data.code[0],
time=item.data.date[0],
amount=Account.sell_available.get(item.code[0], 0),
towards=QA.ORDER_DIRECTION.SELL,
price=0,
order_model=QA.ORDER_MODEL.MARKET,
amount_model=QA.AMOUNT_MODEL.BY_AMOUNT
)
Account.receive_deal(Broker.receive_order(QA.QA_Event(order=order,market_data=item)))
Account.settle()
print(Account.history)
print(Account.history_table)
After Change
// create account
Account = QA.QA_Account()
Broker = QA.QA_BacktestBroker()
Account.reset_assets(1000000)
Account.account_cookie = "user_admin_qsdd"
// get data from mongodb
data = QA.QA_fetch_stock_day_adv(code_list, start_date, end_date)
data = data.to_qfq()
// add indicator
ind = data.add_func(QSDD)
// ind.xs("000001",level=1)["2018-01"].plot()
// data_forbacktest=data.select_time("2018-01-01","2018-05-20")
data_forbacktest = data
for items in data_forbacktest.panel_gen:
for item in items.security_gen:
daily_ind = ind.loc[item.index]
if daily_ind.CROSS_JC.iloc[0] > 0:
order = Account.send_order(
code=item.code[0],
time=item.date[0],
amount=1000,
towards=QA.ORDER_DIRECTION.BUY,
price=0,
order_model=QA.ORDER_MODEL.CLOSE,
amount_model=QA.AMOUNT_MODEL.BY_AMOUNT
)
Broker.receive_order(QA.QA_Event(order=order, market_data=item))
trade_mes = Broker.query_orders(Account.account_cookie, "filled")
res = trade_mes.loc[order.account_cookie, order.realorder_id]
order.trade(res.trade_id, res.trade_price,
res.trade_amount, res.trade_time)
elif daily_ind.CROSS_SC.iloc[0] > 0:
if Account.sell_available.get(item.code[0], 0) > 0:
order = Account.send_order(
code=item.code[0],
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 12
Instances
Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 1222380fa57be704844502726c2b51bbed37a859
Time: 2018-08-18
Author: yutiansut@qq.com
File Name: test_backtest/strategy_qsdd.py
Class Name:
Method Name:
Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 1222380fa57be704844502726c2b51bbed37a859
Time: 2018-08-18
Author: yutiansut@qq.com
File Name: test_backtest/simplebacktest.py
Class Name:
Method Name: simple_backtest
Project Name: QUANTAXIS/QUANTAXIS
Commit Name: 1222380fa57be704844502726c2b51bbed37a859
Time: 2018-08-18
Author: yutiansut@qq.com
File Name: test_backtest/strategy_qsdd.py
Class Name:
Method Name:
Project Name: QUANTAXIS/QUANTAXIS
Commit Name: e9be7536840b75f867d60b342b8b6b9040175b15
Time: 2018-08-17
Author: yutiansut@qq.com
File Name: test_backtest/MACD_JCSC.py
Class Name:
Method Name: