-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
477 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[backtest] | ||
strategy_start_date=2017-01-01 | ||
strategy_end_date=2017-06-15 | ||
|
||
#file:type:local | ||
#file:type:dirname | ||
#mongo:db-coll:path | ||
|
||
strategy_gap=6 | ||
|
||
database_ip=127.0.0.1 | ||
username=admin | ||
password=admin | ||
strategy_name=test_strategy | ||
|
||
|
||
[account] | ||
|
||
account_assets=250000 | ||
strategy_stock_list=file:csv:local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[backtest] | ||
strategy_start_date=2017-01-01 | ||
strategy_end_date=2017-06-15 | ||
|
||
|
||
|
||
strategy_gap=6 | ||
|
||
database_ip=127.0.0.1 | ||
username=admin | ||
password=admin | ||
strategy_name=test_strategy | ||
benchmark_code=hs300 | ||
|
||
[account] | ||
|
||
account_assets=250000 | ||
stock_list=file:csv:local | ||
#file:type:local | ||
#file:type:dirname | ||
#mongo:db-coll:path | ||
|
||
|
||
[bid] | ||
|
||
bid_model=market_price | ||
#close_price/market_price/strategy | ||
|
||
|
||
[strategy] | ||
file_path=file:py:local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# coding:utf-8 | ||
import random | ||
|
||
import QUANTAXIS as QA | ||
|
||
|
||
class strategy: | ||
""" | ||
携带一个函数句柄 | ||
""" | ||
@classmethod | ||
def setting(self): | ||
pass | ||
|
||
@classmethod | ||
def predict(self, market, account, hold): | ||
""" | ||
一个极其简单的示例策略,随机 随机真的随机 | ||
""" | ||
|
||
if hold == 0: | ||
__dat = random.random() | ||
if __dat > 0.5: | ||
|
||
return {'if_buy': 1, 'amount':'mean'} | ||
else: | ||
return {'if_buy': 0,'amount': 'mean'} | ||
else: | ||
__dat = random.random() | ||
if __dat > 0.5: | ||
return {'if_buy': 1,'amount': 'mean'} | ||
else: | ||
|
||
return {'if_buy': 0,'amount': 'all'} | ||
|
||
|
||
d = QA.QA_Backtest() | ||
|
||
d.QA_backtest_init() | ||
d.QA_backtest_start(strategy()) |
This file was deleted.
Oops, something went wrong.