当前位置: 首页 > 工具软件 > AIOTrade > 使用案例 >

AioTrade Investigation (Section B: DataContract and Content)

洪黎昕
2023-12-01
AioTrade Investigation (Section B: DataContract and Content)
guibin.beijing@gmail.com
AioTrade source code: [url]https://github.com/dcaoyuan/aiotrade[/url]

The DataContract's source code is located at [url]https://github.com/dcaoyuan/aiotrade/blob/master/libs/lib.math/src/main/scala/org/aiotrade/lib/math/timeseries/datasource/DataContract.scala[/url]. In order to understand the concept of DataContract, lets review the concept of DataObject in NetBeans firstly.

DataObjects wrap FileObjects. A FileObject is just a container for data; it happens to have a MIME type, but like java.io.File, it doesn't know or care what kind of file it represents, or what data it contains.
A DataObject represents one or more (typically only one) FileObjects. A DataObject knows what kind of a file it represents. It may represent the parsed contents of a file such as a .java file. Or, as in the case of InstanceDataObject, the file name may have semantic meaning. Reference about DataObject: [url]http://wiki.netbeans.org/DevFaqDataObject[/url].

Then we talk a little bit about Descriptor(org.aiotrade.lib.math.timeseries.descriptor.Descriptor), its source code can be found at [url]https://github.com/dcaoyuan/aiotrade/blob/master/libs/lib.math/src/main/scala/org/aiotrade/lib/math/timeseries/descriptor/Descriptor.scala[/url]. Descriptor is something like NetBeans' DataObject, it is just a container for service instance, which can be used method [u]createServiceInstance(args: Any*)[/u] to create or lookup one. Descriptor has the information about service class name, frequent, isActive. It use the service class name to create the service instance, and the isActive is to mark whether the Descriptor is active. The frequent is an attribute of the Descritor, the frequently-used value can be ONE_SEC, ONE_MIN, ONE_HOUR, DAILY, WEEKLY, MONTHLY, ONE_YEAR. Details about TFreq please refer to org.aiotrade.lib.math.timeseries.TFreq.

Let's go back to talk about DataContract. The DataContract simply inherits the Descriptor. It is assumed that the binding class(that is service class) provides the data service for the DataContract.

Finally, we have to say something about Content(org.aiotrade.lib.math.timeseries.descriptor.Content), its source code is at [url]https://github.com/dcaoyuan/aiotrade/blob/master/libs/lib.math/src/main/scala/org/aiotrade/lib/math/timeseries/descriptor/Content.scala[/url].
[b]Content is actually a container for descriptors.[/b] It provides convient method to add, remove, indexOf, clear, lookup the descriptors which are saved in this Content.

[color=red]The Content provides a relationship between the DataServer(the data source service via DataContract's service class) and the Indicator(the descriptor which is added into the Content) which can be computed via the data originated from the data server.[/color]

So, when initializing the Sec(org.aiotrade.lib.securities.model.Sec), firstly get the Content form the sec.content, then add the TickerContract, QuoteContract, MoneyFlowContract to the content use content.addDescriptor, finally add the Indicators' descirptor to the content.
 类似资料:

相关阅读

相关文章

相关问答