Skip to content

Commit

Permalink
upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nickhuangxinyu1 committed Jun 5, 2020
1 parent 1b01f30 commit 6d0bb11
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 147 deletions.
121 changes: 121 additions & 0 deletions config/prod/bk_prod.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
strategy = (
{
unique_name = "IC";
max_position = 1;
max_round = 4000;
range_width = 2.0;
train_samples = 1200;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 360000000;
stop_loss_margin = 10.0;
max_loss_times = 2;
split_num = 6;
no_close_today = true;
},

{
unique_name = "au";
max_position = 5;
range_width = 2.0;
train_samples = 600;
max_round = 40000;
min_range = 2.0;
min_profit = 1.0;
add_margin = 1.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
split_num = 6;
max_loss_times = 2;
},

{
unique_name = "IH";
max_position = 1;
range_width = 2.0;
max_round = 40000;
train_samples = 600;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 360000000;
stop_loss_margin = 10.0;
max_loss_times = 2;
no_close_today = true;
split_num = 6;
},
{
unique_name = "IF";
max_position = 1;
range_width = 2.0;
train_samples = 600;
max_round = 40000;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 360000000;
stop_loss_margin = 10.0;
max_loss_times = 2;
no_close_today = true;
split_num = 6;
},

{
unique_name = "cu";
max_position = 2;
max_round = 40000;
tick_size = 10.0;
range_width = 2.0;
contract_size = 5;
train_samples= 600;
cancel_threshhold = 1000000000;
min_range = 4.0;
min_profit = 1.0;
add_margin = 1.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
max_loss_times = 2;
split_num = 6;
},

{
unique_name = "ni";
max_position = 3;
range_width = 1.0;
max_round = 40000;
train_samples = 600;
min_range = 2.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
max_loss_times = 2;
split_num = 6;
},

{
unique_name = "sn";
max_position = 3;
range_width = 2.0;
train_samples = 600;
max_round = 40000;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
max_loss_times = 2;
split_num = 6;
}
);
order_file = "order.dat";
exchange_file = "exchange.dat";
strat_file = "mid.dat";
129 changes: 19 additions & 110 deletions config/prod/prod.config
Original file line number Diff line number Diff line change
@@ -1,121 +1,30 @@
strategy = (
{
unique_name = "IC";
max_position = 1;
max_round = 4000;
range_width = 2.0;
train_samples = 1200;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 360000000;
stop_loss_margin = 10.0;
max_loss_times = 2;
split_num = 6;
no_close_today = true;
},

{
unique_name = "au";
max_position = 5;
range_width = 2.0;
train_samples = 600;
max_round = 40000;
min_range = 2.0;
min_profit = 1.0;
add_margin = 1.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
split_num = 6;
max_loss_times = 2;
},

{
unique_name = "IH";
max_position = 1;
range_width = 2.0;
max_round = 40000;
train_samples = 600;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 360000000;
stop_loss_margin = 10.0;
max_loss_times = 2;
no_close_today = true;
split_num = 6;
},
{
unique_name = "IF";
max_position = 1;
range_width = 2.0;
train_samples = 600;
max_round = 40000;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 360000000;
stop_loss_margin = 10.0;
max_loss_times = 2;
no_close_today = true;
split_num = 6;
},

{
unique_name = "cu";
max_position = 2;
max_round = 40000;
tick_size = 10.0;
range_width = 2.0;
contract_size = 5;
train_samples= 600;
cancel_threshhold = 1000000000;
min_range = 4.0;
min_profit = 1.0;
add_margin = 1.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
max_loss_times = 2;
split_num = 6;
},

fixed_path="/home/nick/future";
backtest_outputdir = "backtest_plot";
strategy = (
{
unique_name = "ni";
max_position = 3;
ticker = "ni";
max_position = 1;
max_round = 1000;
range_width = 1.0;
max_round = 40000;
train_samples = 600;
min_range = 2.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
max_loss_times = 2;
train_samples = 1200;
min_range = 1.0;
split_num = 6;
},

{
unique_name = "sn";
max_position = 3;
range_width = 2.0;
train_samples = 600;
max_round = 40000;
min_range = 4.0;
min_profit = 1.0;
add_margin = 3.0;
spread_threshold = 3.0;
max_holding_sec = 3600000;
stop_loss_margin = 3.0;
stop_loss_margin = 300.0;
max_loss_times = 2;
split_num = 6;
}
);
order_file = "order.dat";
exchange_file = "exchange.dat";
strat_file = "mid.dat";

// start_date = "today";
// start_date = "yesterday";
test_mode = "nexttest";
start_date = "2019-11-01";
period = 10;

order_file = "order_backtest.dat";
exchange_file = "exchange_backtest.dat";
strat_file = "mid_backtest.dat";
2 changes: 0 additions & 2 deletions external/common/include/util/time_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class TimeController {
std::vector<int>close_stop;
std::vector<int>force_close_start;
std::vector<int>force_close_stop;
std::vector<int>invalid_start;
std::vector<int>invalid_stop;
std::string mode;
long int timer_sec;
long int timer_usec;
Expand Down
Binary file modified external/common/lib/libnick.so
Binary file not shown.
Binary file added external/common/lib/libthostmduserapi.so
Binary file not shown.
Binary file added external/common/lib/libthosttraderapi.so
Binary file not shown.
6 changes: 0 additions & 6 deletions external/ctp/include/ThostFtdcMdApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ class CThostFtdcMdSpi
///登出请求响应
virtual void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///请求查询组播合约响应
virtual void OnRspQryMulticastInstrument(CThostFtdcMulticastInstrumentField *pMulticastInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

///错误应答
virtual void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};

Expand Down Expand Up @@ -158,9 +155,6 @@ class MD_API_EXPORT CThostFtdcMdApi

///登出请求
virtual int ReqUserLogout(CThostFtdcUserLogoutField *pUserLogout, int nRequestID) = 0;

///请求查询组播合约
virtual int ReqQryMulticastInstrument(CThostFtdcQryMulticastInstrumentField *pQryMulticastInstrument, int nRequestID) = 0;
protected:
~CThostFtdcMdApi(){};
};
Expand Down
26 changes: 0 additions & 26 deletions external/ctp/include/ThostFtdcUserApiStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -6835,32 +6835,6 @@ struct CThostFtdcQryBulletinField
TThostFtdcNewsUrgencyType NewsUrgency;
};

