Skip to main content

Public API client for working with the Tradernet platform.

Project description

Upload Python Package Python Version Dependencies Status

Code style: black Security: bandit Pre-commit Semantic Versions License Coverage Report

Tradernet API

Public API client for working with the Tradernet platform.
Official API documentation

Installation

Install package

pip install -U tradernet-api

or

poetry add tradernet-api@latest

Getting Started

from tradernet_api.api import API

# Setup client
api_client = API(api_key="YOUR API KEY", secret_key="YOUR SECRET KEY")

# Get only active orders by default
api_client.get_orders()

# Get all orders
api_client.get_orders(active_only=False)

# Get ticker info
api_client.get_ticker_info(ticker="AAPL")

# Send order to the platform
api_client.send_order(ticker="AAPL", side="buy", margin=True, count=1, order_exp="day", market_order=True)
api_client.send_order(ticker="MSFT", side="sell", margin=False, count=2, order_exp="ext", limit_price=200)
api_client.send_order(ticker="TSLA", side="sell", margin=True, count=3, order_exp="gtc", stop_price=1000)

# Delete/cancel active order
api_client.delete_order(order_id=123456789)

# Set stop loss and/or take profit
api_client.set_stop_order(ticker="AAPL", stop_loss=1, take_profit=2)

🛡 License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

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

tradernet_api-1.1.2.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

tradernet_api-1.1.2-py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 3

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