Python client package for trading within BTG Solutions platform.
Project description
BTG Solutions Trade API package
BTG solutions trade api package.
Install locally
- Clone repo to your local environment
- At package's root level run:
python3 -m pip install -e .
Usage
Get your token and use it in the examples below.
Instantiate an order controller. Provide your token, account number, execution broker and entity to start sending orders.
controller = OrderController(
token=token,
account="YOUR_ACCOUNT_NUMBER",
exec_broker="YOUR_EXEC_BROKER",
entity="YOUR_ENTITY",
)
One can provide a custom order update callback function.
def order_update_callback(order):
print(f"Order update: {order}")
controller = OrderController(
token=token,
account="YOUR_ACCOUNT_NUMBER",
exec_broker="YOUR_EXEC_BROKER",
entity="YOUR_ENTITY",
order_update_callback=order_update_callback,
)
Create an order and receive the resulting order ID.
orderId = controller.create_order(
symbol="PETR4",
side="S",
qty="5000",
price="20.41",
timeInForce="Day",
isDMA="true"
)
Change order.
controller.change_order(
id="YOUR_ORDER_ID",
qty="5000",
price="20.43",
timeInForce="Day"
)
Cancel order.
controller.cancel_order(
id="YOUR_ORDER_ID",
)
Get a summary of all your orders.
controller.summary()
Support
Get help at support@btgpactualsolutions.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for btgsolutions-tradeservices-python-client-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2b463e25bb5c22b116ac72acb71b991f511adb689ffc25681f376d58d03c288 |
|
MD5 | 84747c8ef415e6afbd1c5ef2d5c3d78f |
|
BLAKE2b-256 | 8d2e00c1e6aedd9906470af504a72dd06ed936afaf398e6bff343a60d9ceeb05 |