/tradernet-api

Public API client for working with the Tradernet platform

Primary LanguagePythonMIT LicenseMIT

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.