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.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file tushare-interface-0.1.0.tar.gz.

File metadata

  • Download URL: tushare-interface-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 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.0.tar.gz
Algorithm Hash digest
SHA256 30a399f8989e35a1f0ba57f3d2ddb579780a59af16ab947b2ba8e3b5e8e687b9
MD5 476f03413cd72c3f2053884373ab3927
BLAKE2b-256 214bdb297909dab2b33f6050baf7fbe0c97eaa749c841ea55be0310195c70dbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tushare_interface-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 818bd00ce98f3a9f202ba6f9b61d7769da4aba7efee9a9805c1381c59d1cdb5f
MD5 bf0b88230e66f1a3d83b4b20513e5f59
BLAKE2b-256 7669163ac0a472a50c0f9882cfe862ef1f64312bae26ff3252c24071882bb7ee

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