Interface Name: pro_bar
Updated: stock index and is usually between 15:00 - 17:00, digital currency real-time updates, please refer to the documentation specific details of each interface.
Description: At present, the integration of the stock (not re-right, before reinstatement recovery of the right), index, digital currency, ETF funds, futures, market data option, the future will integrate all trading data including foreign exchange, including while providing minutes of data .
Other: Since this interface is the integrated interface, the SDK layer made some logical process is temporarily unable to use http general market manner retrieval interface. Users can access Tushare of Github, view the source code to perform a similar function.
Note: tushare package download and initialization, please consult my previous article
Input parameters
Name | Type | Required | Description
ts_code | str | Y | ticker
api | str | N | pro version api object, if initialized set_token, this parameter may not be required
start_date | str | N | start date (format: YYYYMMDD)
end_date | str | N | end date (format: YYYYMMDD)
asset | str | Y | asset classes: E Shanghai and Shenzhen stock index I C FT digital currency futures fund FD O options CB CB (v1.2.39), the default E
adj | str | N | recovery of the right type (only for stocks): recovery of the right front None hfq not right to re-qfq reinstatement by default None
freq | str | Y | Data Frequency: Support minutes (min) / day (D) / weeks (W) / month (M) K-line, wherein 1min represents 1 minute (min analogy 1/5/15/30/60 ), the default D. Currently there are 120 points of user data automatically with minute trial rights (5 times per minute)
ma | list | N | moving average, support any reasonable int value
factors | list | N | stock factor (asset = 'E' effective) tor supporting turnover ratio vr
adjfactor | str | N | complex weighting factor, data in complex weights, if this parameter is True, then the returned data with the complex weight factors, the default is False. This function is effective from the beginning of version 1.2.33
Example interface -
Take the first right to re-# 000001 Quotes
df = ts.pro_bar(ts_code='000001.SZ', adj='qfq', start_date='20180101', end_date='20181011')
trade_date ts_code trade_date open high low close \
20181011 000001.SZ 20181011 1085.71 1097.59 1047.90 1065.19
20181010 000001.SZ 20181010 1138.65 1151.61 1121.36 1128.92
20181009 000001.SZ 20181009 1130.00 1155.93 1122.44 1140.81
20181008 000001.SZ 20181008 1155.93 1165.65 1128.92 1128.92
20180928 000001.SZ 20180928 1164.57 1217.51 1164.57 1193.74
# Take the Shanghai index market data
df = ts.pro_bar(ts_code='000001.SH', asset='I', start_date='20180101', end_date='20181011')
In [10]: df.head()
Out[10]:
ts_code trade_date close open high low \
0 000001.SH 20181011 2583.4575 2643.0740 2661.2859 2560.3164
1 000001.SH 20181010 2725.8367 2723.7242 2743.5480 2703.0626
2 000001.SH 20181009 2721.0130 2713.7319 2734.3142 2711.1971
3 000001.SH 20181008 2716.5104 2768.2075 2771.9384 2710.1781
4 000001.SH 20180928 2821.3501 2794.2644 2821.7553 2791.8363
pre_close change pct_chg vol amount
0 2725.8367 -142.3792 -5.2233 197150702.0 170057762.5
1 2721.0130 4.8237 0.1773 113485736.0 111312455.3
2 2716.5104 4.5026 0.1657 116771899.0 110292457.8
3 2821.3501 -104.8397 -3.7159 149501388.0 141531551.8
4 2791.7748 29.5753 1.0594 134290456.0 125369989.4
MA #
df = ts.pro_bar(ts_code='000001.SZ', start_date='20180101', end_date='20181011', ma=[5, 20, 50])
NOTE: Tushare pro_bar median and average amount of data interfaces is dynamically calculated, want to get the average of a certain time period, the date must be set larger than the number of days start_date average of the maximum and desired date section, taken on their own. For example, you want to get started on the 3rd moving average 20,190,801, to be set start_date = '20190729', then removed before the record date of 20,190,801.
# Turnover tor, than vr
df = ts.pro_bar(ts_code='000001.SZ', start_date='20180101', end_date='20181011', factors=['tor', 'vr'])
Explanation
For pro_api parameters, if at the outset by ts.set_token ( 'xxxx') disposed over the token situation, this parameter is not necessary.
E.g:
df = ts.pro_bar(ts_code='000001.SH', asset='I', start_date='20180101', end_date='20181011')
About tushare points earning
I do quantitative investment team in transition, for the trading strategy,
We do have more idle transfer departure colleagues.
600: Original 50, only 39 yuan
1,500 points price: $ 140 only 109 yuan (sold out)
2000 points: the original price of 190 yuan, only 149 yuan
5000 points: the original price of 490 yuan, only 388 yuan (sold out).
The small number even need to ask the Department of VX: a56746435 (Note tushare)
.