MATALB 获取金融数据

  12 Oct 2016


Parallel Get

Parallel Get 是一个基于MATLAB 平台,用于获取股票历史/即时行情数据的工具。

最低版本支持:2014b


使用方法
=========
下载并添加至Path 即可直接调用函数。


API 详解

get_tick_data(code,date) 获取个股以往某日历史的分笔数据明细。

示例1:

>>get_tick_data(‘000002’,’2016-08-26’)

timestamp      price     change     volume    amount  
_________     ______     _______    _______    _______  
'15:00:03'    '23.54'    '-0.03'    '19353'    '45557432'
'14:57:00'    '23.57'    '--'       '1392'     '3280944'
'14:56:57'    '23.57'    '--'       '263'      '619891'  
'14:56:54'    '23.57'    '--'       '283'      '667031'  
'14:56:51'    '23.57'    '--'       '218'      '513826'  
'14:56:48'    '23.57'    '--'       '1428'     '3367681'
'14:56:45'    '23.57'    '0.02'     '350'      '824950'

get_hist_data(code,ktype) 获取某只股票的日k线、周k线、月k线,或5分钟、15分钟、30分钟和60分钟k线数据。 ktype 可以是 ‘d’,’w’,’m’,’15’,’30’,’60’

示例1:

>>get_hist_data(000002,’d’)

  date           open         high        close        low         volume         p_change
  ________      ________    _______      ____       _______      _______        _________  
'2016-08-23'    '24.390'    '25.280'    '24.700'    '23.830'    '1694763.25'     '0.000'
'2016-08-24'    '24.400'    '24.840'    '23.990'    '23.750'    '1470675.62'     '-0.710'
'2016-08-25'    '23.500'    '23.940'    '23.540'    '22.710'    '1821374.88'     '-0.450'
'2016-08-26'    '23.590'    '23.590'    '22.890'    '22.880'    '1200024.12'     '-0.650'

示例2:

>> get_hist_data(300191,’15’)

            timestamp          open       high       close       low       volume      p_change
    _____________________    _______    _______    _______    _______    _________    ________
    '2016-09-26 15:00:00'    '37.5'     '37.53'    '37.28'    '37.15'    '6608.53'    '-0.22'
    '2016-09-26 14:45:00'    '37.5'     '37.63'    '37.5'     '37.28'    '6242.99'    '0",0,'
    '2016-09-26 14:30:00'    '37.8'     '37.9'     '37.61'    '37.61'    '2161'       '-0.19'
    '2016-09-26 14:15:00'    '37.8'     '37.89'    '37.83'    '37.73'    '1573.01'    '0.03'  
    '2016-09-26 14:00:00'    '37.78'    '37.9'     '37.8'     '37.74'    '1728.17'    '0.02'  
    '2016-09-26 13:45:00'    '37.76'    '37.8'     '37.78'    '37.52'    '3223.01'    '0.02'  
    '2016-09-26 13:30:00'    '37.95'    '37.97'    '37.77'    '37.75'    '1571'       '-0.18'
    '2016-09-26 13:15:00'    '37.88'    '37.95'    '37.95'    '37.68'    '1447'       '0.07'  

get_today_ticks(code) 获取单只股票今日分笔数据明细(大约3s 更新一次)

示例1:

>>get_today_ticks(000002)

timestamp      price
 ________       _____
'14:02:54'    '22.92'
'14:02:51'    '22.91'
'14:02:48'    '22.92'
'14:02:45'    '22.91'

get_realtime_quotes(code) 获取多只股票最近时间的成交情况

示例1:

>>get_realtime_quotes({‘000002’,’000025’})

code       name          open      pre_close     price        high        low         volume          amount   
______      _______     _______     _______      _______      _______    _________    ________      ________
'000002'    '万 科A'    '25.190'    '25.480'     '24.680'    '25.350'    '24.400'    '132417339'    '3272364942'
'000025'    '特 力A'    '68.360'    '68.060'     '64.800'    '68.390'    '64.000'    '7135515'      '472024111'

