Compare commits

...

3 commits

Author SHA1 Message Date
Bruno BELANYI 5f5503a4a8 doc: talk about improvements to matching
Some checks failed
continuous-integration/drone/push Build is failing
2022-03-13 18:01:50 +01:00
Bruno BELANYI e4f33061d7 data: add invalid scenarios
Those are not supported by my engine, as they have remaining quantities
on a trade match.
2022-03-13 17:58:19 +01:00
Bruno BELANYI a8fc1bdb25 data: add simple tests for matching
Matching is done with asking price, when there is a difference.
2022-03-13 17:57:02 +01:00
12 changed files with 45 additions and 3 deletions

View file

@ -87,10 +87,18 @@ displays its output as it comes along), etc...
The logic used when trade matching is enabled is pretty limited: it wasn't clear
to me what to do when either of the orders have left-over quantities to be
fulfilled. More explicit instructions on this point would lead to the removal of
the final `FIXME`s in the code.
the final `FIXME`s and `assert`s in the code.
I have added explicit test files of those cases in `data/invalid`.
##### Picking prices
Another improvement that is specific to trade matching would be scripting the
behaviour when bid/ask prices are not exactly equal when matching trades: the
current behaviour is to always use the asking price. One could imagine wanting
to use bid price, or crossing order
price, or the average (weighted by quantity?) of both prices, etc...
Related to that point, the matching functionality should be tested further,
rather than just using the two provided examples.
#### Cancelling orders

View file

@ -0,0 +1,2 @@
N,1,IBM,8,100,S,101
N,2,IBM,10,100,B,102
1 N 1 IBM 8 100 S 101
2 N 2 IBM 10 100 B 102

View file

@ -0,0 +1,2 @@
N,1,IBM,10,100,B,101
N,2,IBM,8,100,S,102
1 N 1 IBM 10 100 B 101
2 N 2 IBM 8 100 S 102

2
data/inputs/matching.csv Normal file
View file

@ -0,0 +1,2 @@
N,1,IBM,10,100,B,101
N,2,IBM,10,100,S,102
1 N 1 IBM 10 100 B 101
2 N 2 IBM 10 100 S 102

View file

@ -0,0 +1,2 @@
N,1,IBM,8,100,S,101
N,2,IBM,10,50,B,102
1 N 1 IBM 8 100 S 101
2 N 2 IBM 10 50 B 102

View file

@ -0,0 +1,2 @@
N,1,IBM,8,50,S,101
N,2,IBM,10,100,B,102
1 N 1 IBM 8 50 S 101
2 N 2 IBM 10 100 B 102

View file

@ -0,0 +1,3 @@
A,1,101
B,S,8,100
R,2,102
1 A,1,101
2 B,S,8,100
3 R,2,102

View file

@ -0,0 +1,5 @@
A,1,101
B,S,8,100
A,2,102
T,2,102,1,101,8,100
B,S,-,-
1 A,1,101
2 B,S,8,100
3 A,2,102
4 T,2,102,1,101,8,100
5 B,S,-,-

View file

@ -0,0 +1,3 @@
A,1,101
B,B,10,100
R,2,102
1 A,1,101
2 B,B,10,100
3 R,2,102

View file

@ -0,0 +1,5 @@
A,1,101
B,B,10,100
A,2,102
T,1,101,2,102,8,100
B,B,-,-
1 A,1,101
2 B,B,10,100
3 A,2,102
4 T,1,101,2,102,8,100
5 B,B,-,-

View file

@ -0,0 +1,3 @@
A,1,101
B,B,10,100
R,2,102
1 A,1,101
2 B,B,10,100
3 R,2,102

View file

@ -0,0 +1,5 @@
A,1,101
B,B,10,100
A,2,102
T,1,101,2,102,10,100
B,B,-,-
1 A,1,101
2 B,B,10,100
3 A,2,102
4 T,1,101,2,102,10,100
5 B,B,-,-