tradelocker


Nametradelocker JSON
Version 0.41.0 PyPI version JSON
download
home_pageNone
SummaryTradeLocker Trading API support for Python
upload_time2024-04-30 07:43:00
maintainerNone
docs_urlNone
authorTradeLocker
requires_python>=3.11
licenseMIT
keywords tradelocker api rest trading exchange algotrading algo bots strategies
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TradeLocker Python API Wrapper

This project provides a Python wrapper for TradeLocker's public API. It simplifies the process of making requests to the API by providing Pythonic interfaces.

A full description of the TradeLocker's public API can be found at [TradeLocker API Documentation](https://tradelocker.com/api)

---

## Table of Contents
1. [Getting Started](#getting-started)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Contributing](#contributing)
5. [License](#license)

## Getting Started

To use this Python wrapper, you'll need the username, password and the id of the server that you use to access TradeLocker.
If you don't already have access, you need to find a broker that supports TradeLocker and create an account.

## Installation

This package requires Python 3.11 or later.
The easiest way to install this package is using pip:

```shell
pip install tradelocker
```

## Usage

Here's a simple example on how to use the TradeLocker Python API wrapper.
The code below initializes a TLAPI object with authentication data.
It then: fetches price history and latest price, creates an order that converts into a position, waits for 2 seconds, and finally closes the same position.

```python
from tradelocker import TLAPI
import time, random

# Initialize the API client with the information you use to login
tl = TLAPI(environment = "https://demo.tradelocker.com", username = "user@email.com", password = "YOUR_PASS", server = "SERVER_NAME")

symbol_name = "BTCUSD" # "RANDOM"
all_instruments = tl.get_all_instruments()
if symbol_name == "RANDOM":
	instrument_id = int(random.choice(all_instruments['tradableInstrumentId']))
else:
	instrument_id = tl.get_instrument_id_from_symbol_name(symbol_name)
price_history = tl.get_price_history(instrument_id, resolution="1D", start_timestamp=0, end_timestamp=0,lookback_period="5D")
latest_price = tl.get_latest_asking_price(instrument_id)
order_id = tl.create_order(instrument_id, quantity=0.01, side="buy", type_="market")
if order_id:
	print(f"Placed order with id {order_id}, sleeping for 2 seconds.")
	time.sleep(2)
	tl.close_position(order_id)
	print(f"Closed order with id {order_id}.")
else:
	print("Failed to place order.")
```

For more detailed examples, see the `examples` directory.

## Contributing

To contribute to the development of this project, please create an issue, or a pull request.

Steps to create a pull request:
1. Clone the project.
2. Create your feature branch (`git checkout -b feature/YourFeature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin feature/YourFeature`).
5. Create a new Merge Request.

## License

This project is licensed under the terms of the MIT license. See [LICENSE](https://github.com/ivosluganovic/tl/blob/main/LICENSE.txt) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tradelocker",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "tradelocker, api, rest, trading, exchange, algotrading, algo, bots, strategies",
    "author": "TradeLocker",
    "author_email": "admin@tradelocker.com",
    "download_url": "https://files.pythonhosted.org/packages/08/23/ef1144fc16be1065fb745456b3b129658a3c9da52f96ab9f3626b611d46c/tradelocker-0.41.0.tar.gz",
    "platform": null,
    "description": "# TradeLocker Python API Wrapper\n\nThis project provides a Python wrapper for TradeLocker's public API. It simplifies the process of making requests to the API by providing Pythonic interfaces.\n\nA full description of the TradeLocker's public API can be found at [TradeLocker API Documentation](https://tradelocker.com/api)\n\n---\n\n## Table of Contents\n1. [Getting Started](#getting-started)\n2. [Installation](#installation)\n3. [Usage](#usage)\n4. [Contributing](#contributing)\n5. [License](#license)\n\n## Getting Started\n\nTo use this Python wrapper, you'll need the username, password and the id of the server that you use to access TradeLocker.\nIf you don't already have access, you need to find a broker that supports TradeLocker and create an account.\n\n## Installation\n\nThis package requires Python 3.11 or later.\nThe easiest way to install this package is using pip:\n\n```shell\npip install tradelocker\n```\n\n## Usage\n\nHere's a simple example on how to use the TradeLocker Python API wrapper.\nThe code below initializes a TLAPI object with authentication data.\nIt then: fetches price history and latest price, creates an order that converts into a position, waits for 2 seconds, and finally closes the same position.\n\n```python\nfrom tradelocker import TLAPI\nimport time, random\n\n# Initialize the API client with the information you use to login\ntl = TLAPI(environment = \"https://demo.tradelocker.com\", username = \"user@email.com\", password = \"YOUR_PASS\", server = \"SERVER_NAME\")\n\nsymbol_name = \"BTCUSD\" # \"RANDOM\"\nall_instruments = tl.get_all_instruments()\nif symbol_name == \"RANDOM\":\n\tinstrument_id = int(random.choice(all_instruments['tradableInstrumentId']))\nelse:\n\tinstrument_id = tl.get_instrument_id_from_symbol_name(symbol_name)\nprice_history = tl.get_price_history(instrument_id, resolution=\"1D\", start_timestamp=0, end_timestamp=0,lookback_period=\"5D\")\nlatest_price = tl.get_latest_asking_price(instrument_id)\norder_id = tl.create_order(instrument_id, quantity=0.01, side=\"buy\", type_=\"market\")\nif order_id:\n\tprint(f\"Placed order with id {order_id}, sleeping for 2 seconds.\")\n\ttime.sleep(2)\n\ttl.close_position(order_id)\n\tprint(f\"Closed order with id {order_id}.\")\nelse:\n\tprint(\"Failed to place order.\")\n```\n\nFor more detailed examples, see the `examples` directory.\n\n## Contributing\n\nTo contribute to the development of this project, please create an issue, or a pull request.\n\nSteps to create a pull request:\n1. Clone the project.\n2. Create your feature branch (`git checkout -b feature/YourFeature`).\n3. Commit your changes (`git commit -am 'Add some feature'`).\n4. Push to the branch (`git push origin feature/YourFeature`).\n5. Create a new Merge Request.\n\n## License\n\nThis project is licensed under the terms of the MIT license. See [LICENSE](https://github.com/ivosluganovic/tl/blob/main/LICENSE.txt) for more details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "TradeLocker Trading API support for Python",
    "version": "0.41.0",
    "project_urls": {
        "Issues": "https://github.com/tradelocker/tradelocker-python/issues",
        "Source": "https://github.com/tradelocker/tradelocker-python/"
    },
    "split_keywords": [
        "tradelocker",
        " api",
        " rest",
        " trading",
        " exchange",
        " algotrading",
        " algo",
        " bots",
        " strategies"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46e7ab8896e71a339a12d37c2ed0a7fca4b0b260b82b8bc466b7e4e590c915c4",
                "md5": "448722cb27b4c4328580c8753f3a9bd0",
                "sha256": "dd23fb8e1a69f3f760b43d0d521433aa799d80251a2917f7e8df41fc20f4381b"
            },
            "downloads": -1,
            "filename": "tradelocker-0.41.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "448722cb27b4c4328580c8753f3a9bd0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 19899,
            "upload_time": "2024-04-30T07:42:58",
            "upload_time_iso_8601": "2024-04-30T07:42:58.666211Z",
            "url": "https://files.pythonhosted.org/packages/46/e7/ab8896e71a339a12d37c2ed0a7fca4b0b260b82b8bc466b7e4e590c915c4/tradelocker-0.41.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0823ef1144fc16be1065fb745456b3b129658a3c9da52f96ab9f3626b611d46c",
                "md5": "7461d845f98b17e293e0532ceb3feb20",
                "sha256": "36c198db8e7f106564efd07e6728df4188e0b2874f8a596b1dff0e5041ec46e6"
            },
            "downloads": -1,
            "filename": "tradelocker-0.41.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7461d845f98b17e293e0532ceb3feb20",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 19881,
            "upload_time": "2024-04-30T07:43:00",
            "upload_time_iso_8601": "2024-04-30T07:43:00.543729Z",
            "url": "https://files.pythonhosted.org/packages/08/23/ef1144fc16be1065fb745456b3b129658a3c9da52f96ab9f3626b611d46c/tradelocker-0.41.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 07:43:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tradelocker",
    "github_project": "tradelocker-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tradelocker"
}
        
Elapsed time: 0.29795s