The advisory_only.py
script is designed to interact with a local API for managing tender offers and calculating weighted average costs (WAC) based on market liquidity. It retrieves tender offers, evaluates them against market conditions, and makes decisions on whether to accept, decline, or remain neutral regarding these offers. It is meant as a supplement to the Liability Trading 3 of the RIT Decision cases (link)
The trading strategy implemented in the advisory_only.py
script involves several key components that work together to make informed decisions on tender offers based on market conditions. Below is a detailed explanation of the strategy:
- The script retrieves tender offers from a local API. A tender offer represents a proposal to purchase securities at a specified price.
- The script filters the retrieved tender offers to focus on those that contain specific phrases, such as "An institution would like to," ensuring that only relevant offers are considered.
- It fetches current market data, including bid and ask prices for relevant securities, using the local API.
- The script assesses the liquidity available in the market for the relevant securities by analyzing order books. It gathers orders that are either bids (for buying) or asks (for selling) based on the action specified in the tender offer.
- The WAC is calculated based on the orders sourced from the market. This involves aggregating costs from multiple orders until the required quantity for the tender offer is reached.
- The calculation considers both the price and quantity of each order, allowing for a dynamic assessment of market conditions.
- Accept Decision: If enough liquidity is sourced to meet or exceed the quantity specified in the tender offer, and if the WAC is greater than the offer price for a buy action or less than the offer price for a sell action, then the decision is to "Accept."
- Neutral Decision: If insufficient quantity is sourced but still meets favorable WAC conditions, it results in a "Neutral" decision, indicating that while there isn’t enough liquidity to fully accept the offer, it may still be worth considering.
- Decline Decision: If there isn’t enough liquidity sourced and the WAC does not favorably compare to the offer price, then the decision is to "Decline."
- The strategy effectively combines market data analysis with liquidity assessment to make informed trading decisions regarding tender offers.
- By leveraging real-time data and calculating WAC, it aims to optimize trading outcomes while managing risk effectively.
- Signal Handling: Gracefully handles shutdown signals to ensure the program can exit cleanly.
- API Interaction: Communicates with a local API to fetch tender offers and market data.
- Tender Offer Filtering: Filters tender offers based on specific criteria.
- WAC Calculation: Calculates the weighted average cost (WAC) and assesses liquidity based on current market conditions.
- Decision Making: Makes decisions on whether to accept or decline tender offers based on calculated WAC and market prices.
- Python 3.x
requests
librarypython-dotenv
for environment variable management
You can install the required libraries using pip:
pip install -r requirements.txt
- automated trading
- order sizing based on available liquidity to minimize market impact
- RIT Decision cases
- RIT Market Simulator application
- This code is meant as an advisor to manual trade execution.
This project is licensed under the MIT License - see the LICENSE.md file for details.
- You may contact me at
zo125
on telegram for inquiries.