/
Examples

Examples

The following provides short videos and code snippets demonstrating hello world level usage of the libraries.

  • Time and sales

  • Market depth

  • Submitting orders

  • Accessing graph data

  • Basic strategy development, combining market data and trading in one script

Time and Sales

https://vimeo.com/835672238/9b3f7fb6d0
from trade29.sc.bridge import SCBridge # create the bridge object bridge = SCBridge() # subscribe to time and sales data bridge.time_and_sales_request('xx') # get access to the response queue messages = bridge.get_response_queue() # go into a while loop, wait for messages and print them out while True: msg = messages.get() print(msg.df)

Market Depth

Supports

  • User defined x number of levels

  • Update frequency

  • Optional pulling/stacking data

  • Optional mbo data

from trade29.sc.bridge import SCBridge bridge = SCBridge() bridge.market_depth_request('xx', update_frequency=5000, include_pulling_stacking=True, include_mbo=True) messages = bridge.get_response_queue() while True: msg = messages.get() print(msg.df)

Order Management

# placing a market order every 30 seconds from trade29.sc.bridge import SCBridge import time bridge = SCBridge() while True: print('placing order') bridge.submit_order('xx', is_buy=1, order_type=0, attach_orders_sc_trade_window=1) time.sleep(30)

Graph Data Request

Graph Data Request Overview Video

Graph Data Request Demo Video

Hello World Snippet

Graph Data Request Documentation

Strategy 1

On the close of a bar, goes long if the bar closes down, goes short if the bar closes up

Demonstrates:

  1. Subscribing to bar based data and using the graph_data_request api

  2. Placing orders with the submit_order method

  3. Using the request_id to handle messages from two sources

 

Creating a volume profile and finding the POC

SC provides a footprint chart that is built in “Volume by Price” data. This data is used for many things including for creating Volume Profiles.

This example demonstrates how to access this data from python, create volume profile and find the Point of Control (POC).

 

As background, you might want to see this overview video first:

https://vimeo.com/843296735/e829a4bd2d?share=copy

 

Related content

Combining Data Subscriptions, Position Updates, Account Updates and Submitting Orders
Combining Data Subscriptions, Position Updates, Account Updates and Submitting Orders
Read with this
Concepts and Overview
Concepts and Overview
More like this
graph_data_request
graph_data_request
Read with this
Releases Notes
Releases Notes
More like this
Documentation Organization and Outline
Documentation Organization and Outline
More like this
T29 Simple Breakout Bot
T29 Simple Breakout Bot
More like this