Files
Quant_Code/2.数据下载与处理/ssquant_download/数据库使用示例.py
Win_home f925dff46b Enhance trading workflow with new order flow management
- Added dingdanliu_nb_mflow for improved order processing
- Updated related scripts and configurations to support new functionality
2025-03-15 22:45:08 +08:00

79 lines
3.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from ssquant.SQDATA import TakeData
#注意首先需要pip install ssquant
#否则链接不到数据库
#输入俱乐部的账号密码即可调用,注意保密。
#目前数据是2019年1月-至今
#每日下午收盘后3点30分录入当天数据。
#有任何疑问可以再群里提出,或者私信我(慕金龙)
#官网: quant789.com
#公众号松鼠Quant
#客服微信: viquant01
#只能调取分钟及以上数据tick数据每月底更新到百度网盘下载
'''
获取数据-
品种:symbol,不区分大小写
起始时间:start_date,
结束时间:end_date(包含当天),
周期kline_period:1M..5M..NM(分钟),1D(天),1W(周),1Y(月)
复权adjust_type:0(不复权)1(后复权)
注意:
1.请正确输入账号密码
2.不要挂代理访问数据库
3.暂时没有股指数据,下个月补齐。
'''
# username='俱乐部账号' password='密码'
client = TakeData(username='77777@qq.com', password='7777')
data = client.get_data(
symbol='rb888',
start_date='2023-01-02',
end_date='2024-01-03',
kline_period='60M',
adjust_type=1
)
print(data)
'''
datetime:时间,
symbol:品种,
open:开盘价,
high:最高价,
low:最低价,
close:收盘价,
volume:成交量(单bar),
amount:成交金额(单bar),
openint:持仓量(单bar),
cumulative_openint:累计持仓量,
open_bidp , open_askp: K线第一个价格的买一价格和卖一价格
close_bidp , close_askp: K线最后一个价格的买一价格和卖一价格
datetime symbol open high low close volume amount cumulative_openint openint open_bidp open_askp close_bidp close_askp
0 2023-01-03 10:00:00 rb2305 4081.0 4081.0 4016.0 4037.0 737537 29782187220 1883481 -48415 4081.0 4084.0 4037.0 4038.0
1 2023-01-03 11:00:00 rb2305 4038.0 4056.0 4037.0 4042.0 158548 6415696920 1887716 4235 4037.0 4038.0 4042.0 4044.0
2 2023-01-03 12:00:00 rb2305 4044.0 4054.0 4037.0 4051.0 67448 2728130300 1890125 2409 4043.0 4044.0 4050.0 4051.0
3 2023-01-03 14:00:00 rb2305 4055.0 4065.0 4045.0 4058.0 110181 4469698600 1895841 5723 4050.0 4051.0 4058.0 4059.0
4 2023-01-03 15:00:00 rb2305 4059.0 4074.0 4056.0 4063.0 167932 6824213940 1882723 -13125 4058.0 4059.0 4062.0 4063.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1689 2024-01-03 12:00:00 rb2405 4055.0 4057.0 4044.0 4049.0 79745 3229361570 1597387 -6515 4054.0 4055.0 4049.0 4050.0
1690 2024-01-03 14:00:00 rb2405 4050.0 4056.0 4046.0 4049.0 55040 2229498750 1598566 1179 4050.0 4051.0 4049.0 4050.0
1691 2024-01-03 15:00:00 rb2405 4050.0 4064.0 4048.0 4055.0 148845 6038835190 1583796 -14770 4049.0 4050.0 4055.0 4056.0
1692 2024-01-03 22:00:00 rb2405 4054.0 4054.0 4040.0 4049.0 181753 7354584770 1582419 990 4053.0 4054.0 4048.0 4049.0
1693 2024-01-03 23:00:00 rb2405 4049.0 4057.0 4042.0 4049.0 104712 4240341050 1574287 -8132 4048.0 4049.0 4049.0 4050.0
'''