
以下内容为程序代码:
1 Sub getcontinuouscontracts()
2 Dim block
3 Dim market
4
5 Set block = CreateObject("stock.block")
6
7 block.Open "自选股", 1
8
9 For i = 0 To block.Count - 1
10 block.removeat (0)
11 Next
12
13 market = Array("SQ", "DQ", "ZQ", "ZJ")
14
15 For i = 0 To UBound(market)
16 n = marketdata.GetReportCount(market(i))
17 For j = 0 To n - 1
18 Set report1 = marketdata.GetReportDataByIndex(market(i), j)
19 If Right(report1.Label, 2) = "00" Then
20 block.addstock market(i), report1.Label
21 End If
22 Next
23 Next
24
25 block.tosave "自选", "自选股"
26 MsgBox "成功筛选连续合约"
27 End Sub
28
29 Sub getdominantcontracts()
30 Dim block
31 Dim market
32
33 Set block = CreateObject("stock.block")
34
35 block.Open "自设股", 1
36
37 For i = 0 To block.Count - 1
38 block.removeat (0)
39 Next
40
41 market = Array("SQ", "DQ", "ZQ", "ZJ")
42 c"
44 contractvolume = 0
45
46 For i = 0 To UBound(market)
47 n = marketdata.GetReportCount(market(i))
48 For j = 0 To n - 1
49 Set report1 = marketdata.GetReportDataByIndex(market(i), j)
50 suffixlabel = Right(report1.Label, 2)
51
52 If suffixlabel = "00" Then
53 block.addstock contractmarket, contractlabel
54 c"
56 contractvolume = 0
57 End If
58
59 If suffixlabel >= "01" And suffixlabel <= "12" Then
60 If report1.volume > contractvolume Then
61 contractlabel = report1.Label
62 contractmarket = market(i)
63 contractvolume = report1.volume
64 End If
65 End If
66 Next
67 Next
68
69 block.addstock contractmarket, contractlabel
70 block.tosave "自选", "自设股"
71 MsgBox "成功筛选主力合约"
72 End Sub
73
74 Sub MENU_Show()
75 Menu.AddMenu 0, 0, "筛选连续合约"
76 Menu.AddMenu 1, 1, "筛选主力合约"
77 End Sub
78
79 Sub MENU_Command(Cmd)
80 Select Case Cmd
81 Case 0
82 getcontinuouscontracts
83 Case 1
84 getdominantcontracts
85 End Select
86 End Sub
87