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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tushare_interface-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 b7d67317a37365faa27525335fde7e5d435abafadd5e07aa0d6c9261acc77a48
MD5 fb1334ed763060262aca414fc1fa0018
BLAKE2b-256 f363e77d23e92d203e75e32ed2106d04cb17e956c28057a63263a854954f3d27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tushare_interface-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ee12cfde1f7bcccfd41c0f77cccc8a8669c5f9dd00f7d4eeebc271fbd24b06c
MD5 c194f768c5a9464c5e73d2746d59d6ce
BLAKE2b-256 1512f5fc1bb8007bd4aec845909567429e4064704a2989d5f46a023ea9a4dea6

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