如何在sql server中进行交易技术分析计算?
我如何像在 Excel 中一样使用 T-SQL 在 SQL SERVER 数据库中进行技术分析指标计算,例如平均方向指数、随机振荡指标等?如果可以的话,是否可以像在excel中做宏一样制作程序呢?提前致谢。
How i can do Technical Analysis indicator calculations like Average directional index, stochastic oscillators etc in SQL SERVER database by using T-SQL as doing in excel? If it possible, is it good for making procudures as doing macros in excel. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
程序代码是在 MS SQL Server 中用 T-SQL 编写的。它与 Excel 宏一样好,而且可能更强大一些,但您可能不像旧版 Excel 那样熟悉它们。
Procedural code is written in T-SQL in MS SQL Server. It's as good as Excel macros and perhaps a bit more powerful, but they aren't likely to be as familiar to you as good old Excel.
弄清楚在哪里进行计算可能是一个困难的选择。这完全取决于您可以从 T-SQL 中获得的性能与在客户端执行此工作的难度(复制更新等)相比。
如果您决定尝试在 T-SQL 中编写这些类型的查询, SQL,这是一篇很好的文章,可以帮助您入门(它不会为您做您的工作,但它会向您展示完成您想要的操作所需的所有部分):
http://www.sqlservercentral.com/articles/Moving+Average/69389/
在本文中,作者展示了如何使用 T-SQL 来开发移动平均线。您可以将本文视为将公式调整为 T-SQL 的起点。
Figuring out where to do the calculations can be a difficult choice. It all depends on the performance you can get out of the T-SQL compared to the difficulties of doing this work client-side (replicating updates, etc.)
If you decide that you want to attempt to write these types of queries in T-SQL, here is a good article that will help you get started (it won't do your work for you but it will show you all the pieces you should need to do what you want):
http://www.sqlservercentral.com/articles/Moving+Average/69389/
In this article, the author shows how to use T-SQL to develop the Moving Averages. You can look at this article as a starting place for adapting your formulas into T-SQL.
用 T-SQL 编写技术分析代码并不是一个好主意。如果你确实想在数据库服务器上执行它;那么我建议您使用任何 .NET 语言编写代码并将代码上传到 SQL Server。然后,您可以使用“用户定义的函数”从 T-SQL 调用该代码。请参阅此链接。
我出于不同的目的在 Oracle 中做了类似的事情。
如果可能,请尝试查看是否可以在客户端或 Web 服务器上执行代码(如果适用于您的情况)。
Writing technical analysis code in T-SQL is not a good idea. If you really want to execute it on Database server; then I would recommend writing your code in any .NET language and uploading the code to SQL Server. Then you can invoke that code from T-SQL using "User defined functions". See this link.
I have done similar things in Oracle for a different purpose.
If possible, try to see if you can execute the code in client side or on a web server if that is applicable in your case.