欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

AioTrade Investigation (Section C: Basic Data Type in AioTrade)

程序员文章站 2024-01-09 20:54:28
...
AioTrade Investigation (Section C: Basic Data Type in AioTrade)
guibin.beijing@gmail.com
AioTrade source code: https://github.com/dcaoyuan/aiotrade

1. TVal
org.aiotrade.lib.math.timeseries.TVal represents a cross section view at some specific time. Please keep this idea in mind, it is the basic concept in this AioTrade system. Each TVal has three common attributes: data, uniSymbol and sec. For example, the org.aiotrade.lib.securities.model.LightTicker is a kind of TVal. At the specific time(LightTicker.time), LighterTicker has the 8 data for one uniSymbol, they are prevClose, lastPrice, dayOpen, dayHigh, dayLow, dayVolume, dayAmount, dayChange.
In AioTrade, the org.aiotrade.lib.securities.model.MoneyFlow, org.aiotrade.lib.securities.model.Quote are all TVal. And Ticker is subclass of LightTicker, also a TVal. org.aiotrade.lib.securities.TickerSnapshot is subclass of Ticker, of course a TVal.
At the specific time, MoneyFlow has 24 data, they are totalVolumeIn, totalAmountIn, totalVolumeOut, totalAmountOut, totalVolumeEven, totalAmountEven, superVolumeIn, superAmountIn, superVolumeOut, superAmountOut, superVolumeEven, superAmountEven, largeVolumeIn, largeAmountIn, largeVolumeOut, largeAmountOut, largeVolumeEven, largeAmountEven, smallVolumeIn, smallAmountIn, smallVolumeOut, smallAmountOut, smallVolumeEven, smallAmountEven; Quote has 7 data, they are open, high, low, close, volume, amount and vwap.

2. TSer
org.aiotrade.lib.math.timeseries.TSer represents Time Series, namely a series of Time related values. Please keep this idea in mind, it is another basic concept in this AioTrade system. Actually, org.aiotrade.lib.securities.QuoteSer and org.aiotrade.lib.securities.MoneyFlowSer are all TSer. These Tser are all consisted of three common attributes: freq, vars and timestamps. Because we use TSer as a basic data structure to describe a series of time related values, such as a K line(candle sticks), the K line must have a frequence: minutely, hourly, daily, monthly, yearly and so on. With a specific frequence, the TSer must have some values base on the frequence, and must have a time axis to let all the values align.
AioTrade Investigation (Section C: Basic Data Type in AioTrade)
            
    
    博客分类: AioTradeScala GmailScalaAioTrade 

The chart above describes the relationship between TSer and the TVar, TimeStamp. All the values(namely TVar) in one TSer share a common TimeStamp. TSer defines the method timestamps to get the TimeStamp. In AioTrade system, the member TimeStamp is actually defined in DefaultTSer.

org.aiotrade.lib.securities.QuoteSer and org.aiotrade.lib.securities.MoneyFlowSer are two kinds of actual TSer. QuoteSer has 9 TVars, they are open, high, low, close, volume, amount, close_adj, close_ori, isClosed. isClose means: if it is minutely QuoteSer and currently it is 9:31:01, the isClose(9:31:00) keeps false until 9:31:59. When it is 9:32:00, the isClose(9:31:00) become true. That means the TVar(9:31:00) has been close, it moves to the next minute.

MoneyFlowSer has 32 TVars, they are totalVolume, totalAmount, totalVolumeIn, totalAmountIn, totalVolumeOut, totalAmountOut, totalVolumeEven, totalAmountEven, superVolume, superAmount, superVolumeIn, superAmountIn, superVolumeOut, superAmountOut, superVolumeEven, superAmountEven, largeVolume, largeAmount, largeVolumeIn, largeAmountIn, largeVolumeOut, largeAmountOut, largeVolumeEven, largeAmountEven, smallVolume, smallAmount,  smallVolumeIn, smallAmountIn, smallVolumeOut, smallAmountOut, smallVolumeEven, smallAmountEven

3. TVar
org.aiotrade.lib.math.timeseries.TVar represents the horizontal view of TSer.
A TSer consists of several TVars. Each TVar is a series, and each TVar has a timestamps. Each TVar gets it's own timestamp via the method "def timestamps: TStamps", but in TSer, these TVars share a common timestamp in order to save memory space. TSer use the method "def attach(timestamps: TStamps)" which is implemented in org.aiotrade.lib.math.timeseries.DefaultTSer to share the timestamp. For instance, in AioTrade system, Indicator invokes attach(baseSer.timestamps) to share the timestamp with baseSer, Function also invokes attach(baseSer.timestamps) to share the timestamp with baseSer.
Basicly, the share timestamp logic can be found in the def timestamps = DefaultTSer.this.timestamps of DefaultTSer.AbstractInnerTVar.

  • AioTrade Investigation (Section C: Basic Data Type in AioTrade)
            
    
    博客分类: AioTradeScala GmailScalaAioTrade 
  • 大小: 41.5 KB