xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
ledger
OrderBookDB.h
1
#pragma once
2
3
#include <xrpl/basics/UnorderedContainers.h>
4
#include <xrpl/beast/utility/Journal.h>
5
#include <xrpl/ledger/AcceptedLedgerTx.h>
6
#include <xrpl/ledger/ReadView.h>
7
#include <xrpl/protocol/Asset.h>
8
#include <xrpl/protocol/Book.h>
9
#include <xrpl/protocol/UintTypes.h>
10
11
#include <
memory
>
12
#include <
optional
>
13
#include <
vector
>
14
15
namespace
xrpl
{
16
29
class
OrderBookDB
30
{
31
public
:
32
virtual
~OrderBookDB
() =
default
;
33
42
virtual
void
43
setup
(
std::shared_ptr<ReadView const>
const
& ledger) = 0;
44
50
virtual
void
51
addOrderBook
(
Book
const
& book) = 0;
52
64
virtual
std::vector<Book>
65
getBooksByTakerPays
(
Asset
const
& asset,
std::optional<Domain>
const
& domain = std::nullopt) = 0;
66
74
virtual
int
75
getBookSize
(
Asset
const
& asset,
std::optional<Domain>
const
& domain = std::nullopt) = 0;
76
84
virtual
bool
85
isBookToXRP
(
Asset
const
& asset,
std::optional<Domain>
const
& domain = std::nullopt) = 0;
86
};
87
104
HashSet<Book>
105
affectedBooks
(
AcceptedLedgerTx
const
& alTx,
beast::Journal
const
& j);
106
107
}
// namespace xrpl
beast::Journal
A generic endpoint for log messages.
Definition
Journal.h:44
xrpl::AcceptedLedgerTx
A transaction that is in a closed ledger.
Definition
AcceptedLedgerTx.h:36
xrpl::Asset
Definition
Asset.h:52
xrpl::Book
Specifies an order book.
Definition
Book.h:28
xrpl::OrderBookDB
Tracks order books in the ledger.
Definition
OrderBookDB.h:30
xrpl::OrderBookDB::getBookSize
virtual int getBookSize(Asset const &asset, std::optional< Domain > const &domain=std::nullopt)=0
Get the count of order books that want a specific issue.
xrpl::OrderBookDB::isBookToXRP
virtual bool isBookToXRP(Asset const &asset, std::optional< Domain > const &domain=std::nullopt)=0
Check if an order book to XRP exists for the given issue.
xrpl::OrderBookDB::getBooksByTakerPays
virtual std::vector< Book > getBooksByTakerPays(Asset const &asset, std::optional< Domain > const &domain=std::nullopt)=0
Get all order books that want a specific issue.
xrpl::OrderBookDB::addOrderBook
virtual void addOrderBook(Book const &book)=0
Add an order book to track.
xrpl::OrderBookDB::setup
virtual void setup(std::shared_ptr< ReadView const > const &ledger)=0
Initialize or update the order book database with a new ledger.
xrpl::OrderBookDB::~OrderBookDB
virtual ~OrderBookDB()=default
memory
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::affectedBooks
HashSet< Book > affectedBooks(AcceptedLedgerTx const &alTx, beast::Journal const &j)
Extract the set of books affected by a transaction.
Definition
OrderBookDBImpl.cpp:309
xrpl::HashSet
std::unordered_set< Value, Hash, Pred, Allocator > HashSet
Definition
UnorderedContainers.h:51
optional
std::shared_ptr
vector
Generated by
1.17.0