Rename OrderBook to LimitOrderBook

This commit is contained in:
Tim Kächele 2023-11-08 20:35:14 +01:00
parent 509b00bb14
commit 1e62686e69
4 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ require_relative "rex/version"
require_relative "rex/book/limit"
require_relative "rex/book/order"
require_relative "rex/book/trade"
require_relative "rex/book/order_book"
require_relative "rex/book/limit_order_book"
require_relative "rex/book/matcher"
module Rex

View File

@ -2,7 +2,7 @@ require "rbtree"
module Rex
module Book
class OrderBook
class LimitOrderBook
def initialize(matcher: Matcher.new)
@matcher = matcher
@sell_side = RBTree.new

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
RSpec.describe Rex::Book::OrderBook do
RSpec.describe Rex::Book::LimitOrderBook do
let(:instance) { described_class.new }
describe "#add_order" do

View File

@ -4,7 +4,7 @@ RSpec.describe Rex::Book::Matcher do
let(:instance) { described_class.new }
describe "#match" do
let(:order_book) { Rex::Book::OrderBook.new }
let(:order_book) { Rex::Book::LimitOrderBook.new }
let(:buy_order) { build(:order, price: 100, is_buy: true, quantity: 100, remaining_quantity: 100) }
let(:cheaper_sell_order) { build(:order, price: 99, is_buy: false, quantity: 50, remaining_quantity: 50) }
let(:pricier_sell_order) { build(:order, price: 100, is_buy: false, quantity: 70, remaining_quantity: 70) }
@ -45,7 +45,7 @@ RSpec.describe Rex::Book::Matcher do
context "when order book is empty" do
it "returns an empty list" do
expect(instance.match(Rex::Book::OrderBook.new)).to eq([])
expect(instance.match(Rex::Book::LimitOrderBook.new)).to eq([])
end
end