Initial commit

This commit is contained in:
Yaser
2026-08-13 19:50:53 +03:30
commit 38084458fe
879 changed files with 95198 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
# encoding: UTF-8
# frozen_string_literal: true
module Matching
class OrderBookManager
attr :ask_orders, :bid_orders
def self.build_order(attrs)
attrs.symbolize_keys!
raise ArgumentError, "Missing ord_type: #{attrs.inspect}" unless attrs[:ord_type].present?
klass = ::Matching.const_get "#{attrs[:ord_type]}_order".camelize
klass.new attrs
end
def initialize(market, options={})
@market = market
@ask_orders = OrderBook.new(market, :ask, options)
@bid_orders = OrderBook.new(market, :bid, options)
end
def get_books(type)
case type
when :ask
[@ask_orders, @bid_orders]
when :bid
[@bid_orders, @ask_orders]
end
end
end
end