Skip to content

Commit

Permalink
make c++ callback func more complicated to support corner cases
Browse files Browse the repository at this point in the history
  • Loading branch information
aslan9 committed Jun 15, 2018
1 parent ab27745 commit ebbc9e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wingchun/strategy/cpp_demo/kungfu_strategy_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ class Strategy: public IWCStrategy

public:
Strategy(const string& name);

friend void callback_func_demo(Strategy*, int);
};

void backtest_func_demo()
void callback_func_demo(Strategy* str, int param)
{
std::cout << "ready to start!" << std::endl;
KF_LOG_INFO(str->logger, "ready to start! test for param: " << param);
}

Strategy::Strategy(const string& name): IWCStrategy(name)
Expand Down Expand Up @@ -81,7 +84,7 @@ void Strategy::init()
signal.has_open_long_position = false;
signal.has_open_short_position = false;
signal.trade_size = 1;
BLCallback bl = backtest_func_demo;
BLCallback bl = boost::bind(callback_func_demo, this, 999);
util->insert_callback(kungfu::yijinjing::getNanoTime() + 2* 1e9, bl);
}

Expand Down

0 comments on commit ebbc9e2

Please sign in to comment.