KucoinPy


NameKucoinPy JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://www.github.com/PrivatePandaCO/KucoinPy
SummaryProbably the fastest kucoin API wrapper in python
upload_time2023-07-06 13:51:28
maintainer
docs_urlNone
authorParth Mittal
requires_python
licenseGNU GENERAL PUBLIC LICENSE Version 2
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # KucoinPy (KCW)
The stuff that speeds my crypto trading bots. My very own kucoin API wrapper in python, using sockets and conversing with the new HFT endpoints

### WIP Warning
It has quite a few issues as of now, especially with kucoin not responding to my pings - I don't know if this is my fault or kucoin's :( <br>
I know some of the works are bad, like return err instead of raise err - but this is still a pretty new wrapper, which was originally meant to be used only and only by me, for my pump trading bot. <br>
That said, I do believe this wrapper is pretty good for it's speed, and I'd appreciate any input and contributions to it.

---

<details>
    <summary> Features </summary>

- Socket cache
  - A new socket is used for each request.
  - This is done, in light of previous tests, to avoid buffer errors and closed socket errors.
- Websocket auto sub/re-sub
  - A pretty basic feature but one I really like
  - In the instance the websocket reboots, it automatically re-subscribes to old channels.
- Inbuilt subscriptions
  - By default, maintains balance and order history
- `second_message_handler`
  - Another very basic feature yet I'm very proud of, that is the ability to pass in a function to handle every websocket message after the default handler has ran.
  - This makes it useful to use in bots where you need additional manageemnt other than the inbuilt already implemented.
- `after_ws`
  - Similar to `second_message_handler`, it allows a function to be passed in that is called/ran after a websocket successfully boots.
  - This is useful in cases where the application requires extra work to be done after booting a socket before everything is ready
- `_shutdown_ws` object variable
  - Automatically varies from `True` to `False` based on the status of the websocket.
  - I found this really useful in HFT or even simply printing data; where it would print outdated data while the socket rebooted. Instead just check if this variable is `True` or `False`

</details>

<details>
    <summary> Installation </summary>

As easy as `pip install KucoinPy`

</details>

<details>
    <summary> Config </summary>

The variables to be passed in to `KCW()`<br>

- `kc_api_key, kc_api_secret, kc_api_passphrase,`: Self explanatory.
- `defaults`: Defaults to `None`
  - Default channels to subscribe to
  - Currently supports `/account/balance` and `/spotMarket/tradeOrdersV2`
  - Pass in `None` to not subscribe to any channels
  - Pass in a list of strings to subscribe to those channels
    - Format: `[("topic", private: bool), ("topic", private: bool)]`
    - Example: `[("/account/balance", True)]`
- `second_message_handler`: Defaults to doing nothing
  - Function called after default websocket message handler is ran.
  - Passes one parameter, message, which is the json of the websocket message.
- `after_ws`: Defaults to do nothing
  - Function called after websocket successfully boots.
  - Does not pass in any parameter
- `logger`: Defaults to `pyloggor(project_root="KucoinPy")`
  - A pyloggor object; check it out [here!](https://pypi.org/project/pyloggor/)
  - This is a library created by me for beautiful logging :)
  - Please note the default logger uses an option `project_root` which MAY slow down logging to about 0.0001 seconds or 0.1 ms for one log call. This occurs due to the stack depth being big.

</details>

<details>
    <summary> TODO </summary>

- I don't like the fact so much overhead is ran if only and only the websocket is required, probably something to be done on a later date.
- The recv function in the socket wrapper (`HTTP`), does not properly manage content length and often contains data which the `Response` class does not properly handle.
  - This happens when the response data is big and gets chunked, in which case the splitting and stuff doesn't resolve properly.
- Clean up log statements; really inconsistent and messy.
- Add support for the good stuff like transfers and order history and balance etc etc

</details>

---

## Appendix

Heyo, just your average good-for-nothing 16 year old backyard programmer here. Check [my site](https://privatepanda.co) instead :)<br>
If you liked this piece of work or it helped you in any way, buy me a coffee and make my day! [Support Me](https://privatepanda.co#patreon)

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.github.com/PrivatePandaCO/KucoinPy",
    "name": "KucoinPy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Parth Mittal",
    "author_email": "parth@privatepanda.co",
    "download_url": "https://files.pythonhosted.org/packages/f9/f7/6e81ad11a1123f2f554bf8dfe81d5bd94892526e3f6634f727d55ea79f7c/KucoinPy-0.0.3.tar.gz",
    "platform": null,
    "description": "# KucoinPy (KCW)\nThe stuff that speeds my crypto trading bots. My very own kucoin API wrapper in python, using sockets and conversing with the new HFT endpoints\n\n### WIP Warning\nIt has quite a few issues as of now, especially with kucoin not responding to my pings - I don't know if this is my fault or kucoin's :( <br>\nI know some of the works are bad, like return err instead of raise err - but this is still a pretty new wrapper, which was originally meant to be used only and only by me, for my pump trading bot. <br>\nThat said, I do believe this wrapper is pretty good for it's speed, and I'd appreciate any input and contributions to it.\n\n---\n\n<details>\n    <summary> Features </summary>\n\n- Socket cache\n  - A new socket is used for each request.\n  - This is done, in light of previous tests, to avoid buffer errors and closed socket errors.\n- Websocket auto sub/re-sub\n  - A pretty basic feature but one I really like\n  - In the instance the websocket reboots, it automatically re-subscribes to old channels.\n- Inbuilt subscriptions\n  - By default, maintains balance and order history\n- `second_message_handler`\n  - Another very basic feature yet I'm very proud of, that is the ability to pass in a function to handle every websocket message after the default handler has ran.\n  - This makes it useful to use in bots where you need additional manageemnt other than the inbuilt already implemented.\n- `after_ws`\n  - Similar to `second_message_handler`, it allows a function to be passed in that is called/ran after a websocket successfully boots.\n  - This is useful in cases where the application requires extra work to be done after booting a socket before everything is ready\n- `_shutdown_ws` object variable\n  - Automatically varies from `True` to `False` based on the status of the websocket.\n  - I found this really useful in HFT or even simply printing data; where it would print outdated data while the socket rebooted. Instead just check if this variable is `True` or `False`\n\n</details>\n\n<details>\n    <summary> Installation </summary>\n\nAs easy as `pip install KucoinPy`\n\n</details>\n\n<details>\n    <summary> Config </summary>\n\nThe variables to be passed in to `KCW()`<br>\n\n- `kc_api_key, kc_api_secret, kc_api_passphrase,`: Self explanatory.\n- `defaults`: Defaults to `None`\n  - Default channels to subscribe to\n  - Currently supports `/account/balance` and `/spotMarket/tradeOrdersV2`\n  - Pass in `None` to not subscribe to any channels\n  - Pass in a list of strings to subscribe to those channels\n    - Format: `[(\"topic\", private: bool), (\"topic\", private: bool)]`\n    - Example: `[(\"/account/balance\", True)]`\n- `second_message_handler`: Defaults to doing nothing\n  - Function called after default websocket message handler is ran.\n  - Passes one parameter, message, which is the json of the websocket message.\n- `after_ws`: Defaults to do nothing\n  - Function called after websocket successfully boots.\n  - Does not pass in any parameter\n- `logger`: Defaults to `pyloggor(project_root=\"KucoinPy\")`\n  - A pyloggor object; check it out [here!](https://pypi.org/project/pyloggor/)\n  - This is a library created by me for beautiful logging :)\n  - Please note the default logger uses an option `project_root` which MAY slow down logging to about 0.0001 seconds or 0.1 ms for one log call. This occurs due to the stack depth being big.\n\n</details>\n\n<details>\n    <summary> TODO </summary>\n\n- I don't like the fact so much overhead is ran if only and only the websocket is required, probably something to be done on a later date.\n- The recv function in the socket wrapper (`HTTP`), does not properly manage content length and often contains data which the `Response` class does not properly handle.\n  - This happens when the response data is big and gets chunked, in which case the splitting and stuff doesn't resolve properly.\n- Clean up log statements; really inconsistent and messy.\n- Add support for the good stuff like transfers and order history and balance etc etc\n\n</details>\n\n---\n\n## Appendix\n\nHeyo, just your average good-for-nothing 16 year old backyard programmer here. Check [my site](https://privatepanda.co) instead :)<br>\nIf you liked this piece of work or it helped you in any way, buy me a coffee and make my day! [Support Me](https://privatepanda.co#patreon)\n",
    "bugtrack_url": null,
    "license": "GNU GENERAL PUBLIC LICENSE Version 2",
    "summary": "Probably the fastest kucoin API wrapper in python",
    "version": "0.0.3",
    "project_urls": {
        "Changelog": "https://github.com/PrivatePandaCO/KucoinPy/blob/master/changelog.md",
        "Documentation": "https://github.com/PrivatePandaCO/KucoinPy/blob/master/README.md",
        "Github": "https://github.com/PrivatePandaCO/KucoinPy",
        "Homepage": "https://www.github.com/PrivatePandaCO/KucoinPy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57d6ae14154cf46dab0e4b0fd3344e07839426f50a3c5179b446213ece6c3c4b",
                "md5": "9c916dfd7c6f5c58dd7395bc14e98f3b",
                "sha256": "6545391408b35993f5f5f2b5709ec4bd723709970b91a41765813e778a81d68f"
            },
            "downloads": -1,
            "filename": "KucoinPy-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c916dfd7c6f5c58dd7395bc14e98f3b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17269,
            "upload_time": "2023-07-06T13:51:17",
            "upload_time_iso_8601": "2023-07-06T13:51:17.539713Z",
            "url": "https://files.pythonhosted.org/packages/57/d6/ae14154cf46dab0e4b0fd3344e07839426f50a3c5179b446213ece6c3c4b/KucoinPy-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9f76e81ad11a1123f2f554bf8dfe81d5bd94892526e3f6634f727d55ea79f7c",
                "md5": "3d78e4769c37fe3bbfefc81053441601",
                "sha256": "8c552043a61645e16ee4a893ad9bf91844e478c10e6b9889916fa95b8838e25f"
            },
            "downloads": -1,
            "filename": "KucoinPy-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3d78e4769c37fe3bbfefc81053441601",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17852,
            "upload_time": "2023-07-06T13:51:28",
            "upload_time_iso_8601": "2023-07-06T13:51:28.730869Z",
            "url": "https://files.pythonhosted.org/packages/f9/f7/6e81ad11a1123f2f554bf8dfe81d5bd94892526e3f6634f727d55ea79f7c/KucoinPy-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-06 13:51:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PrivatePandaCO",
    "github_project": "KucoinPy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "kucoinpy"
}
        
Elapsed time: 0.62001s