misc:elemmap: add checking before delete an element

Add checking before delete an element, otherwise it will
cause an error.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
test: add test to ElementMap

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
ctp:ctpagent: fix recording order history from ctp at beginning

Fix recording order history received from ctp at beginning which
will affect checking the right order status while trading.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
ctp:ctpapi/ctpagent/autopos: fix can not check right order status

1) Add new helper methods to manage order status for trader agent.
2) Enable agent's callback in OnRspOrderInsert for trader api.
3) Update position methods using the helpers introduced in #1.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>