AioTrade Investigation (Section E: The logic of TickerServer)

AioTrade Investigation (Section E: The logic of TickerServer)
guibin.beijing@gmail.com
AioTrade source code: [url]https://github.com/dcaoyuan/aiotrade[/url]

The TickerServer(org.aiotrade.lib.securities.dataserver.TickerServer) is a kind of DataServer which is used to process tickers. Tickers can be from the DBF, streaming, http request and so on. The TickerServer processes the incoming tickers, parses them, and then updates the internal Ser(Such as QuoteSer, MoneyFlowSer and so on) which is save in Sec. While processing the tickers, the TickerServer can also publish the relavent event to anyone who is interested in. The main logic of Ticker is almost in the method processData(values: Array[Ticker], Contract: TickerContract), details are below:

A) In levelI, the input comes from the dbf's parsing result, namely a batch of incoming tickers at a specific time.

B) When the TickerServer gets the tickers, firstly converts these tickers into SecSnaps and tickersLast.
B1) SecSnap represents a sec's snapshot, including the latest newTicker, lastTicker, dailyQuote, minutelyQuote, dailyMoneyFlow, minutelyMoneyFlow. These data can be set by Ticker via setByTicker(ticker) or individually set its setter method of var.
B2) tickerLast represents the latest tickers. Some data copyFrom the incoming ticker in order to avoid the unwanted modifying.

C) Then traverse all the secSnaps to compute the minQuote's open, high, low, close, volume, amount, also it computes the execution. If the incoming ticker's time is not larger than the last ticker's time, we deem the incoming ticker is invalid.
C1) While traversing and if the ticker is valid, collects all the tickers into allTickers, so as to publish TickersEvt(allTickers) finally by TickerServer.
C2) While traversing and if the ticker is valid, collects all the executions into allExecutions so as to insert into database finally.
C3) While traversing and if the ticker is valid, collects all the DepthSnaps into allDepthSnaps so as to publish DepthSnapsEvt(allDepthSnaps) finally by TickerServer.
C4) While traversing and if the ticker is valid, updates the daily quote by ticker, then sends the minutely and daily QuoteEvt to sec to update the chain time series. At the same time, collecting all the dailyQuote and minutelyQuote so as to publish QuotesEvt(allUpdatedDailyQuotes) and QuotesEvt(allUpdatedMinuteQuotes) by TikerServer.
C5) While traversing and if the ticker is valid, the sec could also publish single TickerEvt and single ExecutionEvt.
C6) While traversing and if the ticker is valid, update the exchangeToLastTime so as to try to tryClosing finally.

D) According to the TrandingStatus and tradingTimeInMinutes to try to do close.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值