get_index 获取指数的实时行情

示例1:

>> get_index

   code        name         open         pre_close        price          high            low           volume            amount    
 ________    ________      __________     __________     __________    __________    ___________    ___________    __________
 '000001'    '上证指数'      '3028.2428'    '3033.8956'    '2980.4295'    '3028.2428'    '2980.1169'    '144330286'      '162257246419'
 '000002'    'A股指数'      '3169.9480'    '3175.8765'    '3119.8737'    '3169.9480'    '3119.5429'    '143852012'      '161933662807'
 '000003'    'B股指数'      '353.0047'     '353.3536'     '348.0875'     '353.3246'     '347.8740'     '478275'         '323583612'   
 '000008'    '综合指数'      '2674.7152'    '2680.0651'    '2643.7808'    '2674.7152'    '2643.3551'    '32095410'       '33830427621'
 '000009'    '上证380'     '5553.9553'    '5561.8088'    '5445.9972'    '5554.6702'    '5441.8891'    '42880656'       '48138671063'
 '000010'    '上证180'     '7010.0702'    '7025.2953'    '6915.9930'    '7010.0702'    '6915.9133'    '46628253'       '45307561410'
 '000011'    '基金指数'      '5702.3802'    '5706.5903'    '5657.5139'    '5702.4024'    '5656.3607'    '14313413'       '34222047051'
 '000012'    '国债指数'      '159.6086'     '159.5646'     '159.6141'     '159.6185'     '159.5666'     '229703'         '243046703'   
 '000016'    '上证50'      '2190.3899'    '2196.2903'    '2167.2640'    '2190.3899'    '2166.8248'    '16948209'       '16306550462'
 '000017'    '新综指'       '2555.9284'    '2560.7325'    '2515.5150'    '2555.9284'    '2515.2482'    '143236322'      '159421304866'
 '000300'    '沪深300'     '3267.6905'    '3275.6665'    '3220.2838'    '3267.6905'    '3220.2838'    '70452186'       '78700835132'
 '399001'    '深证成指'      '10588.354'    '10609.695'    '10392.695'    '10588.510'    '10392.695'    '17991773412'    '262945278836'
 '399002'    '深成指R'      '12506.839'    '12530.149'    '12275.729'    '12507.023'    '12275.729'    '7900427053'     '108309087042'
 '399003'    '成份B指'      '6425.106'     '6440.190'     '6365.087'     '6434.232'     '6360.422'     '13867140'       '95261075'    
 '399004'    '深证100R'    '4589.451'     '4599.742'     '4505.893'     '4589.832'     '4505.786'     '2499887991'     '37125326089'
 '399005'    '中小板指'      '6809.622'     '6822.026'     '6667.080'     '6809.636'     '6667.080'     '1485150473'     '24683372972'
 '399006'    '创业板指'      '2154.399'     '2156.510'     '2122.900'     '2161.764'     '2122.900'     '867056848'      '18788827737'
 '399101'    '中小板综'      '11653.298'    '11677.238'    '11432.207'    '11653.298'    '11432.207'    '7404608266'     '115953976575'
 '399106'    '深证综指'      '2004.155'     '2008.121'     '1966.604'     '2004.160'     '1966.604'     '17991773412'    '262945278836'
 '399107'    '深证A指'      '2096.283'     '2100.437'     '2056.919'     '2096.288'     '2056.919'     '17959684421'    '262755809256'
 '399108'    '深证B指'      '1188.299'     '1189.904'     '1178.405'     '1188.648'     '1177.034'     '32088991'       '189469579'   
 '399333'    '中小板R'      '7437.371'     '7450.918'     '7281.688'     '7437.386'     '7281.688'     '1485150473'     '24683372972'
 '399606'    '创业板R'      '2228.524'     '2230.708'     '2195.942'     '2236.143'     '2195.942'     '867056848'      '18788827737'
 '399100'    '新 指 数'     '8721.404'     '8739.147'     '8560.899'     '8721.485'     '8560.899'     '17659822775'    '260606794092'

