[Tex/LaTex] Block diagram in Tikz with absolute positioning

tikz-pgf

I'm trying to recreate an image using Tikz from a presentation about market structure:

enter image description here

I'm having a very hard time specifying absolute positions for each node. What's the best way to assign block positions for something like this?

Here's what I have so far:

\tikzstyle{trade} = [rectangle, minimum height=0.5cm, text
centered, color=white, draw=black, fill=red]
\tikzstyle{order} = [rectangle, minimum height=0.5cm, text
centered, color=white, draw=black, fill=blue]

\begin{tikzpicture}[node distance=1cm]

\node (trade) at (0, 0) [trade, minimum width=6cm] {Marketable Order};

\node (o1) [order, below of=trade, minimum width=0.5cm, xshift=-2.75cm, node
distance=2cm] {1}; 
\node (o2) [order, right of=o1, minimum width=1cm] {2};
\node (o3) [order, right of=o2, minimum width=3cm, xshift=1cm] {3};
\node (o4) [order, right of=o3, minimum width=1cm, xshift=2cm] {4};

\draw[->] (trade.west) -- (o1.west);
\draw[->] (o1.north) to [out=180] (o2.north);

\end{tikzpicture}

Best Answer

I am not doing any work today!

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{positioning}
\tikzset{
  blueblock/.style = {draw,rectangle,fill = blue,text=white,align = center,font=\sffamily},
  every node/.style = {font=\sffamily}
}

\begin{document}
  \begin{tikzpicture}
    %% horizontal nodes
    \node[anchor=east] at (-0.5,0) {Best bid price};
    \node[coordinate] (0) at (-0.5,0) {};
    \node[blueblock,minimum width = 1cm,right=.5cm of 0] (1)  {1};
    \node[blueblock,minimum width = .5cm,right=.5cm of 1] (2) {2};
    \node[blueblock,minimum width = 1.5cm,right=.5cm of 2] (3) {3};
    \node[blueblock,minimum width = 1.2cm,right=.5cm of 3] (4) {4};
    \node[blueblock,minimum width = .3cm,right=.5cm of 4] (5) {5};
    \node[blueblock,minimum width = .6cm,right=.5cm of 5] (6) {6};
    \node[blueblock,minimum width = 2.5cm,right=.5cm of 6] (7) {7};
    \node[coordinate,right=.5cm of 7] (8) {};
    %
    \node[draw,fill=red,rectangle,minimum width = 4cm,label=above:Incoming market sell order,anchor=west] (red) at (0,6) {\vphantom{1}};
    \node[align=center,text width = 4cm,anchor=south]  at (2.5,4) {Earliest limit order filled completely first};
    \node[align=center,text width = 5.5cm]  at (3,2) {Remaining quantity \\ in time order};
    \node[align=center,text width = 5.5cm,above = 3cm of 6]  (rest) {Resting limit buy orders \\ of different sizes};
    %
    \draw[-stealth] ([yshift=-1cm]2.east) -- ([yshift=-1cm]7.west)node[below,pos=0.5] {Time of order submission};
    %lines and arrows
    \draw[-stealth,shorten >=2pt] (red.south) -| (1.north);
    \draw[-stealth,shorten >=2pt,shorten <=2pt] (rest.south) -- (4.45);
    \draw[-stealth,shorten >=2pt,shorten <=2pt] (rest.south) -- (5.65);
    \draw[-stealth,shorten >=2pt,shorten <=2pt] (rest.south) -- (6);
    \foreach \x [remember=\x as \lastx (initially 0)] in {1,...,8}{
    \path[draw] (\lastx)--(\x);
    }
    \foreach \x [remember=\x as \lastx (initially 1)] in {2,...,4}{
    \draw (\lastx.65) edge [bend left,-stealth,shorten >=2pt,shorten <=2pt](\x.115);
    }
  \end{tikzpicture}
\end{document}

enter image description here