Skip to content

Commit

Permalink
add a c++ callback example
Browse files Browse the repository at this point in the history
  • Loading branch information
aslan9 committed Jun 15, 2018
1 parent 183f70b commit ab27745
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wingchun/strategy/cpp_demo/kungfu_strategy_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*/

#include "IWCStrategy.h"
#include "Timer.h"
#include <deque>
#include <iostream>

USING_WC_NAMESPACE

Expand Down Expand Up @@ -47,6 +49,11 @@ class Strategy: public IWCStrategy
Strategy(const string& name);
};

void backtest_func_demo()
{
std::cout << "ready to start!" << std::endl;
}

Strategy::Strategy(const string& name): IWCStrategy(name)
{
rid = -1;
Expand Down Expand Up @@ -74,6 +81,8 @@ void Strategy::init()
signal.has_open_long_position = false;
signal.has_open_short_position = false;
signal.trade_size = 1;
BLCallback bl = backtest_func_demo;
util->insert_callback(kungfu::yijinjing::getNanoTime() + 2* 1e9, bl);
}

void Strategy::on_rsp_position(const PosHandlerPtr posMap, int request_id, short source, long rcv_time)
Expand Down

0 comments on commit ab27745

Please sign in to comment.