thsdata


Namethsdata JSON
Version 0.0.65 PyPI version JSON
download
home_pageNone
Summary金融数据查询
upload_time2025-03-14 03:34:10
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords python thsdata
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# thsdata

# Installation

```bash
pip install --upgrade thsdata
```

# Usage

```python
from thsdata import Quote, FuquanNo, KlineDay
import datetime


def main():
    # 初始化
    quote = Quote()

    try:
        # quote.connect()
        start_date = datetime.datetime(2024, 1, 1)
        end_date = datetime.datetime(2025, 2, 28)
        data = quote.security_bars("USHA600519", start_date, end_date, FuquanNo, KlineDay)
        print(data)

    except Exception as e:
        print("An error occurred:", e)

    finally:
        # 断开连接
        quote.disconnect()
        print("Disconnected from the server.")


if __name__ == "__main__":
    main()

```

result:

```
2025/03/04 18:16:56 hello thsdk!
          time    close   volume    turnover     open     high      low
0   2024-01-02  1685.01  3215644  5440082500  1715.00  1718.19  1678.10
1   2024-01-03  1694.00  2022929  3411400700  1681.11  1695.22  1676.33
2   2024-01-04  1669.00  2155107  3603970100  1693.00  1693.00  1662.93
3   2024-01-05  1663.36  2024286  3373155600  1661.33  1678.66  1652.11
4   2024-01-08  1643.99  2558620  4211918600  1661.00  1662.00  1640.01
..         ...      ...      ...         ...      ...      ...      ...
273 2025-02-24  1479.07  3474373  5157907300  1488.00  1499.52  1474.00
274 2025-02-25  1454.00  2838743  4142814500  1470.01  1473.39  1452.00
275 2025-02-26  1460.01  2636609  3835949000  1455.45  1464.96  1445.00
276 2025-02-27  1485.56  4976217  7368002400  1460.02  1489.90  1454.00
277 2025-02-28  1500.79  5612895  8475738200  1485.50  1528.38  1482.00

[278 rows x 7 columns]
Disconnected from the server.
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "thsdata",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, thsdata",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/73/67/58745d74efadfaf46676651f23e9672da9855799678d3f8160694fff7de8/thsdata-0.0.65.tar.gz",
    "platform": null,
    "description": "\n# thsdata\n\n# Installation\n\n```bash\npip install --upgrade thsdata\n```\n\n# Usage\n\n```python\nfrom thsdata import Quote, FuquanNo, KlineDay\nimport datetime\n\n\ndef main():\n    # \u521d\u59cb\u5316\n    quote = Quote()\n\n    try:\n        # quote.connect()\n        start_date = datetime.datetime(2024, 1, 1)\n        end_date = datetime.datetime(2025, 2, 28)\n        data = quote.security_bars(\"USHA600519\", start_date, end_date, FuquanNo, KlineDay)\n        print(data)\n\n    except Exception as e:\n        print(\"An error occurred:\", e)\n\n    finally:\n        # \u65ad\u5f00\u8fde\u63a5\n        quote.disconnect()\n        print(\"Disconnected from the server.\")\n\n\nif __name__ == \"__main__\":\n    main()\n\n```\n\nresult:\n\n```\n2025/03/04 18:16:56 hello thsdk!\n          time    close   volume    turnover     open     high      low\n0   2024-01-02  1685.01  3215644  5440082500  1715.00  1718.19  1678.10\n1   2024-01-03  1694.00  2022929  3411400700  1681.11  1695.22  1676.33\n2   2024-01-04  1669.00  2155107  3603970100  1693.00  1693.00  1662.93\n3   2024-01-05  1663.36  2024286  3373155600  1661.33  1678.66  1652.11\n4   2024-01-08  1643.99  2558620  4211918600  1661.00  1662.00  1640.01\n..         ...      ...      ...         ...      ...      ...      ...\n273 2025-02-24  1479.07  3474373  5157907300  1488.00  1499.52  1474.00\n274 2025-02-25  1454.00  2838743  4142814500  1470.01  1473.39  1452.00\n275 2025-02-26  1460.01  2636609  3835949000  1455.45  1464.96  1445.00\n276 2025-02-27  1485.56  4976217  7368002400  1460.02  1489.90  1454.00\n277 2025-02-28  1500.79  5612895  8475738200  1485.50  1528.38  1482.00\n\n[278 rows x 7 columns]\nDisconnected from the server.\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "\u91d1\u878d\u6570\u636e\u67e5\u8be2",
    "version": "0.0.65",
    "project_urls": null,
    "split_keywords": [
        "python",
        " thsdata"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "736758745d74efadfaf46676651f23e9672da9855799678d3f8160694fff7de8",
                "md5": "ea9c52ab87b02671fbe6f86e780c20ad",
                "sha256": "064c7163c8c9b68d1a8e6f6556d90ee3d9cd1690871f10d669a7b53c9337628a"
            },
            "downloads": -1,
            "filename": "thsdata-0.0.65.tar.gz",
            "has_sig": false,
            "md5_digest": "ea9c52ab87b02671fbe6f86e780c20ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8728,
            "upload_time": "2025-03-14T03:34:10",
            "upload_time_iso_8601": "2025-03-14T03:34:10.865391Z",
            "url": "https://files.pythonhosted.org/packages/73/67/58745d74efadfaf46676651f23e9672da9855799678d3f8160694fff7de8/thsdata-0.0.65.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-14 03:34:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "thsdata"
}
        
Elapsed time: 0.42221s