0% found this document useful (0 votes)
41 views

Programming For AI (BAI-21F-006)

This document discusses an automated financial investing system. It describes how such systems use algorithms to manage investments based on analyzing market data, executing trades, and continuously monitoring performance. The benefits are improved efficiency, accuracy, emotional discipline, and access to vast amounts of data. It also provides an example of pseudo code to illustrate the process an automated system may follow. Finally, it outlines some considerations investors should examine when adopting such a system.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Programming For AI (BAI-21F-006)

This document discusses an automated financial investing system. It describes how such systems use algorithms to manage investments based on analyzing market data, executing trades, and continuously monitoring performance. The benefits are improved efficiency, accuracy, emotional discipline, and access to vast amounts of data. It also provides an example of pseudo code to illustrate the process an automated system may follow. Finally, it outlines some considerations investors should examine when adopting such a system.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

NAME: MUHAMMAD HASAAN

ID: BAI-21F-006

COURSE: PROGRAMMING FOR A.I

DEPARTMENT: ARTIFICIAL INTELLIGENCE


AUTOMATED FINANCIAL
INVESTING SYSTEM.
WHAT IS AUTOMATED FINANCIAL
INVESTING SYSTEM?

Automated financial investing is when a


computer algorithm manages your
investments instead of a human financial
advisor. It's also known as robo-advising.
Benefits of Automated Financial Investing
System
• Improved Efficiency: Automating investment processes eliminates manual tasks and
reduces administrative burdens.

• Enhanced Accuracy: Minimizes human error and ensures trades are executed
promptly and accurately.

• Emotional Discipline: Removes emotional biases from investment decisions, leading


to more objective and consistent strategies.
Benefits of Automated Financial Investing
System
• Time Savings: Investors can focus on other aspects of their lives while the system
manages their investments.

• Access to Data: Utilizes vast amounts of financial data and market insights to
make informed investment decisions.
How It Works?
• Data Collection: Aggregates and analyzes financial data, news, and market trends
from various sources.

• Algorithm Development: Develops sophisticated algorithms to identify investment


opportunities and manage portfolios.
 Mean-Variance Optimization
 Modern Portfolio Theory (MPT)
 Trend Following
 Arbitrage Strategies
 Machine Learning Algorithms
 Genetic Algorithms
 Quantitative Factor Models
How It Works?
• Execution: Executes trades based on predefined rules and real-time market
conditions.

• Monitoring and Adjustments: Continuously monitors portfolio performance and


adjusts strategies as needed.
PSEUDO CODE:
Certainly! Here's an example of pseudo code for an automated financial investing system:

```
1. Initialize the system:
- Set up parameters, such as risk tolerance, investment goals, and time horizon.
- Connect to data sources for market data, news, and other relevant information.

2. Fetch and analyze data:


- Retrieve market data for various assets, including prices, volumes, and other relevant indicators.
- Collect news and sentiment data related to the assets.
- Perform data cleaning, preprocessing, and feature engineering as necessary.

3. Implement investment strategy:


- Determine the appropriate asset allocation based on the predefined parameters and investment strategy.
- Apply risk management techniques, such as setting stop-loss orders or position size limits.
- Utilize algorithms specific to the investment strategy, such as mean-variance optimization or trend following.
- Generate specific trade signals or recommendations based on the analysis.
4. Execute trades:
- Check the available funds and account balance.
- Validate the trade signals against predefined rules and risk management parameters.
- Submit buy/sell orders to the appropriate brokerage or trading platform.
- Monitor order execution and handle any exceptions or errors that may occur.

5. Monitor and manage the portfolio:


- Continuously monitor the performance of the portfolio and individual investments.
- Analyze changes in market conditions, news, and other factors that may impact the investments.
- Adjust the portfolio allocation or investment strategy as needed based on real-time data and predefined rules.
- Rebalance the portfolio periodically to maintain the desired asset allocation.

6. Generate reports and provide insights:


- Prepare regular reports on portfolio performance, including returns, risk measures, and allocation.
- Analyze and interpret the performance results, providing insights and recommendations to investors.
- Present the reports in a user-friendly format, including visualizations and charts.

7. Handle exceptions and errors:


- Implement error handling mechanisms to address technical failures, connectivity issues, or data inaccuracies.
- Define fallback strategies or alternative actions in case of unexpected situations.
- Monitor and log errors for debugging and system improvement purposes.
8. Continuous improvement and optimization:
- Collect feedback from users and evaluate the system's performance.
- Conduct periodic reviews of the algorithms, data sources, and investment strategies.
- Incorporate machine learning techniques to enhance decision-making or refine algorithms based on historical
data.

9. End of system execution.


EXAMPLE:
Buy 1 CFD S&P 500 at Open (value is 2000), sell it at Close of the
day (value is 2020). The difference, hence, the gain, is 20 points. If
each point has a value of €5:

Gross Gain is 20 points x $25 = $500 with 1 CFD contract.


Let’s say that the broker keeps a slippage of 0.6 points for its own
revenue:

Net gain is (20 - 0.6) points x $25 = $485.


• # This is a helper function to trade 1 bar (for example 1 day) with a Buy order at opening session
• # and a Sell order at closing session. To protect against adverse movements of the price, a STOP order
• # will limit the loss to the stop level (stop parameter must be a negative number)
• # each bar must contains the following attributes:
• # Open, High, Low, Close prices as well as gain = Close - Open and lo = Low - Open
• def trade_with_stop(bar, slippage = 0, stop=None):
• """
• Given a bar, with a gain obtained by the closing price - opening price
• it applies a stop limit order to limit a negative loss
• If stop is equal to None, then it returns bar['gain']
• """
• bar['gain'] = bar['gain'] - slippage
• if stop<>None:
• real_stop = stop - slippage
• if bar['lo']<=stop:
• return real_stop
• # stop == None
• return bar['gain']
OUTPUT:
• SLIPPAGE = 0.6
• STOP = -3
• trades = testing[testing['predictions'] == 1][('datetime', 'gain', 'ho', 'lo', 'open', 'close')]
• trades['pnl'] = trades.apply(lambda x: trade_with_stop(x, slippage=SLIPPAGE, stop=STOP))
• plot_equity_chart(trades['pnl'],'Decision tree model')
• print("SlippMean of PnL is 2.162171
• Sharpe is 3.502897
• Round turns 511
• Slippage is 0.6
• STOP level at -3age is %s, STOP level at %s" % (SLIPPAGE, STOP))
Considerations for Investors
• Risk Profile: Ensure the automated system aligns with your risk tolerance and investment goals.

• Track Record: Evaluate the system's historical performance and consider the expertise of the
development team.

• Transparency: Understand the system's algorithms, investment strategies, and fees involved.

• Support and Customer Service: Assess the availability of customer support and the ease of
communication with the provider.
CONCLUSION:
However, it's essential to consider certain factors when adopting an
automated financial investing system. Investors should assess their risk
profile, evaluate the track record and transparency of the system, and
ensure the availability of reliable customer support. Additionally, it's
important to remember that automated systems have certain limitations,
including technical failures, market volatility, and the need for occasional
human oversight.

You might also like