以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  下面是飞狐转GET时用的一组公式,请问如何在金字塔中实现。  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=270)

--  作者:liangxq
--  发布时间:2009/11/25 16:06:35
--  下面是飞狐转GET时用的一组公式,请问如何在金字塔中实现。

下面是飞狐转GET时用的一组公式,请问如何在金字塔中实现。我的邮箱,cityhunter528@yahoo.com.cn

 

 

_Barpos := BARPOS;
       _Year := YEAR;
      _Month := MONTH;
        _Day := DAY;
   _Datatype := DATATYPE;
_Marketlabel := MARKETLABEL;
    _StkName := STKLABEL;
       _Open := OPEN;
       _High := HIGH;
        _Low := LOW;
      _Close := CLOSE;
        _Vol := VOL;
     _Amount := AMOUNT; 

<%

Sub create(fso,path)
If fso.FolderExists(path) Then
Exit Sub
End If
If Not fso.FolderExists(fso.GetParentFolderName(path)) Then
create fso,fso.GetParentFolderName(path)
End If
fso.CreateFolder(path)
End Sub

Set fso = CreateObject("scripting.filesystemobject")
outputf = "E:\\Program Files\\证券\\Get\\TEXT\\"  \'修改成你所要输出的绝对路径
\' 注意:1.不能缺少最后的"\\"号
\'      2.注意输出目录的关系必须保证在此目录的上一级目录存在GET.EXE,确保调用无误
\'      3.请自行设置AGET的输入目录为此目录
create fso,outputf
set fso = Nothing

Dim Marketlabels,Stknames,Datatypes,Opens,Highs,Lows,Closes,Vols,Amounts,Years,Months,Days
     Barposes = ffl.vardata("_Barpos")
        Years = ffl.vardata("_Year")
       Months = ffl.vardata("_Month")
         Days = ffl.vardata("_Day")
    Datatypes = ffl.vardata("_Datatype")
Marketlabels = ffl.vardata("_Marketlabel")
     Stknames = ffl.vardata("_Stkname")
        Opens = ffl.vardata("_Open")
        Highs = ffl.vardata("_High")
         Lows = ffl.vardata("_Low")
       Closes = ffl.vardata("_Close")
         Vols = ffl.vardata("_Vol")
      Amounts = ffl.vardata("_Amount")

SelectCreatAsciiDataType(Datatypes)

Function SelectCreatAsciiDataType(Types)
        Select Case Types
                Case 0

                Case 1
                        Call CreateAsciiDataMin("-1min-")                       
                Case 2
                        Call CreateAsciiDataMin("-5min-")                       
                Case 3
                        Call CreateAsciiDataMin("-15min-")                       
                Case 4
                        Call CreateAsciiDataMin("-30min-")                       
                Case 5
                        Call CreateAsciiDataMin("-60min-")
                Case 6
                        Call CreateAsciiDataDayes()
                Case 7
                        Call CreateAsciiDataMin("-Week-")                       
                Case 8
                        Call CreateAsciiDataMin("-Month-")                       
                Case 9
                        Call CreateAsciiDataMin("-Year-")                       
                Case 10
                        Call CreateAsciiDataMin("-MDay-")
                Case 11
                        Call CreateAsciiDataMin("-MMin-")
                Case 12
                        Call CreateAsciiDataMin("-MSec-")
                Case Else

                End Select
End Function

Function CreateAsciiDataMin(FolderName)

 

        Const ForReading = 1, ForWriting = 2, ForAppending = 8
        Const TristateTrue = -1,TristateFalse = 0,TristateUseDefault = -2
        Dim Fso,FileName,TextStream,LineData,ArrayLast,LastDate,AforeDate,AforeYear,AforeMonth,AforeDay
for n=1 to 555555
next
        Set Fso = CreateObject("Scripting.FileSystemObject")
        FileName = outputf & StkNames & FolderName & ".txt"
        Set TextStream = Fso.OpenTextFile(FileName, ForWriting, True)
        ArrayLast = Ubound(Barposes)
        LastDate = Years(ArrayLast) & "-" & Months(ArrayLast) & "-" & Days(ArrayLast)
        For i = 0 To ArrayLast
                AforeDate = DateAdd("d",(i-ArrayLast),LastDate)
                AforeYear = Year(AforeDate)
                AforeMonth = Month(AforeDate)
                If Len(AforeMonth) = 1 Then AforeM & AforeMonth
                AforeDay = Day(AforeDate)
                If Len(AforeDay) = 1 Then AforeDay = "0" & AforeDay
                Opens(i) = FormatNumber(Opens(i),3,,,TristateFalse)
                Highs(i) = FormatNumber(Highs(i),3,,,TristateFalse)
                Lows(i) = FormatNumber(Lows(i),3,,,TristateFalse)
                Closes(i) = FormatNumber(Closes(i),3,,,TristateFalse)
            Vols(i) = FormatNumber(Vols(i),3,,,TristateFalse)
                Amounts(i) = FormatNumber(Amounts(i),3,,,TristateFalse)
                LineData = AforeYear & "0" & AforeMonth & "0" & AforeDay & " " & Opens(i) & " " & Highs(i) & " " & Lows(i) & " " & Closes(i) & " " & Vols(i) & " " & Amounts(i)
                TextStream.WriteLine LineData
      