get_today_all 获取当前时间全市场行情数据(不包括st)

示例1:

>>get_today_all

      code       name       price      price_change    p_change      buy1         sell1      settlement      open         high          low         volume          amount   
    ________    ______    _________    ___________    ________    _________    _________    __________    _________    _________    _________    ___________    ____________
    '600370'    '三房巷'     '6.890'      '0.630'        '10.064'    '6.890'      '0.000'      '6.260'       '6.260'      '6.890'      '6.210'      '65041187'     '434417192'
    '300163'    '先锋新材'    '13.150'     '1.200'        '10.042'    '13.150'     '0.000'      '11.950'      '13.150'     '13.150'     '13.150'     '651783'       '8570946'   
    '600159'    '大龙地产'    '5.810'      '0.530'        '10.038'    '5.810'      '0.000'      '5.280'       '5.250'      '5.810'      '5.230'      '75321625'     '431408473'
    '600634'    '中技控股'    '15.790'     '1.440'        '10.035'    '15.790'     '0.000'      '14.350'      '15.790'     '15.790'     '15.790'     '852202'       '13456270'  
    '600908'    '无锡银行'    '7.790'      '0.710'        '10.028'    '7.790'      '0.000'      '7.080'       '7.790'      '7.790'      '7.790'      '50025'        '389695'    
    '600228'    '昌九生化'    '14.270'     '1.300'        '10.023'    '14.270'     '0.000'      '12.970'      '12.800'     '14.270'     '12.800'     '18945134'     '260854202'
    '600743'    '华远地产'    '5.160'      '0.470'        '10.021'    '5.160'      '0.000'      '4.690'       '4.670'      '5.160'      '4.660'      '47495982'     '241370696'
    '002614'    '蒙发利'     '16.800'     '1.530'        '10.020'    '16.800'     '0.000'      '15.270'      '15.480'     '16.800'     '14.900'     '66443794'     '1044344625'

Parallel Get

Parallel Get is a open source MATLAB toolbox that can be used to obtain stock information about Chinese stock matket.

Support version :MATLAB 2014b or above


Installation ========= Download and add to path. Then your are free to use.


Quick Start

get_tick_data(code,date) get tick level data of one stock

Expamle 1:

>>get_tick_data(‘000002’,’2016-08-26’)

timestamp      price     change     volume    amount  
_________     ______     _______    _______    _______  
'15:00:03'    '23.54'    '-0.03'    '19353'    '45557432'
'14:57:00'    '23.57'    '--'       '1392'     '3280944'
'14:56:57'    '23.57'    '--'       '263'      '619891'  
'14:56:54'    '23.57'    '--'       '283'      '667031'  
'14:56:51'    '23.57'    '--'       '218'      '513826'  
'14:56:48'    '23.57'    '--'       '1428'     '3367681'
'14:56:45'    '23.57'    '0.02'     '350'      '824950'

get_hist_data(code,ktype) get Historical Prices of one stock ktype can be ‘d’,’w’,’m’,’15’,’30’,’60’

Example1:

>>get_hist_data(000002,’d’)

  date           open         high        close        low         volume         price_change
  ________      ________    _______      ____       _______      _______        _________  
'2016-08-23'    '24.390'    '25.280'    '24.700'    '23.830'    '1694763.25'     '0.000'
'2016-08-24'    '24.400'    '24.840'    '23.990'    '23.750'    '1470675.62'     '-0.710'
'2016-08-25'    '23.500'    '23.940'    '23.540'    '22.710'    '1821374.88'     '-0.450'
'2016-08-26'    '23.590'    '23.590'    '22.890'    '22.880'    '1200024.12'     '-0.650'

Example2:

