加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
order_book.h 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
Andrew Tulloch 提交于 2014-01-21 20:34 . With clang-format
#include <vector>
#include <boost/noncopyable.hpp>
#include <boost/intrusive/slist.hpp>
#include <boost/intrusive/list.hpp>
#include "types.h"
namespace OB {
class OrderBook : public boost::noncopyable {
public:
static OrderBook& get();
void initialize();
void shutdown();
// TODO: take by value?
t_orderid limit(t_order& order);
void cancel(t_orderid orderid);
private:
OrderBook() {}
struct OrderBookEntry : public boost::intrusive::slist_base_hook<> {
t_size size{0}; /* Order size * */
Field trader{};
};
// pricePoint: describes a single price point in the limit order book.
typedef boost::intrusive::slist<
OrderBookEntry, boost::intrusive::cache_last<true> > PricePoint;
// An array of pricePoint structures representing the entire limit order book
std::vector<OrderBookEntry> arenaBookEntries;
std::vector<PricePoint> pricePoints;
// Monotonically-increasing orderID
t_orderid curOrderID;
// Minimum Ask price
t_price askMin;
// Maximum Bid price
t_price bidMax;
};
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化