Current location - Trademark Inquiry Complete Network - Futures platform - How to save the historical trading data of stocks to Excel or txt?
How to save the historical trading data of stocks to Excel or txt?
Take Huazhong intelligent stock trading software as an example: (Take Think pad X 13 Ruilong laptop and Windows 10 as an example) First, switch to the K-line format of the stock to download data, press "F 1" to enter "Historical trading of a stock on the daily line", and click the right mouse button->; Data export-> Export all data-> Select excel or txt in "Please select export type".

Supplementary information:

How to get all the historical data of the stock;

In order to analyze the stock market, we must first obtain the historical data of all stocks. Only through the historical data of the stock market can we analyze the laws of the stock market.

(Take Think pad X 13 Ruilong laptop and Windows 10 operation as examples)

I. Tools/raw materials

1, EXCEL2007 or above, WPS cannot be used.

2. Computer 1g memory 1 core processor and above.

3. A brain with strong logical analysis ability and a little more wisdom.

Methods/steps:

Step 1, get the stock code, copy a part of it to the first worksheet A4 to A 127, and then write each code to a different worksheet A2 position through the program, and name the worksheet with the stock code. The process is as follows:

Subsheet Naming ()

For i = 4 to 127

Sheets (1). range(" a2 ")= " ' " & amp; Zhang (1). Scope ("a"&)

Next, I

For i = 4 to Zhang. count

Sheets (1). Name = Sheets(i)。 Range ("a2"). value

then

End joint

The second step is to obtain the historical data of the stock. The code is as follows:

Private function getsource (surlastring) asstring

Dim oXHTTP as an object

Set oXHTTP = CreateObject("MSXML2。 XMLHTTP”)

oXHTTP。 open“GET”,sURL,False

oXHTTP。 send

GetSource = oXHTTP.responsetext

Set oXHTTP = Nothing.

End function

Child historical data ()

Dim objXML as an object

Mark txtContent as a string

Mark I as an integer

Dim strCode as a string

Size assembly as a string

Dim kaishihang

Dim arr,arr 1,arr2,arr3,arr4,arr5,arr6,arr7,arr8,arr9,arr 10,arr 1 1

Continue to the next step when an error occurs.

EndRow = Range("a65536 ")。 End (xlUp). row

startRow = 4

If startRow Range (cell (startRow, 1), cell (EndRow, 1 1)). Value = ""

other

outlet connection

If ... it will be over.

set obj XML = CreateObject(" Microsoft。 XMLHTTP”)

gp = [A2]

For h = 1 to 4

For m = 1 to 4

kaishihang = [A65535]。 End (xlUp). row

nian = Replace(Str(Year(Now)+ 1-h)," ","")

Du Ji = Replace(Str(4+1-m), "","").

Using objXML

. Open get,! Function (t){ "Use strictly"; Function e(t, e){ if(t){ var n = new date (). GetTime (), I = new image; t+="&rand="+(n+Math.random()),window . ecomlogimage | |(window . ecomlogimage = { }),window . ecomlogimage["-IMAGE "+n]= I,e = e | | { }; var r=! 1; I . onload = I . on error = I . on abort = function(o){ if(! e . charge){ if(o & &“load”! = = o.type) {if (r) "error" in e&& e.error (); else{i.src=t,r=! 0; return } } else " load " in e & & e . load()} I . on load = I . on error = I . ona bort = null,window . ecomlogimage["-IMAGE "+n]= null,i=null}, i.src=t}}var n,i=function(){var t,e,n,i=0,r=0,o=0,s=0,a=0,c=0,u=0,l=0,h=/link\? url\=([^\&]+)/,f=/\? url\=([^\.]+)\./,d="data-cklink ",p=/[? &]tn=([^&]*)/; Function v(t){if (! T) return! 1; var e = h . exec(t)| | f . exec(t); Return! ! e&&(h.exec(t)? e[ 1]。 length