>> get_hist_data(300191,’15’)

            timestamp          open       high       close       low       volume      p_change
    _____________________    _______    _______    _______    _______    _________    ________
    '2016-09-26 15:00:00'    '37.5'     '37.53'    '37.28'    '37.15'    '6608.53'    '-0.22'
    '2016-09-26 14:45:00'    '37.5'     '37.63'    '37.5'     '37.28'    '6242.99'    '0",0,'
    '2016-09-26 14:30:00'    '37.8'     '37.9'     '37.61'    '37.61'    '2161'       '-0.19'
    '2016-09-26 14:15:00'    '37.8'     '37.89'    '37.83'    '37.73'    '1573.01'    '0.03'  
    '2016-09-26 14:00:00'    '37.78'    '37.9'     '37.8'     '37.74'    '1728.17'    '0.02'  
    '2016-09-26 13:45:00'    '37.76'    '37.8'     '37.78'    '37.52'    '3223.01'    '0.02'  
    '2016-09-26 13:30:00'    '37.95'    '37.97'    '37.77'    '37.75'    '1571'       '-0.18'
    '2016-09-26 13:15:00'    '37.88'    '37.95'    '37.95'    '37.68'    '1447'       '0.07'  

get_today_ticks(code) Get today’s tick level data of one stock

Example1:

>>get_today_ticks(000002)

timestamp      price
 ________       _____
'14:02:54'    '22.92'
'14:02:51'    '22.91'
'14:02:48'    '22.92'
'14:02:45'    '22.91'

get_realtime_quotes(code) Get current price of multiple stocks

Example1:

>>get_realtime_quotes({‘000002’,’000025’})

code       name          open      pre_close     price        high        low         volume          amount   
______      _______     _______     _______      _______      _______     _________    ________      ________
'000002'    '万 科A'    '25.190'    '25.480'     '24.680'    '25.350'    '24.400'    '132417339'    '3272364942'
'000025'    '特 力A'    '68.360'    '68.060'     '64.800'    '68.390'    '64.000'    '7135515'      '472024111'

get_index Get current information of index

Example1:

