reinforcement learning for trading video -凯发k8网页登录
from the series: machine learning in finance
algorithmic stock trading is now the norm rather than the exception with the majority of trades being automated. deep reinforcement learning is a promising area of research with the potential to mimic the decision-making of traders with years of experience on the trading floor.
take a quick look into one potential application for deep reinforcement learning for trading using matlab®. learn about an automated trading strategy that leverages reinforcement learning to decide when to hedge a european call option contract while accounting for transaction costs.
in this video i will be talking about building an automated trader that is able to decide when to hedge a european call option contract in the presence of transaction costs using reinforcement learning.
think of hedging as home insurance, but in finance we use hedging to reduce risk from stock price movement.
the amount of stocks traded at each time step is calculated using delta from the black-scholes formula. therefore, if the call option is for 100 shares of mlb stock, and delta is 0.1, the trader needs to short 10 shares of mlb.
in a real-world scenario, where transaction costs exist, it becomes critical, while observing the market, to know when to hedge during the life of the option to have this tradeoff between trading costs and hedging risk.
let’s see how we apply reinforcement learning in hedging.
the agent is observing the financial market inputs like the stock price, time to maturity, the option price, and the stock holdings and takes an action of whether to hedge or not. if the agent hedges, the new stock holdings are -51 calculated using delta. therefore, the agent has sold 6 stocks resulting in $3 in transaction costs. if the agent doesn’t hedge, the holdings remain the same.
after one period, the stock price moves to $99.40. the agent observes a total profit and loss resulting from the change of the stock price, the change of the option price, transaction costs paid, and a reward related to the total profit and loss.
in reinforcement learning, the agent will learn by trial and error to maximize the cumulative reward by choosing when to hedge during the life of the option.
the rl setup is composed of an agent and an environment. the environment sends a state to the agent, which takes an action in response. the agent will evaluate its last action based on the reward it returned. the loop keeps going until the environment sends a terminal state, say the maturity of the option, which ends the episode. after each episode the agent will learn to take actions that maximize the cumulative reward.
matlab made it easier to set up the environment and design the reinforcement learning components.
the reset function returns the initial state of the environment. it is called at the beginning of each training episode.
the step function specifies how the environment advances to the next state based on which action the agent takes.
the observations include the stock price, time to maturity, and the agent’s stock holdings.
the action is whether to hedge or not.
the observations, actions, and reset and step functions form the environment.
the agent consists of a policy and a reinforcement learning algorithm. the policy is a mapping function between observations and action. it can be a neural network designed by specifying the layers, activation functions, and neurons.
the reinforcement learning algorithm continuously updates the policy parameters and will find an optimal policy that maximizes the cumulative reward.
we train the agent for an hour and we can see that the agent has learned to maximize the cumulative reward over time.
as a result, a trained agent outperformed a trader who used delta hedging and another who decided not to hedge at all.
we simulate a random stock path, and when all periods are hedged, the loss is $120. the agent hedged 38 periods and didn’t trade for 12 times and the loss is $55.
thank you for watching.
featured product
reinforcement learning toolbox
up next:
related videos:
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 mathworks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- (español)
- (english)
- (english)
欧洲
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
亚太
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)