libjmmcg
release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
i
l
m
n
o
p
s
t
u
v
w
Variables
_
a
b
c
d
g
i
l
m
n
p
r
s
u
w
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
u
v
Enumerator
a
b
c
d
e
h
j
l
m
n
s
t
u
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
c
d
e
f
m
o
p
r
s
t
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Related Functions
a
c
d
e
h
i
j
m
n
o
p
r
s
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
~
Variables
a
b
c
d
e
g
h
i
l
m
n
o
p
r
s
t
u
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
Enumerations
Enumerator
Macros
_
a
b
c
f
i
j
l
n
o
p
r
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
smart_order_router.hpp
Go to the documentation of this file.
1
#
ifndef
LIBJMMCG_ISIMUD_EXCHANGES_LINKS_SMART_ORDER_ROUTER_HPP
2
#
define
LIBJMMCG_ISIMUD_EXCHANGES_LINKS_SMART_ORDER_ROUTER_HPP
3
4
/******************************************************************************
5
** Copyright © 2020 by J.M.McGuiness, isimud@hussar.me.uk
6
**
7
** This library is free software; you can redistribute it and/or
8
** modify it under the terms of the GNU Lesser General Public
9
** License as published by the Free Software Foundation; either
10
** version 2.1 of the License, or (at your option) any later version.
11
**
12
** This library is distributed in the hope that it will be useful,
13
** but WITHOUT ANY WARRANTY; without even the implied warranty of
14
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
** Lesser General Public License for more details.
16
**
17
** You should have received a copy of the GNU Lesser General Public
18
** License along with this library; if not, write to the Free Software
19
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
*/
21
22
#
include
"common/isin.hpp"
23
24
#
include
<
map
>
25
26
namespace
isimud
{
namespace
ISIMUD_VER_NAMESPACE
{
27
28
/// An idea for implementing a very simple smart order router.
29
class
smart_order_router
{
30
public
:
31
struct
available_to_trade
{
32
using
price_t=
int
;
///< Probably needs to be a variant over the various price_types of the links if there is no common_type.
33
using
volume_t=
int
;
///< Probably needs to be a variant over the various volume_types of the links if there is no common_type.
34
35
bool
operator
<(
available_to_trade
const
&)
const
noexcept
(
true
);
36
};
37
using
link_t=
int
;
///< Base class of all the links.
38
using
link_ptr_t=link_t*;
39
/**
40
A collection that contains the ISINs that are tradeable on multiple exchanges ordered by ISIN->{price, volume}->link. So that as market data comes in the prices & available volumes are updated.
41
42
May want to use a sorted vector instead....
43
*/
44
using
container_type
=
std
::
map
<
45
exchanges
::
ISIN_t
,
///< These are only ISINs that are traded on multiple venues.
46
/**
47
* May want to use a std::heap instead, as only need the best available, not all in order.
48
*/
49
std
::
map
<
50
available_to_trade
,
51
link_ptr_t
52
>
53
>;
54
55
/// The market-data thread receives updates for the subscribed ISINs and calls this function to update the internal container.
56
/**
57
* Re-insert the ISIN into the map with the updated details.
58
*/
59
void
market_data_update
(
ISIN_t
const
&,
available_to_trade
::price_t
const
&,
available_to_trade
::volume_t
const
&);
60
61
/// Call to place an order via the SOR.
62
/**
63
* Places the trade on the venue that has the best price & most volume. Could split the trade between venues.
64
*/
65
void
place_an_order
(...)
noexcept
(
false
);
66
67
private
:
68
/**
69
TODO We'll need some kind of funky locking for this, probably multi-level....
70
*/
71
container_type multi_venue_instruments;
72
};
73
74
} }
75
76
#
endif
isimud
exchanges
links
smart_order_router.hpp
Generated on Tue May 11 2021 17:31:51 for libjmmcg by
1.9.2