>> get_index

   code        name         open         pre_close        price          high            low           volume            amount    
 ________    ________    ___________    ___________    ___________    ___________    ___________    _____________    __________
 '000001'    '上证指数'      '3028.2428'    '3033.8956'    '2980.4295'    '3028.2428'    '2980.1169'    '144330286'      '162257246419'
 '000002'    'A股指数'      '3169.9480'    '3175.8765'    '3119.8737'    '3169.9480'    '3119.5429'    '143852012'      '161933662807'
 '000003'    'B股指数'      '353.0047'     '353.3536'     '348.0875'     '353.3246'     '347.8740'     '478275'         '323583612'   
 '000008'    '综合指数'      '2674.7152'    '2680.0651'    '2643.7808'    '2674.7152'    '2643.3551'    '32095410'       '33830427621'
 '000009'    '上证380'     '5553.9553'    '5561.8088'    '5445.9972'    '5554.6702'    '5441.8891'    '42880656'       '48138671063'
 '000010'    '上证180'     '7010.0702'    '7025.2953'    '6915.9930'    '7010.0702'    '6915.9133'    '46628253'       '45307561410'
 '000011'    '基金指数'      '5702.3802'    '5706.5903'    '5657.5139'    '5702.4024'    '5656.3607'    '14313413'       '34222047051'
 '000012'    '国债指数'      '159.6086'     '159.5646'     '159.6141'     '159.6185'     '159.5666'     '229703'         '243046703'   
 '000016'    '上证50'      '2190.3899'    '2196.2903'    '2167.2640'    '2190.3899'    '2166.8248'    '16948209'       '16306550462'
 '000017'    '新综指'       '2555.9284'    '2560.7325'    '2515.5150'    '2555.9284'    '2515.2482'    '143236322'      '159421304866'
 '000300'    '沪深300'     '3267.6905'    '3275.6665'    '3220.2838'    '3267.6905'    '3220.2838'    '70452186'       '78700835132'
 '399001'    '深证成指'      '10588.354'    '10609.695'    '10392.695'    '10588.510'    '10392.695'    '17991773412'    '262945278836'
 '399002'    '深成指R'      '12506.839'    '12530.149'    '12275.729'    '12507.023'    '12275.729'    '7900427053'     '108309087042'
 '399003'    '成份B指'      '6425.106'     '6440.190'     '6365.087'     '6434.232'     '6360.422'     '13867140'       '95261075'    
 '399004'    '深证100R'    '4589.451'     '4599.742'     '4505.893'     '4589.832'     '4505.786'     '2499887991'     '37125326089'
 '399005'    '中小板指'      '6809.622'     '6822.026'     '6667.080'     '6809.636'     '6667.080'     '1485150473'     '24683372972'
 '399006'    '创业板指'      '2154.399'     '2156.510'     '2122.900'     '2161.764'     '2122.900'     '867056848'      '18788827737'
 '399101'    '中小板综'      '11653.298'    '11677.238'    '11432.207'    '11653.298'    '11432.207'    '7404608266'     '115953976575'
 '399106'    '深证综指'      '2004.155'     '2008.121'     '1966.604'     '2004.160'     '1966.604'     '17991773412'    '262945278836'
 '399107'    '深证A指'      '2096.283'     '2100.437'     '2056.919'     '2096.288'     '2056.919'     '17959684421'    '262755809256'
 '399108'    '深证B指'      '1188.299'     '1189.904'     '1178.405'     '1188.648'     '1177.034'     '32088991'       '189469579'   
 '399333'    '中小板R'      '7437.371'     '7450.918'     '7281.688'     '7437.386'     '7281.688'     '1485150473'     '24683372972'
 '399606'    '创业板R'      '2228.524'     '2230.708'     '2195.942'     '2236.143'     '2195.942'     '867056848'      '18788827737'
 '399100'    '新 指 数'     '8721.404'     '8739.147'     '8560.899'     '8721.485'     '8560.899'     '17659822775'    '260606794092'

get_today_all get current price of all stocks(excluding st)

Example1:

>>get_today_all

  code       name       price      pricechange    p_change      buy1         sell1      settlement      open         high          low         volume          amount   
    ________    ______    _________    ___________    ________    _________    _________    __________    _________    _________    _________    ___________    ____________
    '600370'    '三房巷'     '6.890'      '0.630'        '10.064'    '6.890'      '0.000'      '6.260'       '6.260'      '6.890'      '6.210'      '65041187'     '434417192'
    '300163'    '先锋新材'    '13.150'     '1.200'        '10.042'    '13.150'     '0.000'      '11.950'      '13.150'     '13.150'     '13.150'     '651783'       '8570946'   
    '600159'    '大龙地产'    '5.810'      '0.530'        '10.038'    '5.810'      '0.000'      '5.280'       '5.250'      '5.810'      '5.230'      '75321625'     '431408473'
    '600634'    '中技控股'    '15.790'     '1.440'        '10.035'    '15.790'     '0.000'      '14.350'      '15.790'     '15.790'     '15.790'     '852202'       '13456270'  
    '600908'    '无锡银行'    '7.790'      '0.710'        '10.028'    '7.790'      '0.000'      '7.080'       '7.790'      '7.790'      '7.790'      '50025'        '389695'    
    '600228'    '昌九生化'    '14.270'     '1.300'        '10.023'    '14.270'     '0.000'      '12.970'      '12.800'     '14.270'     '12.800'     '18945134'     '260854202'
    '600743'    '华远地产'    '5.160'      '0.470'        '10.021'    '5.160'      '0.000'      '4.690'       '4.670'      '5.160'      '4.660'      '47495982'     '241370696'
    '002614'    '蒙发利'     '16.800'     '1.530'        '10.020'    '16.800'     '0.000'      '15.270'      '15.480'     '16.800'     '14.900'     '66443794'     '1044344625'