Skip to main content

An interface encapsulated based on Tushare, which implements rate limiting and retry mechanisms.

Project description

tushare-interface

将tushare接口封装在类中,并提供限流、重试功能

安装教程

  1. pip 安装(待定)
  2. 在.bashrc中添加环境变量:
  • export TUSHARE_TOKEN='xxxxxxxxxx' 该api从tushare.pro网站购买
  • export TUSHARE_API_PER_MINUTUS=100, 设置每分钟可访问接口的次数

使用说明

  1. import tushare_interface
  2. package内有实例化对象: interfaceTuShare,
  • 如果环境变量已经设置好,import后即可使用
  • 如果环境变量未设置,可通过setToken函数设置从htp://tushare.pro获得的token; 以及
  • 通过setTimesPerMinutus函数设置每分钟可访问的次数(最少1次)
  1. interfaceTuShare还可以使用setRetry设置重试次数(最少0次)和重试间隔(以秒为单位)
  2. 调用query接口从tushare下载数据,接口与tushare原始的query保持一致
  3. 函数原型
  • setToken(self, token: str) -> None
  • setTimesPerMinutus(self, timesPerMinutus: int) -> None
  • setRetry(self, retrys: int, secondsWaitRetry: int) -> None
  • query(self, func_name: str, **kwds: object) -> pandas.DataFrame | None

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tushare_interface-0.1.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

tushare_interface-0.1.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file tushare_interface-0.1.1.tar.gz.

File metadata

  • Download URL: tushare_interface-0.1.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.14

File hashes

Hashes for tushare_interface-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e6f4294cb6b19c0937076b5df6de6d15b47688dfeeefc422ee4831e0711ae9ae
MD5 00b96fd55f6176fa7d576ab93ced7475
BLAKE2b-256 83f7dcacdb37a89383a474fbca0b055b5fb580948f033fa8b5882f0191b2accd

See more details on using hashes here.

File details

Details for the file tushare_interface-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tushare_interface-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e4a0b876dd74c1e13078298aff647521b70c627cb7fd423bd94d9cc38312e11
MD5 e209f06c7f00373e3ebcc58dc3b9c39c
BLAKE2b-256 29f9ab00b301537fe2f8d28c74a873ad13d322c278d8a1ecf01577421c8daae5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page