///MulticastInstrument
struct CThostFtdcMulticastInstrumentField
{
///主题号
TThostFtdcInstallIDType TopicID;
///合约代码
TThostFtdcInstrumentIDType InstrumentID;
///合约编号
TThostFtdcInstallIDType InstrumentNo;
///基准价
TThostFtdcPriceType CodePrice;
///合约数量乘数
TThostFtdcVolumeMultipleType VolumeMultiple;
///最小变动价位
TThostFtdcPriceType PriceTick;
};

///QryMulticastInstrument
struct CThostFtdcQryMulticastInstrumentField
{
///主题号
TThostFtdcInstallIDType TopicID;
///合约代码
TThostFtdcInstrumentIDType InstrumentID;
};

///转帐开户请求
struct CThostFtdcReqOpenAccountField
{
Expand Down
Binary file modified external/ctp/lib/libthostmduserapi.so
Binary file not shown.
Binary file modified external/ctp/lib/libthosttraderapi.so
Binary file not shown.
6 changes: 3 additions & 3 deletions src/ctporder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ int main() {
CThostFtdcTraderApi* user_api = CThostFtdcTraderApi::CreateFtdcTraderApi();

std::string broker = "1025";
std::string username = "160197";
std::string password = "qw78963";
std::string username = "920207";
std::string password = "584hxy..";
/*
std::string broker = "9999";
std::string username = "116909";
Expand Down Expand Up @@ -117,7 +117,7 @@ int main() {

user_api->SubscribePrivateTopic(THOST_TERT_QUICK);
user_api->SubscribePublicTopic(THOST_TERT_QUICK);
std::string counterparty_host = "tcp://123.138.59.245:51216"; // simnow
std::string counterparty_host = "tcp://101.226.250.179:51205"; // simnow
user_api->RegisterFront(const_cast<char*>(counterparty_host.c_str()));
user_api->Init();
if (enable_file) {
Expand Down

0 comments on commit 6d0bb11

Please sign in to comment.