Is there a way to determine if a trade tick is traded on the bid or ask side? (To simulate information offered in a footprint chart)
Thank you in advance for all who would participate in this discussion
QUANTCONNECT COMMUNITY
Is there a way to determine if a trade tick is traded on the bid or ask side? (To simulate information offered in a footprint chart)
Thank you in advance for all who would participate in this discussion
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mia Alissi
To determine if a trade tick is traded on the bid or ask side using QuantConnect, you can follow these steps:
Access Tick Data: Use the
Tick
class to access tick data, focusing on properties likebid_price
,ask_price
, andlast_price
.Compare Prices: For each tick, compare the
last_price
with thebid_price
andask_price
to determine its position relative to these prices.Identify Trade Side:
last_price
is equal to or less than thebid_price
, classify the trade as occurring on the bid side.last_price
is equal to or greater than theask_price
, classify it as occurring on the ask side.Flag Suspicious Ticks: Use the
suspicious
method to flag ticks that occur outside the normal bid-ask range, as these might indicate hidden orders or other anomalies.Aggregate Data: Collect and aggregate this tick data over a specified period to simulate the footprint chart, showing the volume of trades on the bid and ask sides.
Visualize Data: Use QuantConnect's charting capabilities to visualize the aggregated data, creating a footprint chart that displays the volume of trades on each side.
Here's a basic implementation in Python:
This code initializes a trading algorithm that tracks the volume of trades on the bid and ask sides for the SPY ticker. It uses the
Tick
class to access tick data and classify trades based on their last price relative to the bid and ask prices. Suspicious ticks are flagged, and the trade volumes are plotted for visualization.Sources: US Equities - QuantConnect.com, Data Preparation - QuantConnect.com, CFD - QuantConnect.com, Using Data - QuantConnect.com, Intraday Arbitrage Between Index ETFs
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Stanley Choo
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!