--  作者:liangxq
--  发布时间:2009/11/25 16:07:03
--  类似函数dma

接上面:

 

 

  Next
        TextStream.Close
End Function

Function CreateAsciiDataDayes()
        Const ForReading = 1, ForWriting = 2, ForAppending = 8
        Const TristateTrue = -1,TristateFalse = 0,TristateUseDefault = -2
        Dim i,Fso,FileName,TextStream,LineData,AforeLast,ArrayLast
for n=1 to 555555
next
        Set Fso = CreateObject("Scripting.FileSystemObject")
        FileName = outputf & StkNames & "-Day-" & ".txt"
        IF ReportFileStatus(FileName) = 0 Then
                Set TextStream = Fso.OpenTextFile(FileName,ForWriting,True)
                ArrayLast = Ubound(Barposes)
                For i = 0 To ArrayLast
                        If Len(Months(i)) = 1 Then Months(i) = "0" & Months(i)
                        If Len(Days(i)) = 1 Then Days(i) = "0" & Days(i)
                        Opens(i) = FormatNumber(Opens(i),3,,,TristateFalse)
                        Highs(i) = FormatNumber(Highs(i),3,,,TristateFalse)
                        Lows(i) = FormatNumber(Lows(i),3,,,TristateFalse)
                        Closes(i) = FormatNumber(Closes(i),3,,,TristateFalse)
                        Vols(i) = FormatNumber(Vols(i),3,,,TristateFalse)
                        Amounts(i) = FormatNumber(Amounts(i),3,,,TristateFalse)
                        LineData = Years(i) & "0" & Months(i) & "0" & Days(i) & " " & Opens(i) & " " & Highs(i) & " " & Lows(i) & " " & Closes(i) & " " & Vols(i) & " " & Amounts(i)
                        TextStream.WriteLine LineData
                Next
                TextStream.Close
        ElseIf ReportFileStatus(FileName) = 1 Then
                AforeLast = 0
                Set TextStream = Fso.OpenTextFile(FileName, ForReading, False)
                Do Until TextStream.AtEndOfStream = True
                TextStream.ReadLine
                AforeLast = AforeLast+1
                Loop
                TextStream.Close
                Set TextStream = Fso.OpenTextFile(FileName,ForAppending,False)
                ArrayLast = Ubound(Barposes)
                For i = AforeLast To ArrayLast
                        If Len(Months(i)) = 1 Then Months(i) = "0" & Months(i)
                        If Len(Days(i)) = 1 Then Days(i) = "0" & Days(i)
                        Opens(i) = FormatNumber(Opens(i),3,,,TristateFalse)
                        Highs(i) = FormatNumber(Highs(i),3,,,TristateFalse)
                        Lows(i) = FormatNumber(Lows(i),3,,,TristateFalse)
                        Closes(i) = FormatNumber(Closes(i),3,,,TristateFalse)
                        Vols(i) = FormatNumber(Vols(i),3,,,TristateFalse)
                        Amounts(i) = FormatNumber(Amounts(i),3,,,TristateFalse)
                        LineData = Years(i) & "0" & Months(i) & "0" & Days(i) & " " & Opens(i) & " " & Highs(i) & " " & Lows(i) & " " & Closes(i) & " " & Vols(i) & " " & Amounts(i)
                        TextStream.WriteLine LineData
                Next
                TextStream.Close
        End If       
End Function

Function ReportFileStatus(Filespec)
        Dim Fso, Status
        Set Fso = CreateObject("Scripting.FileSystemObject")
        If (Fso.FileExists(Filespec)) Then
                Status = 1
        Else
                Status = 0
        End If
        ReportFileStatus = Status
End Function

 

%>
0;


--  作者:liangxq
--  发布时间:2009/11/25 16:07:36
--  
分开主要是字数限制,不得已分开
--  作者:admin
--  发布时间:2009/11/25 16:20:35
--  

公式嵌VBS语句,金字塔目前无法直接与飞狐兼容。

我们春节后的版本,会全面解决这个问题。


--  作者:liangxq
--  发布时间:2009/11/25 18:31:33
--  

谢谢,期待解决

 

另外,请问,金字塔与金融天骄以及金娇期股数据接口有什么关联么?是什么样的关系?

 


--  作者:liangxq
--  发布时间:2009/11/25 18:32:16
--  
金娇的P2P数据接口我一直用不习惯。
--  作者:cq2698
--  发布时间:2010/10/11 13:19:02
--  
这个公式在1.995中引入后提示错误不能使用请老师修正