Skip to main content

BTG Solutions Trade API package

BTG solutions trade api package.

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. sampleInterval is optional

controller = OrderController(
    token="TOKEN",
    order_api_host="URL",
    account="YOUR_ACCOUNT_NUMBER",
    execBroker="YOUR_EXEC_BROKER",
    entity="YOUR_ENTITY",
    sampleInterval = None
)

One can provide a custom order update callback function.

def order_update_callback(order):
    print(f"Order update: {order}")

controller = OrderController(
    token=token,
    order_api_host="URL",
    account="YOUR_ACCOUNT_NUMBER",
    execBroker="YOUR_EXEC_BROKER",
    entity="YOUR_ENTITY",
    order_update_callback=order_update_callback,
    sampleInterval = 5
    )

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"
)

Create an order and receive the resulting order ID. This signature allow user to use different account, entity and broker of Controller session

orderId = controller.create_order(
    symbol="PETR4",
    side="S",
    qty="5000",
    price="20.41",
    timeInForce="Day",
    isDMA="true",
    account="ACCOUNT", 
    execBroker="NUMBER_OF_BROKER", 
    entity="ENTITY",
    memo = "memo"
)

Create an order using strategy and receive the resulting order ID. This signature allow user to use different account, entity and broker of Controller session

strategyParameter = { 
"max-floor": "100",    
"start-time": "20240614-19:00:00",
"end-time": "20240614-20:00:00"
}

orderId = controller.create_order(
    symbol="PETR4",
    side="S",
    qty="5000",
    price="20.41",
    timeInForce="Day",
    isDMA="true",
    account="ACCOUNT", 
    execBroker="NUMBER_OF_BROKER", 
    entity="ENTITY",
    strategy = "twap",
    strategyParameter = strategyParameter
)

Change order.

controller.change_order(
    id="YOUR_ORDER_ID",
    qty="5000",
    price="20.43",
    timeInForce="Day",
    ordType="Limit"
)

Cancel order.

controller.cancel_order(
    id="YOUR_ORDER_ID",
)

Cancel ALL order.

controller.cancel_all_orders()

Get Trades.

controller.get_trades()

Get Orders.

controller.get_orders()

Get Orders by Params. All params are optional

controller.get_ordersByParams(complete = True, symbol = "WEGE3", status = "New", side = "Sell", memo = "memo", parent = True)

Get Orders.

controller.get_order(
		id = "ORDER ID"
)

Get a summary of all your orders.

controller.summary()

Support

Get help at support@btgpactualsolutions.com

Metadata

Release files for btgsolutions-tradeservices-python-client 0.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for btgsolutions-tradeservices-python-client 0.1.13
File Size Uploaded Provenance Actions
btgsolutions_tradeservices_python_client-0.1.13.tar.gz 7.8 kB Without provenance Details for btgsolutions_tradeservices_python_client-0.1.13.tar.gz

Release files / btgsolutions_tradeservices_python_client-0.1.13.tar.gz

Download URL btgsolutions_tradeservices_python_client-0.1.13.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bbaeb1aba9fdc6717c113dda130b155d8db8cf2748aa70a9dfe8f3b8f1cda29b
BLAKE2b-256 checksum
How to use checksums
b0809b5382bb90a6b3dc5f8d1a3a0e7801cafd3335191e103e5d76f8d67b3cc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.4

Security for btgsolutions-tradeservices-python-client 0.1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page